export type StrippedNonemptyStringAZAZ09 = string; export type UpsertRequest = {name: StrippedNonemptyStringAZAZ09, value: string, is_secret: boolean}; export type SrcAppEndpointsUserModifyUserVariablesRequestDeleteRequest = {name: StrippedNonemptyStringAZAZ09}; export type SrcAppEndpointsUserModifyUserVariablesRequest = {upserts?: Array | undefined, deletes?: Array | undefined}; export type CreateApiV1OrganizationUserRequestedUserIdVariableArgs = {organization: string, requested_user_id: string, 'x-mongo-cluster-name'?: (string | null) | undefined, 'Sec-WebSocket-Protocol'?: Array | undefined, body: SrcAppEndpointsUserModifyUserVariablesRequest}; export type CreateApiV1OrganizationUserRequestedUserIdVariableOptions = {baseUrl?: string | undefined, BearerAuthorization?: string | undefined, BearerAuthorizationOrganization?: string | undefined, Basic?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Modify the variables of an user * * POST /v1/{organization}/user/{requested_user_id}/variable */ export const createApiV1OrganizationUserRequestedUserIdVariable = async (args: CreateApiV1OrganizationUserRequestedUserIdVariableArgs, options?: CreateApiV1OrganizationUserRequestedUserIdVariableOptions) => { const {baseUrl = "https://api.amigo.ai", fetch: fetchFn = fetch, BearerAuthorization, BearerAuthorizationOrganization, Basic} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['x-mongo-cluster-name'] != null) headers.set("x-mongo-cluster-name", String(args['x-mongo-cluster-name'])) if (args['Sec-WebSocket-Protocol'] != null) headers.set("Sec-WebSocket-Protocol", args['Sec-WebSocket-Protocol'].join(',')) if (BearerAuthorization !== undefined) headers.set('authorization', `Bearer ${BearerAuthorization}`) if (BearerAuthorizationOrganization !== undefined) headers.set("X-ORG-ID", BearerAuthorizationOrganization) if (Basic !== undefined) headers.set('authorization', `Basic ${btoa(`${Basic.username}:${Basic.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/${encodeURIComponent(String(args.organization))}/user/${encodeURIComponent(String(args.requested_user_id))}/variable${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 };