Skip to content

Commit

Permalink
(fix): support pagination for list endpoints
Browse files Browse the repository at this point in the history
Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
  • Loading branch information
fern-api[bot] authored Mar 4, 2024
1 parent 93760e1 commit 2e0d0d7
Show file tree
Hide file tree
Showing 24 changed files with 134 additions and 84 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webflow-api",
"version": "v2.1.0",
"version": "v2.1.1",
"private": false,
"repository": "https://github.com/webflow/js-webflow-api",
"main": "./index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/api/resources/accessGroups/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class AccessGroups {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down
16 changes: 8 additions & 8 deletions src/api/resources/assets/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class Assets {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -129,7 +129,7 @@ export class Assets {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -205,7 +205,7 @@ export class Assets {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -280,7 +280,7 @@ export class Assets {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -355,7 +355,7 @@ export class Assets {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -431,7 +431,7 @@ export class Assets {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -513,7 +513,7 @@ export class Assets {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -592,7 +592,7 @@ export class Assets {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down
10 changes: 5 additions & 5 deletions src/api/resources/collections/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class Collections {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -131,7 +131,7 @@ export class Collections {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -207,7 +207,7 @@ export class Collections {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -282,7 +282,7 @@ export class Collections {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -355,7 +355,7 @@ export class Collections {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class Fields {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -140,7 +140,7 @@ export class Fields {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down
18 changes: 9 additions & 9 deletions src/api/resources/collections/resources/items/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class Items {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -158,7 +158,7 @@ export class Items {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -242,7 +242,7 @@ export class Items {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -323,7 +323,7 @@ export class Items {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -414,7 +414,7 @@ export class Items {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -499,7 +499,7 @@ export class Items {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -579,7 +579,7 @@ export class Items {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -663,7 +663,7 @@ export class Items {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -745,7 +745,7 @@ export class Items {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down
2 changes: 1 addition & 1 deletion src/api/resources/ecommerce/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class Ecommerce {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down
29 changes: 22 additions & 7 deletions src/api/resources/forms/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,23 @@ export class Forms {
* @throws {@link Webflow.InternalServerError}
*
* @example
* await webflow.forms.list("site_id")
* await webflow.forms.list("site_id", {})
*/
public async list(siteId: string, requestOptions?: Forms.RequestOptions): Promise<Webflow.FormList> {
public async list(
siteId: string,
request: Webflow.FormsListRequest = {},
requestOptions?: Forms.RequestOptions
): Promise<Webflow.FormList> {
const { limit, offset } = request;
const _queryParams: Record<string, string | string[] | object | object[]> = {};
if (limit != null) {
_queryParams["limit"] = limit.toString();
}

if (offset != null) {
_queryParams["offset"] = offset.toString();
}

const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.WebflowEnvironment.Default,
Expand All @@ -48,11 +62,12 @@ export class Forms {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
contentType: "application/json",
queryParameters: _queryParams,
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
});
Expand Down Expand Up @@ -128,7 +143,7 @@ export class Forms {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -209,7 +224,7 @@ export class Forms {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -290,7 +305,7 @@ export class Forms {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -373,7 +388,7 @@ export class Forms {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down
18 changes: 18 additions & 0 deletions src/api/resources/forms/client/requests/FormsListRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

/**
* @example
* {}
*/
export interface FormsListRequest {
/**
* Maximum number of records to be returned (max limit: 100)
*/
limit?: number;
/**
* Offset used for pagination if the results have more than limit records
*/
offset?: number;
}
1 change: 1 addition & 0 deletions src/api/resources/forms/client/requests/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { FormsListRequest } from "./FormsListRequest";
export { FormsUpdateSubmissionRequest } from "./FormsUpdateSubmissionRequest";
4 changes: 2 additions & 2 deletions src/api/resources/inventory/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class Inventory {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -146,7 +146,7 @@ export class Inventory {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "webflow-api",
"X-Fern-SDK-Version": "v2.1.0",
"X-Fern-SDK-Version": "v2.1.1",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down
Loading

0 comments on commit 2e0d0d7

Please sign in to comment.