@roxybrowser/openapi 1.0.11 → 1.0.12-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -124,6 +124,10 @@ var ListAccounts = class {
124
124
 
125
125
  error message: ${result.msg}`;
126
126
  } else {
127
+ const currentPage = params.pageIndex ?? 1;
128
+ const pageSize = params.pageSize ?? 15;
129
+ const totalPages = Math.max(1, Math.ceil((data.total || 0) / pageSize));
130
+ const hasNextPage = currentPage < totalPages;
127
131
  text = `Found ${data.total} accounts in workspace ${params.workspaceId}:
128
132
 
129
133
  ${data.rows.map(
@@ -132,7 +136,14 @@ ${data.rows.map(
132
136
  - Platform URL: ${account.platformUrl}
133
137
  - Remarks: ${account.platformRemarks || "N/A"}
134
138
  - Created: ${account.createTime}`
135
- ).join("\n\n")}`;
139
+ ).join("\n\n")}
140
+
141
+ Pagination:
142
+ - currentPage: ${currentPage}
143
+ - pageSize: ${pageSize}
144
+ - totalPages: ${totalPages}
145
+ - hasNextPage: ${hasNextPage}
146
+ ${hasNextPage ? `- nextPageHint: Call roxy_list_accounts again with pageIndex=${currentPage + 1}` : "- nextPageHint: No more pages"}`;
136
147
  }
137
148
  return {
138
149
  content: [
@@ -569,13 +580,13 @@ var ProxyList = class {
569
580
  }
570
581
  async handle(params) {
571
582
  const searchParams = new URLSearchParams();
572
- searchParams.append("workspaceId", params.workspaceId);
583
+ searchParams.append("workspaceId", params.workspaceId.toString());
573
584
  if (params.id)
574
- searchParams.append("id", params.id);
575
- if (params.page_index)
576
- searchParams.append("page_index", params.pageIndex);
577
- if (params.page_size)
578
- searchParams.append("page_size", params.pageSize);
585
+ searchParams.append("id", params.id.toString());
586
+ if (params.pageIndex)
587
+ searchParams.append("page_index", params.pageIndex.toString());
588
+ if (params.pageSize)
589
+ searchParams.append("page_size", params.pageSize.toString());
579
590
  if (!params.workspaceId) {
580
591
  throw new Error("workspaceId is required");
581
592
  }
@@ -583,6 +594,10 @@ var ProxyList = class {
583
594
  let text = "";
584
595
  if (result.code === 0) {
585
596
  const data = result.data;
597
+ const currentPage = params.pageIndex ?? 1;
598
+ const pageSize = params.pageSize ?? 15;
599
+ const totalPages = Math.max(1, Math.ceil((data.total || 0) / pageSize));
600
+ const hasNextPage = currentPage < totalPages;
586
601
  const proxyListText = data.rows.length > 0 ? data.rows.map((proxy, index) => {
587
602
  const statusText = proxy.checkStatus === 1 ? "\u2705 available" : proxy.checkStatus === 2 ? "\u274C unavailable" : "\u23F3 not checked";
588
603
  const name = `proxy (id: ${proxy.id}) ${proxy.remark ? `remark: ${proxy.remark}` : ""}`;
@@ -609,7 +624,14 @@ ${ipInfo.length > 0 ? `${ipInfo.join("")}
609
624
  }).join("\n\n") : "";
610
625
  text = `\u{1F4CB} **proxy list** (total: ${data.total})
611
626
 
612
- ${proxyListText}`;
627
+ ${proxyListText}
628
+
629
+ Pagination:
630
+ - currentPage: ${currentPage}
631
+ - pageSize: ${pageSize}
632
+ - totalPages: ${totalPages}
633
+ - hasNextPage: ${hasNextPage}
634
+ ${hasNextPage ? `- nextPageHint: Call roxy_list_proxies again with pageIndex=${currentPage + 1}` : "- nextPageHint: No more pages"}`;
613
635
  } else {
614
636
  text = `\u274C **get proxy list failed**
615
637
 
@@ -656,16 +678,20 @@ var ProxyStore = class {
656
678
  async handle(params) {
657
679
  const searchParams = new URLSearchParams();
658
680
  searchParams.append("workspaceId", params.workspaceId.toString());
659
- if (params.page_index)
660
- searchParams.append("page_index", params.page_index.toString());
661
- if (params.page_size)
662
- searchParams.append("page_size", params.page_size.toString());
681
+ if (params.pageIndex)
682
+ searchParams.append("page_index", params.pageIndex.toString());
683
+ if (params.pageSize)
684
+ searchParams.append("page_size", params.pageSize.toString());
663
685
  if (params.type)
664
686
  searchParams.append("type", params.type.toString());
665
687
  const result = await request(`/proxy/bought_list?${searchParams}`);
666
688
  let text = "";
667
689
  if (result.code === 0) {
668
690
  const data = result.data;
691
+ const currentPage = params.pageIndex ?? 1;
692
+ const pageSize = params.pageSize ?? 15;
693
+ const totalPages = Math.max(1, Math.ceil((data.total || 0) / pageSize));
694
+ const hasNextPage = currentPage < totalPages;
669
695
  const proxyListText = data.rows.length > 0 ? data.rows.map((proxy, index) => {
670
696
  const statusText = proxy.checkStatus === 1 ? "\u2705 available" : proxy.checkStatus === 2 ? "\u274C unavailable" : "\u23F3 not checked";
671
697
  const name = `proxy (id: ${proxy.id}) ${proxy.remark ? `remark: ${proxy.remark}` : ""}`;
@@ -689,7 +715,14 @@ ${ipInfo.join("")}
689
715
  }).join("\n\n") : "";
690
716
  text = `\u{1F4CB} **proxy store** (total: ${data.total})
691
717
 
692
- ${proxyListText}`;
718
+ ${proxyListText}
719
+
720
+ Pagination:
721
+ - currentPage: ${currentPage}
722
+ - pageSize: ${pageSize}
723
+ - totalPages: ${totalPages}
724
+ - hasNextPage: ${hasNextPage}
725
+ ${hasNextPage ? `- nextPageHint: Call roxy_store_proxies again with pageIndex=${currentPage + 1}` : "- nextPageHint: No more pages"}`;
693
726
  } else {
694
727
  text = `\u274C **get proxy store failed**
695
728
 
@@ -2128,6 +2161,10 @@ var ListBrowsers = class {
2128
2161
 
2129
2162
  error message: ${result.msg}`;
2130
2163
  } else {
2164
+ const currentPage = params.pageIndex ?? 1;
2165
+ const pageSize = params.pageSize ?? 15;
2166
+ const totalPages = Math.max(1, Math.ceil((data.total || 0) / pageSize));
2167
+ const hasNextPage = currentPage < totalPages;
2131
2168
  text = `Found ${data.total} browsers in workspace ${params.workspaceId}:
2132
2169
 
2133
2170
  ${data.rows.map(
@@ -2136,7 +2173,14 @@ ${data.rows.map(
2136
2173
  - OSVersion: ${browser.osVersion}
2137
2174
  - OS: ${browser.os}
2138
2175
  - Remark: ${browser.windowRemark}`
2139
- ).join("\n\n")}`;
2176
+ ).join("\n\n")}
2177
+
2178
+ Pagination:
2179
+ - currentPage: ${currentPage}
2180
+ - pageSize: ${pageSize}
2181
+ - totalPages: ${totalPages}
2182
+ - hasNextPage: ${hasNextPage}
2183
+ ${hasNextPage ? `- nextPageHint: Call roxy_list_browsers again with pageIndex=${currentPage + 1}` : "- nextPageHint: No more pages"}`;
2140
2184
  }
2141
2185
  return {
2142
2186
  content: [