Skip to main content
Module

x/windmill/windmill-api/apis/VariableApi.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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
// 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 { ContextualVariable } from '../models/ContextualVariable.ts';import { CreateVariable } from '../models/CreateVariable.ts';import { EditVariable } from '../models/EditVariable.ts';import { ListableVariable } from '../models/ListableVariable.ts';
/** * no description */export class VariableApiRequestFactory extends BaseAPIRequestFactory {
/** * create variable * @param workspace * @param createVariable new variable */ public async createVariable(workspace: string, createVariable: CreateVariable, _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("VariableApi", "createVariable", "workspace"); }

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

// Path Params const localVarPath = '/w/{workspace}/variables/create' .replace('{' + 'workspace' + '}', encodeURIComponent(String(workspace)));
// 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(createVariable, "CreateVariable", ""), 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; }
/** * delete variable * @param workspace * @param path */ public async deleteVariable(workspace: string, path: string, _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("VariableApi", "deleteVariable", "workspace"); }

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

// Path Params const localVarPath = '/w/{workspace}/variables/delete/{path}' .replace('{' + 'workspace' + '}', encodeURIComponent(String(workspace))) .replace('{' + 'path' + '}', encodeURIComponent(String(path)));
// Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); 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; }
/** * does variable exists at path * @param workspace * @param path */ public async existsVariable(workspace: string, path: string, _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("VariableApi", "existsVariable", "workspace"); }

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

// Path Params const localVarPath = '/w/{workspace}/variables/exists/{path}' .replace('{' + 'workspace' + '}', encodeURIComponent(String(workspace))) .replace('{' + 'path' + '}', encodeURIComponent(String(path)));
// 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; }
/** * get variable * @param workspace * @param path * @param decryptSecret ask to decrypt secret if this variable is secret (if not secret no effect, default: true) */ public async getVariable(workspace: string, path: string, decryptSecret?: boolean, _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("VariableApi", "getVariable", "workspace"); }

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


// Path Params const localVarPath = '/w/{workspace}/variables/get/{path}' .replace('{' + 'workspace' + '}', encodeURIComponent(String(workspace))) .replace('{' + 'path' + '}', encodeURIComponent(String(path)));
// Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
// Query Params if (decryptSecret !== undefined) { requestContext.setQueryParam("decrypt_secret", ObjectSerializer.serialize(decryptSecret, "boolean", "")); }

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; }
/** * list contextual variables * @param workspace */ public async listContextualVariables(workspace: string, _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("VariableApi", "listContextualVariables", "workspace"); }

// Path Params const localVarPath = '/w/{workspace}/variables/list_contextual' .replace('{' + 'workspace' + '}', encodeURIComponent(String(workspace)));
// 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; }
/** * list variables * @param workspace */ public async listVariable(workspace: string, _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("VariableApi", "listVariable", "workspace"); }

// Path Params const localVarPath = '/w/{workspace}/variables/list' .replace('{' + 'workspace' + '}', encodeURIComponent(String(workspace)));
// 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; }
/** * update variable * @param workspace * @param path * @param editVariable updated variable */ public async updateVariable(workspace: string, path: string, editVariable: EditVariable, _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("VariableApi", "updateVariable", "workspace"); }

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

// verify required parameter 'editVariable' is not null or undefined if (editVariable === null || editVariable === undefined) { throw new RequiredError("VariableApi", "updateVariable", "editVariable"); }

// Path Params const localVarPath = '/w/{workspace}/variables/update/{path}' .replace('{' + 'workspace' + '}', encodeURIComponent(String(workspace))) .replace('{' + 'path' + '}', encodeURIComponent(String(path)));
// 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(editVariable, "EditVariable", ""), 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 VariableApiResponseProcessor {
/** * 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 createVariable * @throws ApiException if the response code was not in [200, 299] */ public async createVariable(response: ResponseContext): Promise<string > { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("201", 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 deleteVariable * @throws ApiException if the response code was not in [200, 299] */ public async deleteVariable(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 existsVariable * @throws ApiException if the response code was not in [200, 299] */ public async existsVariable(response: ResponseContext): Promise<boolean > { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: boolean = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "boolean", "" ) as boolean; return body; }
// Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: boolean = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "boolean", "" ) as 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 getVariable * @throws ApiException if the response code was not in [200, 299] */ public async getVariable(response: ResponseContext): Promise<ListableVariable > { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: ListableVariable = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ListableVariable", "" ) as ListableVariable; return body; }
// Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: ListableVariable = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ListableVariable", "" ) as ListableVariable; 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 listContextualVariables * @throws ApiException if the response code was not in [200, 299] */ public async listContextualVariables(response: ResponseContext): Promise<Array<ContextualVariable> > { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Array<ContextualVariable> = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Array<ContextualVariable>", "" ) as Array<ContextualVariable>; return body; }
// Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: Array<ContextualVariable> = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Array<ContextualVariable>", "" ) as Array<ContextualVariable>; 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 listVariable * @throws ApiException if the response code was not in [200, 299] */ public async listVariable(response: ResponseContext): Promise<Array<ListableVariable> > { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Array<ListableVariable> = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Array<ListableVariable>", "" ) as Array<ListableVariable>; return body; }
// Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: Array<ListableVariable> = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Array<ListableVariable>", "" ) as Array<ListableVariable>; 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 updateVariable * @throws ApiException if the response code was not in [200, 299] */ public async updateVariable(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); }
}