Documentation ¶
Index ¶
- func InvalidScopeResponse(requiredScope string, c echo.Context) error
- func IsGranted(scope string, c echo.Context) bool
- func Project(projectID string, c echo.Context) (*nerdz.Project, error)
- func SelectFields(in interface{}, c echo.Context) error
- func User(userID string, c echo.Context) (*nerdz.User, error)
- type CommentID
- type ID
- type NewMessage
- type NewVote
- type OtherID
- type PmID
- type PostID
- type ProjectInfo
- type Response
- type Target
- type UserInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InvalidScopeResponse ¶
InvalidScopeResponse prints a JSON response and returns a error asserting that the required scope is missing from the accepted scopes
func IsGranted ¶
IsGranted returns true if the c.Get("scopes") slice contains the scope or there's a scompatible scope into the slice
func Project ¶
Project extract "id" from the url parameter, parse it and returns the Project if the "me" (in the context) user is allowed to see it. Otherwise returns an error
func SelectFields ¶
SelectFields changes the json part of struct tags of in interface{} (that must by a struct or a slice of structs with the right json tags) Selecting only specified fields (in the query string "fields" value). If "fields" is not present the input parameter is unchanged returns error when there's a problem with some required fileld. otherwies returns nil and ends the request, printing the c.JSON of the input value, with its field selected
Types ¶
type CommentID ¶
type CommentID struct { // a Cid is the Comment ID // // in: path // required: true Cid uint64 `json:"cid"` }
CommentID is the ID of the comment
swagger:parameters GetUserPostComment EditUserPostComment DeleteUserPostComment GetUserPostCommentsVotes NewUserPostCommentVote DeleteMePostComment DeleteMePost EditMeComment GetMePostCommentsVotes NewMePostCommentVote GetProjectPostComment EditProjectPostComment DeleteProjectPostComment GetProjectPostCommentsVotes NewProjectPostCommentVote
type ID ¶
type ID struct { // a ID is the User ID // // in: path // required: true ID uint64 `json:"id"` }
ID is the ID of the referenced board, user or project
swagger:parameters GetUserPosts GetUserPost NewUserPost DeleteUserPost EditUserPost GetUserPostComments GetUserPostComment NewUserPostComment EditUserPostComment DeleteUserPostComment GetUserInfo GetUserFriends GetUserFollowers GetUserFollowing GetProjectFollowing GetWhitelist GetWhitelisting GetBlacklist GetBlacklisting GetUserPostVotes NewUserPostVote GetUserPostCommentsVotes NewUserPostCommentVote GetUserPostBookmarks NewUserPostBookmark DeleteUserPostBookmark GetUserPostLurks NewUserPostLurk DeleteUserPostLurk GetUserPostLock NewUserPostLock DeleteUserPostLock NewUserNewPostUserLock DeleteUserPostUserLock getProjectPosts getProjectPost NewProjectPost DeleteProjectPost EditProjectPost getProjectPostComments GetProjectPostComment NewProjectPostComment EditProjectPostComment DeleteProjectPostComment getProjectInfo getProjectMembers getProjectFollowers GetProjectPostVotes NewProjectPostVote GetProjectPostCommentsVotes NewProjectPostCommentVote GetProjectPostBookmarks NewProjectPostBookmark DeleteProjectPostBookmark GetProjectPostLurks NewProjectPostLurk DeleteProjectPostLurk GetProjectPostLock NewProjectPostLock DeleteProjectPostLock NewUserNewPostProjectLock DeleteProjectPostUserLock
type NewMessage ¶
type NewMessage struct { // a Message is a string that contains a new message // // in: body Message string `json:"message"` Lang string `json:"lang, omitempty"` }
NewMessage represents a new message from the current user
swagger:parameters addMessage
type NewVote ¶
type NewVote struct { // a Vote has value in [-1, 0, 1] // // in: body Vote int8 `json:"vote"` }
NewVote represent a new vote from the current user
swagger:parameters addVote
type OtherID ¶
type OtherID struct { // Other is the ID of the other user // // in:path // required:true Other uint64 `json:"other"` }
OtherID is the ID of the other user
swagger:parameters getMeConversation DeleteMePms GetMePm NewMePm EditMePm DeleteMePm
type PmID ¶
type PmID struct { // a PMID is the ID of the PM // // in:path // required:true Pmid uint64 `json:"pmid"` }
PmID is the ID of the PM
swagger:parameters GetMePm EditMePm DeleteMePm
type PostID ¶
type PostID struct { // a Pid is the post id // // in: path // required: true Pid uint64 `json:"pid"` }
PostID is the post ID swagger parameter
swagger:parameters GetUserPost DeleteUserPost EditUserPost GetUserPostComments GetUserPostComment NewUserPostComment EditUserPostComment DeleteUserPostComment GetUserPostVotes NewUserPostVote GetUserPostCommentsVotes NewUserPostCommentVote GetUserPostBookmarks NewUserPostBookmark DeleteUserPostBookmark GetUserPostLurks NewUserPostLurk DeleteUserPostLurk GetUserPostLock NewUserPostLock DeleteUserPostLock NewUserNewPostUserLock DeleteUserPostUserLock EditMePost DeleteMePostComment DeleteMePost EditMeComment NewMePostComment GetMePostVotes NewMePostVote GetMePostCommentsVotes NewMePostCommentVote GetMePostBookmarks NewMePostBookmark DeleteMePostBookmark GetMePostLurks NewMePostLurk DeleteMePostLurk GetMePostLock NewMePostLock DeleteMePostLock NewMeNewPostUserLock DeleteMePostUserLock getProjectPost DeleteProjectPost EditProjectPost getProjectPostComments GetProjectPostComment NewProjectPostComment EditProjectPostComment DeleteProjectPostComment GetProjectPostVotes NewProjectPostVote GetProjectPostCommentsVotes NewProjectPostCommentVote GetProjectPostBookmarks NewProjectPostBookmark DeleteProjectPostBookmark GetProjectPostLurks NewProjectPostLurk DeleteProjectPostLurk GetProjectPostLock NewProjectPostLock DeleteProjectPostLock NewUserNewPostProjectLock DeleteProjectPostUserLock
type ProjectInfo ¶
type ProjectInfo struct { // The general information of the project // in: body Info *nerdz.InfoTO `json:"info"` }
ProjectInfo represents the project information
swagger:response projectInfo
func GetProjectInfo ¶
func GetProjectInfo(project *nerdz.Project) *ProjectInfo
GetProjectInfo returns the *ProjectInfo of the project
func GetProjectsInfo ¶
func GetProjectsInfo(projects []*nerdz.Project) (projectsInfo []*ProjectInfo)
GetProjectsInfo returns a slice of *Interfations
type Response ¶
type Response struct { // The API response data // in: body Data interface{} `json:"data"` // The API generated message Message string `json:"message"` // The human generated message, easy to understand HumanMessage string `json:"humanMessage"` // Status Code of the request Status uint `json:"status"` // Success indicates if the requested succeded Success bool `json:"success"` }
Response represents the response format of the API
swagger:response apiResponse
type Target ¶
type Target struct { // a Target is the ID of the User referenced by the operation // // in: path // required: true Target uint64 `json:"target"` }
Target is the ID of the User referenced by the operation
swagger:parameters NewUserNewPostUserLock DeleteUserPostUserLock NewMeNewPostUserLock DeleteMePostUserLock NewMeFollowing DeleteMeFollowing NewProjectFollowing DeleteProjectFollowing NewWhitelisted DeleteWhitelisted NewBlacklisted DeleteBlacklisted NewUserNewPostProjectLock DeleteProjectPostUserLock
type UserInfo ¶
type UserInfo struct { // The general information of the User // in: body Info *nerdz.InfoTO `json:"info"` // The contact information of the User // in: body Contacts *nerdz.ContactInfoTO `json:"contacts"` // The personal information of the user // in: body Personal *nerdz.PersonalInfoTO `json:"personal"` }
UserInformations represents the user information
swagger:response userInfo
func GetUserInfo ¶
GetUserInfo returns the *UserInfo of the user
func GetUsersInfo ¶
GetUsersInfo returns a slice of *Interfations