Documentation
¶
Index ¶
- func NewClient(baseURL, token, secret string, options ...ClientOption) *client
- func NewRequest(r *http.Request) *request
- func SignPayload(secret, payload string) string
- type Client
- type ClientOption
- type CreateSessionPayload
- type CreateSessionResponse
- type HttpClient
- type SessionDecisionResponse
- type SessionMediaResponse
- type Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
func NewClient(baseURL, token, secret string, options ...ClientOption) *client
func NewRequest ¶
func SignPayload ¶ added in v0.5.0
Types ¶
type Client ¶
type Client interface { CreateSession(ctx context.Context, payload CreateSessionPayload) (CreateSessionResponse, error) SessionDecision(ctx context.Context, sessionID string) (SessionDecisionResponse, error) SessionMedia(ctx context.Context, sessionID string) (SessionMediaResponse, error) DownloadMedia(ctx context.Context, mediaID string, dst io.Writer) error }
type ClientOption ¶
type ClientOption func(*client)
ClientOption is a function that configures a Client.
func WithHTTPClient ¶
func WithHTTPClient(c HttpClient) ClientOption
WithHTTPClient sets the HTTP client for the paystack API client.
func WithLogger ¶
func WithLogger(l *logrus.Logger) ClientOption
WithLogger sets the *logrus.Logger for the paystack API client.
type CreateSessionPayload ¶
type CreateSessionPayload struct { Verification struct { Person struct { FirstName string `json:"firstName,omitempty"` LastName string `json:"lastName,omitempty"` DateOfBirth string `json:"dateOfBirth,omitempty"` Gender string `json:"gender,omitempty"` } `json:"person"` Callback string `json:"callback,omitempty"` VendorData string `json:"vendorData"` } `json:"verification"` }
type CreateSessionResponse ¶
type SessionDecisionResponse ¶ added in v0.4.0
type SessionDecisionResponse struct { Status string `json:"status"` Verification struct { ID string `json:"id"` Code int `json:"code"` Status string `json:"status"` Person struct { FirstName string `json:"firstName"` LastName string `json:"lastName"` DateOfBirth *Time `json:"dateOfBirth"` Nationality string `json:"nationality"` } `json:"person"` Document struct { Type string `json:"type"` Number string `json:"number"` Remarks string `json:"remarks"` Country string `json:"country"` State string `json:"state"` ValidFrom *Time `json:"validFrom"` ValidUntil *Time `json:"validUntil"` } `json:"document"` } `json:"verification"` }
type SessionMediaResponse ¶ added in v0.4.0
type SessionMediaResponse struct { Status string `json:"status"` Videos []struct { ID string `json:"id"` SessionID string `json:"sessionId"` Context string `json:"context"` Duration float64 `json:"duration"` Mimetype string `json:"mimetype"` Name string `json:"name"` Size int64 `json:"size"` URL string `json:"url"` } `json:"videos"` Images []struct { ID string `json:"id"` SessionID string `json:"sessionId"` Context string `json:"context"` Mimetype string `json:"mimetype"` Name string `json:"name"` URL string `json:"url"` Size int64 `json:"size"` } `json:"images"` }
Click to show internal directories.
Click to hide internal directories.