Documentation ¶
Index ¶
- Constants
- Variables
- func IsErrorCode(err error, code string) bool
- func ParseError(resp *http.Response) error
- func ParseLogin(resp *http.Response) (*User, *Session, error)
- type APIAuth
- type APIAuthFilter
- type APIAuths
- type Account
- type Client
- type Entity
- type EntityAggregate
- type Error
- type Event
- type EventAggregate
- type EventAggregates
- type EventFilter
- type Events
- type EventsTimeline
- type Login
- type Page
- type Paging
- type Range
- type Session
- type SessionFilter
- type Sessions
- type TimelineEntry
- type TimelineFilter
- type User
- type Users
Constants ¶
const ( ErrCodeIncorrectPassword = "incorrect_password" ErrCodeUserClosed = "user_closed" ErrCodeSessionNotFound = "session_not_found" )
Error Codes used by Luno - https://luno.io/docs/errors
Variables ¶
var ErrNotImplemented = fmt.Errorf("not implemented")
ErrNotImplemented is returned for any API method not yet implemented
var Log *log.Logger
Log allows an application to provie a custom logger for logging care must be taken, as logs may contain sensitive information
var LogRequestBody = false
LogRequestBody allows you to log the body of every HTTP request
var LogRequestURL = false
LogRequestURL allows you to log the URL of every HTTP request
var LogResponseBody = false
LogResponseBody allows you to log every HTTP response body
var LogResponseCode = false
LogResponseCode allows you to log every HTTP response code
Functions ¶
func IsErrorCode ¶
IsErrorCode checks is an error was a luno error with the matching code
func ParseError ¶
ParseError parses a Luno error from an HTTP response
Types ¶
type APIAuth ¶
type APIAuth struct { Entity UserID string `json:"user_id,omitempty"` Key string `json:"key,omitempty"` Secret string `json:"secret,omitempty"` Created string `json:"created,omitempty"` Details interface{} `json:"details,omitempty"` User *User `json:"user,omitempty"` }
APIAuth represents the Luno API Authetication - https://luno.io/docs#api_authentication
func ParseAPIAuth ¶
ParseAPIAuth parses an APIAuth out of an HTTP response
func (*APIAuth) MarshalForUpdate ¶
MarshalForUpdate exports only the fields suitable for update
type APIAuthFilter ¶
type APIAuthFilter struct {
UserID string `json:"user_id"`
}
APIAuthFilter allows you tou filter ApiAuth objects
type Account ¶
type Account struct { Entity Email string `json:"email"` Name string `json:"name"` FirstName string `json:"first_name"` LastName string `json:"last_name"` UserName string `json:"username"` Created string `json:"created"` Closed string `json:"closed"` }
Account represents the Luno Account - https://luno.io/docs#account
func ParseAccount ¶
ParseAccount parses an Account out of an HTTP response
func (*Account) MarshalForUpdate ¶
MarshalForUpdate exports only those fields suitable for an update operation
type Client ¶
type Client struct { Users *usersClient Events *eventsClient Sessions *sessionsClient APIAuth *apiAuthClient Analytics *analyticsClient Account *accountClient // contains filtered or unexported fields }
Client is a Luno Client - https://luno.io/docs/libraries
type Entity ¶
type Entity struct { Type string `json:"type,omitempty"` ID string `json:"id,omitempty"` URL string `json:"url,omitempty"` }
Entity contains fields common to many Luno entities
type EntityAggregate ¶
EntityAggregate represents a response containing aggregte information about an entitites, Users, Sessions, Events
func ParseEntityAggregate ¶
func ParseEntityAggregate(resp *http.Response) (EntityAggregate, error)
ParseEntityAggregate parses an EntityAggregate out of an HTTP response
type Error ¶
type Error struct { Code string `json:"code"` Message string `json:"message"` Description string `json:"description"` Status int `json:"status"` Extra interface{} `json:"extra"` }
Error represents all the information in a Luno Error
type Event ¶
type Event struct { Entity UserID string `json:"user_id,omitempty"` Timestamp string `json:"timestamp,omitempty"` Name string `json:"name,omitempty"` Details interface{} `json:"details,omitempty"` User *User `json:"user,omitempty"` }
Event represents a Luno Event - https://luno.io/docs#events
func ParseEvent ¶
ParseEvent parses an Event out of an HTTP response
func (*Event) MarshalForUpdate ¶
MarshalForUpdate exports the event fields suitable for an update operation
type EventAggregate ¶
type EventAggregate struct { Entity Name string `json:"name"` Count int `json:"count"` Last string `json:"last"` }
EventAggregate represents aggregate information about an Event
type EventAggregates ¶
type EventAggregates struct {
List []*EventAggregate `json:"list"`
}
EventAggregates contains a list of EventAggregate
func ParseEventAggregates ¶
func ParseEventAggregates(resp *http.Response) (*EventAggregates, error)
ParseEventAggregates parses EventAggregates out of an HTTP response
type EventFilter ¶
EventFilter lets you filter events
type EventsTimeline ¶
type EventsTimeline struct { Timeline []*TimelineEntry `json:"timeline"` Total int `json:"total"` }
EventsTimeline represents a list of TimelineEntry objects
func ParseEventsTimeline ¶
func ParseEventsTimeline(resp *http.Response) (*EventsTimeline, error)
ParseEventsTimeline parses an EventsTimeline out of an HTTP response
type Login ¶
type Login struct { ID string `json:"id,omitempty"` Email string `json:"email,omitempty"` Username string `json:"username,omitempty"` Login string `json:"username,omitempty"` Password string `json:"password,omitempty"` Session *Session `json:"session,omitempty"` }
Login represents information used to log in to the system
func (*Login) MarshalJSON ¶
MarshalJSON converts a Login to JSON
type Session ¶
type Session struct { Entity UserID string `json:"user_id,omitempty"` Key string `json:"key,omitempty"` Created string `json:"created,omitempty"` Expires string `json:"expires,omitempty"` LastAccess string `json:"last_access,omitempty"` AccessCount int `json:"access_count,omitempty"` IP string `json:"ip,omitempty"` UserAgent string `json:"user_agent,omitempty"` Details interface{} `json:"details,omitempty"` User *User `json:"user,omitempty"` }
Session represents a Luno session - https://luno.io/docs#sessions
func ParseSession ¶
ParseSession parses a Session out of an HTTP response
type SessionFilter ¶
type SessionFilter struct {
UserID string `json:"user_id"`
}
SessionFilter lets you filter session
type TimelineEntry ¶
type TimelineEntry struct { Timestamp string `json:"timestamp"` Range *Range `json:"range"` Count int }
TimelineEntry represents an point on a Timeline
type TimelineFilter ¶
type TimelineFilter struct { Distinct bool `json:"distinct"` From string `json:"from"` To string `json:"to"` Group string `json:"group"` Name string `json:"name"` RoundRange bool `json:"round_range"` UserID string `json:"user_id"` }
TimelineFilter allows you to filter items returned from an Event Timeline
func (*TimelineFilter) Params ¶
func (t *TimelineFilter) Params() url.Values
Params converts a TimelineFilter into HTTP URL parameters
type User ¶
type User struct { Entity Email string `json:"email,omitempty"` UserName string `json:"username,omitempty"` Name string `json:"name,omitempty"` FirstName string `json:"first_name,omitempty"` LastName string `json:"last_name,omitempty"` Created string `json:"created,omitempty"` Closed string `json:"closed,omitempty"` Password string `json:"password,omitempty"` Profile interface{} `json:"profile,omitempty"` }
User represents a Luno User - https://luno.io/docs#users
func (*User) MarshalForUpdate ¶
MarshalForUpdate exports only the User fields suitable for an update operation