Documentation ¶
Index ¶
- Constants
- Variables
- type API
- type AuthRequest
- type AuthSuccessResponse
- type AuthenticationResponse
- type CheckRequest
- type CheckResponse
- type CheckSuccessResponse
- type Config
- type ErrorCode
- type ErrorResponse
- type GatewayErrorMessage
- type LeveledLogger
- type RetryRequest
- type RetryResponse
- type RetrySuccessResponse
Constants ¶
View Source
const APIKeyHeader = "x-api-key"
Variables ¶
View Source
var ( ErrInternal = fmt.Errorf("internal error") )
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func (*API) Authentication ¶
func (a *API) Authentication(ctx context.Context, req AuthRequest) (*AuthenticationResponse, error)
func (*API) Check ¶
func (a *API) Check(ctx context.Context, req CheckRequest) (*CheckResponse, error)
func (*API) Retry ¶
func (a *API) Retry(ctx context.Context, req RetryRequest) (*RetryResponse, error)
type AuthRequest ¶
type AuthRequest struct { PhoneNumber string `json:"phone_number,omitempty"` CustomerUUID string `json:"customer_uuid,omitempty"` IP *string `json:"ip,omitempty"` DeviceID *string `json:"device_id,omitempty"` DeviceType *string `json:"device_type,omitempty"` AppVersion *string `json:"app_version,omitempty"` CallbackURL *string `json:"callback_url,omitempty"` IsReturningUser *bool `json:"is_returning_user,omitempty"` }
type AuthSuccessResponse ¶
type AuthenticationResponse ¶
type AuthenticationResponse struct { Error *ErrorResponse Success *AuthSuccessResponse }
TODO(2024-25) -> abstract each endpoint parsing logic using generics
type CheckRequest ¶
type CheckResponse ¶
type CheckResponse struct { Error *ErrorResponse Success *CheckSuccessResponse }
type CheckSuccessResponse ¶
type ErrorCode ¶
type ErrorCode string
const ( ErrorCodeInternalServer ErrorCode = "internal_server_error" ErrorCodeBadRequest ErrorCode = "bad_request" ErrorCodeInvalidPhoneNumber ErrorCode = "invalid_phone_number" ErrorCodeAccountInvalid ErrorCode = "account_invalid" ErrorCodeNegativeBalance ErrorCode = "negative_balance" ErrorCodeInvalidLine ErrorCode = "invalid_line" ErrorCodeUnsupportedRegion ErrorCode = "unsupported_region" ErrorCodeInvalidAuthUUID ErrorCode = "invalid_auth_uuid" )
type ErrorResponse ¶
type GatewayErrorMessage ¶
type GatewayErrorMessage struct {
Message string `json:"message"`
}
type LeveledLogger ¶ added in v1.1.0
type LeveledLogger interface { Debugf(format string, v ...interface{}) Errorf(format string, v ...interface{}) Infof(format string, v ...interface{}) Warnf(format string, v ...interface{}) }
LeveledLogger is an interface that can be implemented by any logger or a logger wrapper to provide leveled logging. The methods accept a message string and a variadic number of key-value pairs.
type RetryRequest ¶
type RetryResponse ¶
type RetryResponse struct { Error *ErrorResponse Success *RetrySuccessResponse }
Click to show internal directories.
Click to hide internal directories.