export type LinkedInAdAccountCreationRequest = {accountId?: string | undefined, name?: string | undefined, currency?: string | undefined, organization?: string | undefined}; export type CreateApiV1PromotionsLinkedinBusinessAssetsAdAccountsArgs = {body: LinkedInAdAccountCreationRequest}; export type CreateApiV1PromotionsLinkedinBusinessAssetsAdAccountsOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * POST /v1/promotions/linkedin/businessAssets/adAccounts */ export const createApiV1PromotionsLinkedinBusinessAssetsAdAccounts = async (args: CreateApiV1PromotionsLinkedinBusinessAssetsAdAccountsArgs, options: CreateApiV1PromotionsLinkedinBusinessAssetsAdAccountsOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v1/promotions/linkedin/businessAssets/adAccounts${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 (await res.json()) as unknown };