fix(api): align list defaults with backend page limits
This commit is contained in:
+1
-1
@@ -25,7 +25,7 @@ export type ListChatMessagesOptions = {
|
|||||||
|
|
||||||
function withOffsetLimit(path: string, options?: { offset?: number; limit?: number }): string {
|
function withOffsetLimit(path: string, options?: { offset?: number; limit?: number }): string {
|
||||||
const offset = options?.offset ?? 0
|
const offset = options?.offset ?? 0
|
||||||
const limit = options?.limit ?? 1000
|
const limit = options?.limit ?? 100
|
||||||
|
|
||||||
const searchParams = new URLSearchParams({
|
const searchParams = new URLSearchParams({
|
||||||
offset: String(offset),
|
offset: String(offset),
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ type ListOptions = {
|
|||||||
|
|
||||||
function withOffsetLimit(path: string, options?: ListOptions): string {
|
function withOffsetLimit(path: string, options?: ListOptions): string {
|
||||||
const offset = options?.offset ?? 0
|
const offset = options?.offset ?? 0
|
||||||
const limit = options?.limit ?? 1000
|
const limit = options?.limit ?? 100
|
||||||
const searchParams = new URLSearchParams({
|
const searchParams = new URLSearchParams({
|
||||||
offset: String(offset),
|
offset: String(offset),
|
||||||
limit: String(limit),
|
limit: String(limit),
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ type Paginated<T> = {
|
|||||||
|
|
||||||
function withOffsetLimit(path: string, options?: ListDisputesOptions): string {
|
function withOffsetLimit(path: string, options?: ListDisputesOptions): string {
|
||||||
const offset = options?.offset ?? 0
|
const offset = options?.offset ?? 0
|
||||||
const limit = options?.limit ?? 1000
|
const limit = options?.limit ?? 100
|
||||||
|
|
||||||
const searchParams = new URLSearchParams({
|
const searchParams = new URLSearchParams({
|
||||||
offset: String(offset),
|
offset: String(offset),
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@ type Paginated<T> = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function listGames(): Promise<Game[]> {
|
export async function listGames(): Promise<Game[]> {
|
||||||
const res = await httpJson<Paginated<Game>>("/api/v1/games?offset=0&limit=1000", {
|
const res = await httpJson<Paginated<Game>>("/api/v1/games?offset=0&limit=100", {
|
||||||
cache: "no-store",
|
cache: "no-store",
|
||||||
})
|
})
|
||||||
return res.items
|
return res.items
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ type ActionResult = { decision: ApiDecision; order?: Order }
|
|||||||
|
|
||||||
function withOffsetLimit(path: string, options?: ListOrdersOptions): string {
|
function withOffsetLimit(path: string, options?: ListOrdersOptions): string {
|
||||||
const offset = options?.offset ?? 0
|
const offset = options?.offset ?? 0
|
||||||
const limit = options?.limit ?? 1000
|
const limit = options?.limit ?? 100
|
||||||
|
|
||||||
const searchParams = new URLSearchParams({
|
const searchParams = new URLSearchParams({
|
||||||
offset: String(offset),
|
offset: String(offset),
|
||||||
|
|||||||
+2
-2
@@ -13,7 +13,7 @@ type Paginated<T> = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function listPlayers(): Promise<Player[]> {
|
export async function listPlayers(): Promise<Player[]> {
|
||||||
const res = await httpJson<Paginated<Player>>("/api/v1/players?offset=0&limit=1000", {
|
const res = await httpJson<Paginated<Player>>("/api/v1/players?offset=0&limit=100", {
|
||||||
cache: "no-store",
|
cache: "no-store",
|
||||||
})
|
})
|
||||||
return res.items
|
return res.items
|
||||||
@@ -37,7 +37,7 @@ export async function getPlayerById(playerId: string): Promise<Player | undefine
|
|||||||
|
|
||||||
export async function listPlayersByShop(shopId: string): Promise<Player[]> {
|
export async function listPlayersByShop(shopId: string): Promise<Player[]> {
|
||||||
const res = await httpJson<Paginated<Player>>(
|
const res = await httpJson<Paginated<Player>>(
|
||||||
`/api/v1/shops/${encodeURIComponent(shopId)}/players?offset=0&limit=1000`,
|
`/api/v1/shops/${encodeURIComponent(shopId)}/players?offset=0&limit=100`,
|
||||||
{ cache: "no-store" },
|
{ cache: "no-store" },
|
||||||
)
|
)
|
||||||
return res.items
|
return res.items
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ type ListOptions = {
|
|||||||
|
|
||||||
function withOffsetLimit(path: string, options?: ListOptions): string {
|
function withOffsetLimit(path: string, options?: ListOptions): string {
|
||||||
const offset = options?.offset ?? 0
|
const offset = options?.offset ?? 0
|
||||||
const limit = options?.limit ?? 1000
|
const limit = options?.limit ?? 100
|
||||||
|
|
||||||
const searchParams = new URLSearchParams({
|
const searchParams = new URLSearchParams({
|
||||||
offset: String(offset),
|
offset: String(offset),
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ export type ListReviewsOptions = {
|
|||||||
|
|
||||||
function withOffsetLimit(path: string, options?: ListReviewsOptions): string {
|
function withOffsetLimit(path: string, options?: ListReviewsOptions): string {
|
||||||
const offset = options?.offset ?? 0
|
const offset = options?.offset ?? 0
|
||||||
const limit = options?.limit ?? 1000
|
const limit = options?.limit ?? 100
|
||||||
|
|
||||||
const searchParams = new URLSearchParams({
|
const searchParams = new URLSearchParams({
|
||||||
offset: String(offset),
|
offset: String(offset),
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@ type Paginated<T> = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function listShops(): Promise<Shop[]> {
|
export async function listShops(): Promise<Shop[]> {
|
||||||
const res = await httpJson<Paginated<Shop>>("/api/v1/shops?offset=0&limit=1000", {
|
const res = await httpJson<Paginated<Shop>>("/api/v1/shops?offset=0&limit=100", {
|
||||||
cache: "no-store",
|
cache: "no-store",
|
||||||
})
|
})
|
||||||
return res.items
|
return res.items
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export type ListWalletTransactionsOptions = {
|
|||||||
|
|
||||||
function withOffsetLimit(path: string, options?: ListWalletTransactionsOptions): string {
|
function withOffsetLimit(path: string, options?: ListWalletTransactionsOptions): string {
|
||||||
const offset = options?.offset ?? 0
|
const offset = options?.offset ?? 0
|
||||||
const limit = options?.limit ?? 1000
|
const limit = options?.limit ?? 100
|
||||||
const searchParams = new URLSearchParams({
|
const searchParams = new URLSearchParams({
|
||||||
offset: String(offset),
|
offset: String(offset),
|
||||||
limit: String(limit),
|
limit: String(limit),
|
||||||
|
|||||||
Reference in New Issue
Block a user