-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
629 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,239 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* Typesense API | ||
* An open source search engine for building delightful search experiences. | ||
* | ||
* The version of the OpenAPI document: 0.25.0 | ||
* | ||
* | ||
* 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 { | ||
AnalyticsRuleSchema, | ||
AnalyticsRulesRetrieveSchema, | ||
ModelApiResponse, | ||
} from '../models'; | ||
import { | ||
AnalyticsRuleSchemaFromJSON, | ||
AnalyticsRuleSchemaToJSON, | ||
AnalyticsRulesRetrieveSchemaFromJSON, | ||
AnalyticsRulesRetrieveSchemaToJSON, | ||
ModelApiResponseFromJSON, | ||
ModelApiResponseToJSON, | ||
} from '../models'; | ||
|
||
export interface CreateAnalyticsRuleRequest { | ||
analyticsRuleSchema: AnalyticsRuleSchema; | ||
} | ||
|
||
export interface DeleteAnalyticsRuleRequest { | ||
ruleName: string; | ||
} | ||
|
||
export interface RetrieveAnalyticsRuleRequest { | ||
ruleName: string; | ||
} | ||
|
||
export interface UpsertAnalyticsRuleRequest { | ||
ruleName: string; | ||
analyticsRuleSchema: AnalyticsRuleSchema; | ||
} | ||
|
||
/** | ||
* | ||
*/ | ||
export class AnalyticsApi extends runtime.BaseAPI { | ||
|
||
/** | ||
* When an analytics rule is created, we give it a name and describe the type, the source collections and the destination collection. | ||
* Creates an analytics rule | ||
*/ | ||
async createAnalyticsRuleRaw(requestParameters: CreateAnalyticsRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AnalyticsRuleSchema>> { | ||
if (requestParameters.analyticsRuleSchema === null || requestParameters.analyticsRuleSchema === undefined) { | ||
throw new runtime.RequiredError('analyticsRuleSchema','Required parameter requestParameters.analyticsRuleSchema was null or undefined when calling createAnalyticsRule.'); | ||
} | ||
|
||
const queryParameters: any = {}; | ||
|
||
const headerParameters: runtime.HTTPHeaders = {}; | ||
|
||
headerParameters['Content-Type'] = 'application/json'; | ||
|
||
if (this.configuration && this.configuration.apiKey) { | ||
headerParameters["X-TYPESENSE-API-KEY"] = this.configuration.apiKey("X-TYPESENSE-API-KEY"); // api_key_header authentication | ||
} | ||
|
||
const response = await this.request({ | ||
path: `/analytics/rules`, | ||
method: 'POST', | ||
headers: headerParameters, | ||
query: queryParameters, | ||
body: AnalyticsRuleSchemaToJSON(requestParameters.analyticsRuleSchema), | ||
}, initOverrides); | ||
|
||
return new runtime.JSONApiResponse(response, (jsonValue) => AnalyticsRuleSchemaFromJSON(jsonValue)); | ||
} | ||
|
||
/** | ||
* When an analytics rule is created, we give it a name and describe the type, the source collections and the destination collection. | ||
* Creates an analytics rule | ||
*/ | ||
async createAnalyticsRule(requestParameters: CreateAnalyticsRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AnalyticsRuleSchema> { | ||
const response = await this.createAnalyticsRuleRaw(requestParameters, initOverrides); | ||
return await response.value(); | ||
} | ||
|
||
/** | ||
* Permanently deletes an analytics rule, given it\'s name | ||
* Delete an analytics rule | ||
*/ | ||
async deleteAnalyticsRuleRaw(requestParameters: DeleteAnalyticsRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AnalyticsRuleSchema>> { | ||
if (requestParameters.ruleName === null || requestParameters.ruleName === undefined) { | ||
throw new runtime.RequiredError('ruleName','Required parameter requestParameters.ruleName was null or undefined when calling deleteAnalyticsRule.'); | ||
} | ||
|
||
const queryParameters: any = {}; | ||
|
||
const headerParameters: runtime.HTTPHeaders = {}; | ||
|
||
if (this.configuration && this.configuration.apiKey) { | ||
headerParameters["X-TYPESENSE-API-KEY"] = this.configuration.apiKey("X-TYPESENSE-API-KEY"); // api_key_header authentication | ||
} | ||
|
||
const response = await this.request({ | ||
path: `/analytics/rules/{ruleName}`.replace(`{${"ruleName"}}`, encodeURIComponent(String(requestParameters.ruleName))), | ||
method: 'DELETE', | ||
headers: headerParameters, | ||
query: queryParameters, | ||
}, initOverrides); | ||
|
||
return new runtime.JSONApiResponse(response, (jsonValue) => AnalyticsRuleSchemaFromJSON(jsonValue)); | ||
} | ||
|
||
/** | ||
* Permanently deletes an analytics rule, given it\'s name | ||
* Delete an analytics rule | ||
*/ | ||
async deleteAnalyticsRule(requestParameters: DeleteAnalyticsRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AnalyticsRuleSchema> { | ||
const response = await this.deleteAnalyticsRuleRaw(requestParameters, initOverrides); | ||
return await response.value(); | ||
} | ||
|
||
/** | ||
* Retrieve the details of an analytics rule, given it\'s name | ||
* Retrieves an analytics rule | ||
*/ | ||
async retrieveAnalyticsRuleRaw(requestParameters: RetrieveAnalyticsRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AnalyticsRuleSchema>> { | ||
if (requestParameters.ruleName === null || requestParameters.ruleName === undefined) { | ||
throw new runtime.RequiredError('ruleName','Required parameter requestParameters.ruleName was null or undefined when calling retrieveAnalyticsRule.'); | ||
} | ||
|
||
const queryParameters: any = {}; | ||
|
||
const headerParameters: runtime.HTTPHeaders = {}; | ||
|
||
if (this.configuration && this.configuration.apiKey) { | ||
headerParameters["X-TYPESENSE-API-KEY"] = this.configuration.apiKey("X-TYPESENSE-API-KEY"); // api_key_header authentication | ||
} | ||
|
||
const response = await this.request({ | ||
path: `/analytics/rules/{ruleName}`.replace(`{${"ruleName"}}`, encodeURIComponent(String(requestParameters.ruleName))), | ||
method: 'GET', | ||
headers: headerParameters, | ||
query: queryParameters, | ||
}, initOverrides); | ||
|
||
return new runtime.JSONApiResponse(response, (jsonValue) => AnalyticsRuleSchemaFromJSON(jsonValue)); | ||
} | ||
|
||
/** | ||
* Retrieve the details of an analytics rule, given it\'s name | ||
* Retrieves an analytics rule | ||
*/ | ||
async retrieveAnalyticsRule(requestParameters: RetrieveAnalyticsRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AnalyticsRuleSchema> { | ||
const response = await this.retrieveAnalyticsRuleRaw(requestParameters, initOverrides); | ||
return await response.value(); | ||
} | ||
|
||
/** | ||
* Retrieve the details of all analytics rules | ||
* Retrieves all analytics rules | ||
*/ | ||
async retrieveAnalyticsRulesRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AnalyticsRulesRetrieveSchema>> { | ||
const queryParameters: any = {}; | ||
|
||
const headerParameters: runtime.HTTPHeaders = {}; | ||
|
||
if (this.configuration && this.configuration.apiKey) { | ||
headerParameters["X-TYPESENSE-API-KEY"] = this.configuration.apiKey("X-TYPESENSE-API-KEY"); // api_key_header authentication | ||
} | ||
|
||
const response = await this.request({ | ||
path: `/analytics/rules`, | ||
method: 'GET', | ||
headers: headerParameters, | ||
query: queryParameters, | ||
}, initOverrides); | ||
|
||
return new runtime.JSONApiResponse(response, (jsonValue) => AnalyticsRulesRetrieveSchemaFromJSON(jsonValue)); | ||
} | ||
|
||
/** | ||
* Retrieve the details of all analytics rules | ||
* Retrieves all analytics rules | ||
*/ | ||
async retrieveAnalyticsRules(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AnalyticsRulesRetrieveSchema> { | ||
const response = await this.retrieveAnalyticsRulesRaw(initOverrides); | ||
return await response.value(); | ||
} | ||
|
||
/** | ||
* Upserts an analytics rule with the given name. | ||
* Upserts an analytics rule | ||
*/ | ||
async upsertAnalyticsRuleRaw(requestParameters: UpsertAnalyticsRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AnalyticsRuleSchema>> { | ||
if (requestParameters.ruleName === null || requestParameters.ruleName === undefined) { | ||
throw new runtime.RequiredError('ruleName','Required parameter requestParameters.ruleName was null or undefined when calling upsertAnalyticsRule.'); | ||
} | ||
|
||
if (requestParameters.analyticsRuleSchema === null || requestParameters.analyticsRuleSchema === undefined) { | ||
throw new runtime.RequiredError('analyticsRuleSchema','Required parameter requestParameters.analyticsRuleSchema was null or undefined when calling upsertAnalyticsRule.'); | ||
} | ||
|
||
const queryParameters: any = {}; | ||
|
||
const headerParameters: runtime.HTTPHeaders = {}; | ||
|
||
headerParameters['Content-Type'] = 'application/json'; | ||
|
||
if (this.configuration && this.configuration.apiKey) { | ||
headerParameters["X-TYPESENSE-API-KEY"] = this.configuration.apiKey("X-TYPESENSE-API-KEY"); // api_key_header authentication | ||
} | ||
|
||
const response = await this.request({ | ||
path: `/analytics/rules/{ruleName}`.replace(`{${"ruleName"}}`, encodeURIComponent(String(requestParameters.ruleName))), | ||
method: 'PUT', | ||
headers: headerParameters, | ||
query: queryParameters, | ||
body: AnalyticsRuleSchemaToJSON(requestParameters.analyticsRuleSchema), | ||
}, initOverrides); | ||
|
||
return new runtime.JSONApiResponse(response, (jsonValue) => AnalyticsRuleSchemaFromJSON(jsonValue)); | ||
} | ||
|
||
/** | ||
* Upserts an analytics rule with the given name. | ||
* Upserts an analytics rule | ||
*/ | ||
async upsertAnalyticsRule(requestParameters: UpsertAnalyticsRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AnalyticsRuleSchema> { | ||
const response = await this.upsertAnalyticsRuleRaw(requestParameters, initOverrides); | ||
return await response.value(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* Typesense API | ||
* An open source search engine for building delightful search experiences. | ||
* | ||
* The version of the OpenAPI document: 0.25.0 | ||
* | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
import { exists, mapValues } from '../runtime'; | ||
import type { AnalyticsRuleParametersDestination } from './AnalyticsRuleParametersDestination'; | ||
import { | ||
AnalyticsRuleParametersDestinationFromJSON, | ||
AnalyticsRuleParametersDestinationFromJSONTyped, | ||
AnalyticsRuleParametersDestinationToJSON, | ||
} from './AnalyticsRuleParametersDestination'; | ||
import type { AnalyticsRuleParametersSource } from './AnalyticsRuleParametersSource'; | ||
import { | ||
AnalyticsRuleParametersSourceFromJSON, | ||
AnalyticsRuleParametersSourceFromJSONTyped, | ||
AnalyticsRuleParametersSourceToJSON, | ||
} from './AnalyticsRuleParametersSource'; | ||
|
||
/** | ||
* | ||
* @export | ||
* @interface AnalyticsRuleParameters | ||
*/ | ||
export interface AnalyticsRuleParameters { | ||
/** | ||
* | ||
* @type {AnalyticsRuleParametersSource} | ||
* @memberof AnalyticsRuleParameters | ||
*/ | ||
source: AnalyticsRuleParametersSource; | ||
/** | ||
* | ||
* @type {AnalyticsRuleParametersDestination} | ||
* @memberof AnalyticsRuleParameters | ||
*/ | ||
destination: AnalyticsRuleParametersDestination; | ||
/** | ||
* | ||
* @type {number} | ||
* @memberof AnalyticsRuleParameters | ||
*/ | ||
limit: number; | ||
} | ||
|
||
/** | ||
* Check if a given object implements the AnalyticsRuleParameters interface. | ||
*/ | ||
export function instanceOfAnalyticsRuleParameters(value: object): boolean { | ||
let isInstance = true; | ||
isInstance = isInstance && "source" in value; | ||
isInstance = isInstance && "destination" in value; | ||
isInstance = isInstance && "limit" in value; | ||
|
||
return isInstance; | ||
} | ||
|
||
export function AnalyticsRuleParametersFromJSON(json: any): AnalyticsRuleParameters { | ||
return AnalyticsRuleParametersFromJSONTyped(json, false); | ||
} | ||
|
||
export function AnalyticsRuleParametersFromJSONTyped(json: any, ignoreDiscriminator: boolean): AnalyticsRuleParameters { | ||
if ((json === undefined) || (json === null)) { | ||
return json; | ||
} | ||
return { | ||
|
||
'source': AnalyticsRuleParametersSourceFromJSON(json['source']), | ||
'destination': AnalyticsRuleParametersDestinationFromJSON(json['destination']), | ||
'limit': json['limit'], | ||
}; | ||
} | ||
|
||
export function AnalyticsRuleParametersToJSON(value?: AnalyticsRuleParameters | null): any { | ||
if (value === undefined) { | ||
return undefined; | ||
} | ||
if (value === null) { | ||
return null; | ||
} | ||
return { | ||
|
||
'source': AnalyticsRuleParametersSourceToJSON(value.source), | ||
'destination': AnalyticsRuleParametersDestinationToJSON(value.destination), | ||
'limit': value.limit, | ||
}; | ||
} | ||
|
Oops, something went wrong.