@vectorize-io/vectorize-client
Version:
Client for the Vectorize API
343 lines (289 loc) • 14.7 kB
text/typescript
/* tslint:disable */
/* eslint-disable */
/**
* Vectorize API
* API for Vectorize services (Beta)
*
* The version of the OpenAPI document: 0.1.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import * as runtime from '../runtime';
import type {
AIPlatformConnector,
CreateAIPlatformConnectorRequest,
CreateAIPlatformConnectorResponse,
DeleteAIPlatformConnectorResponse,
GetAIPlatformConnectors200Response,
GetWorkspaces400Response,
UpdateAIPlatformConnectorRequest,
UpdateAIPlatformConnectorResponse,
} from '../models/index';
import {
AIPlatformConnectorFromJSON,
AIPlatformConnectorToJSON,
CreateAIPlatformConnectorRequestFromJSON,
CreateAIPlatformConnectorRequestToJSON,
CreateAIPlatformConnectorResponseFromJSON,
CreateAIPlatformConnectorResponseToJSON,
DeleteAIPlatformConnectorResponseFromJSON,
DeleteAIPlatformConnectorResponseToJSON,
GetAIPlatformConnectors200ResponseFromJSON,
GetAIPlatformConnectors200ResponseToJSON,
GetWorkspaces400ResponseFromJSON,
GetWorkspaces400ResponseToJSON,
UpdateAIPlatformConnectorRequestFromJSON,
UpdateAIPlatformConnectorRequestToJSON,
UpdateAIPlatformConnectorResponseFromJSON,
UpdateAIPlatformConnectorResponseToJSON,
} from '../models/index';
export interface CreateAIPlatformConnectorOperationRequest {
organizationId: string;
createAIPlatformConnectorRequest: CreateAIPlatformConnectorRequest;
workspaceId?: string;
}
export interface DeleteAIPlatformConnectorRequest {
organizationId: string;
aiPlatformConnectorId: string;
}
export interface GetAIPlatformConnectorRequest {
organizationId: string;
aiPlatformConnectorId: string;
}
export interface GetAIPlatformConnectorsRequest {
organizationId: string;
workspaceId?: string;
}
export interface UpdateAIPlatformConnectorOperationRequest {
organizationId: string;
aiPlatformConnectorId: string;
updateAIPlatformConnectorRequest: UpdateAIPlatformConnectorRequest;
}
/**
*
*/
export class AIPlatformConnectorsApi extends runtime.BaseAPI {
/**
* Creates a new AI platform connector for embeddings and processing. The specific configuration fields required depend on the platform type selected.
* Create a new AI platform connector
*/
async createAIPlatformConnectorRaw(requestParameters: CreateAIPlatformConnectorOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CreateAIPlatformConnectorResponse>> {
if (requestParameters['organizationId'] == null) {
throw new runtime.RequiredError(
'organizationId',
'Required parameter "organizationId" was null or undefined when calling createAIPlatformConnector().'
);
}
if (requestParameters['createAIPlatformConnectorRequest'] == null) {
throw new runtime.RequiredError(
'createAIPlatformConnectorRequest',
'Required parameter "createAIPlatformConnectorRequest" was null or undefined when calling createAIPlatformConnector().'
);
}
const queryParameters: any = {};
if (requestParameters['workspaceId'] != null) {
queryParameters['workspaceId'] = requestParameters['workspaceId'];
}
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("bearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/org/{organizationId}/connectors/aiplatforms`.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters['organizationId']))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: CreateAIPlatformConnectorRequestToJSON(requestParameters['createAIPlatformConnectorRequest']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => CreateAIPlatformConnectorResponseFromJSON(jsonValue));
}
/**
* Creates a new AI platform connector for embeddings and processing. The specific configuration fields required depend on the platform type selected.
* Create a new AI platform connector
*/
async createAIPlatformConnector(requestParameters: CreateAIPlatformConnectorOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CreateAIPlatformConnectorResponse> {
const response = await this.createAIPlatformConnectorRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Delete an AI platform connector
* Delete an AI platform connector
*/
async deleteAIPlatformConnectorRaw(requestParameters: DeleteAIPlatformConnectorRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DeleteAIPlatformConnectorResponse>> {
if (requestParameters['organizationId'] == null) {
throw new runtime.RequiredError(
'organizationId',
'Required parameter "organizationId" was null or undefined when calling deleteAIPlatformConnector().'
);
}
if (requestParameters['aiPlatformConnectorId'] == null) {
throw new runtime.RequiredError(
'aiPlatformConnectorId',
'Required parameter "aiPlatformConnectorId" was null or undefined when calling deleteAIPlatformConnector().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("bearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/org/{organizationId}/connectors/aiplatforms/{aiPlatformConnectorId}`.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters['organizationId']))).replace(`{${"aiPlatformConnectorId"}}`, encodeURIComponent(String(requestParameters['aiPlatformConnectorId']))),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => DeleteAIPlatformConnectorResponseFromJSON(jsonValue));
}
/**
* Delete an AI platform connector
* Delete an AI platform connector
*/
async deleteAIPlatformConnector(requestParameters: DeleteAIPlatformConnectorRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DeleteAIPlatformConnectorResponse> {
const response = await this.deleteAIPlatformConnectorRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Get an AI platform connector
* Get an AI platform connector
*/
async getAIPlatformConnectorRaw(requestParameters: GetAIPlatformConnectorRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AIPlatformConnector>> {
if (requestParameters['organizationId'] == null) {
throw new runtime.RequiredError(
'organizationId',
'Required parameter "organizationId" was null or undefined when calling getAIPlatformConnector().'
);
}
if (requestParameters['aiPlatformConnectorId'] == null) {
throw new runtime.RequiredError(
'aiPlatformConnectorId',
'Required parameter "aiPlatformConnectorId" was null or undefined when calling getAIPlatformConnector().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("bearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/org/{organizationId}/connectors/aiplatforms/{aiPlatformConnectorId}`.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters['organizationId']))).replace(`{${"aiPlatformConnectorId"}}`, encodeURIComponent(String(requestParameters['aiPlatformConnectorId']))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => AIPlatformConnectorFromJSON(jsonValue));
}
/**
* Get an AI platform connector
* Get an AI platform connector
*/
async getAIPlatformConnector(requestParameters: GetAIPlatformConnectorRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AIPlatformConnector> {
const response = await this.getAIPlatformConnectorRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Get all existing AI Platform connectors
* Get all existing AI Platform connectors
*/
async getAIPlatformConnectorsRaw(requestParameters: GetAIPlatformConnectorsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GetAIPlatformConnectors200Response>> {
if (requestParameters['organizationId'] == null) {
throw new runtime.RequiredError(
'organizationId',
'Required parameter "organizationId" was null or undefined when calling getAIPlatformConnectors().'
);
}
const queryParameters: any = {};
if (requestParameters['workspaceId'] != null) {
queryParameters['workspaceId'] = requestParameters['workspaceId'];
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("bearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/org/{organizationId}/connectors/aiplatforms`.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters['organizationId']))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => GetAIPlatformConnectors200ResponseFromJSON(jsonValue));
}
/**
* Get all existing AI Platform connectors
* Get all existing AI Platform connectors
*/
async getAIPlatformConnectors(requestParameters: GetAIPlatformConnectorsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetAIPlatformConnectors200Response> {
const response = await this.getAIPlatformConnectorsRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Update an AI Platform connector
* Update an AI Platform connector
*/
async updateAIPlatformConnectorRaw(requestParameters: UpdateAIPlatformConnectorOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UpdateAIPlatformConnectorResponse>> {
if (requestParameters['organizationId'] == null) {
throw new runtime.RequiredError(
'organizationId',
'Required parameter "organizationId" was null or undefined when calling updateAIPlatformConnector().'
);
}
if (requestParameters['aiPlatformConnectorId'] == null) {
throw new runtime.RequiredError(
'aiPlatformConnectorId',
'Required parameter "aiPlatformConnectorId" was null or undefined when calling updateAIPlatformConnector().'
);
}
if (requestParameters['updateAIPlatformConnectorRequest'] == null) {
throw new runtime.RequiredError(
'updateAIPlatformConnectorRequest',
'Required parameter "updateAIPlatformConnectorRequest" was null or undefined when calling updateAIPlatformConnector().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("bearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/org/{organizationId}/connectors/aiplatforms/{aiPlatformConnectorId}`.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters['organizationId']))).replace(`{${"aiPlatformConnectorId"}}`, encodeURIComponent(String(requestParameters['aiPlatformConnectorId']))),
method: 'PATCH',
headers: headerParameters,
query: queryParameters,
body: UpdateAIPlatformConnectorRequestToJSON(requestParameters['updateAIPlatformConnectorRequest']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => UpdateAIPlatformConnectorResponseFromJSON(jsonValue));
}
/**
* Update an AI Platform connector
* Update an AI Platform connector
*/
async updateAIPlatformConnector(requestParameters: UpdateAIPlatformConnectorOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UpdateAIPlatformConnectorResponse> {
const response = await this.updateAIPlatformConnectorRaw(requestParameters, initOverrides);
return await response.value();
}
}