-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(v1): update responses to use cache control headers * feat(v1): add required params error * feat(v1): add better comments * chore: squash
- Loading branch information
1 parent
b98f4bc
commit 0ae00e7
Showing
22 changed files
with
189 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package constants | ||
|
||
const HourInSeconds = 3600 | ||
const TwentyFourHoursInSeconds = 604800 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
package constants | ||
|
||
const ( | ||
// general | ||
UnknownError int = 1000 | ||
// validation errors | ||
InvalidAddressError int = 2000 | ||
RequiredParamsError int = 2000 | ||
InvalidAddressError int = 2001 | ||
// integration errors | ||
PostHogError int = 4000 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package errors | ||
|
||
import ( | ||
"fmt" | ||
"lib/constants" | ||
) | ||
|
||
type RequiredParamsError struct { | ||
Code int `json:"code"` | ||
Message string `json:"message"` | ||
Name string `json:"name"` | ||
Params []string `json:"params"` | ||
} | ||
|
||
func NewRequiredParamsError(params []string) *RequiredParamsError { | ||
return &RequiredParamsError{ | ||
Code: constants.RequiredParamsError, | ||
Message: fmt.Sprintf("the params \"%s\" are required", params), | ||
Name: "RequiredParamsError", | ||
Params: params, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module quests | ||
|
||
go 1.21 | ||
go 1.20 | ||
|
||
require ( | ||
github.com/algorand/go-algorand-sdk v1.24.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
package types | ||
|
||
// DailyQuest | ||
// @Description The ID of the quest and the amount of times it has been completed. | ||
type DailyQuest struct { | ||
Completed int `json:"completed"` | ||
Id string `json:"id"` | ||
// The amount of times the quest has been completed | ||
Completed int `json:"completed" example:"22"` | ||
// The ID of the quest | ||
Id string `json:"id" example:"send-native-currency-action"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package types | ||
|
||
type Response struct { | ||
Body ResponseBody `json:"body,omitempty"` | ||
StatusCode int `json:"statusCode,omitempty"` | ||
Body ResponseBody `json:"body,omitempty"` | ||
Headers ResponseHeaders `json:"headers,omitempty"` | ||
StatusCode int `json:"statusCode,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
package types | ||
|
||
type ResponseBody struct { | ||
Account string `json:"account,omitempty"` | ||
Error interface{} `json:"error,omitempty"` | ||
Quests []DailyQuest `json:"quests,omitempty"` | ||
// The account address | ||
Account string `json:"account,omitempty" example:"TESTK4BURRDGVVHAX2FBY7CPRC2RTTVRRN4C2TVDCHRCXNTFGL3TVSDROE"` | ||
Error interface{} `json:"error,omitempty" swaggertype:"object"` | ||
// The completed quests | ||
Quests []DailyQuest `json:"quests,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package types | ||
|
||
type ResponseHeaders struct { | ||
CacheControl string `json:"Cache-Control"` | ||
ContentType string `json:"Content-Type"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
module docs | ||
|
||
go 1.20 | ||
|
||
require lib v0.0.0 | ||
|
||
replace lib v0.0.0 => ../../../lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package types | ||
|
||
type ResponseHeaders struct { | ||
ContentType string `json:"Content-Type"` | ||
CacheControl string `json:"Cache-Control"` | ||
ContentType string `json:"Content-Type"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.