Documentation ¶
Index ¶
- Constants
- func CheckResponse(r *http.Response) error
- type Account
- type AccountResponse
- type AccountService
- type Album
- type AlbumResponse
- type AlbumService
- type Client
- type ErrorData
- type ErrorResponse
- type Gallery
- type GalleryAlbumResponse
- type GalleryService
- type GalleryTagResponse
- type Image
- type MockClient
- type Option
- type ResponseStatus
- type Tag
Constants ¶
View Source
const (
LibraryVersion = "0.1"
)
const
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present.
Types ¶
type Account ¶
type Account struct { ID int `json:"id,omitempty"` Url string `json:"url,omitempty"` Bio string `json:"bio,omitempty"` Reputation float32 `json:"reputation,omitempty"` Created int `json:"created,omitempty"` ProExpiration bool `json:"pro_expiration,omitempty"` }
Account Model
type AccountResponse ¶
type AccountResponse struct { Success bool `json:"success,omitempty"` Status int `json:"status,omitempty"` Data Account `json:"data,omitempty"` }
AccountResponse
type AccountService ¶
type AccountService struct {
// contains filtered or unexported fields
}
AccountService Imgur API docs: https://api.imgur.com/models/account
type AlbumResponse ¶
type AlbumService ¶
type AlbumService struct {
// contains filtered or unexported fields
}
AlbumService Digital Ocean API docs: https://api.imgur.com/models/album
type Client ¶
type Client struct { Option *Option BaseURL *url.URL UserAgent string GalleryService *GalleryService AccountService *AccountService AlbumService *AlbumService // contains filtered or unexported fields }
A Client manages communication with the Digital Ocean API.
type ErrorData ¶
type ErrorData struct { Error string `json:"error,omitempty"` Request string `json:"request,omitempty"` Method string `json:"method,omitempty"` }
ErrorData https://api.imgur.com/errorhandling
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response Success bool `json:"success,omitempty"` Status int `json:"status,omitempty"` ErrorData ErrorData }
An ErrorResponse reports one or more errors caused by an API request.
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type GalleryAlbumResponse ¶
type GalleryService ¶
type GalleryService struct {
// contains filtered or unexported fields
}
GalleryService Imgur API
type GalleryTagResponse ¶
type MockClient ¶
type MockClient struct { Mux *http.ServeMux Client *Client Server *httptest.Server FixturesDir string }
A MockClient manages communication with the imgur API mock.
func NewMockClient ¶
func NewMockClient() *MockClient
NewMockClient returns a new imgur API client mock.
func (*MockClient) ReadJSON ¶
func (r *MockClient) ReadJSON(filename string) string
ReadJSON Read json from file
type ResponseStatus ¶
An Response by API request.
Click to show internal directories.
Click to hide internal directories.