-
Notifications
You must be signed in to change notification settings - Fork 1
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
Created new route offer-info #12
Conversation
This new route retrieves contents and metadata information about an offer instance already seen by the player.
1 similar 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.
Just fix the 404/500 thing and some minor details and we'll be good to go.
api/offer_request.go
Outdated
if playerID == "" { | ||
err := fmt.Errorf("The player-id parameter cannot be empty") | ||
logger.WithError(err).Error("Failed to retrieve offer for player.") | ||
h.App.HandleError(w, http.StatusBadRequest, "The player-id parameter cannot be empty.", err) |
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.
h.App.HandleError(w, http.StatusBadRequest, err.Error(), err)
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.
Much better, will fix all of these problems
api/offer_request.go
Outdated
} else if gameID == "" { | ||
err := fmt.Errorf("The game-id parameter cannot be empty") | ||
logger.WithError(err).Error("Failed to retrieve offer for player.") | ||
h.App.HandleError(w, http.StatusBadRequest, "The game-id parameter cannot be empty.", err) |
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.
h.App.HandleError(w, http.StatusBadRequest, err.Error(), err)
api/offer_request.go
Outdated
} else if offerInstanceID == "" { | ||
err := fmt.Errorf("The offer-id parameter cannot be empty") | ||
logger.WithError(err).Error("Failed to retrieve offer for player.") | ||
h.App.HandleError(w, http.StatusBadRequest, "The offer-id parameter cannot be empty.", err) |
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.
h.App.HandleError(w, http.StatusBadRequest, err.Error(), err)
return err | ||
}) | ||
|
||
if err != nil { |
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.
I think there is an specific error if GetOfferInfo can't find the offer for the given player. In this case you should respond with 404 instead of 500.
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.
Makes sense, will fix!
docs/source/API.md
Outdated
} | ||
``` | ||
* Header: | ||
A max-age header is sent to indicate how long the response returned by get available offers can be cached. |
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.
... returned by get offer info can be cached.
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.
Done
QueryStruct(&offerInstance) | ||
}) | ||
|
||
err = HandleNotFoundError("OfferInstance", map[string]interface{}{ |
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.
here it is!
@cscatolini I made the requested changes, can you take another look? |
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.
Great! Thanks for your contribution
This new route retrieves contents and metadata information
about an offer instance already seen by the player.