-
Notifications
You must be signed in to change notification settings - Fork 31
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
1 parent
85e706d
commit 5c7031d
Showing
66 changed files
with
2,630 additions
and
1,636 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 |
---|---|---|
@@ -1 +1 @@ | ||
configured_endpoints: 1137 | ||
configured_endpoints: 1147 |
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
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,128 @@ | ||
// File generated from our OpenAPI spec by Stainless. | ||
|
||
import { AbstractPage, Response, APIClient, FinalRequestOptions, PageInfo } from './core'; | ||
|
||
export interface V4PagePaginationResponse<Item> { | ||
result: V4PagePaginationResponse.Result; | ||
|
||
result_info: V4PagePaginationResponse.ResultInfo; | ||
} | ||
|
||
export namespace V4PagePaginationResponse { | ||
export interface Result { | ||
items?: Array<Item>; | ||
} | ||
|
||
export interface ResultInfo { | ||
page?: number; | ||
|
||
per_page?: number; | ||
} | ||
} | ||
|
||
export interface V4PagePaginationParams { | ||
page?: number; | ||
|
||
per_page?: number; | ||
} | ||
|
||
export class V4PagePagination<Item> extends AbstractPage<Item> implements V4PagePaginationResponse<Item> { | ||
result: V4PagePaginationResponse.Result; | ||
|
||
result_info: V4PagePaginationResponse.ResultInfo; | ||
|
||
constructor( | ||
client: APIClient, | ||
response: Response, | ||
body: V4PagePaginationResponse<Item>, | ||
options: FinalRequestOptions, | ||
) { | ||
super(client, response, body, options); | ||
|
||
this.result = body.result || {}; | ||
this.result_info = body.result_info || {}; | ||
} | ||
|
||
getPaginatedItems(): Item[] { | ||
return this.result?.items ?? []; | ||
} | ||
|
||
// @deprecated Please use `nextPageInfo()` instead | ||
nextPageParams(): Partial<V4PagePaginationParams> | null { | ||
const info = this.nextPageInfo(); | ||
if (!info) return null; | ||
if ('params' in info) return info.params; | ||
const params = Object.fromEntries(info.url.searchParams); | ||
if (!Object.keys(params).length) return null; | ||
return params; | ||
} | ||
|
||
nextPageInfo(): PageInfo | null { | ||
const query = this.options.query as V4PagePaginationParams; | ||
const currentPage = query?.page ?? 1; | ||
|
||
return { params: { page: currentPage + 1 } }; | ||
} | ||
} | ||
|
||
export interface V4PagePaginationArrayResponse<Item> { | ||
result: Array<Item>; | ||
|
||
result_info: V4PagePaginationArrayResponse.ResultInfo; | ||
} | ||
|
||
export namespace V4PagePaginationArrayResponse { | ||
export interface ResultInfo { | ||
page?: number; | ||
|
||
per_page?: number; | ||
} | ||
} | ||
|
||
export interface V4PagePaginationArrayParams { | ||
page?: number; | ||
|
||
per_page?: number; | ||
} | ||
|
||
export class V4PagePaginationArray<Item> | ||
extends AbstractPage<Item> | ||
implements V4PagePaginationArrayResponse<Item> | ||
{ | ||
result: Array<Item>; | ||
|
||
result_info: V4PagePaginationArrayResponse.ResultInfo; | ||
|
||
constructor( | ||
client: APIClient, | ||
response: Response, | ||
body: V4PagePaginationArrayResponse<Item>, | ||
options: FinalRequestOptions, | ||
) { | ||
super(client, response, body, options); | ||
|
||
this.result = body.result || []; | ||
this.result_info = body.result_info || {}; | ||
} | ||
|
||
getPaginatedItems(): Item[] { | ||
return this.result ?? []; | ||
} | ||
|
||
// @deprecated Please use `nextPageInfo()` instead | ||
nextPageParams(): Partial<V4PagePaginationArrayParams> | null { | ||
const info = this.nextPageInfo(); | ||
if (!info) return null; | ||
if ('params' in info) return info.params; | ||
const params = Object.fromEntries(info.url.searchParams); | ||
if (!Object.keys(params).length) return null; | ||
return params; | ||
} | ||
|
||
nextPageInfo(): PageInfo | null { | ||
const query = this.options.query as V4PagePaginationArrayParams; | ||
const currentPage = query?.page ?? 1; | ||
|
||
return { params: { page: currentPage + 1 } }; | ||
} | ||
} |
Oops, something went wrong.