export type CoarseLocation = {administrativeArea?: string | undefined, locality?: string | undefined, regionCode?: string | undefined, sublocality?: string | undefined}; export type ConsumptionUsageEvent = {consumptionItemDescription?: string | undefined, consumptionTime?: unknown | undefined, ipAddress?: string | undefined, location?: CoarseLocation | undefined, obfuscatedAccountId?: string | undefined, obfuscatedProfileId?: string | undefined}; export type OrdersReviewRefundRequest = {consumptionPercentageMilliunits?: number | undefined, consumptionUsageEvents?: Array | undefined, pendingRefundToken?: string | undefined, refundPreference?: ('REFUND_PREFERENCE_UNSPECIFIED' | 'DECLINE' | 'APPROVE' | 'NEUTRAL') | undefined, sampleContentProvided?: boolean | undefined}; export type CreateApiAndroidpublisherV3ApplicationsPackageNameOrdersOrderIdReviewrefundArgs = {packageName: string, orderId: string, body: OrdersReviewRefundRequest}; export type CreateApiAndroidpublisherV3ApplicationsPackageNameOrdersOrderIdReviewrefundOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, Oauth2c?: string | undefined, fetch?: typeof fetch | undefined}; /** * Provide refund preference and purchase usage for a chargeback request * * POST /androidpublisher/v3/applications/{packageName}/orders/{orderId}:reviewrefund */ export const createApiAndroidpublisherV3ApplicationsPackageNameOrdersOrderIdReviewrefund = async (args: CreateApiAndroidpublisherV3ApplicationsPackageNameOrdersOrderIdReviewrefundArgs, options?: CreateApiAndroidpublisherV3ApplicationsPackageNameOrdersOrderIdReviewrefundOptions) => { const {baseUrl = "https://androidpublisher.googleapis.com", fetch: fetchFn = fetch, Oauth2, Oauth2c} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Oauth2 !== undefined) headers.set('authorization', `Bearer ${Oauth2}`) if (Oauth2c !== undefined) headers.set('authorization', `Bearer ${Oauth2c}`) const url = `${baseUrl.replace(/\/+$/, '')}/androidpublisher/v3/applications/${encodeURIComponent(String(args.packageName))}/orders/${encodeURIComponent(String(args.orderId))}:reviewrefund${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 undefined };