2018-01-27 23:16:24 +00:00
|
|
|
package pastee
|
2017-06-08 05:40:35 +00:00
|
|
|
|
|
|
|
import "net/http"
|
|
|
|
|
|
|
|
type Pastee struct {
|
|
|
|
ApiKey string
|
|
|
|
Base string
|
|
|
|
Client *http.Client
|
|
|
|
}
|
|
|
|
|
|
|
|
type Paste struct {
|
2018-01-27 23:01:14 +00:00
|
|
|
ID string `json:"id,omitempty"`
|
|
|
|
Views int `json:"views,omitempty"`
|
2017-06-08 05:40:35 +00:00
|
|
|
Encrypted bool `json:"encrypted,omitempty"`
|
|
|
|
Description string `json:"description,omitempty"`
|
|
|
|
Sections []*Section `json:"sections"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Section struct {
|
|
|
|
Name string `json:"name,omitempty"`
|
|
|
|
Syntax string `json:"syntax,omitempty"`
|
|
|
|
Contents string `json:"contents"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Error struct {
|
|
|
|
Field string `json:"field"`
|
|
|
|
Code int `json:"code"`
|
|
|
|
Message string `json:"message"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type PasteResponse struct {
|
|
|
|
Success bool `json:"success"`
|
|
|
|
Errors []*Error `json:"errors"`
|
2018-01-27 23:01:14 +00:00
|
|
|
Key string `json:"-"`
|
2017-06-08 05:40:35 +00:00
|
|
|
ID string `json:"id"`
|
|
|
|
Link string `json:"link"`
|
2018-01-27 23:01:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type authRequest struct {
|
|
|
|
username string `json:"username"`
|
|
|
|
password string `json:"password"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type AuthResponse struct {
|
|
|
|
Success bool `json:"success"`
|
|
|
|
Key string `json:"key"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type PaginationResponse struct {
|
|
|
|
Total int `json:"total"`
|
|
|
|
PerPage int `json:"per_page"`
|
|
|
|
CurrentPage int `json:"current_page"`
|
|
|
|
LastPage int `json:"last_page"`
|
|
|
|
NextPageURL string `json:"next_page_url"`
|
|
|
|
PreviousPageURL string `json:"prev_page_url"`
|
|
|
|
From int `json:"from"`
|
|
|
|
To int `json:"to"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type PasteListResponse struct {
|
|
|
|
*PaginationResponse
|
|
|
|
|
|
|
|
Data []*Paste `json:"data"`
|
2017-06-08 05:40:35 +00:00
|
|
|
}
|