export type InputValueChoiceInputValue = {choiceInputOptionId?: string | undefined}; export type InputValueCheckboxInputValue = {value?: boolean | undefined}; export type InputValueTextInputValue = {value?: string | undefined}; export type InputValue = {inputFieldId?: string | undefined, choiceInputValue?: InputValueChoiceInputValue | undefined, checkboxInputValue?: InputValueCheckboxInputValue | undefined, textInputValue?: InputValueTextInputValue | undefined}; export type ActionInput = {actionFlowId?: string | undefined, inputValues?: Array | undefined}; export type TriggerActionPayload = {actionContext?: string | undefined, actionInput?: ActionInput | undefined}; export type CreateApiMerchantIdMerchantsupportTriggeractionArgs = {merchantId: string, languageCode?: string | undefined, body: TriggerActionPayload}; export type CreateApiMerchantIdMerchantsupportTriggeractionOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, Oauth2c?: string | undefined, fetch?: typeof fetch | undefined}; /** * Start an action. The action can be requested by merchants in third-party application. Before merchants can request the action, the third-party application needs to show them action specific content and display a user input form. You can submit an allowlist request in the [Shopping API Support Form](https://support.google.com/merchants/contact/shopping_api_support_form) under "What is the issue/question?" to get access to this feature. The action can be successfully started only once all `required` inputs are provided. If any `required` input is missing, or invalid value was provided, the service will return 400 error. Validation errors will contain Ids for all problematic field together with translated, human readable error messages that can be shown to the user. * * POST /{merchantId}/merchantsupport/triggeraction */ export const createApiMerchantIdMerchantsupportTriggeraction = async (args: CreateApiMerchantIdMerchantsupportTriggeractionArgs, options?: CreateApiMerchantIdMerchantsupportTriggeractionOptions) => { const {baseUrl = "https://shoppingcontent.googleapis.com/content/v2.1", fetch: fetchFn = fetch, Oauth2, Oauth2c} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (args.languageCode != null) query.append("languageCode", String(args.languageCode)) if (Oauth2 !== undefined) headers.set('authorization', `Bearer ${Oauth2}`) if (Oauth2c !== undefined) headers.set('authorization', `Bearer ${Oauth2c}`) const url = `${baseUrl.replace(/\/+$/, '')}/${encodeURIComponent(String(args.merchantId))}/merchantsupport/triggeraction${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() };