Skip to main content
Module

x/windmill/windmill-api/apis/GranularAclApi.ts

Windmill deno client (separated from the main repo because most of the code is auto-generated from the openapi and not worth committing)
Go to Latest
File
// TODO: better import syntax?import {BaseAPIRequestFactory, RequiredError} from './baseapi.ts';import {Configuration} from '../configuration.ts';import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http.ts';import {ObjectSerializer} from '../models/ObjectSerializer.ts';import {ApiException} from './exception.ts';import {canConsumeForm, isCodeInRange} from '../util.ts';import {SecurityAuthentication} from '../auth/auth.ts';

import { InlineObject23 } from '../models/InlineObject23.ts';import { InlineObject24 } from '../models/InlineObject24.ts';
/** * no description */export class GranularAclApiRequestFactory extends BaseAPIRequestFactory {
/** * add granular acls * @param workspace * @param path * @param kind * @param inlineObject23 */ public async addGranularAcls(workspace: string, path: string, kind: 'script' | 'group_' | 'resource' | 'schedule' | 'variable' | 'flow', inlineObject23: InlineObject23, _options?: Configuration): Promise<RequestContext> { let _config = _options || this.configuration;
// verify required parameter 'workspace' is not null or undefined if (workspace === null || workspace === undefined) { throw new RequiredError("GranularAclApi", "addGranularAcls", "workspace"); }

// verify required parameter 'path' is not null or undefined if (path === null || path === undefined) { throw new RequiredError("GranularAclApi", "addGranularAcls", "path"); }

// verify required parameter 'kind' is not null or undefined if (kind === null || kind === undefined) { throw new RequiredError("GranularAclApi", "addGranularAcls", "kind"); }

// verify required parameter 'inlineObject23' is not null or undefined if (inlineObject23 === null || inlineObject23 === undefined) { throw new RequiredError("GranularAclApi", "addGranularAcls", "inlineObject23"); }

// Path Params const localVarPath = '/w/{workspace}/acls/add/{kind}/{path}' .replace('{' + 'workspace' + '}', encodeURIComponent(String(workspace))) .replace('{' + 'path' + '}', encodeURIComponent(String(path))) .replace('{' + 'kind' + '}', encodeURIComponent(String(kind)));
// Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")

// Body Params const contentType = ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( ObjectSerializer.serialize(inlineObject23, "InlineObject23", ""), contentType ); requestContext.setBody(serializedBody);
let authMethod: SecurityAuthentication | undefined; // Apply auth methods authMethod = _config.authMethods["bearerAuth"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } // Apply auth methods authMethod = _config.authMethods["cookieAuth"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); }
return requestContext; }
/** * get granular acls * @param workspace * @param path * @param kind */ public async getGranularAcls(workspace: string, path: string, kind: 'script' | 'group_' | 'resource' | 'schedule' | 'variable' | 'flow', _options?: Configuration): Promise<RequestContext> { let _config = _options || this.configuration;
// verify required parameter 'workspace' is not null or undefined if (workspace === null || workspace === undefined) { throw new RequiredError("GranularAclApi", "getGranularAcls", "workspace"); }

// verify required parameter 'path' is not null or undefined if (path === null || path === undefined) { throw new RequiredError("GranularAclApi", "getGranularAcls", "path"); }

// verify required parameter 'kind' is not null or undefined if (kind === null || kind === undefined) { throw new RequiredError("GranularAclApi", "getGranularAcls", "kind"); }

// Path Params const localVarPath = '/w/{workspace}/acls/get/{kind}/{path}' .replace('{' + 'workspace' + '}', encodeURIComponent(String(workspace))) .replace('{' + 'path' + '}', encodeURIComponent(String(path))) .replace('{' + 'kind' + '}', encodeURIComponent(String(kind)));
// Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")

let authMethod: SecurityAuthentication | undefined; // Apply auth methods authMethod = _config.authMethods["bearerAuth"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } // Apply auth methods authMethod = _config.authMethods["cookieAuth"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); }
return requestContext; }
/** * remove granular acls * @param workspace * @param path * @param kind * @param inlineObject24 */ public async removeGranularAcls(workspace: string, path: string, kind: 'script' | 'group_' | 'resource' | 'schedule' | 'variable' | 'flow', inlineObject24: InlineObject24, _options?: Configuration): Promise<RequestContext> { let _config = _options || this.configuration;
// verify required parameter 'workspace' is not null or undefined if (workspace === null || workspace === undefined) { throw new RequiredError("GranularAclApi", "removeGranularAcls", "workspace"); }

// verify required parameter 'path' is not null or undefined if (path === null || path === undefined) { throw new RequiredError("GranularAclApi", "removeGranularAcls", "path"); }

// verify required parameter 'kind' is not null or undefined if (kind === null || kind === undefined) { throw new RequiredError("GranularAclApi", "removeGranularAcls", "kind"); }

// verify required parameter 'inlineObject24' is not null or undefined if (inlineObject24 === null || inlineObject24 === undefined) { throw new RequiredError("GranularAclApi", "removeGranularAcls", "inlineObject24"); }

// Path Params const localVarPath = '/w/{workspace}/acls/remove/{kind}/{path}' .replace('{' + 'workspace' + '}', encodeURIComponent(String(workspace))) .replace('{' + 'path' + '}', encodeURIComponent(String(path))) .replace('{' + 'kind' + '}', encodeURIComponent(String(kind)));
// Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")

// Body Params const contentType = ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( ObjectSerializer.serialize(inlineObject24, "InlineObject24", ""), contentType ); requestContext.setBody(serializedBody);
let authMethod: SecurityAuthentication | undefined; // Apply auth methods authMethod = _config.authMethods["bearerAuth"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } // Apply auth methods authMethod = _config.authMethods["cookieAuth"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); }
return requestContext; }
}
export class GranularAclApiResponseProcessor {
/** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to addGranularAcls * @throws ApiException if the response code was not in [200, 299] */ public async addGranularAcls(response: ResponseContext): Promise<string > { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: string = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "string", "" ) as string; return body; }
// Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: string = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "string", "" ) as string; return body; }
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); }
/** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to getGranularAcls * @throws ApiException if the response code was not in [200, 299] */ public async getGranularAcls(response: ResponseContext): Promise<{ [key: string]: boolean; } > { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: { [key: string]: boolean; } = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "{ [key: string]: boolean; }", "" ) as { [key: string]: boolean; }; return body; }
// Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: { [key: string]: boolean; } = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "{ [key: string]: boolean; }", "" ) as { [key: string]: boolean; }; return body; }
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); }
/** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to removeGranularAcls * @throws ApiException if the response code was not in [200, 299] */ public async removeGranularAcls(response: ResponseContext): Promise<string > { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: string = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "string", "" ) as string; return body; }
// Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: string = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "string", "" ) as string; return body; }
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); }
}