encode_decode

package
v0.0.0-...-1a2a7be Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2017 License: GPL-3.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeAccessTokenBody2AccessToken

func DecodeAccessTokenBody2AccessToken(b AccessTokenBody) *user.AccessToken

func DecodeAccessTokensBody2AccessTokens

func DecodeAccessTokensBody2AccessTokens(bs AccessTokensBody) []*user.AccessToken

func DecodeAgentTokenBody2AgentToken

func DecodeAgentTokenBody2AgentToken(b AgentTokenBody) *user.AgentToken

func DecodeAgentTokensBody2AgentTokens

func DecodeAgentTokensBody2AgentTokens(bs AgentTokensBody) []*user.AgentToken

func DecodeSignCreateAgentTokenRequest

func DecodeSignCreateAgentTokenRequest(ctx context.Context, r *http.Request) (interface{}, error)

func DecodeSignCreateAgentTokenResponse

func DecodeSignCreateAgentTokenResponse(ctx context.Context, res *http.Response) (interface{}, error)

func DecodeSignCreateUserRequest

func DecodeSignCreateUserRequest(ctx context.Context, r *http.Request) (interface{}, error)

func DecodeSignCreateUserResponse

func DecodeSignCreateUserResponse(ctx context.Context, res *http.Response) (interface{}, error)

func DecodeSignDeleteAgentTokenRequest

func DecodeSignDeleteAgentTokenRequest(ctx context.Context, r *http.Request) (interface{}, error)

func DecodeSignDeleteAgentTokenResponse

func DecodeSignDeleteAgentTokenResponse(ctx context.Context, res *http.Response) (interface{}, error)

func DecodeSignDeleteUserByIDRequest

func DecodeSignDeleteUserByIDRequest(ctx context.Context, r *http.Request) (interface{}, error)

func DecodeSignDeleteUserByIDResponse

func DecodeSignDeleteUserByIDResponse(ctx context.Context, res *http.Response) (interface{}, error)

func DecodeSignGetUserByIDResponse

func DecodeSignGetUserByIDResponse(ctx context.Context, res *http.Response) (interface{}, error)

func DecodeSignGetUserRequest

func DecodeSignGetUserRequest(ctx context.Context, r *http.Request) (interface{}, error)

func DecodeSignLoginRequest

func DecodeSignLoginRequest(ctx context.Context, r *http.Request) (interface{}, error)

func DecodeSignLoginResponse

func DecodeSignLoginResponse(ctx context.Context, res *http.Response) (interface{}, error)

func DecodeSignLogoutRequest

func DecodeSignLogoutRequest(ctx context.Context, r *http.Request) (interface{}, error)

func DecodeSignLogoutResponse

func DecodeSignLogoutResponse(ctx context.Context, res *http.Response) (interface{}, error)

func DecodeSignValidateTokenRequest

func DecodeSignValidateTokenRequest(ctx context.Context, r *http.Request) (interface{}, error)

func DecodeSignValidateTokenResponse

func DecodeSignValidateTokenResponse(ctx context.Context, res *http.Response) (interface{}, error)

func DecodeUserBody2User

func DecodeUserBody2User(b UserBody) *user.User

func EncodeError

func EncodeError(ctx context.Context, err error, w http.ResponseWriter)

func EncodeRequest

func EncodeRequest(ctx context.Context, r *http.Request, request interface{}) error

func EncodeResponse

func EncodeResponse(ctx context.Context, w http.ResponseWriter, code int, response interface{}) error

func EncodeSignCreateAgentTokenRequest

func EncodeSignCreateAgentTokenRequest(ctx context.Context, r *http.Request, request interface{}) error

func EncodeSignCreateUserRequest

func EncodeSignCreateUserRequest(ctx context.Context, r *http.Request, request interface{}) error

func EncodeSignDeleteAgentTokenRequest

func EncodeSignDeleteAgentTokenRequest(ctx context.Context, r *http.Request, request interface{}) error

func EncodeSignDeleteUserByIDRequest

func EncodeSignDeleteUserByIDRequest(ctx context.Context, r *http.Request, request interface{}) error

func EncodeSignGetUserByIDRequest

func EncodeSignGetUserByIDRequest(ctx context.Context, r *http.Request, request interface{}) error

func EncodeSignLoginRequest

func EncodeSignLoginRequest(ctx context.Context, r *http.Request, request interface{}) error

func EncodeSignLogoutRequest

func EncodeSignLogoutRequest(ctx context.Context, r *http.Request, request interface{}) error

func EncodeSignValidateTokenRequest

func EncodeSignValidateTokenRequest(ctx context.Context, r *http.Request, request interface{}) error

func MakeResponseEncoder

func MakeResponseEncoder(code int) func(context.Context, http.ResponseWriter, interface{}) error

Types

type AccessTokenBody

type AccessTokenBody struct {
	Token    string    `json:"token"`
	ExpireAt time.Time `json:"expire_at"`
}

func EncodeAccessToken2AccessTokenBody

func EncodeAccessToken2AccessTokenBody(t *user.AccessToken) AccessTokenBody

type AccessTokensBody

type AccessTokensBody []AccessTokenBody

func EncodeAccessTokens2AccessTokensBody

func EncodeAccessTokens2AccessTokensBody(ts []*user.AccessToken) AccessTokensBody

type AgentTokenBody

type AgentTokenBody struct {
	Name  string `json:"name"`
	Token string `json:"token"`
}

func EncodeAgentToken2AgentTokenBody

func EncodeAgentToken2AgentTokenBody(t *user.AgentToken) AgentTokenBody

type AgentTokensBody

type AgentTokensBody []AgentTokenBody

func EncodeAgentTokens2AgentTokensBody

func EncodeAgentTokens2AgentTokensBody(ts []*user.AgentToken) AgentTokensBody

type SignCreateAgentTokenRequest

type SignCreateAgentTokenRequest struct {
	Name string `json:"name"`
}

type SignCreateAgentTokenResponse

type SignCreateAgentTokenResponse AgentTokenBody

type SignCreateUserRequest

type SignCreateUserRequest struct {
	Username string
	Password string
	Email    string
}

type SignCreateUserResponse

type SignCreateUserResponse UserBody

type SignDeleteAgentTokenRequest

type SignDeleteAgentTokenRequest struct {
	Name string
}

type SignDeleteAgentTokenResponse

type SignDeleteAgentTokenResponse struct{}

func (SignDeleteAgentTokenResponse) StatusCode

func (res SignDeleteAgentTokenResponse) StatusCode() int

type SignDeleteUserRequest

type SignDeleteUserRequest struct {
	ID string `json:"-"`
}

type SignDeleteUserResponse

type SignDeleteUserResponse struct{}

type SignGetUserRequest

type SignGetUserRequest struct {
	ID string `json:"-"`
}

type SignGetUserResponse

type SignGetUserResponse UserBody

type SignLoginRequest

type SignLoginRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type SignLoginResponse

type SignLoginResponse UserBody

type SignLogoutRequest

type SignLogoutRequest struct {
	ID string `json:"-"`
}

type SignLogoutResponse

type SignLogoutResponse struct{}

func (SignLogoutResponse) StatusCode

func (res SignLogoutResponse) StatusCode() int

type SignValidateTokenRequest

type SignValidateTokenRequest struct{}

type SignValidateTokenResponse

type SignValidateTokenResponse UserBody

func (SignValidateTokenResponse) StatusCode

func (res SignValidateTokenResponse) StatusCode() int

type UserBody

type UserBody struct {
	ID           string            `json:"id"`
	Username     string            `json:"username"`
	Email        string            `json:"email"`
	AccessTokens []AccessTokenBody `json:"access_tokens"`
	AgentTokens  []AgentTokenBody  `json:"agent_tokens"`
}

func EncodeUser2UserBody

func EncodeUser2UserBody(u *user.User) UserBody

Jump to

Keyboard shortcuts

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