export type LocalizedString = {value?: string | undefined, locale?: string | undefined, kind?: string | undefined}; export type LocalizedStringBundle = {kind?: string | undefined, translations?: Array | undefined}; export type AchievementConfigurationDetail = {sortRank?: number | undefined, kind?: string | undefined, pointValue?: number | undefined, name?: LocalizedStringBundle | undefined, description?: LocalizedStringBundle | undefined, iconUrl?: string | undefined}; export type AchievementConfiguration = {id?: string | undefined, stepsToUnlock?: number | undefined, initialState?: ('INITIAL_STATE_UNSPECIFIED' | 'HIDDEN' | 'REVEALED') | undefined, kind?: string | undefined, draft?: AchievementConfigurationDetail | undefined, published?: AchievementConfigurationDetail | undefined, token?: string | undefined, achievementType?: ('ACHIEVEMENT_TYPE_UNSPECIFIED' | 'STANDARD' | 'INCREMENTAL') | undefined}; export type CreateApiGamesV1configurationApplicationsApplicationIdAchievementsArgs = {applicationId: string, body: AchievementConfiguration}; export type CreateApiGamesV1configurationApplicationsApplicationIdAchievementsOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, Oauth2c?: string | undefined, fetch?: typeof fetch | undefined}; /** * Insert a new achievement configuration in this application. * * POST /games/v1configuration/applications/{applicationId}/achievements */ export const createApiGamesV1configurationApplicationsApplicationIdAchievements = async (args: CreateApiGamesV1configurationApplicationsApplicationIdAchievementsArgs, options?: CreateApiGamesV1configurationApplicationsApplicationIdAchievementsOptions) => { 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))}/achievements${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() };