export type CreateApiV20UsersMePinArgs = {body: {resourceType?: 'project' | undefined, resourceId?: string | undefined, pin?: boolean | undefined}}; export type CreateApiV20UsersMePinOptions = {baseUrl?: string | undefined, APIKeyHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Pin or Unpin Resources * * POST /v2.0/users/me/pin * * Also accepts auth: APIKeyQueryParam, CXoneTokenHeader, OAuth2 */ export const createApiV20UsersMePin = async (args: CreateApiV20UsersMePinArgs, options?: CreateApiV20UsersMePinOptions) => { const {baseUrl = "https://api-trial.cognigy.ai/testing", fetch: fetchFn = fetch, APIKeyHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (APIKeyHeader !== undefined) headers.set("X-API-Key", APIKeyHeader) const url = `${baseUrl.replace(/\/+$/, '')}/v2.0/users/me/pin${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 };