export type LocalizedString = {value?: string | undefined, locale?: string | undefined, kind?: string | undefined}; export type LocalizedStringBundle = {kind?: string | undefined, translations?: Array | undefined}; export type GamesNumberAffixConfiguration = {two?: LocalizedStringBundle | undefined, few?: LocalizedStringBundle | undefined, many?: LocalizedStringBundle | undefined, zero?: LocalizedStringBundle | undefined, other?: LocalizedStringBundle | undefined, one?: LocalizedStringBundle | undefined}; export type GamesNumberFormatConfiguration = {numberFormatType?: ('NUMBER_FORMAT_TYPE_UNSPECIFIED' | 'NUMERIC' | 'TIME_DURATION' | 'CURRENCY') | undefined, currencyCode?: string | undefined, suffix?: GamesNumberAffixConfiguration | undefined, numDecimalPlaces?: number | undefined}; export type LeaderboardConfigurationDetail = {sortRank?: number | undefined, kind?: string | undefined, scoreFormat?: GamesNumberFormatConfiguration | undefined, name?: LocalizedStringBundle | undefined, iconUrl?: string | undefined}; export type LeaderboardConfiguration = {scoreOrder?: ('SCORE_ORDER_UNSPECIFIED' | 'LARGER_IS_BETTER' | 'SMALLER_IS_BETTER') | undefined, kind?: string | undefined, draft?: LeaderboardConfigurationDetail | undefined, published?: LeaderboardConfigurationDetail | undefined, token?: string | undefined, scoreMax?: unknown | undefined, id?: string | undefined, scoreMin?: unknown | undefined}; export type CreateApiGamesV1configurationApplicationsApplicationIdLeaderboardsArgs = {applicationId: string, body: LeaderboardConfiguration}; export type CreateApiGamesV1configurationApplicationsApplicationIdLeaderboardsOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, Oauth2c?: string | undefined, fetch?: typeof fetch | undefined}; /** * Insert a new leaderboard configuration in this application. * * POST /games/v1configuration/applications/{applicationId}/leaderboards */ export const createApiGamesV1configurationApplicationsApplicationIdLeaderboards = async (args: CreateApiGamesV1configurationApplicationsApplicationIdLeaderboardsArgs, options?: CreateApiGamesV1configurationApplicationsApplicationIdLeaderboardsOptions) => { const {baseUrl = "https://gamesconfiguration.googleapis.com", fetch: fetchFn = fetch, Oauth2, Oauth2c} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (Oauth2 !== undefined) headers.set('authorization', `Bearer ${Oauth2}`) if (Oauth2c !== undefined) headers.set('authorization', `Bearer ${Oauth2c}`) const url = `${baseUrl.replace(/\/+$/, '')}/games/v1configuration/applications/${encodeURIComponent(String(args.applicationId))}/leaderboards${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };