export type GetApiV1MerchantsChildAccountsArgs = {account_type?: string | undefined, created_at_end_date?: string | undefined, created_at_start_date?: string | undefined, features?: string | undefined, limit?: number | undefined, page?: number | undefined, search_term?: string | undefined, status?: string | undefined}; export type GetApiV1MerchantsChildAccountsOptions = {baseUrl?: string | undefined, sec0?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * GET /v1/merchants/child_accounts */ export const getApiV1MerchantsChildAccounts = async (args: GetApiV1MerchantsChildAccountsArgs, options?: GetApiV1MerchantsChildAccountsOptions) => { const {baseUrl = "https://api.paymongo.com", fetch: fetchFn = fetch, sec0} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.account_type != null) query.append("account_type", String(args.account_type)) if (args.created_at_end_date != null) query.append("created_at_end_date", String(args.created_at_end_date)) if (args.created_at_start_date != null) query.append("created_at_start_date", String(args.created_at_start_date)) if (args.features != null) query.append("features", String(args.features)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.page != null) query.append("page", String(args.page)) if (args.search_term != null) query.append("search_term", String(args.search_term)) if (args.status != null) query.append("status", String(args.status)) if (sec0 !== undefined) headers.set('authorization', `Basic ${btoa(`${sec0.username}:${sec0.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/merchants/child_accounts${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) 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 };