export type GetApiPromocodesIdUsersArgs = {username?: string | undefined, email?: string | undefined, 'pagination[limit]'?: number | undefined, 'pagination[page]'?: number | undefined, id: number}; export type GetApiPromocodesIdUsersOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * List promocode users * * GET /promocodes/{id}/users */ export const getApiPromocodesIdUsers = async (args: GetApiPromocodesIdUsersArgs, options?: GetApiPromocodesIdUsersOptions) => { const {baseUrl = "http://api.gostarmartbus.com/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.username != null) query.append("username", String(args.username)) if (args.email != null) query.append("email", String(args.email)) if (args['pagination[limit]'] != null) query.append("pagination[limit]", String(args['pagination[limit]'])) if (args['pagination[page]'] != null) query.append("pagination[page]", String(args['pagination[page]'])) const url = `${baseUrl.replace(/\/+$/, '')}/promocodes/${encodeURIComponent(String(args.id))}/users${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 undefined };