fix: add getList with records wrapper + correct options format from browser capture

This commit is contained in:
2026-07-28 17:03:59 +08:00
parent 284a503541
commit 7190d93edf
7 changed files with 56 additions and 15 deletions
+21
View File
@@ -0,0 +1,21 @@
package rainyun
// listOptions returns the standard pagination query for Rainyun list endpoints.
// Format verified via browser DevTools capture of the Rainyun web console:
//
// https://api.v2.rainyun.com/product/rcs/?options={url-encoded JSON}
//
// The decoded JSON is: {"columnFilters":{},"sort":[],"page":1,"perPage":20}
func listOptions() map[string]string {
return map[string]string{
"options": `{"columnFilters":{},"sort":[],"page":1,"perPage":50}`,
}
}
// listResponse is the JSON envelope returned by Rainyun list endpoints.
// The API wraps data in {"code":0,"data":{"records":[...],"totalRecords":N}}.
// Our client extracts apiResp.Data ({"records":[...]}), then we unmarshal into this.
type listResponse struct {
Records []any `json:"records"`
TotalRecords int `json:"totalRecords"`
}