-
Notifications
You must be signed in to change notification settings - Fork 58
feat: Add stores.plugins.list API #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe changes extend the CozeAPI client with a new Stores subsystem that provides store plugin listing capabilities. A new stores.go file introduces the stores structure with plugin support, stores_plugins.go implements plugin discovery with pagination, client.go exposes the Stores field, and an example demonstrates the API usage. Changes
Sequence DiagramsequenceDiagram
participant Client
participant CozeAPI
participant StoresPlugins
participant API
Client->>CozeAPI: NewCozeAPI(token)
CozeAPI->>CozeAPI: newStores(core)
CozeAPI-->>Client: initialized client
Client->>StoresPlugins: ListStoresPlugins(req)
StoresPlugins->>API: GET /v1/stores/plugins
API-->>StoresPlugins: paginated response<br/>(Items[], HasMore)
rect rgba(100, 150, 200, 0.1)
Note over Client,StoresPlugins: Pagination Loop
loop For each page
Client->>StoresPlugins: listResp.Next()
StoresPlugins->>StoresPlugins: toReq(page)
StoresPlugins->>API: GET /v1/stores/plugins
API-->>StoresPlugins: next page
Client->>StoresPlugins: listResp.Current()
StoresPlugins-->>Client: ProductPlugin[]
end
end
StoresPlugins-->>Client: final response + error (if any)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–25 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
client.go(2 hunks)examples/stores/plugins/list/main.go(1 hunks)stores.go(1 hunks)stores_plugins.go(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
examples/stores/plugins/list/main.go (4)
const.go (1)
CnBaseURL(5-5)auth_token.go (1)
NewTokenAuth(23-27)client.go (2)
NewCozeAPI(80-119)WithBaseURL(41-45)stores_plugins.go (1)
ListStoresPluginsReq(72-79)
stores_plugins.go (4)
client.go (1)
CozeAPIOption(38-38)pagination.go (2)
NumberPaged(12-15)NewNumberPaged(77-95)request.go (1)
RawRequestReq(27-35)base_model.go (1)
HTTPResponse(9-11)
🔇 Additional comments (7)
client.go (1)
24-24: LGTM! Consistent integration of the Stores subsystem.The new
Storesfield and its initialization follow the established pattern used by all other subsystems in the codebase.Also applies to: 115-115
stores.go (1)
1-10: LGTM! Clean subsystem structure.The
storesstruct and constructor follow the established patterns in the codebase, with proper initialization of thePluginsfield.examples/stores/plugins/list/main.go (2)
13-22: LGTM! Proper client initialization.The example correctly demonstrates environment-based configuration with sensible defaults and proper client initialization.
24-30: LGTM! Clear API usage demonstration.The example properly demonstrates the pagination API with appropriate page size and error handling.
stores_plugins.go (3)
35-70: LGTM! Well-structured data models.The data models are cleanly organized with appropriate types, JSON tags, and comprehensive documentation in Chinese comments. The embedding of
baseModelfollows the established pattern.
72-100: LGTM! Well-designed request/response structures.The request and response types are properly structured with appropriate tags and field mappings. The
toReqhelper correctly merges pagination parameters while preserving filter criteria.
102-108: LGTM! Standard constructor pattern.The
storesPluginstype and constructor follow the established patterns in the codebase.
Summary by CodeRabbit