Documentation
¶
Index ¶
- Constants
- Variables
- type ApiError
- type Classifier
- type ClassifierOperationResponse
- type ClassifierResponse
- type Client
- type DataUser
- type OperationResponse
- type Status
- type Transport
- type User
- type UserResponse
- type UserService
- func (us *UserService) Create(ctx context.Context, u *User) (*OperationResponse, error)
- func (us *UserService) CreateClassifier(ctx context.Context, c *Classifier) (*ClassifierOperationResponse, error)
- func (us *UserService) Read(ctx context.Context, id, name string) (*UserResponse, error)
- func (us *UserService) ReadClassifier(ctx context.Context, field, value string) (*ClassifierResponse, error)
- func (us *UserService) Update(ctx context.Context, u *User) (*OperationResponse, error)
- func (us *UserService) UpdateStatus(ctx context.Context, s *UserStatus) (*OperationResponse, error)
- type UserStatus
Constants ¶
const ( // Request statuses. ReqStatusFail reqStatus = iota ReqStatusOK )
const ( Json = `json` Xml = `xml` )
Request return types.
const ( UserStatusInactive userStatus = iota UserStatusActive UserStatusSynching )
User statuses
Variables ¶
var ResType contextKey
ResType is the context key to use with context's WithValue function to set the type of request's payload that will be received from the API.
Functions ¶
This section is empty.
Types ¶
type ApiError ¶
type ApiError struct {
// contains filtered or unexported fields
}
ApiError implements the error interface and returns infos from the request
type Classifier ¶
type Classifier struct {
ID string `json:"field_id,omitempty"`
Field string `json:"field,omitempty"`
Value string `json:"field_value"`
AdditionalValue string `json:"field_additional_value,omitempty"`
}
Classifier is the classifier field infos.
type ClassifierOperationResponse ¶
type ClassifierOperationResponse struct {
OperationResponse
Data string `json:"data"`
}
ClassifierOperationResponse is the response returned by the API for non-idempotent operations on user's classifier fields.
type ClassifierResponse ¶
type ClassifierResponse struct {
Status reqStatus
Data []Classifier `json:"data"`
}
ClassifierResponse is the response returned by the API when reading the classifier field info.
type Client ¶
type Client struct {
// User is the service that handles http logic for requests
// related to the user.
User *UserService
// contains filtered or unexported fields
}
Client encapsulates the requests to the Ligue Taxi endpoints.
type DataUser ¶
type DataUser struct {
ID string `json:"authorized_id"`
Name string `json:"client_name"`
Email *emptyObjToStr `json:"client_email"`
Phone *emptyObjToStr `json:"client_phone"`
Status *userStatus `json:"cod_status"`
StatusDescription string `json:"status_description"`
}
DataUser is the result from check user request.
type OperationResponse ¶
type OperationResponse struct {
Status reqStatus
Message string `json:"message"`
}
OperationResponse is the response returned by the API for non-idempotent operations on user.
type Transport ¶
type Transport struct {
// Token is the string to be injected to the
// outgoing request header
Token string
// Base is the base RoundTripper to make HTTP request.
Base http.RoundTripper
}
Transport is the RountTripper for injecting the authorization header for every request to Ligue Taxi player.
type User ¶
type User struct {
ID string `json:"unique_field,omitempty"`
Name string `json:"user_name"`
Email string `json:"user_email"`
Phone string `json:"user_phone,omitempty"`
Password string `json:"user_password,omitempty"`
Classifier1 string `json:"classificador1,omitempty"`
Classifier2 string `json:"classificador2,omitempty"`
Classifier3 string `json:"classificador3,omitempty"`
Classifier4 string `json:"classificador4,omitempty"`
Classifier5 string `json:"classificador5,omitempty"`
Classifier6 string `json:"classificador6,omitempty"`
Classifier7 string `json:"classificador7,omitempty"`
Classifier8 string `json:"classificador8,omitempty"`
Classifier9 string `json:"classificador9,omitempty"`
Classifier10 string `json:"classificador10,omitempty"`
Classifier11 string `json:"classificador11,omitempty"`
Classifier12 string `json:"classificador12,omitempty"`
Classifier13 string `json:"classificador13,omitempty"`
Classifier14 string `json:"classificador14,omitempty"`
Classifier15 string `json:"classificador15,omitempty"`
Classifier16 string `json:"classificador16,omitempty"`
Classifier17 string `json:"classificador17,omitempty"`
Classifier18 string `json:"classificador18,omitempty"`
Classifier19 string `json:"classificador19,omitempty"`
Classifier20 string `json:"classificador20,omitempty"`
}
User is sent to server when creating or editing user.
type UserResponse ¶
type UserResponse struct {
Status reqStatus
Data DataUser `json:"data"`
}
UserResponse is the response returned by the API when listing a user info.
type UserService ¶
type UserService service
UserService handles the requests related to the user.
func (*UserService) Create ¶
func (us *UserService) Create(ctx context.Context, u *User) (*OperationResponse, error)
Create returns the status operation for creating a user or an error.
func (*UserService) CreateClassifier ¶
func (us *UserService) CreateClassifier(ctx context.Context, c *Classifier) (*ClassifierOperationResponse, error)
CreateClassifier returns the status operation for creating classifier field or an error.
func (*UserService) Read ¶
func (us *UserService) Read(ctx context.Context, id, name string) (*UserResponse, error)
Read returns User infos or an error.
func (*UserService) ReadClassifier ¶
func (us *UserService) ReadClassifier(ctx context.Context, field, value string) (*ClassifierResponse, error)
ReadClassifier returns the classifier field info.
func (*UserService) Update ¶
func (us *UserService) Update(ctx context.Context, u *User) (*OperationResponse, error)
Update returns the status operation for updating user or an error.
func (*UserService) UpdateStatus ¶
func (us *UserService) UpdateStatus(ctx context.Context, s *UserStatus) (*OperationResponse, error)
UpdateStatus returns the status operation for updating the user status or an error.
type UserStatus ¶
type UserStatus struct {
ID string `json:"authorized_id"`
Name string `json:"user_name,omitempty"`
Status userStatus `json:"status"`
Reason string `json:"reason,omitempty"`
}
UserStatus is the user status infos.