Documentation
¶
Index ¶
- type ApiError
- type Client
- type Collaborator
- type CollaboratorResponse
- type CollaboratorService
- func (cs *CollaboratorService) Activate(ctx context.Context, id int) (*OperationDefaultResponse, error)
- func (cs *CollaboratorService) Create(ctx context.Context, c *Collaborator) (*DefaultResponse, error)
- func (cs *CollaboratorService) Inactivate(ctx context.Context, id int) (*OperationDefaultResponse, error)
- func (cs *CollaboratorService) Read(ctx context.Context, f Filter) (*CollaboratorResponse, error)
- func (cs *CollaboratorService) Update(ctx context.Context, c *Collaborator) (*OperationDefaultResponse, error)
- type CostCenter
- type CostCenterResponse
- type CostCenterService
- func (cs *CostCenterService) Create(ctx context.Context, cc *CostCenter) (*DefaultResponse, error)
- func (cs *CostCenterService) Inactivate(ctx context.Context, id int) (*OperationDefaultResponse, error)
- func (cs *CostCenterService) Read(ctx context.Context, f Filter) (*CostCenterResponse, error)
- func (cs *CostCenterService) Update(ctx context.Context, cc *CostCenter) (*OperationDefaultResponse, error)
- type DefaultResponse
- type Filter
- type OperationDefaultResponse
- type ResponseError
- type Role
- type RoleResponse
- type RoleService
- type Time
- type TokenSource
- type Unity
- type UnityResponse
- type UnityService
- func (us *UnityService) Create(ctx context.Context, u *Unity) (*DefaultResponse, error)
- func (us *UnityService) Inactivate(ctx context.Context, id int) (*OperationDefaultResponse, error)
- func (us *UnityService) Read(ctx context.Context, f Filter) (*UnityResponse, error)
- func (us *UnityService) Update(ctx context.Context, u *Unity) (*OperationDefaultResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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 Client ¶
type Client struct {
// Services implemented
Collaborator *CollaboratorService
CostCenter *CostCenterService
Role *RoleService
Unity *UnityService
// contains filtered or unexported fields
}
Client is responsible for handling requests to the Wappa API.
type Collaborator ¶
type Collaborator struct {
ID int `json:"IdColaborador,omitempty"`
Company int `json:"Idempresa,omitempty"`
Association int `json:"IdAssociacao,omitempty"`
CostCenterID int `json:"IdCentroCusto,omitempty"`
UnityID int `json:"IdUnidade,omitempty"`
RoleID int `json:"IdCargo,omitempty"`
Name string `json:"Nome,omitempty"`
CPF string `json:"Cpf,omitempty"`
Email string `json:"Email,omitempty"`
Role string `json:"Cargo,omitempty"`
Enrollment string `json:"Matricula,omitempty"`
Active bool `json:"StatusAtivo,omitempty"`
Blocked bool `json:"StatusBloqueado,omitempty"`
MonthlyTaxiFare float64 `json:"ValorMensalTaxi,omitempty"`
MonthlyLimit string `json:"LimiteMensal,omitempty"`
UnlimitedTaxi bool `json:"FlgTaxiIlimitado,omitempty"`
ExtraMonthlyTaxiFare float64 `json:"ValorAcrescimoMensalTaxi,omitempty"`
AccumulatedTaxiFare float64 `json:"ValorAcumuladoTaxi,omitempty"`
AuthorizedFleet bool `json:"FlgFrotaAutorizado,omitempty"`
SendUnblockSMS bool `json:"FlgEnviarSmsDesbloqueio,omitempty"`
CostCenterCode string `json:"CodigoCentroCusto,omitempty"`
CostCenterName string `json:"NomeCentroCusto,omitempty"`
UnityCode string `json:"CodigoUnidade,omitempty"`
UnityName string `json:"NomeUnidade,omitempty"`
ChangedStatusAt Time `json:"DataStatus,omitempty"`
CreatedAt Time `json:"DataCadastro,omitempty"`
ActivatedAt Time `json:"DataAtivacao,omitempty"`
ReactivatedAt Time `json:"DataReativacao,omitempty"`
InactivatedAt Time `json:"DataDesativacao,omitempty"`
BlockedAt Time `json:"DataBloqueio,omitempty"`
PasswordResentAt Time `json:"DataReenvioSenha,omitempty"`
Type int `json:"TipoColaborador,omitempty"`
Foreign bool `json:"Estrangeiro,omitempty"`
CardExpiration string `json:"ValidadeCartao,omitempty"`
CardFinalDigits string `json:"FinalCartao,omitempty"`
CountryCode string `json:"CodPaisNF,omitempty"`
CountryName string `json:"NomePaisNF,omitempty"`
UnlimitedRides bool `json:"QtdCorridasIlimitado,omitempty"`
AnswerToID int `json:"IdRespondePara,omitempty"`
AnswerToName string `json:"NomeRespondePara,omitempty"`
AnswerToEnrollment string `json:"MatriculaRespondePara,omitempty"`
AppVersion string `json:"VersaoApp,omitempty"`
UserID int `json:"IdUsuario,omitempty"`
DDD string `json:"Ddd,omitempty"`
Login string `json:"Login,omitempty"`
}
Collaborator is the struct representing the collaborator entity in the API.
type CollaboratorResponse ¶
type CollaboratorResponse struct {
DefaultResponse
Response []*Collaborator
}
UnitResponse is the API response payload.
type CollaboratorService ¶
type CollaboratorService struct {
// contains filtered or unexported fields
}
CollaboratorService is responsible for handling the requests to the collaborator resource.
func (*CollaboratorService) Activate ¶
func (cs *CollaboratorService) Activate(ctx context.Context, id int) (*OperationDefaultResponse, error)
Activate activates the collaborator in the API.
func (*CollaboratorService) Create ¶
func (cs *CollaboratorService) Create(ctx context.Context, c *Collaborator) (*DefaultResponse, error)
Create creates a collaborator resource in the API.
func (*CollaboratorService) Inactivate ¶
func (cs *CollaboratorService) Inactivate(ctx context.Context, id int) (*OperationDefaultResponse, error)
Inactivate inactivates the collaborator in the API.
func (*CollaboratorService) Read ¶
func (cs *CollaboratorService) Read(ctx context.Context, f Filter) (*CollaboratorResponse, error)
Read returns the CollaboratorResponse for the passed filters.
func (*CollaboratorService) Update ¶
func (cs *CollaboratorService) Update(ctx context.Context, c *Collaborator) (*OperationDefaultResponse, error)
Updated edits the collaborator information.
type CostCenter ¶
type CostCenter struct {
ID int `json:"IdCentroCusto,omtempty"`
Name string `json:"Nome,omitempty"`
Code string `json:"Codigo,omitempty"`
ParentCostCenterID int `json:"IdCentroCustoSuperior,omitempty"`
ParentCostCenterCode string `json:"CodigoCCSuperior,omitempty"`
ParentCostCenterName string `json:"NomeCCSuperior,omitempty"`
CNPJ string `json:"CNPJEmpresaGrupo,omitempty"`
}
CostCenter is the struct representing the cost center entity in the API.
type CostCenterResponse ¶
type CostCenterResponse struct {
DefaultResponse
Response []*CostCenter
}
CostCenterResponse is the API response payload.
type CostCenterService ¶
type CostCenterService struct {
// contains filtered or unexported fields
}
CostCenterService is responsible for handling the requests to the cost center resource.
func (*CostCenterService) Create ¶
func (cs *CostCenterService) Create(ctx context.Context, cc *CostCenter) (*DefaultResponse, error)
Create creates a cost center resource in the API.
func (*CostCenterService) Inactivate ¶
func (cs *CostCenterService) Inactivate(ctx context.Context, id int) (*OperationDefaultResponse, error)
Inactivate inactivates the cost center in the API.
func (*CostCenterService) Read ¶
func (cs *CostCenterService) Read(ctx context.Context, f Filter) (*CostCenterResponse, error)
Read returns the CostCenterResponse for the passed filters.
func (*CostCenterService) Update ¶
func (cs *CostCenterService) Update(ctx context.Context, cc *CostCenter) (*OperationDefaultResponse, error)
Updated edits the cost center information.
type DefaultResponse ¶
type DefaultResponse struct {
Success bool
Quantity int `json:"Quantidade,omitempty"`
Error ResponseError
// Returned by the API when error occurs
Message string
MessageDetail string
// Response of Create, Update and Activate/Inactivate-family operations.
Response string
}
DefaultResponse contains the basics porperties all requests to the Wappa API returns.
type OperationDefaultResponse ¶
type OperationDefaultResponse struct {
DefaultResponse
}
type ResponseError ¶
ResponseError contains the default error porperties returnes by the API.
type Role ¶
type Role struct {
ID int `json:"IdCargo,omtempty"`
Description string `json:"Descricao,omitempty"`
Filter string `json:"Filtro,omitempty"`
}
Role is the struct representing the role entity in the API.
type RoleResponse ¶
type RoleResponse struct {
DefaultResponse
Response []*Role
}
RoleResponse is the API reading response payload for role entity.
type RoleService ¶
type RoleService struct {
// contains filtered or unexported fields
}
RoleService is responsible for handling the requests to the role resource.
func (*RoleService) Create ¶
func (rs *RoleService) Create(ctx context.Context, r *Role) (*DefaultResponse, error)
Create creates a role resource in the API.
func (*RoleService) Read ¶
func (rs *RoleService) Read(ctx context.Context, f Filter) (*RoleResponse, error)
Read returns the RoleResponse for the passed filters.
type Time ¶
Time is a custom time type for unmashaling data from the API.
func (Time) MarshalJSON ¶
func (*Time) UnmarshalJSON ¶
type TokenSource ¶
type TokenSource struct {
// contains filtered or unexported fields
}
TokenSource implements the oauth2.TokenSource interface, in order to reuse the Wappa token.
func NewTokenSource ¶
func NewTokenSource(ctx context.Context, host, clientID, clientSecret, username, password string) *TokenSource
NewTokenSource returns a oauth2.TokenSource for issuing a Wappa token.
The provided context optionally controls which HTTP client is used. See the oauth2.HTTPClient variable. host should be sufixed by '/'.
type Unity ¶
type Unity struct {
ID int `json:"IdUnidade,omtempty"`
CustomerCompany int `json:"IdEmpresaCliente,omitempty"`
Code string `json:"Codigo,omitempty"`
Name string `json:"Nome,omitempty"`
Address string `json:"Endereco,omitempty"`
Number string `json:"Numero,omitempty"`
Complement string `json:"Complemento,omitempty"`
Neighborhood string `json:"Bairro,omitempty"`
StateID string `json:"SiglaUf,omitempty"`
ZipCode string `json:"Cep,omitempty"`
AreaCode string `json:"Ddd,omitempty"`
Phone string `json:"Telefone,omitempt"`
AreaCode2 string `json:"Ddd2,omitempty"`
Phone2 string `json:"Telefone2,omitempty"`
CityID int `json:"IdCidade,omitempty"`
City string `json:"Cidade,omitempty"`
}
Unity is the struct representing the unity entity in the API.
type UnityResponse ¶
type UnityResponse struct {
DefaultResponse
Response []*Unity
}
UnitResponse is the API response payload.
type UnityService ¶
type UnityService struct {
// contains filtered or unexported fields
}
UnityService is responsible for handling the requests to the unity resource.
func (*UnityService) Create ¶
func (us *UnityService) Create(ctx context.Context, u *Unity) (*DefaultResponse, error)
Create creates a unity resource in the API.
func (*UnityService) Inactivate ¶
func (us *UnityService) Inactivate(ctx context.Context, id int) (*OperationDefaultResponse, error)
Inactivate inactivates the unity in the API.
func (*UnityService) Read ¶
func (us *UnityService) Read(ctx context.Context, f Filter) (*UnityResponse, error)
Read returns the UnityResponse for the passed filters.
func (*UnityService) Update ¶
func (us *UnityService) Update(ctx context.Context, u *Unity) (*OperationDefaultResponse, error)
Updated edits the unity information.