Skip to content

Commit 14cd244

Browse files
authored
regen code to fix variables type, add accountId param (#56)
- pin generator at v6.0.1 - update package version to 5.0.0 - regen code - update wrappers
1 parent 16650ab commit 14cd244

File tree

108 files changed

+674
-258
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+674
-258
lines changed

generate/Dockerfile.generate

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
FROM openapitools/openapi-generator-cli@sha256:bc3f07ee4032923c7158b1a4a59aadd1861c6b4227c58d8ded5ee2b6c075bf72
1+
FROM openapitools/openapi-generator-cli@sha256:c49d9c99124fe2ad94ccef54cc6d3362592e7ca29006a8cf01337ab10d1c01f4

generate/generate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if [ -z "$TEMPLATES_PATH" ]; then
1616
die "TEMPLATES_PATH must be set, e.g. /path/to/sajari/sdk-node/generate/templates"
1717
fi
1818

19-
VERSION=4.6.2
19+
VERSION=5.0.0
2020

2121
docker-entrypoint.sh generate \
2222
-i /openapi.json \

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sajari/sdk-node",
3-
"version": "4.6.2",
3+
"version": "5.0.0",
44
"repository": "git@github.com:github.com/sajari/sdk-node.git",
55
"author": "Search.io",
66
"license": "MIT",

src/collections.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,16 @@ export class CollectionsClient extends Client {
3939
}
4040

4141
async listCollections({
42+
accountId,
4243
pageSize,
4344
pageToken,
4445
}: {
46+
accountId?: string;
4547
pageSize?: number;
4648
pageToken?: string;
4749
}) {
4850
try {
49-
const res = await this.client.listCollections(pageSize, pageToken);
51+
const res = await this.client.listCollections(accountId, pageSize, pageToken);
5052
return res.body;
5153
} catch (e) {
5254
throw handleError(e);
@@ -72,7 +74,8 @@ export class CollectionsClient extends Client {
7274
}
7375

7476
async updateCollection(
75-
id: string,
77+
collectionId: string,
78+
accountId?: string,
7679
...options: Array<
7780
(c: Collection, updateMask: Record<string, boolean>) => void
7881
>
@@ -89,7 +92,7 @@ export class CollectionsClient extends Client {
8992
const um = Object.keys(updateMask).map((field) => field);
9093

9194
try {
92-
const res = await this.client.updateCollection(id, um.join(","), c);
95+
const res = await this.client.updateCollection(collectionId, c, accountId, um.join(","));
9396
// OpenAPI readonly fields become optional TS fields, but we know the API
9497
// will return it, so use ! to fix the types. This is done so upstream
9598
// users don't have to do this.

src/events.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class EventsClient extends Client {
2424

2525
async sendEvent(accountId: string, args: SendEventRequest) {
2626
try {
27-
const res = await this.client.sendEvent(args, {
27+
const res = await this.client.sendEvent(accountId, args, {
2828
headers: {
2929
"Account-Id": accountId,
3030
},

src/generated/.openapi-generator/FILES

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,27 @@ model/batchUpdateRecordsResponseError.ts
1919
model/batchUpdateRecordsResponseRecord.ts
2020
model/batchUpsertRecordsRequest.ts
2121
model/batchUpsertRecordsRequestPipeline.ts
22+
model/batchUpsertRecordsRequestVariablesValue.ts
2223
model/batchUpsertRecordsResponse.ts
2324
model/batchUpsertRecordsResponseError.ts
2425
model/batchUpsertRecordsResponseKey.ts
2526
model/batchUpsertRecordsResponseVariables.ts
2627
model/collection.ts
28+
model/collectionType.ts
29+
model/createSchemaFieldRequest.ts
2730
model/deleteRecordRequest.ts
2831
model/event.ts
2932
model/experimentRequest.ts
3033
model/experimentRequestPipeline.ts
3134
model/experimentResponse.ts
3235
model/generatePipelinesRequest.ts
3336
model/generatePipelinesResponse.ts
37+
model/getCollectionRequestView.ts
3438
model/getDefaultPipelineResponse.ts
3539
model/getDefaultVersionRequestView.ts
3640
model/getPipelineRequestView.ts
3741
model/getRecordRequest.ts
42+
model/listCollectionsRequestView.ts
3843
model/listCollectionsResponse.ts
3944
model/listPipelinesRequestView.ts
4045
model/listPipelinesResponse.ts
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.4.0
1+
6.1.0-SNAPSHOT

src/generated/api/collectionsApi.ts

Lines changed: 59 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
22
* Search.io API
3-
* Search.io offers a search and discovery service with Neuralsearch®, the world\'s first instant AI search technology. Businesses of all sizes use Search.io to build site search and discovery solutions that maximize e-commerce revenue, optimize on-site customer experience, and scale their online presence.
3+
* Search.io offers a search and discovery service with Neuralsearch®, the world\'s first instant AI search technology. Businesses of all sizes use Search.io to build site search and discovery solutions that maximize e-commerce revenue, optimize on-site customer experience, and scale their online presence. # Authentication <!-- ReDoc-Inject: <SecurityDefinitions> --> # Rate limiting The Search.io API employs a number of safeguards against bursts of incoming traffic to help maximize its stability. Users who send many requests in quick succession may see error responses that show up as HTTP status code `429`. For the [UpsertRecord](/docs/api#operation/UpsertRecord) call, Search.io allows up to 175 write operations per second. Treat these limits as maximums and don\'t generate unnecessary load. See [Handling limiting gracefully](/docs/api/#section/Rate-limiting/Handling-limiting-gracefully) for advice on handling `429`s. We may reduce limits to prevent abuse. ## Common causes and mitigations Rate limiting can occur under a variety of conditions, but it\'s most common in these scenarios: - Running a large volume of closely-spaced requests. Often this is part of a user\'s long-running reindex job. When engaging in these activities, you should try to control the request rate (see [Handling limiting gracefully](/docs/api/#section/Rate-limiting/Handling-limiting-gracefully)). - Running batch operations in parallel. Often [BatchUpsertRecords](/docs/api#operation/BatchUpsertRecords) is used as part of a user\'s long-running reindex job. A batch of records of size `N` passed to [BatchUpsertRecords](/docs/api#operation/BatchUpsertRecords) is counted as `N` [UpsertRecord](/docs/api#operation/UpsertRecord) calls for the purposes of rate limiting, as opposed to a single call. Treat batch API calls as a convenience rather than a way to get more write throughput. ## Handling limiting gracefully A basic technique for integrations to gracefully handle limiting is to watch for `429` HTTP status codes and build in a retry mechanism. The retry mechanism should follow an exponential backoff schedule to reduce request volume when necessary. We also recommend building some randomness into the backoff schedule to avoid a [thundering herd effect](https://en.wikipedia.org/wiki/Thundering_herd_problem).
44
*
5-
* The version of the OpenAPI document: v4
5+
* The version of the OpenAPI document: 4.0.0
66
* Contact: support@search.io
77
*
88
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -122,10 +122,12 @@ export class CollectionsApi {
122122
* @summary Create collection
123123
* @param collectionId The ID to use for the collection. This must start with an alphanumeric character followed by one or more alphanumeric or &#x60;-&#x60; characters. Strictly speaking, it must match the regular expression: &#x60;^[A-Za-z][A-Za-z0-9\\-]*$&#x60;.
124124
* @param collection Details of the collection to create.
125+
* @param accountId The account that owns the collection, e.g. &#x60;1618535966441231024&#x60;.
125126
*/
126127
public async createCollection(
127128
collectionId: string,
128129
collection: Collection,
130+
accountId?: string,
129131
options: { headers: { [name: string]: string } } = { headers: {} }
130132
): Promise<{ response: http.IncomingMessage; body: Collection }> {
131133
const localVarPath = this.basePath + "/v4/collections";
@@ -164,6 +166,10 @@ export class CollectionsApi {
164166
);
165167
}
166168

169+
localVarHeaderParams["Account-Id"] = ObjectSerializer.serialize(
170+
accountId,
171+
"string"
172+
);
167173
(<any>Object).assign(localVarHeaderParams, options.headers);
168174

169175
let localVarUseFormData = false;
@@ -232,9 +238,11 @@ export class CollectionsApi {
232238
* Delete a collection and all of its associated data. > Note: This operation cannot be reversed.
233239
* @summary Delete collection
234240
* @param collectionId The collection to delete, e.g. &#x60;my-collection&#x60;.
241+
* @param accountId The account that owns the collection, e.g. &#x60;1618535966441231024&#x60;.
235242
*/
236243
public async deleteCollection(
237244
collectionId: string,
245+
accountId?: string,
238246
options: { headers: { [name: string]: string } } = { headers: {} }
239247
): Promise<{ response: http.IncomingMessage; body: any }> {
240248
const localVarPath =
@@ -264,6 +272,10 @@ export class CollectionsApi {
264272
);
265273
}
266274

275+
localVarHeaderParams["Account-Id"] = ObjectSerializer.serialize(
276+
accountId,
277+
"string"
278+
);
267279
(<any>Object).assign(localVarHeaderParams, options.headers);
268280

269281
let localVarUseFormData = false;
@@ -441,9 +453,13 @@ export class CollectionsApi {
441453
* Retrieve the details of a collection.
442454
* @summary Get collection
443455
* @param collectionId The collection to retrieve, e.g. &#x60;my-collection&#x60;.
456+
* @param accountId The account that owns the collection, e.g. &#x60;1618535966441231024&#x60;.
457+
* @param view The amount of information to include in the retrieved pipeline. - BASIC: Include basic information including display name and domains. This is the default value (for both [ListCollections](/docs/api#operation/ListCollections) and [GetCollection](/docs/api#operation/GetCollection)). - FULL: Include the information from &#x60;BASIC&#x60;, plus full collection details like disk usage.
444458
*/
445459
public async getCollection(
446460
collectionId: string,
461+
accountId?: string,
462+
view?: "VIEW_UNSPECIFIED" | "BASIC" | "FULL",
447463
options: { headers: { [name: string]: string } } = { headers: {} }
448464
): Promise<{ response: http.IncomingMessage; body: Collection }> {
449465
const localVarPath =
@@ -473,6 +489,17 @@ export class CollectionsApi {
473489
);
474490
}
475491

492+
if (view !== undefined) {
493+
localVarQueryParameters["view"] = ObjectSerializer.serialize(
494+
view,
495+
"'VIEW_UNSPECIFIED' | 'BASIC' | 'FULL'"
496+
);
497+
}
498+
499+
localVarHeaderParams["Account-Id"] = ObjectSerializer.serialize(
500+
accountId,
501+
"string"
502+
);
476503
(<any>Object).assign(localVarHeaderParams, options.headers);
477504

478505
let localVarUseFormData = false;
@@ -539,12 +566,16 @@ export class CollectionsApi {
539566
/**
540567
* Retrieve a list of collections in an account.
541568
* @summary List collections
569+
* @param accountId The account that owns this set of collections, e.g. &#x60;1618535966441231024&#x60;.
542570
* @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.
543571
* @param pageToken A page token, received from a previous [ListCollections](/docs/api#operation/ListCollections) call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to [ListCollections](/docs/api#operation/ListCollections) must match the call that provided the page token.
572+
* @param view The amount of information to include in each retrieved collection. - BASIC: Include basic information including display name and domains. This is the default value (for both [ListCollections](/docs/api#operation/ListCollections) and [GetCollection](/docs/api#operation/GetCollection)). - FULL: Include the information from &#x60;BASIC&#x60;, plus full collection details like disk usage.
544573
*/
545574
public async listCollections(
575+
accountId?: string,
546576
pageSize?: number,
547577
pageToken?: string,
578+
view?: "VIEW_UNSPECIFIED" | "BASIC" | "FULL",
548579
options: { headers: { [name: string]: string } } = { headers: {} }
549580
): Promise<{
550581
response: http.IncomingMessage;
@@ -579,6 +610,17 @@ export class CollectionsApi {
579610
);
580611
}
581612

613+
if (view !== undefined) {
614+
localVarQueryParameters["view"] = ObjectSerializer.serialize(
615+
view,
616+
"'VIEW_UNSPECIFIED' | 'BASIC' | 'FULL'"
617+
);
618+
}
619+
620+
localVarHeaderParams["Account-Id"] = ObjectSerializer.serialize(
621+
accountId,
622+
"string"
623+
);
582624
(<any>Object).assign(localVarHeaderParams, options.headers);
583625

584626
let localVarUseFormData = false;
@@ -651,10 +693,12 @@ export class CollectionsApi {
651693
* @summary Query collection
652694
* @param collectionId The collection to query, e.g. &#x60;my-collection&#x60;.
653695
* @param queryCollectionRequest
696+
* @param accountId The account that owns the collection, e.g. &#x60;1618535966441231024&#x60;. Unlike other API calls, the &#x60;QueryCollection&#x60; call can be called from a browser. When called from a browser, the &#x60;Account-Id&#x60; header must be set to your account ID.
654697
*/
655698
public async queryCollection(
656699
collectionId: string,
657700
queryCollectionRequest: QueryCollectionRequest,
701+
accountId?: string,
658702
options: { headers: { [name: string]: string } } = { headers: {} }
659703
): Promise<{
660704
response: http.IncomingMessage;
@@ -697,6 +741,10 @@ export class CollectionsApi {
697741
);
698742
}
699743

744+
localVarHeaderParams["Account-Id"] = ObjectSerializer.serialize(
745+
accountId,
746+
"string"
747+
);
700748
(<any>Object).assign(localVarHeaderParams, options.headers);
701749

702750
let localVarUseFormData = false;
@@ -891,7 +939,7 @@ export class CollectionsApi {
891939
});
892940
}
893941
/**
894-
* Track an analytics event when a user interacts with an object returned by a [QueryCollection](/docs/api/#operation/QueryCollection) request. An analytics event can be tracked for the following objects: - Results - Promotion banners - Redirects Note: You must pass an `Account-Id` header.
942+
* Track an analytics event when a user interacts with an object returned by a [QueryCollection](/docs/api/#operation/QueryCollection) request. An analytics event can be tracked for the following objects: - Results - Promotion banners - Redirects When tracking redirect events, set `type` to `redirect`. - **Note:** You must pass an `Account-Id` header. - **Note:** One of `result_id`, `banner_id` or `redirect_id` are required.
895943
* @summary Track event
896944
* @param accountId The account that owns the collection, e.g. &#x60;1618535966441231024&#x60;.
897945
* @param collectionId The collection to track the event against, e.g. &#x60;my-collection&#x60;.
@@ -1016,13 +1064,15 @@ export class CollectionsApi {
10161064
* Update the details of a collection.
10171065
* @summary Update collection
10181066
* @param collectionId The collection to update, e.g. &#x60;my-collection&#x60;.
1019-
* @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.
10201067
* @param collection The details of the collection to update.
1068+
* @param accountId The account that owns the collection, e.g. &#x60;1618535966441231024&#x60;.
1069+
* @param updateMask The list of fields to update, separated by a comma, e.g. &#x60;authorized_query_domains,display_name&#x60;. Each field should be in snake case. For each field that you want to update, provide a corresponding value in the collection object containing the new value.
10211070
*/
10221071
public async updateCollection(
10231072
collectionId: string,
1024-
updateMask: string,
10251073
collection: Collection,
1074+
accountId?: string,
1075+
updateMask?: string,
10261076
options: { headers: { [name: string]: string } } = { headers: {} }
10271077
): Promise<{ response: http.IncomingMessage; body: Collection }> {
10281078
const localVarPath =
@@ -1052,13 +1102,6 @@ export class CollectionsApi {
10521102
);
10531103
}
10541104

1055-
// verify required parameter 'updateMask' is not null or undefined
1056-
if (updateMask === null || updateMask === undefined) {
1057-
throw new Error(
1058-
"Required parameter updateMask was null or undefined when calling updateCollection."
1059-
);
1060-
}
1061-
10621105
// verify required parameter 'collection' is not null or undefined
10631106
if (collection === null || collection === undefined) {
10641107
throw new Error(
@@ -1073,6 +1116,10 @@ export class CollectionsApi {
10731116
);
10741117
}
10751118

1119+
localVarHeaderParams["Account-Id"] = ObjectSerializer.serialize(
1120+
accountId,
1121+
"string"
1122+
);
10761123
(<any>Object).assign(localVarHeaderParams, options.headers);
10771124

10781125
let localVarUseFormData = false;

0 commit comments

Comments
 (0)