mirror of
https://github.com/gfleury/go-bitbucket-v1.git
synced 2025-04-09 19:08:07 -05:00
Adding Content response type structure
This commit is contained in:
parent
3e6935e03f
commit
9d1c827cd2
@ -244,6 +244,35 @@ type Branch struct {
|
|||||||
IsDefault bool `json:"isDefault"`
|
IsDefault bool `json:"isDefault"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Content contains repository content information (and files content)
|
||||||
|
type Content struct {
|
||||||
|
Children struct {
|
||||||
|
IsLastPage bool `json:"isLastPage"`
|
||||||
|
Limit int `json:"limit"`
|
||||||
|
Size int `json:"size"`
|
||||||
|
Start int `json:"start"`
|
||||||
|
Values []struct {
|
||||||
|
ContentID string `json:"contentId,omitempty"`
|
||||||
|
Path struct {
|
||||||
|
Components []string `json:"components"`
|
||||||
|
Extension string `json:"extension"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Parent string `json:"parent"`
|
||||||
|
ToString string `json:"toString"`
|
||||||
|
} `json:"path"`
|
||||||
|
Size int `json:"size,omitempty"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Node string `json:"node,omitempty"`
|
||||||
|
} `json:"values"`
|
||||||
|
} `json:"children"`
|
||||||
|
Path struct {
|
||||||
|
Components []string `json:"components"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
ToString string `json:"toString"`
|
||||||
|
} `json:"path"`
|
||||||
|
Revision string `json:"revision"`
|
||||||
|
}
|
||||||
|
|
||||||
func (k *SSHKey) String() string {
|
func (k *SSHKey) String() string {
|
||||||
parts := make([]string, 1, 2)
|
parts := make([]string, 1, 2)
|
||||||
parts[0] = strings.TrimSpace(k.Text)
|
parts[0] = strings.TrimSpace(k.Text)
|
||||||
@ -306,6 +335,13 @@ func GetPullRequestResponse(r *APIResponse) (PullRequest, error) {
|
|||||||
return m, err
|
return m, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetContentResponse cast Content into structure
|
||||||
|
func GetContentResponse(r *APIResponse) (Content, error) {
|
||||||
|
var c Content
|
||||||
|
err := mapstructure.Decode(r.Values, &c)
|
||||||
|
return c, err
|
||||||
|
}
|
||||||
|
|
||||||
// NewAPIResponse create new APIResponse from http.Response
|
// NewAPIResponse create new APIResponse from http.Response
|
||||||
func NewAPIResponse(r *http.Response) *APIResponse {
|
func NewAPIResponse(r *http.Response) *APIResponse {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user