client

package
v0.0.0-...-813fb4a Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2014 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UnexpectedStatusCode = errors.New("Service returned unexpected status code.")

Functions

func ApiAuthenticate

func ApiAuthenticate(loginName, loginPassword string) (string, error)

func ApiChangeEmail

func ApiChangeEmail(userID, newEmail string) error

func ApiChangeLoginCredentials

func ApiChangeLoginCredentials(userID, name, password string) error

func ApiChangeProfileName

func ApiChangeProfileName(userID, profileName string) error

func ApiCreateUser

func ApiCreateUser(profileName, email, loginName, loginPassword string) (string, error)

func ApiNewResetPasswordToken

func ApiNewResetPasswordToken(email string) (string, error)

func ApiResetLoginCredentials

func ApiResetLoginCredentials(token, login_name, login_password string) error

func ApiVerifyEmail

func ApiVerifyEmail(userID string) error

func Endpoint

func Endpoint(action string) string

func Execute

func Execute(url string, call Call) (interface{}, error)

func SetEndpoint

func SetEndpoint(url string)

Types

type ApiUser

type ApiUser struct {
	ProfileName   string `json:"profile_name"`
	LoginName     string `json:"login_name"`
	Email         string `json:"email"`
	EmailVerified bool   `json:"email_verified"`
}

func ApiGetUser

func ApiGetUser(userID string) (ApiUser, error)

type AuthenticateCall

type AuthenticateCall struct {
	BodyReader
	Name     string
	Password string
}

func (AuthenticateCall) PostForm

func (call AuthenticateCall) PostForm() url.Values

type BadRequestHandler

type BadRequestHandler interface {
	ResponseBadRequest(resp *http.Response) (interface{}, error)
}

type BodyReader

type BodyReader struct{}

func (BodyReader) ResponseBadRequest

func (call BodyReader) ResponseBadRequest(resp *http.Response) (interface{}, error)

func (BodyReader) ResponseOK

func (c BodyReader) ResponseOK(resp *http.Response) (interface{}, error)

type Call

type Call interface {
}

Call describes an object to be passed into Execute() to define the input and output handling to perform an action on a resource via HTTP. To actually trigger behavior, the call struct should implement some of the other interfaces in this package.

type ChangeEmailCall

type ChangeEmailCall struct {
	ID    string
	Email string
}

func (ChangeEmailCall) PostForm

func (call ChangeEmailCall) PostForm() url.Values

func (ChangeEmailCall) ResponseNoContent

func (call ChangeEmailCall) ResponseNoContent(resp *http.Response) (interface{}, error)

type ChangeLoginCredentialsCall

type ChangeLoginCredentialsCall struct {
	ID       string
	Login    string
	Password string
}

func (ChangeLoginCredentialsCall) PostForm

func (call ChangeLoginCredentialsCall) PostForm() url.Values

func (ChangeLoginCredentialsCall) ResponseNoContent

func (call ChangeLoginCredentialsCall) ResponseNoContent(resp *http.Response) (interface{}, error)

type ChangeProfileNameCall

type ChangeProfileNameCall struct {
	ID          string
	ProfileName string
}

func (ChangeProfileNameCall) PostForm

func (call ChangeProfileNameCall) PostForm() url.Values

func (ChangeProfileNameCall) ResponseNoContent

func (call ChangeProfileNameCall) ResponseNoContent(resp *http.Response) (interface{}, error)

type CreatedHandler

type CreatedHandler interface {
	ResponseCreated(resp *http.Response) (interface{}, error)
}

type FallbackHandler

type FallbackHandler interface {
	// HandleFallback is called when the Call object does not implement the appropriate response handler.
	HandleFallback(response *http.Response) (interface{}, error)
}

type JsonCall

type JsonCall struct {
	Target interface{}
}

func (JsonCall) ResponseOK

func (c JsonCall) ResponseOK(resp *http.Response) (interface{}, error)

type NewResetPasswordToken

type NewResetPasswordToken struct {
	Email string
}

func (NewResetPasswordToken) PostForm

func (call NewResetPasswordToken) PostForm() url.Values

func (NewResetPasswordToken) ResponseOK

func (call NewResetPasswordToken) ResponseOK(resp *http.Response) (interface{}, error)

type NoContentHandler

type NoContentHandler interface {
	ResponseNoContent(resp *http.Response) (interface{}, error)
}

type NotFoundHandler

type NotFoundHandler interface {
	ResponseNotFound(resp *http.Response) (interface{}, error)
}

type OKHandler

type OKHandler interface {
	ResponseOK(resp *http.Response) (interface{}, error)
}

OKHandler can be implemented to handle the 200 OK case.

type PostCallForm

type PostCallForm interface {
	PostForm() url.Values
}

PostCallForm can be implemented to perform a POST with a classic form-encoded body.

type PostForm

type PostForm interface {
	// Body returns the content-type and stream for the POST body to for this call.
	Body() (string, io.Reader)
}

PostForm can be implemented to perform a POST with the returned stream.

type QueryParams

type QueryParams interface {
	QueryParams() url.Values
}

QueryParams can be implemented to provide URL parameters.

type RequestErrorHandler

type RequestErrorHandler interface {
	HandleRequestError(err error) (interface{}, error)
}

type ResetLoginCredentials

type ResetLoginCredentials struct {
	Token         string
	LoginName     string
	LoginPassword string
}

func (ResetLoginCredentials) PostForm

func (call ResetLoginCredentials) PostForm() url.Values

func (ResetLoginCredentials) ResponseNoContent

func (call ResetLoginCredentials) ResponseNoContent(resp *http.Response) (interface{}, error)

type VerifyEmailCall

type VerifyEmailCall struct {
	UserID string
	Email  string
}

func (VerifyEmailCall) PostForm

func (call VerifyEmailCall) PostForm() url.Values

func (VerifyEmailCall) ResponseNoContent

func (call VerifyEmailCall) ResponseNoContent(resp *http.Response) (interface{}, error)

Jump to

Keyboard shortcuts

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