예제 #1
0
// Followers handles the request and returns the project followers
func Followers() echo.HandlerFunc {

	// swagger:route GET /projects/{id}/followers project info followers getProjectFollowers
	//
	// Shows the followers informations for the specified project
	//
	// You can personalize the request via query string parameters
	//
	//	Produces:
	//	- application/json
	//
	//	Security:
	//		oauth: projects:read
	//
	//	Responses:
	//		default: apiResponse

	return func(c echo.Context) error {
		if !rest.IsGranted("projects:read", c) {
			return rest.InvalidScopeResponse("projects:read", c)
		}
		followers := c.Get("project").(*nerdz.Project).Followers()
		return rest.SelectFields(rest.GetUsersInfo(followers), c)
	}
}
예제 #2
0
파일: user.go 프로젝트: nerdzeu/nerdz-api
// Whitelist handles the request and returns the user whitelist
func Whitelist() echo.HandlerFunc {

	// swagger:route GET /users/{id}/whitelist user whitelist GetWhitelist
	//
	// Show the whitelist of the specified user
	//
	// You can personalize the request via query string parameters
	//
	//	Produces:
	//	- application/json
	//
	//	Security:
	//		oauth: profile:read
	//
	//	Responses:
	//		default: apiResponse

	return func(c echo.Context) error {
		if !rest.IsGranted("profile:read", c) {
			return rest.InvalidScopeResponse("profile:read", c)
		}
		whitelist := c.Get("other").(*nerdz.User).Whitelist()
		return rest.SelectFields(rest.GetUsersInfo(whitelist), c)
	}
}
예제 #3
0
파일: user.go 프로젝트: nerdzeu/nerdz-api
// Blacklisting handles the request and returns the user blacklisting
func Blacklisting() echo.HandlerFunc {

	// swagger:route GET /users/{id}/blacklisting user blacklisting GetWhitelisting
	//
	// Show the user that placed the specified user in their blacklist
	//
	// You can personalize the request via query string parameters
	//
	//	Produces:
	//	- application/json
	//
	//	Security:
	//		oauth: profile:read
	//
	//	Responses:
	//		default: apiResponse

	return func(c echo.Context) error {
		if !rest.IsGranted("profile:read", c) {
			return rest.InvalidScopeResponse("profile:read", c)
		}
		blacklisting := c.Get("other").(*nerdz.User).Blacklisting()
		return rest.SelectFields(rest.GetUsersInfo(blacklisting), c)
	}
}
예제 #4
0
파일: user.go 프로젝트: nerdzeu/nerdz-api
// UserFollowing handles the request and returns the user following
func UserFollowing() echo.HandlerFunc {

	// swagger:route GET /users/{id}/following/users user info following GetUserFollowing
	//
	// Shows the following informations for the specified user
	//
	// You can personalize the request via query string parameters
	//
	//	Produces:
	//	- application/json
	//
	//	Security:
	//		oauth: profile:read
	//
	//	Responses:
	//		default: apiResponse

	return func(c echo.Context) error {
		if !rest.IsGranted("profile:read", c) {
			return rest.InvalidScopeResponse("profile:read", c)
		}
		following := c.Get("other").(*nerdz.User).UserFollowing()
		return rest.SelectFields(rest.GetUsersInfo(following), c)
	}
}