handler

package
v0.0.0-...-73ce370 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2017 License: GPL-3.0 Imports: 25 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// BuildTime is filled by the main package
	BuildTime = ""
	// BuildVersion is filled by the main package
	BuildVersion = ""
)
View Source
var (
	// ErrUnableToSend is the message to write when the response can't be sent to client
	ErrUnableToSend = errors.New("unable to send response to client")
)

Functions

func ChanCreate

func ChanCreate(c echo.Context) (err error)

ChanCreate create a new channel for the logged user

func ChanMessageCreate

func ChanMessageCreate(c echo.Context) (err error)

func ChanMessagesList

func ChanMessagesList(c echo.Context) (err error)

func ChansList

func ChansList(c echo.Context) (err error)

func GetLoggedUser

func GetLoggedUser(loggedUser interface{}) (u *user.User, err error)

GetLoggedUser return the current logged user based on the auth middleware

func UserCreate

func UserCreate(c echo.Context) (err error)

UserCreate handle the route POST /user/. Return a CRT generated from the CRS submitted and the CA. *

  • @api {post} /user/ Register an account
  • @apiDescription Create a user and allow him to connect to restricted areas of the API
  • @apiName User - Create profile
  • @apiGroup User *
  • @apiExample {curl} Usage example
  • $>curl -X POST --cacert ca.crt -v "https://api.nebulo.io/user/" --data-binary "@user.csr" *
  • @apiSuccess (Success) {nothing} 201 Created
  • @apiSuccessExample {binary} Success example
  • HTTP/1.1 201 "Created"
  • -----BEGIN CERTIFICATE----- MIIE6jCCAtKgAwIBAgIBAjANBgkqhkiG9w0BAQsFADARMQ8wDQYDVQQDDAZuZWJ1 bG8wHhcNMTcwMzA4MTIxMDIxWhcNMTcwMzA5MTIxMDIxWjAWMRQwEgYDVQQDEwtK ... 93FwQ9M4vipScDcrkyj9X9vueWzv7GBK2npXXsXoAVecLkLL5P6MMi8z7wcmlUSB FG4WG+sgP5x/bNY5fZ4= -----END CERTIFICATE----- *
  • @apiError (Errors 4XX) {json} 400 Bad Request: unable to load user certificate request
  • @apiError (Errors 4XX) {json} 409 Conflict: user already exist
  • @apiError (Errors 5XX) {json} 500 Internal server error: server failed to handle the request

func UserDelete

func UserDelete(c echo.Context) (err error)

UserDelete handle the route DELETE /user/. Delete all the users informations and revoke certificate *

  • @api {delete} /user Delete user profile
  • @apiDescription Delete the user profile, wiping every data about the user.
  • @apiName User - delete profile
  • @apiGroup User *
  • @apiExample {curl} Usage example
  • $>curl -X DELETE -v --cert bob.crt --key bob.key "https://api.nebulo.io/user/" *
  • @apiSuccess (Success) {nothing} 202 Accepted
  • @apiSuccessExample {json} Success example
  • HTTP/1.1 202 "Accepted" *
  • @apiError (Errors 4XX) {json} 401 Unauthorized: missing client certificate
  • @apiError (Errors 4XX) {json} 404 Not found: user not found
  • @apiError (Errors 5XX) {json} 500 Internal server error: server failed to handle the request

func UserEdit

func UserEdit(c echo.Context) (err error)

UserEdit handle the route PUT /user/. Perform a profile modification and return the whole profile of the logged user *

  • @api {put} /user Update user profile
  • @apiDescription Perform a profile modification and return the whole profile of the logged user.
  • You can't revoke and issue a new certificate from this call. The only updatable field is: "display_name".
  • @apiName User - update profile infos
  • @apiGroup User *
  • @apiExample {curl} Usage example
  • $>curl -X PUT -v --cert bob.crt --key bob.key "https://api.nebulo.io/user/" --data "{\"display_name\": \"bob\"}" *
  • @apiSuccess (Success) {nothing} 200 OK
  • @apiSuccessExample {json} Success example
  • HTTP/1.1 200 "OK"
  • {
  • "key_fingerprint": "SHA256:r3nwvMos/pMuSuDLmWt0owQVUViqNw6Tn0mCZ0FLbUs",
  • "display_name": "Bob",
  • "signup": "2017-03-30T05:21:45.787568658-07:00",
  • "login_first": "2017-03-30T05:22:33.543332295-07:00",
  • "login_last": "2017-03-30T05:34:29.527686645-07:00"
  • } *
  • @apiError (Errors 4XX) {json} 400 Bad request: bad json input
  • @apiError (Errors 4XX) {json} 401 Unauthorized: missing client certificate
  • @apiError (Errors 4XX) {json} 404 Not found: user not found
  • @apiError (Errors 5XX) {json} 500 Internal server error: server failed to handle the request

func UserInfos

func UserInfos(c echo.Context) (err error)

UserInfos handle the route GET /user/. Return the whole profile of the logged user *

  • @api {get} /user Get profile infos
  • @apiDescription Return all the informations are stored about the users
  • @apiName User - Get profile infos
  • @apiGroup User *
  • @apiExample {curl} Usage example
  • $>curl -X GET -v --cert bob.crt --key bob.key "https://api.nebulo.io/user/" *
  • @apiSuccess (Success) {nothing} 200 OK
  • @apiSuccessExample {json} Success example
  • HTTP/1.1 200 "OK"
  • {
  • "key_fingerprint": "SHA256:r3nwvMos/pMuSuDLmWt0owQVUViqNw6Tn0mCZ0FLbUs",
  • "display_name": "bob",
  • "signup": "2017-03-11T15:47:54.153661099-08:00",
  • "login_first": "2017-03-11T15:47:59.316160305-08:00",
  • "login_last": "2017-03-11T15:48:12.89865226-08:00"
  • } *
  • @apiError (Errors 4XX) {json} 401 Unauthorized: missing client certificate
  • @apiError (Errors 4XX) {json} 404 Not found: user not found
  • @apiError (Errors 5XX) {json} 500 Internal server error: server failed to handle the request

func Version

func Version(c echo.Context) error

Version handle the route /version. Return the build time and tag version or the revision if tag doesnt exist *

  • @api {get} /version Version of the API
  • @apiDescription GIT revision or TAG of the API
  • @apiName Version
  • @apiGroup Other *
  • @apiExample {curl} Usage example
  • $>curl -X GET -v "https://api.nebulo.io/version/" *
  • @apiSuccess (Success) {nothing} 200 OK
  • @apiSuccessExample {json} Success example
  • HTTP/1.1 200 "OK"
  • {
  • "build_version": "0.1.0",
  • "build_time": "2017-02-16-0624 UTC",
  • } *
  • @apiError (Errors 5XX) {json} 500 Internal server error: server failed to handle the request

Types

type ChanCreateRequest

type ChanCreateRequest struct {
	Name    string   `json:"name"`
	Members []string `json:"members_public_key"`
}

ChanCreateRequest store the request body for a ChanCreate request

type ChanMessageCreateRequest

type ChanMessageCreateRequest struct {
	ChannelName string         `json:"channel_name"`
	Messages    []messageInfos `json:"messages"`
}

ChanMessageCreateRequest store the request body for a ChanMessageCreate request

type ChansListRequest

type ChansListRequest struct {
	Offset int `json:"offset"`
	Limit  int `json:"limit"`
}

ChansListRequest store the request body for a ChansList request

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL