export type CoreScopeConstraint = {field?: string | undefined, operator?: string | undefined, values?: Array | undefined}; export type CoreScopeKind = 'lookup_table'; export type CoreAccessScope = {constraints?: Array | undefined, kind?: CoreScopeKind | undefined, params?: {[key: string]: unknown} | undefined}; export type CoreAccessCreateRequest = {id?: string | undefined, owner?: string | undefined, resource?: string | undefined, scope?: CoreAccessScope | undefined, type?: string | undefined}; export type UpdateApiV1OrgsOrgIdAccessAccessIdArgs = {org_id: string, access_id: string, body: CoreAccessCreateRequest}; export type UpdateApiV1OrgsOrgIdAccessAccessIdOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update access for caller and given id. * * PUT /v1/orgs/{org_id}/access/{access_id} */ export const updateApiV1OrgsOrgIdAccessAccessId = async (args: UpdateApiV1OrgsOrgIdAccessAccessIdArgs, options?: UpdateApiV1OrgsOrgIdAccessAccessIdOptions) => { const {baseUrl = "https://api.edgedelta.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKeyAuth !== undefined) headers.set("X-ED-API-Token", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v1/orgs/${encodeURIComponent(String(args.org_id))}/access/${encodeURIComponent(String(args.access_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };