export type RenameProjectRequest = {'new-name': string}; export type CreateApiManagementV1ProjectRenameArgs = {'x-project-id'?: (string | null) | undefined, body: RenameProjectRequest}; export type CreateApiManagementV1ProjectRenameOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Rename Project * * POST /management/v1/project/rename */ export const createApiManagementV1ProjectRename = async (args: CreateApiManagementV1ProjectRenameArgs, options?: CreateApiManagementV1ProjectRenameOptions) => { const {baseUrl = "https://localhost", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['x-project-id'] != null) headers.set("x-project-id", String(args['x-project-id'])) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/management/v1/project/rename${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 };