-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add GET /api/trades #2
Conversation
Caution Review failedThe pull request is closed. WalkthroughThe recent updates to the Coincheck API client enhance its functionality by introducing new features for trade retrieval and improving HTTP request handling. Key changes include the addition of pagination support, a dedicated method for managing requests, and refined documentation. These modifications aim to boost code readability, maintainability, and robustness, ultimately enriching the client's usability. Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
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: 4
Outside diff range, codebase verification and nitpick comments (1)
coincheck.go (1)
114-115
: Add a comment to explain the purpose of thedo
method.Adding a brief comment to explain the purpose of this method would improve readability and maintainability.
+ // do sends an HTTP request and processes the response. func (c *Client) do(req *http.Request, output any) error {
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (8)
- README.md (2 hunks)
- coincheck.go (2 hunks)
- order.go (1 hunks)
- pagenation.go (1 hunks)
- ticker.go (2 hunks)
- trade.go (1 hunks)
- trade_test.go (1 hunks)
- withdraw.go (2 hunks)
Files skipped from review due to trivial changes (1)
- README.md
Additional context used
golangci-lint
pagenation.go
9-9: json(snake): got 'order' want 'pagination_order'
(tagliatelle)
Additional comments not posted (10)
order.go (1)
1-11
: LGTM!The code correctly defines the
OrderType
type and constants for buy and sell order types. It is clear and follows Go conventions.pagenation.go (1)
18-26
: LGTM!The code correctly defines the
PaginationOrder
type and constants for ascending and descending order. It is clear and follows Go conventions.withdraw.go (1)
48-49
: LGTM! But verifyc.do
method.The refactoring using
c.do
method is approved. It simplifies theGetBankAccounts
method.However, ensure that
c.do
properly handles errors and responses.Verification successful
LGTM! The
c.do
method handles errors and responses correctly.The
c.do
method implementation incoincheck.go
properly handles HTTP requests, checks for errors, verifies the status code, and decodes the response body. The refactoring using this method is approved.
coincheck.go:115-130
: Implementation ofc.do
method.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the `c.do` method handles errors and responses correctly. # Test: Search for the `c.do` method implementation. Expect: Proper error and response handling. rg --type go -A 10 'func (c *Client) do'Length of output: 42
Script:
#!/bin/bash # Description: Verify the `c.do` method handles errors and responses correctly. # Test: Search for the `c.do` method implementation using ast-grep. Expect: Proper error and response handling. ast-grep --lang go --pattern 'func (c *Client) do($_, $_) $_'Length of output: 776
trade.go (4)
8-12
: LGTM!The
GetTradesInput
struct is straightforward and correctly defined.
14-22
: LGTM!The
GetTradesResponse
struct is well-defined with appropriate JSON tags.
24-37
: LGTM!The
Trade
struct is well-defined with appropriate JSON tags.
40-60
: LGTM!The
GetTrades
function is well-structured, handles errors appropriately, and promotes reusability and maintainability by usingcreateRequest
anddo
methods.ticker.go (1)
78-79
: LGTM!The refactoring of the
GetTicker
method to use thedo
method for HTTP handling improves readability and maintainability.trade_test.go (2)
13-106
: LGTM!The test case "In the case of a successful GET /api/trades request" is well-structured and covers various aspects of the
GetTrades
function, including HTTP method, endpoint, query parameters, and response data.
108-124
: LGTM!The test case "In the case of a failed GET /api/trades request" is well-structured and verifies the error handling of the
GetTrades
function.
Summary by CodeRabbit
New Features
GET /api/trades
).Documentation
Refactor