Skip to main content
Glama

Flipt MCP Server

Official
by flipt-io
SegmentsServiceApi.ts19.2 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 { CreateSegmentRequest } from '../models/CreateSegmentRequest'; import { Segment } from '../models/Segment'; import { SegmentList } from '../models/SegmentList'; import { UpdateSegmentRequest } from '../models/UpdateSegmentRequest'; /** * no description */ export class SegmentsServiceApiRequestFactory extends BaseAPIRequestFactory { /** * @param namespaceKey * @param createSegmentRequest */ public async createSegment(namespaceKey: string, createSegmentRequest: CreateSegmentRequest, _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("SegmentsServiceApi", "createSegment", "namespaceKey"); } // verify required parameter 'createSegmentRequest' is not null or undefined if (createSegmentRequest === null || createSegmentRequest === undefined) { throw new RequiredError("SegmentsServiceApi", "createSegment", "createSegmentRequest"); } // Path Params const localVarPath = '/api/v1/namespaces/{namespaceKey}/segments' .replace('{' + 'namespaceKey' + '}', encodeURIComponent(String(namespaceKey))); // 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(createSegmentRequest, "CreateSegmentRequest", ""), 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 key */ public async deleteSegment(namespaceKey: string, key: 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("SegmentsServiceApi", "deleteSegment", "namespaceKey"); } // verify required parameter 'key' is not null or undefined if (key === null || key === undefined) { throw new RequiredError("SegmentsServiceApi", "deleteSegment", "key"); } // Path Params const localVarPath = '/api/v1/namespaces/{namespaceKey}/segments/{key}' .replace('{' + 'namespaceKey' + '}', encodeURIComponent(String(namespaceKey))) .replace('{' + 'key' + '}', encodeURIComponent(String(key))); // 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 key * @param reference */ public async getSegment(namespaceKey: string, key: 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("SegmentsServiceApi", "getSegment", "namespaceKey"); } // verify required parameter 'key' is not null or undefined if (key === null || key === undefined) { throw new RequiredError("SegmentsServiceApi", "getSegment", "key"); } // Path Params const localVarPath = '/api/v1/namespaces/{namespaceKey}/segments/{key}' .replace('{' + 'namespaceKey' + '}', encodeURIComponent(String(namespaceKey))) .replace('{' + 'key' + '}', encodeURIComponent(String(key))); // 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 limit * @param offset * @param pageToken * @param reference */ public async listSegments(namespaceKey: 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("SegmentsServiceApi", "listSegments", "namespaceKey"); } // Path Params const localVarPath = '/api/v1/namespaces/{namespaceKey}/segments' .replace('{' + 'namespaceKey' + '}', encodeURIComponent(String(namespaceKey))); // 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 key * @param updateSegmentRequest */ public async updateSegment(namespaceKey: string, key: string, updateSegmentRequest: UpdateSegmentRequest, _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("SegmentsServiceApi", "updateSegment", "namespaceKey"); } // verify required parameter 'key' is not null or undefined if (key === null || key === undefined) { throw new RequiredError("SegmentsServiceApi", "updateSegment", "key"); } // verify required parameter 'updateSegmentRequest' is not null or undefined if (updateSegmentRequest === null || updateSegmentRequest === undefined) { throw new RequiredError("SegmentsServiceApi", "updateSegment", "updateSegmentRequest"); } // Path Params const localVarPath = '/api/v1/namespaces/{namespaceKey}/segments/{key}' .replace('{' + 'namespaceKey' + '}', encodeURIComponent(String(namespaceKey))) .replace('{' + 'key' + '}', encodeURIComponent(String(key))); // 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(updateSegmentRequest, "UpdateSegmentRequest", ""), 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 SegmentsServiceApiResponseProcessor { /** * 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 createSegment * @throws ApiException if the response code was not in [200, 299] */ public async createSegmentWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Segment >> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Segment = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Segment", "" ) as Segment; 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: Segment = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Segment", "" ) as Segment; 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 deleteSegment * @throws ApiException if the response code was not in [200, 299] */ public async deleteSegmentWithHttpInfo(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 getSegment * @throws ApiException if the response code was not in [200, 299] */ public async getSegmentWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Segment >> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Segment = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Segment", "" ) as Segment; 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: Segment = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Segment", "" ) as Segment; 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 listSegments * @throws ApiException if the response code was not in [200, 299] */ public async listSegmentsWithHttpInfo(response: ResponseContext): Promise<HttpInfo<SegmentList >> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: SegmentList = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "SegmentList", "" ) as SegmentList; 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: SegmentList = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "SegmentList", "" ) as SegmentList; 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 updateSegment * @throws ApiException if the response code was not in [200, 299] */ public async updateSegmentWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Segment >> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Segment = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Segment", "" ) as Segment; 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: Segment = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Segment", "" ) as Segment; 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