add a couple post endpoints + /timelines/home
This commit is contained in:
parent
dd72a1f4c1
commit
9f052dc9ef
24 changed files with 462 additions and 32 deletions
|
@ -122,14 +122,18 @@ const (
|
|||
ErrInternalServerError = 500 // catch-all code for unknown errors
|
||||
|
||||
// Auth related
|
||||
ErrInvalidToken = 1001
|
||||
ErrMissingScope = 1002
|
||||
ErrInvalidToken = 1001
|
||||
ErrMissingScope = 1002
|
||||
ErrNotYourObject = 1003
|
||||
|
||||
// Account related
|
||||
ErrAccountNotFound = 2001
|
||||
|
||||
// Blog related
|
||||
ErrBlogNotFound = 3001
|
||||
|
||||
// Post related
|
||||
ErrPostNotFound = 4001
|
||||
)
|
||||
|
||||
func ErrCodeMessage(code int) string {
|
||||
|
@ -144,12 +148,15 @@ var errCodeMessages = map[int]string{
|
|||
ErrTooManyRequests: "Rate limit reached",
|
||||
ErrMethodNotAllowed: "Method not allowed",
|
||||
|
||||
ErrInvalidToken: "No token supplied, or token is invalid",
|
||||
ErrMissingScope: "Token is missing required scope for this endpoint",
|
||||
ErrInvalidToken: "No token supplied, or token is invalid",
|
||||
ErrMissingScope: "Token is missing required scope for this endpoint",
|
||||
ErrNotYourObject: "Object you are trying to perform action on is not owned by you",
|
||||
|
||||
ErrAccountNotFound: "Account not found",
|
||||
|
||||
ErrBlogNotFound: "Blog not found",
|
||||
|
||||
ErrPostNotFound: "Post not found",
|
||||
}
|
||||
|
||||
func ErrCodeStatus(code int) int {
|
||||
|
@ -164,10 +171,13 @@ var errCodeStatuses = map[int]int{
|
|||
ErrTooManyRequests: http.StatusTooManyRequests,
|
||||
ErrMethodNotAllowed: http.StatusMethodNotAllowed,
|
||||
|
||||
ErrInvalidToken: http.StatusUnauthorized,
|
||||
ErrMissingScope: http.StatusForbidden,
|
||||
ErrInvalidToken: http.StatusUnauthorized,
|
||||
ErrMissingScope: http.StatusForbidden,
|
||||
ErrNotYourObject: http.StatusForbidden,
|
||||
|
||||
ErrAccountNotFound: http.StatusNotFound,
|
||||
|
||||
ErrBlogNotFound: http.StatusNotFound,
|
||||
|
||||
ErrPostNotFound: http.StatusNotFound,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue