api-structs #117
Merged
lash
merged 35 commits from 2024-10-24 15:53:46 +02:00
api-structs into master
Dismiss Review
Are you sure you want to dismiss this review?
Labels
Clear labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
cleanup
devops
documentation
easypeasy
exchange
i18n
legacy
meta
migration
optimization
privilege
refactor
smell
support
tooling
ux
Breaking change that won't be backward compatible
Something is not working
Documentation changes
Improve existing functionality
New functionality
This is security issue
Issue or pull request related to testing
Priority
Critical
The priority is critical
Priority
High
The priority is high
Priority
Low
The priority is low
Priority
Medium
The priority is medium
Reviewed
Confirmed
Issue has been confirmed
Reviewed
Duplicate
This issue or pull request already exists
Reviewed
Invalid
Invalid issue
Reviewed
Won't Fix
This issue won't be fixed
Status
Abandoned
Somebody has started to work on this but abandoned work
Status
Blocked
Something is blocking this issue or pull request
Status
Need More Info
Feedback is required to reproduce issue or to continue work
Activity
Doing
An item actively being worked on currently
Activity
Hold
Not being actively worked on
Activity
Proposal
A proposal for a new feature or enhancement
Activity
QA
Ready for QA testing
Activity
Validate
Dev team validating changes
Runner
AT
Runner
CLI
Runner
HTTP
Runner
SSH
A task that can be completed with little effort
relating to swapping of assets and offramps
Languages and translations
Legacy features from the old ussd system to be ported
container for other issues
features that have to do with special, privileged axx
Code smell
transparency and help with exception states
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: urdt/ussd#117
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Introduces new api structs that communicate with the local development setup
@@ -11,2 +12,4 @@"github.com/grassrootseconomics/eth-custodial/pkg/api")type ApiResponse struct {why is this needed?
Well,at the point of making the api call and receiving a response back, we don't really know the response that will be sent back,it can either be an ErrResponse or an OKResponse but we are certain that the ok and description field will be present.So the OK field in the ApiResponse will be used to decide which type to Unmarshal on.
@@ -53,0 +65,4 @@var okResponse api.OKResponsevar err error// Construct the URL with the path parameterurl := fmt.Sprintf("%s/%s", config.TrackURL, publicKey)I think it is better and safer to use the
net/urlpackage for handling urls?I will add it as a separate issue.
#125
@@ -140,0 +144,4 @@flag_api_call_error, _ := h.flagManager.GetFlag("flag_api_call_error")okResponse, errResponse := h.accountService.CreateAccount()if errResponse != nil {if !errResponse.Ok {When is an error response "ok"?
If unknown, perhaps @kamikazechaser can clear it up
In the menu handler's context,we needed a way to decide which error from calling the CreateAccountService we could use to set the flag 'flag_api_call_error' and because an error could occur when calling the CreateAccount that's not associated with an api call,say maybe Unmarshaling,then checking if the Ok field is present and is false is what i considered as an api call failure.
@@ -53,0 +93,4 @@}return nil, errors.New(errResponse.Description)}if len(okResponse.Result) == EMPTY_RESPONSE {I would just use the literal
0hereIf there is no matching tracking id, result.otx will be null.
@kamikazechaser please elaborate is there a missing case?
@@ -53,0 +79,4 @@return nil, err}defer resp.Body.Close()Check the HTTP response code first. If it is >= 400 (Bad request you can then unmarshal to an api.ErrResp.