Skip to main content
Glama

Flipt MCP Server

Official
by flipt-io
RulesServiceApi.ts24.6 kB
// TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; import {canConsumeForm, isCodeInRange} from '../util'; import {SecurityAuthentication} from '../auth/auth'; import { CreateRuleRequest } from '../models/CreateRuleRequest'; import { OrderRulesRequest } from '../models/OrderRulesRequest'; import { Rule } from '../models/Rule'; import { RuleList } from '../models/RuleList'; import { UpdateRuleRequest } from '../models/UpdateRuleRequest'; /** * no description */ export class RulesServiceApiRequestFactory extends BaseAPIRequestFactory { /** * @param namespaceKey * @param flagKey * @param createRuleRequest */ public async createRule(namespaceKey: string, flagKey: string, createRuleRequest: CreateRuleRequest, _options?: Configuration): Promise<RequestContext> { let _config = _options || this.configuration; // verify required parameter 'namespaceKey' is not null or undefined if (namespaceKey === null || namespaceKey === undefined) { throw new RequiredError("RulesServiceApi", "createRule", "namespaceKey"); } // verify required parameter 'flagKey' is not null or undefined if (flagKey === null || flagKey === undefined) { throw new RequiredError("RulesServiceApi", "createRule", "flagKey"); } // verify required parameter 'createRuleRequest' is not null or undefined if (createRuleRequest === null || createRuleRequest === undefined) { throw new RequiredError("RulesServiceApi", "createRule", "createRuleRequest"); } // Path Params const localVarPath = '/api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules' .replace('{' + 'namespaceKey' + '}', encodeURIComponent(String(namespaceKey))) .replace('{' + 'flagKey' + '}', encodeURIComponent(String(flagKey))); // 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(createRuleRequest, "CreateRuleRequest", ""), contentType ); requestContext.setBody(serializedBody); let authMethod: SecurityAuthentication | undefined; // Apply auth methods authMethod = _config.authMethods["bearerAuth"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } return requestContext; } /** * @param namespaceKey * @param flagKey * @param id */ public async deleteRule(namespaceKey: string, flagKey: string, id: string, _options?: Configuration): Promise<RequestContext> { let _config = _options || this.configuration; // verify required parameter 'namespaceKey' is not null or undefined if (namespaceKey === null || namespaceKey === undefined) { throw new RequiredError("RulesServiceApi", "deleteRule", "namespaceKey"); } // verify required parameter 'flagKey' is not null or undefined if (flagKey === null || flagKey === undefined) { throw new RequiredError("RulesServiceApi", "deleteRule", "flagKey"); } // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new RequiredError("RulesServiceApi", "deleteRule", "id"); } // Path Params const localVarPath = '/api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{id}' .replace('{' + 'namespaceKey' + '}', encodeURIComponent(String(namespaceKey))) .replace('{' + 'flagKey' + '}', encodeURIComponent(String(flagKey))) .replace('{' + 'id' + '}', encodeURIComponent(String(id))); // 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); } const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } return requestContext; } /** * @param namespaceKey * @param flagKey * @param id * @param reference */ public async getRule(namespaceKey: string, flagKey: string, id: string, reference?: string, _options?: Configuration): Promise<RequestContext> { let _config = _options || this.configuration; // verify required parameter 'namespaceKey' is not null or undefined if (namespaceKey === null || namespaceKey === undefined) { throw new RequiredError("RulesServiceApi", "getRule", "namespaceKey"); } // verify required parameter 'flagKey' is not null or undefined if (flagKey === null || flagKey === undefined) { throw new RequiredError("RulesServiceApi", "getRule", "flagKey"); } // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new RequiredError("RulesServiceApi", "getRule", "id"); } // Path Params const localVarPath = '/api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{id}' .replace('{' + 'namespaceKey' + '}', encodeURIComponent(String(namespaceKey))) .replace('{' + 'flagKey' + '}', encodeURIComponent(String(flagKey))) .replace('{' + 'id' + '}', encodeURIComponent(String(id))); // Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") // Query Params if (reference !== undefined) { requestContext.setQueryParam("reference", ObjectSerializer.serialize(reference, "string", "")); } let authMethod: SecurityAuthentication | undefined; // Apply auth methods authMethod = _config.authMethods["bearerAuth"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } return requestContext; } /** * @param namespaceKey * @param flagKey * @param limit * @param offset * @param pageToken * @param reference */ public async listRules(namespaceKey: string, flagKey: string, limit?: number, offset?: number, pageToken?: string, reference?: string, _options?: Configuration): Promise<RequestContext> { let _config = _options || this.configuration; // verify required parameter 'namespaceKey' is not null or undefined if (namespaceKey === null || namespaceKey === undefined) { throw new RequiredError("RulesServiceApi", "listRules", "namespaceKey"); } // verify required parameter 'flagKey' is not null or undefined if (flagKey === null || flagKey === undefined) { throw new RequiredError("RulesServiceApi", "listRules", "flagKey"); } // Path Params const localVarPath = '/api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules' .replace('{' + 'namespaceKey' + '}', encodeURIComponent(String(namespaceKey))) .replace('{' + 'flagKey' + '}', encodeURIComponent(String(flagKey))); // Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") // Query Params if (limit !== undefined) { requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "int32")); } // Query Params if (offset !== undefined) { requestContext.setQueryParam("offset", ObjectSerializer.serialize(offset, "number", "int32")); } // Query Params if (pageToken !== undefined) { requestContext.setQueryParam("pageToken", ObjectSerializer.serialize(pageToken, "string", "")); } // Query Params if (reference !== undefined) { requestContext.setQueryParam("reference", ObjectSerializer.serialize(reference, "string", "")); } let authMethod: SecurityAuthentication | undefined; // Apply auth methods authMethod = _config.authMethods["bearerAuth"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } return requestContext; } /** * @param namespaceKey * @param flagKey * @param orderRulesRequest */ public async orderRules(namespaceKey: string, flagKey: string, orderRulesRequest: OrderRulesRequest, _options?: Configuration): Promise<RequestContext> { let _config = _options || this.configuration; // verify required parameter 'namespaceKey' is not null or undefined if (namespaceKey === null || namespaceKey === undefined) { throw new RequiredError("RulesServiceApi", "orderRules", "namespaceKey"); } // verify required parameter 'flagKey' is not null or undefined if (flagKey === null || flagKey === undefined) { throw new RequiredError("RulesServiceApi", "orderRules", "flagKey"); } // verify required parameter 'orderRulesRequest' is not null or undefined if (orderRulesRequest === null || orderRulesRequest === undefined) { throw new RequiredError("RulesServiceApi", "orderRules", "orderRulesRequest"); } // Path Params const localVarPath = '/api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/order' .replace('{' + 'namespaceKey' + '}', encodeURIComponent(String(namespaceKey))) .replace('{' + 'flagKey' + '}', encodeURIComponent(String(flagKey))); // Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PUT); 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(orderRulesRequest, "OrderRulesRequest", ""), contentType ); requestContext.setBody(serializedBody); let authMethod: SecurityAuthentication | undefined; // Apply auth methods authMethod = _config.authMethods["bearerAuth"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } return requestContext; } /** * @param namespaceKey * @param flagKey * @param id * @param updateRuleRequest */ public async updateRule(namespaceKey: string, flagKey: string, id: string, updateRuleRequest: UpdateRuleRequest, _options?: Configuration): Promise<RequestContext> { let _config = _options || this.configuration; // verify required parameter 'namespaceKey' is not null or undefined if (namespaceKey === null || namespaceKey === undefined) { throw new RequiredError("RulesServiceApi", "updateRule", "namespaceKey"); } // verify required parameter 'flagKey' is not null or undefined if (flagKey === null || flagKey === undefined) { throw new RequiredError("RulesServiceApi", "updateRule", "flagKey"); } // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new RequiredError("RulesServiceApi", "updateRule", "id"); } // verify required parameter 'updateRuleRequest' is not null or undefined if (updateRuleRequest === null || updateRuleRequest === undefined) { throw new RequiredError("RulesServiceApi", "updateRule", "updateRuleRequest"); } // Path Params const localVarPath = '/api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{id}' .replace('{' + 'namespaceKey' + '}', encodeURIComponent(String(namespaceKey))) .replace('{' + 'flagKey' + '}', encodeURIComponent(String(flagKey))) .replace('{' + 'id' + '}', encodeURIComponent(String(id))); // Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PUT); 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(updateRuleRequest, "UpdateRuleRequest", ""), contentType ); requestContext.setBody(serializedBody); let authMethod: SecurityAuthentication | undefined; // Apply auth methods authMethod = _config.authMethods["bearerAuth"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } return requestContext; } } export class RulesServiceApiResponseProcessor { /** * 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 createRule * @throws ApiException if the response code was not in [200, 299] */ public async createRuleWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Rule >> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Rule = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Rule", "" ) as Rule; return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: Rule = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Rule", "" ) as Rule; return new HttpInfo(response.httpStatusCode, response.headers, response.body, 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 deleteRule * @throws ApiException if the response code was not in [200, 299] */ public async deleteRuleWithHttpInfo(response: ResponseContext): Promise<HttpInfo<void >> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: void = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "void", "" ) as void; return new HttpInfo(response.httpStatusCode, response.headers, response.body, 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 getRule * @throws ApiException if the response code was not in [200, 299] */ public async getRuleWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Rule >> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Rule = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Rule", "" ) as Rule; return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: Rule = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Rule", "" ) as Rule; return new HttpInfo(response.httpStatusCode, response.headers, response.body, 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 listRules * @throws ApiException if the response code was not in [200, 299] */ public async listRulesWithHttpInfo(response: ResponseContext): Promise<HttpInfo<RuleList >> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: RuleList = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "RuleList", "" ) as RuleList; return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: RuleList = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "RuleList", "" ) as RuleList; return new HttpInfo(response.httpStatusCode, response.headers, response.body, 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 orderRules * @throws ApiException if the response code was not in [200, 299] */ public async orderRulesWithHttpInfo(response: ResponseContext): Promise<HttpInfo<void >> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: void = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "void", "" ) as void; return new HttpInfo(response.httpStatusCode, response.headers, response.body, 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 updateRule * @throws ApiException if the response code was not in [200, 299] */ public async updateRuleWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Rule >> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Rule = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Rule", "" ) as Rule; return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: Rule = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Rule", "" ) as Rule; return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/flipt-io/mcp-server-flipt'

If you have feedback or need assistance with the MCP directory API, please join our Discord server