export type Schema = {defaultValue?: Record | undefined, format?: string | undefined, type?: string | undefined}; export type RequestParam = {name?: string | undefined, required?: boolean | undefined, schema?: Schema | undefined, type?: string | undefined}; export type ServiceMethod = {deprecated?: boolean | undefined, description?: string | undefined, exampleInput?: {[key: string]: Record} | undefined, id?: number | undefined, inputType?: string | undefined, methodName?: string | undefined, methodType?: string | undefined, operationName?: string | undefined, outputType?: string | undefined, requestContentType?: string | undefined, requestParams?: Array | undefined, responseContentType?: string | undefined}; export type CreateApiApiRegistryServiceRegistryNameMethodsArgs = {registryName: string, body: ServiceMethod}; export type CreateApiApiRegistryServiceRegistryNameMethodsOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /api/registry/service/{registryName}/methods */ export const createApiApiRegistryServiceRegistryNameMethods = async (args: CreateApiApiRegistryServiceRegistryNameMethodsArgs, options?: CreateApiApiRegistryServiceRegistryNameMethodsOptions) => { const {baseUrl = "https://developer.orkescloud.com", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set("X-Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/registry/service/${encodeURIComponent(String(args.registryName))}/methods${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 };