Skip to content

Commit

Permalink
Update to support UpdateRecord API method
Browse files Browse the repository at this point in the history
Increment version in generate.sh to 4.2.0
  • Loading branch information
jkaho committed Nov 4, 2021
1 parent 0c13135 commit 7118fdd
Show file tree
Hide file tree
Showing 39 changed files with 719 additions and 324 deletions.
2 changes: 1 addition & 1 deletion generate/Dockerfile.generate
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM openapitools/openapi-generator-cli@sha256:1de19c2ef32f8d1b74de687ad72c47e0024287e780be38ada4c6ace09cda13e4
FROM openapitools/openapi-generator-cli:latest-release
2 changes: 1 addition & 1 deletion generate/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if [ -z "$TEMPLATES_PATH" ]; then
die "TEMPLATES_PATH must be set, e.g. /path/to/sajari/sdk-node/generate/templates"
fi

VERSION=4.1.0
VERSION=4.2.0

docker-entrypoint.sh generate \
-i /openapi.json \
Expand Down
3 changes: 2 additions & 1 deletion src/generated/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ model/listPipelinesRequestView.ts
model/listPipelinesResponse.ts
model/listSchemaFieldsResponse.ts
model/apiError.ts
model/models.ts
model/percentileDataPoint.ts
model/pipeline.ts
model/pipelineStep.ts
Expand Down Expand Up @@ -61,7 +62,7 @@ model/sendEventRequest.ts
model/setDefaultPipelineRequest.ts
model/setDefaultVersionRequest.ts
model/status.ts
model/updateRecordRequest.ts
model/upsertRecordRequest.ts
model/upsertRecordRequestPipeline.ts
model/upsertRecordResponse.ts
model/models.ts
2 changes: 1 addition & 1 deletion src/generated/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.0-SNAPSHOT
5.3.0
137 changes: 133 additions & 4 deletions src/generated/api/collectionsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ export class CollectionsApi {
});
}
/**
* Retrieve a list of collections in the account.
* Retrieve a list of collections in an account.
* @summary List collections
* @param pageSize The maximum number of collections to return. The service may return fewer than this value. If unspecified, at most 50 collections are returned. The maximum value is 100; values above 100 are coerced to 100.
* @param pageToken A page token, received from a previous [ListCollections](/api#operation/ListCollections) call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to [ListCollections](/api#operation/ListCollections) must match the call that provided the page token.
Expand Down Expand Up @@ -549,7 +549,7 @@ export class CollectionsApi {
}> {
const localVarPath =
this.basePath +
"/v4/collections/{collection_id}:queryCollection".replace(
"/v4/collections/{collection_id}:query".replace(
"{" + "collection_id" + "}",
encodeURIComponent(String(collectionId))
);
Expand Down Expand Up @@ -655,17 +655,139 @@ export class CollectionsApi {
});
});
}
/**
* Query the collection to search for records. The following example demonstrates how to run a simple search for a particular string: ```json { \"variables\": { \"q\": \"search terms\" } } ``` For more information: - See [filtering content](https://docs.sajari.com/user-guide/integrating-search/filters/) - See [tracking in the Go SDK](https://github.com/sajari/sdk-go/blob/v2/session.go) - See [tracking in the JS SDK](https://github.com/sajari/sajari-sdk-js/blob/master/src/session.ts)
* @summary Query collection
* @param collectionId The collection to query, e.g. `my-collection`.
* @param queryCollectionRequest
*/
public async queryCollection2(
collectionId: string,
queryCollectionRequest: QueryCollectionRequest,
options: { headers: { [name: string]: string } } = { headers: {} }
): Promise<{
response: http.IncomingMessage;
body: QueryCollectionResponse;
}> {
const localVarPath =
this.basePath +
"/v4/collections/{collection_id}:queryCollection".replace(
"{" + "collection_id" + "}",
encodeURIComponent(String(collectionId))
);
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign(
{},
this._defaultHeaders
);
const produces = ["application/json"];
// give precedence to 'application/json'
if (produces.indexOf("application/json") >= 0) {
localVarHeaderParams.Accept = "application/json";
} else {
localVarHeaderParams.Accept = produces.join(",");
}
let localVarFormParams: any = {};

// verify required parameter 'collectionId' is not null or undefined
if (collectionId === null || collectionId === undefined) {
throw new Error(
"Required parameter collectionId was null or undefined when calling queryCollection2."
);
}

// verify required parameter 'queryCollectionRequest' is not null or undefined
if (
queryCollectionRequest === null ||
queryCollectionRequest === undefined
) {
throw new Error(
"Required parameter queryCollectionRequest was null or undefined when calling queryCollection2."
);
}

(<any>Object).assign(localVarHeaderParams, options.headers);

let localVarUseFormData = false;

let localVarRequestOptions: localVarRequest.Options = {
method: "POST",
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(
queryCollectionRequest,
"QueryCollectionRequest"
),
};

let authenticationPromise = Promise.resolve();
if (
this.authentications.BasicAuth.username &&
this.authentications.BasicAuth.password
) {
authenticationPromise = authenticationPromise.then(() =>
this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)
);
}
authenticationPromise = authenticationPromise.then(() =>
this.authentications.default.applyToRequest(localVarRequestOptions)
);

let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() =>
interceptor(localVarRequestOptions)
);
}

return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{
response: http.IncomingMessage;
body: QueryCollectionResponse;
}>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
body = ObjectSerializer.deserialize(
body,
"QueryCollectionResponse"
);
if (
response.statusCode &&
response.statusCode >= 200 &&
response.statusCode <= 299
) {
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
* Update the details of a collection.
* @summary Update collection
* @param collectionId The collection to update, e.g. &#x60;my-collection&#x60;.
* @param collection Details of the collection to update.
* @param updateMask The list of fields to be updated, separated by a comma, e.g. &#x60;field1,field2&#x60;. Each field should be in snake case, e.g. &#x60;display_name&#x60;. For each field that you want to update, provide a corresponding value in the collection object containing the new value.
* @param collection Details of the collection to update.
*/
public async updateCollection(
collectionId: string,
updateMask: string,
collection: Collection,
updateMask?: string,
options: { headers: { [name: string]: string } } = { headers: {} }
): Promise<{ response: http.IncomingMessage; body: Collection }> {
const localVarPath =
Expand Down Expand Up @@ -695,6 +817,13 @@ export class CollectionsApi {
);
}

// verify required parameter 'updateMask' is not null or undefined
if (updateMask === null || updateMask === undefined) {
throw new Error(
"Required parameter updateMask was null or undefined when calling updateCollection."
);
}

// verify required parameter 'collection' is not null or undefined
if (collection === null || collection === undefined) {
throw new Error(
Expand Down
97 changes: 96 additions & 1 deletion src/generated/api/eventsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class EventsApi {
sendEventRequest: SendEventRequest,
options: { headers: { [name: string]: string } } = { headers: {} }
): Promise<{ response: http.IncomingMessage; body: object }> {
const localVarPath = this.basePath + "/v4/events:sendEvent";
const localVarPath = this.basePath + "/v4/events:send";
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign(
{},
Expand Down Expand Up @@ -176,6 +176,101 @@ export class EventsApi {
);
}

return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: object }>(
(resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "object");
if (
response.statusCode &&
response.statusCode >= 200 &&
response.statusCode <= 299
) {
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
}
);
});
}
/**
* Send an event to the ranking system after a user interacts with a search result. When querying a collection, you can set the tracking type of the query request. When it is `CLICK` or `POS_NEG`, a token is generated for each result in the query response. You can use this token to provide feedback to the ranking system. Each time you want to record an event on a particular search result, use the send event call and provide: - The `name` of the event, e.g. `click`, `purchase`. - The `token` from the search result. - The `weight` to assign to the event, e.g. `1`. - An object containing any additional `metadata`. For example, to send an event where a customer purchased a product, use the following call: ```json { \"name\": \"purchase\", \"token\": \"eyJ...\", \"weight\": 1, \"metadata\": { \"discount\": 0.2, \"margin\": 30.0, \"customer_id\": \"12345\", \"ui_test_segment\": \"A\" } } ```
* @summary Send event
* @param sendEventRequest
*/
public async sendEvent2(
sendEventRequest: SendEventRequest,
options: { headers: { [name: string]: string } } = { headers: {} }
): Promise<{ response: http.IncomingMessage; body: object }> {
const localVarPath = this.basePath + "/v4/events:sendEvent";
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign(
{},
this._defaultHeaders
);
const produces = ["application/json"];
// give precedence to 'application/json'
if (produces.indexOf("application/json") >= 0) {
localVarHeaderParams.Accept = "application/json";
} else {
localVarHeaderParams.Accept = produces.join(",");
}
let localVarFormParams: any = {};

// verify required parameter 'sendEventRequest' is not null or undefined
if (sendEventRequest === null || sendEventRequest === undefined) {
throw new Error(
"Required parameter sendEventRequest was null or undefined when calling sendEvent2."
);
}

(<any>Object).assign(localVarHeaderParams, options.headers);

let localVarUseFormData = false;

let localVarRequestOptions: localVarRequest.Options = {
method: "POST",
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(sendEventRequest, "SendEventRequest"),
};

let authenticationPromise = Promise.resolve();
if (
this.authentications.BasicAuth.username &&
this.authentications.BasicAuth.password
) {
authenticationPromise = authenticationPromise.then(() =>
this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)
);
}
authenticationPromise = authenticationPromise.then(() =>
this.authentications.default.applyToRequest(localVarRequestOptions)
);

let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() =>
interceptor(localVarRequestOptions)
);
}

return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
Expand Down
2 changes: 1 addition & 1 deletion src/generated/api/pipelinesApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ export class PipelinesApi {
});
}
/**
* Retrieve a list of pipelines.
* Retrieve a list of pipelines in a collection.
* @summary List pipelines
* @param collectionId The collection that owns this set of pipelines, e.g. &#x60;my-collection&#x60;.
* @param pageSize The maximum number of pipelines to return. The service may return fewer than this value. If unspecified, at most 50 pipelines are returned. The maximum value is 1000; values above 1000 are coerced to 1000.
Expand Down
Loading

0 comments on commit 7118fdd

Please sign in to comment.