64 lines
1.3 KiB
Go
64 lines
1.3 KiB
Go
package pastee
|
|
|
|
import "net/http"
|
|
|
|
type Pastee struct {
|
|
ApiKey string
|
|
Base string
|
|
Client *http.Client
|
|
}
|
|
|
|
type Paste struct {
|
|
ID string `json:"id,omitempty"`
|
|
Views int `json:"views,omitempty"`
|
|
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"`
|
|
Key string `json:"-"`
|
|
ID string `json:"id"`
|
|
Link string `json:"link"`
|
|
}
|
|
|
|
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"`
|
|
} |