initial commit
parent
6c26457e95
commit
4aede0f83a
@ -0,0 +1,9 @@
|
||||
workspace:
|
||||
base: /go
|
||||
path: src/github.com/drone/go-scm
|
||||
|
||||
pipeline:
|
||||
test:
|
||||
image: golang:1.9
|
||||
commands:
|
||||
- go test -v ./...
|
@ -0,0 +1,4 @@
|
||||
*.bak
|
||||
*.env
|
||||
*.out
|
||||
_*.md
|
@ -0,0 +1,9 @@
|
||||
1. Install go 1.9 or later
|
||||
2. Install dependencies:
|
||||
|
||||
go get github.com/google/go-cmp
|
||||
|
||||
3. Compile and test:
|
||||
|
||||
go install ./...
|
||||
go test ./...
|
@ -0,0 +1,3 @@
|
||||
Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
Use of this source code is governed by a BSD-style
|
||||
license that can be found in the LICENSE file.
|
@ -0,0 +1,188 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package scm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrNotFound indicates a resource is not found.
|
||||
ErrNotFound = errors.New("Not Found")
|
||||
|
||||
// ErrNotSupported indicates a resource endpoint is not
|
||||
// supported or implemented.
|
||||
ErrNotSupported = errors.New("Not Supported")
|
||||
)
|
||||
|
||||
type (
|
||||
// Request represents an HTTP request.
|
||||
Request struct {
|
||||
Method string
|
||||
Path string
|
||||
Header http.Header
|
||||
Body io.Reader
|
||||
}
|
||||
|
||||
// Response represents an HTTP response.
|
||||
Response struct {
|
||||
ID string
|
||||
Status int
|
||||
Header http.Header
|
||||
Body io.ReadCloser
|
||||
|
||||
Page Page // Page values
|
||||
Rate Rate // Rate limit snapshot
|
||||
}
|
||||
|
||||
// Page represents parsed link rel values for
|
||||
// pagination.
|
||||
Page struct {
|
||||
Next int
|
||||
Last int
|
||||
First int
|
||||
Prev int
|
||||
}
|
||||
|
||||
// Rate represents the rate limit for the current
|
||||
// client.
|
||||
Rate struct {
|
||||
Limit int
|
||||
Remaining int
|
||||
Reset int64
|
||||
}
|
||||
|
||||
// ListOptions specifies optional pagination
|
||||
// parameters.
|
||||
ListOptions struct {
|
||||
Page int
|
||||
Size int
|
||||
}
|
||||
|
||||
// Client manages communication with a version control
|
||||
// system API.
|
||||
Client struct {
|
||||
// HTTP client used to communicate with the API.
|
||||
Client *http.Client
|
||||
|
||||
// Base URL for API requests.
|
||||
BaseURL *url.URL
|
||||
|
||||
// Services used for communicating with the API.
|
||||
Contents ContentService
|
||||
Git GitService
|
||||
Organizations OrganizationService
|
||||
Issues IssueService
|
||||
PullRequests PullRequestService
|
||||
Repositories RepositoryService
|
||||
Reviews ReviewService
|
||||
Users UserService
|
||||
Webhooks WebhookService
|
||||
}
|
||||
)
|
||||
|
||||
// Do sends an API request and returns the API response.
|
||||
// The API response is JSON decoded and stored in the
|
||||
// value pointed to by v, or returned as an error if an
|
||||
// API error has occurred. If v implements the io.Writer
|
||||
// interface, the raw response will be written to v,
|
||||
// without attempting to decode it.
|
||||
func (c *Client) Do(ctx context.Context, in *Request) (*Response, error) {
|
||||
uri, err := c.BaseURL.Parse(in.Path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// creates a new http request with context.
|
||||
req, err := http.NewRequest(in.Method, uri.String(), in.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// hack to prevent the client from un-escaping the
|
||||
// encoded github path parameters when parsing the url.
|
||||
if strings.Contains(in.Path, "%2F") {
|
||||
req.URL.Opaque = strings.Split(req.URL.RawPath, "?")[0]
|
||||
}
|
||||
|
||||
req = req.WithContext(ctx)
|
||||
if in.Header != nil {
|
||||
req.Header = in.Header
|
||||
}
|
||||
|
||||
// use the default client if none provided.
|
||||
client := c.Client
|
||||
if client == nil {
|
||||
client = http.DefaultClient
|
||||
}
|
||||
res, err := client.Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return newResponse(res), nil
|
||||
}
|
||||
|
||||
// newResponse creates a new Response for the provided
|
||||
// http.Response. r must not be nil.
|
||||
func newResponse(r *http.Response) *Response {
|
||||
res := &Response{
|
||||
Status: r.StatusCode,
|
||||
Header: r.Header,
|
||||
Body: r.Body,
|
||||
}
|
||||
res.populatePageValues()
|
||||
return res
|
||||
}
|
||||
|
||||
// populatePageValues parses the HTTP Link response headers
|
||||
// and populates the various pagination link values in the
|
||||
// Response.
|
||||
//
|
||||
// Copyright 2013 The go-github AUTHORS. All rights reserved.
|
||||
// https://github.com/google/go-github
|
||||
func (r *Response) populatePageValues() {
|
||||
links := strings.Split(r.Header.Get("Link"), ",")
|
||||
for _, link := range links {
|
||||
segments := strings.Split(strings.TrimSpace(link), ";")
|
||||
|
||||
if len(segments) < 2 {
|
||||
continue
|
||||
}
|
||||
|
||||
if !strings.HasPrefix(segments[0], "<") ||
|
||||
!strings.HasSuffix(segments[0], ">") {
|
||||
continue
|
||||
}
|
||||
|
||||
url, err := url.Parse(segments[0][1 : len(segments[0])-1])
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
page := url.Query().Get("page")
|
||||
if page == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
for _, segment := range segments[1:] {
|
||||
switch strings.TrimSpace(segment) {
|
||||
case `rel="next"`:
|
||||
r.Page.Next, _ = strconv.Atoi(page)
|
||||
case `rel="prev"`:
|
||||
r.Page.Prev, _ = strconv.Atoi(page)
|
||||
case `rel="first"`:
|
||||
r.Page.First, _ = strconv.Atoi(page)
|
||||
case `rel="last"`:
|
||||
r.Page.Last, _ = strconv.Atoi(page)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package scm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestClient(t *testing.T) {
|
||||
t.Skip()
|
||||
}
|
||||
|
||||
func TestResponse(t *testing.T) {
|
||||
res := newResponse(&http.Response{
|
||||
StatusCode: 200,
|
||||
Header: http.Header{
|
||||
"Link": {`<https://api.github.com/resource?page=4>; rel="next",
|
||||
<https://api.github.com/resource?page=2>; rel="prev",
|
||||
<https://api.github.com/resource?page=1>; rel="first",
|
||||
<https://api.github.com/resource?page=5>; rel="last"`},
|
||||
},
|
||||
})
|
||||
if got, want := res.Status, 200; got != want {
|
||||
t.Errorf("Want status code %d, got %d", want, got)
|
||||
}
|
||||
if got, want := res.Page.First, 1; got != want {
|
||||
t.Errorf("Want rel first %d, got %d", want, got)
|
||||
}
|
||||
if got, want := res.Page.Last, 5; got != want {
|
||||
t.Errorf("Want rel last %d, got %d", want, got)
|
||||
}
|
||||
if got, want := res.Page.Prev, 2; got != want {
|
||||
t.Errorf("Want rel prev %d, got %d", want, got)
|
||||
}
|
||||
if got, want := res.Page.Next, 4; got != want {
|
||||
t.Errorf("Want rel next %d, got %d", want, got)
|
||||
}
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package scm
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// State represents the commit state.
|
||||
type State int
|
||||
|
||||
// State values.
|
||||
const (
|
||||
StateUnknown State = iota
|
||||
StatePending
|
||||
StateRunning
|
||||
StateSuccess
|
||||
StateFailure
|
||||
StateCanceled
|
||||
StateError
|
||||
)
|
||||
|
||||
// Action identifies webhook actions.
|
||||
type Action int
|
||||
|
||||
// Action values.
|
||||
const (
|
||||
ActionCreate Action = iota + 1
|
||||
ActionUpdate
|
||||
ActionDelete
|
||||
// issues
|
||||
ActionOpen
|
||||
ActionReopen
|
||||
ActionClose
|
||||
ActionLabel
|
||||
ActionUnlabel
|
||||
// pull requests
|
||||
ActionSync
|
||||
ActionMerge
|
||||
)
|
||||
|
||||
// String returns the string representation of Action.
|
||||
func (a Action) String() (s string) {
|
||||
switch a {
|
||||
case ActionCreate:
|
||||
return "created"
|
||||
case ActionUpdate:
|
||||
return "updated"
|
||||
case ActionDelete:
|
||||
return "deleted"
|
||||
case ActionLabel:
|
||||
return "labeled"
|
||||
case ActionUnlabel:
|
||||
return "unlabeled"
|
||||
case ActionOpen:
|
||||
return "opened"
|
||||
case ActionReopen:
|
||||
return "reopened"
|
||||
case ActionClose:
|
||||
return "closed"
|
||||
case ActionSync:
|
||||
return "synchronized"
|
||||
case ActionMerge:
|
||||
return "merged"
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalJSON returns the JSON-encoded Action.
|
||||
func (a Action) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(a.String())
|
||||
}
|
||||
|
||||
// UnmarshalJSON unmarshales the JSON-encoded Action.
|
||||
func (a *Action) UnmarshalJSON(data []byte) error {
|
||||
var s string
|
||||
if err := json.Unmarshal(data, &s); err != nil {
|
||||
return err
|
||||
}
|
||||
switch s {
|
||||
case "created":
|
||||
*a = ActionCreate
|
||||
case "updated":
|
||||
*a = ActionUpdate
|
||||
case "deleted":
|
||||
*a = ActionDelete
|
||||
case "labeled":
|
||||
*a = ActionLabel
|
||||
case "unlabeled":
|
||||
*a = ActionUnlabel
|
||||
case "opened":
|
||||
*a = ActionOpen
|
||||
case "reopened":
|
||||
*a = ActionReopen
|
||||
case "closed":
|
||||
*a = ActionClose
|
||||
case "synchronized":
|
||||
*a = ActionSync
|
||||
case "merged":
|
||||
*a = ActionMerge
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package scm
|
||||
|
||||
import "context"
|
||||
|
||||
type (
|
||||
// Content stores the contents of a repository file.
|
||||
Content struct {
|
||||
Path string
|
||||
Data []byte
|
||||
}
|
||||
|
||||
// ContentParams provide parameters for creating and
|
||||
// updating repository content.
|
||||
ContentParams struct {
|
||||
Ref string
|
||||
Branch string
|
||||
Message string
|
||||
Data []byte
|
||||
}
|
||||
|
||||
// ContentService provides access to repositroy content.
|
||||
ContentService interface {
|
||||
// Find returns the repository file content by path.
|
||||
Find(ctx context.Context, repo, path, ref string) (*Content, *Response, error)
|
||||
|
||||
// Create creates a new repositroy file.
|
||||
Create(ctx context.Context, repo, path string, params *ContentParams) (*Response, error)
|
||||
|
||||
// Update updates a repository file.
|
||||
Update(ctx context.Context, repo, path string, params *ContentParams) (*Response, error)
|
||||
|
||||
// Delete deletes a reository file.
|
||||
Delete(ctx context.Context, repo, path, ref string) (*Response, error)
|
||||
}
|
||||
)
|
@ -0,0 +1,64 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
)
|
||||
|
||||
type contentService struct {
|
||||
client *wrapper
|
||||
}
|
||||
|
||||
func (s *contentService) Find(ctx context.Context, repo, path, ref string) (*scm.Content, *scm.Response, error) {
|
||||
endpoint := fmt.Sprintf("repos/%s/contents/%s?ref=%s", repo, path, ref)
|
||||
out := new(content)
|
||||
res, err := s.client.do(ctx, "GET", endpoint, nil, out)
|
||||
raw, _ := base64.StdEncoding.DecodeString(out.Content)
|
||||
return &scm.Content{
|
||||
Path: out.Path,
|
||||
Data: raw,
|
||||
}, res, err
|
||||
}
|
||||
|
||||
func (s *contentService) Create(ctx context.Context, repo, path string, params *scm.ContentParams) (*scm.Response, error) {
|
||||
return nil, scm.ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *contentService) Update(ctx context.Context, repo, path string, params *scm.ContentParams) (*scm.Response, error) {
|
||||
return nil, scm.ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *contentService) Delete(ctx context.Context, repo, path, ref string) (*scm.Response, error) {
|
||||
return nil, scm.ErrNotSupported
|
||||
}
|
||||
|
||||
type content struct {
|
||||
Name string `json:"name"`
|
||||
Path string `json:"path"`
|
||||
Sha string `json:"sha"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
type contentUpdate struct {
|
||||
Sha string `json:"sha"`
|
||||
Message string `json:"message"`
|
||||
HTMLURL string `json:"html_url"`
|
||||
Author struct {
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
Date time.Time `json:"date"`
|
||||
} `json:"author"`
|
||||
Committer struct {
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
Date time.Time `json:"date"`
|
||||
} `json:"committer"`
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
"github.com/drone/go-scm/scm/driver/github/fixtures"
|
||||
)
|
||||
|
||||
func TestContentFind(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, _, err := client.Contents.Find(context.Background(), "octocat/hello-world", "README", "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if got, want := result.Path, "README"; got != want {
|
||||
t.Errorf("Want content Path %q, got %q", want, got)
|
||||
}
|
||||
if got, want := string(result.Data), "Hello World!\n"; got != want {
|
||||
t.Errorf("Want content Body %q, got %q", want, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestContentCreate(t *testing.T) {
|
||||
content := new(contentService)
|
||||
_, err := content.Create(context.Background(), "octocat/hello-world", "README", nil)
|
||||
if err != scm.ErrNotSupported {
|
||||
t.Errorf("Expect Not Supported error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestContentUpdate(t *testing.T) {
|
||||
content := new(contentService)
|
||||
_, err := content.Update(context.Background(), "octocat/hello-world", "README", nil)
|
||||
if err != scm.ErrNotSupported {
|
||||
t.Errorf("Expect Not Supported error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestContentDelete(t *testing.T) {
|
||||
content := new(contentService)
|
||||
_, err := content.Delete(context.Background(), "octocat/hello-world", "README", "master")
|
||||
if err != scm.ErrNotSupported {
|
||||
t.Errorf("Expect Not Supported error")
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
GET /repos/octocat/hello-world/branches/master
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
|
||||
{
|
||||
"name": "master",
|
||||
"commit": {
|
||||
"sha": "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
|
||||
"commit": {
|
||||
"author": {
|
||||
"name": "The Octocat",
|
||||
"date": "2012-03-06T15:06:50-08:00",
|
||||
"email": "octocat@nowhere.com"
|
||||
},
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/git/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
|
||||
"message": "Merge pull request #6 from Spaceghost/patch-1\n\nNew line at end of file.",
|
||||
"tree": {
|
||||
"sha": "b4eecafa9be2f2006ce1b709d6857b07069b4608",
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/git/trees/b4eecafa9be2f2006ce1b709d6857b07069b4608"
|
||||
},
|
||||
"committer": {
|
||||
"name": "The Octocat",
|
||||
"date": "2012-03-06T15:06:50-08:00",
|
||||
"email": "octocat@nowhere.com"
|
||||
},
|
||||
"verification": {
|
||||
"verified": false,
|
||||
"reason": "unsigned",
|
||||
"signature": null,
|
||||
"payload": null
|
||||
}
|
||||
},
|
||||
"author": {
|
||||
"gravatar_id": "",
|
||||
"avatar_url": "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"id": 583231,
|
||||
"login": "octocat"
|
||||
},
|
||||
"parents": [
|
||||
{
|
||||
"sha": "553c2077f0edc3d5dc5d17262f6aa498e69d6f8e",
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/commits/553c2077f0edc3d5dc5d17262f6aa498e69d6f8e"
|
||||
},
|
||||
{
|
||||
"sha": "762941318ee16e59dabbacb1b4049eec22f0d303",
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/commits/762941318ee16e59dabbacb1b4049eec22f0d303"
|
||||
}
|
||||
],
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
|
||||
"committer": {
|
||||
"gravatar_id": "",
|
||||
"avatar_url": "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"id": 583231,
|
||||
"login": "octocat"
|
||||
}
|
||||
},
|
||||
"_links": {
|
||||
"html": "https://github.com/octocat/Hello-World/tree/master",
|
||||
"self": "https://api.github.com/repos/octocat/Hello-World/branches/master"
|
||||
},
|
||||
"protected": true,
|
||||
"protection_url": "https://api.github.com/repos/octocat/Hello-World/branches/master/protection"
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
GET /repos/octocat/hello-world/branches?page=1&per_page=30
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
Link: <https://api.github.com/resource?page=2>; rel="next",
|
||||
<https://api.github.com/resource?page=1>; rel="prev",
|
||||
<https://api.github.com/resource?page=1>; rel="first",
|
||||
<https://api.github.com/resource?page=5>; rel="last"
|
||||
|
||||
[
|
||||
{
|
||||
"name": "master",
|
||||
"commit": {
|
||||
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc"
|
||||
},
|
||||
"protected": true,
|
||||
"protection_url": "https://api.github.com/repos/octocat/Hello-World/branches/master/protection"
|
||||
}
|
||||
]
|
@ -0,0 +1,109 @@
|
||||
GET /repos/octocat/hello-world/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
|
||||
{
|
||||
"sha": "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
|
||||
"commit": {
|
||||
"author": {
|
||||
"name": "The Octocat",
|
||||
"email": "octocat@nowhere.com",
|
||||
"date": "2012-03-06T23:06:50Z"
|
||||
},
|
||||
"committer": {
|
||||
"name": "The Octocat",
|
||||
"email": "octocat@nowhere.com",
|
||||
"date": "2012-03-06T23:06:50Z"
|
||||
},
|
||||
"message": "Merge pull request #6 from Spaceghost/patch-1\n\nNew line at end of file.",
|
||||
"tree": {
|
||||
"sha": "b4eecafa9be2f2006ce1b709d6857b07069b4608",
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/git/trees/b4eecafa9be2f2006ce1b709d6857b07069b4608"
|
||||
},
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/git/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
|
||||
"comment_count": 51,
|
||||
"verification": {
|
||||
"verified": false,
|
||||
"reason": "unsigned",
|
||||
"signature": null,
|
||||
"payload": null
|
||||
}
|
||||
},
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
|
||||
"html_url": "https://github.com/octocat/Hello-World/commit/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
|
||||
"comments_url": "https://api.github.com/repos/octocat/Hello-World/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d/comments",
|
||||
"author": {
|
||||
"login": "octocat",
|
||||
"id": 583231,
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/583231?v=4",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"committer": {
|
||||
"login": "octocat",
|
||||
"id": 583231,
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/583231?v=4",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"parents": [
|
||||
{
|
||||
"sha": "553c2077f0edc3d5dc5d17262f6aa498e69d6f8e",
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/commits/553c2077f0edc3d5dc5d17262f6aa498e69d6f8e",
|
||||
"html_url": "https://github.com/octocat/Hello-World/commit/553c2077f0edc3d5dc5d17262f6aa498e69d6f8e"
|
||||
},
|
||||
{
|
||||
"sha": "762941318ee16e59dabbacb1b4049eec22f0d303",
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/commits/762941318ee16e59dabbacb1b4049eec22f0d303",
|
||||
"html_url": "https://github.com/octocat/Hello-World/commit/762941318ee16e59dabbacb1b4049eec22f0d303"
|
||||
}
|
||||
],
|
||||
"stats": {
|
||||
"total": 2,
|
||||
"additions": 1,
|
||||
"deletions": 1
|
||||
},
|
||||
"files": [
|
||||
{
|
||||
"sha": "980a0d5f19a64b4b30a87d4206aade58726b60e3",
|
||||
"filename": "README",
|
||||
"status": "modified",
|
||||
"additions": 1,
|
||||
"deletions": 1,
|
||||
"changes": 2,
|
||||
"blob_url": "https://github.com/octocat/Hello-World/blob/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d/README",
|
||||
"raw_url": "https://github.com/octocat/Hello-World/raw/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d/README",
|
||||
"contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/README?ref=7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
|
||||
"patch": "@@ -1 +1 @@\n-Hello World!\n\\ No newline at end of file\n+Hello World!"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
GET /repos/octocat/hello-world/commits?ref=master
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
Link: <https://api.github.com/resource?page=2>; rel="next",
|
||||
<https://api.github.com/resource?page=1>; rel="prev",
|
||||
<https://api.github.com/resource?page=1>; rel="first",
|
||||
<https://api.github.com/resource?page=5>; rel="last"
|
||||
|
||||
[
|
||||
{
|
||||
"sha": "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
|
||||
"commit": {
|
||||
"author": {
|
||||
"name": "The Octocat",
|
||||
"email": "octocat@nowhere.com",
|
||||
"date": "2012-03-06T23:06:50Z"
|
||||
},
|
||||
"committer": {
|
||||
"name": "The Octocat",
|
||||
"email": "octocat@nowhere.com",
|
||||
"date": "2012-03-06T23:06:50Z"
|
||||
},
|
||||
"message": "Merge pull request #6 from Spaceghost/patch-1\n\nNew line at end of file.",
|
||||
"tree": {
|
||||
"sha": "b4eecafa9be2f2006ce1b709d6857b07069b4608",
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/git/trees/b4eecafa9be2f2006ce1b709d6857b07069b4608"
|
||||
},
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/git/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
|
||||
"comment_count": 51,
|
||||
"verification": {
|
||||
"verified": false,
|
||||
"reason": "unsigned",
|
||||
"signature": null,
|
||||
"payload": null
|
||||
}
|
||||
},
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
|
||||
"html_url": "https://github.com/octocat/Hello-World/commit/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
|
||||
"comments_url": "https://api.github.com/repos/octocat/Hello-World/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d/comments",
|
||||
"author": {
|
||||
"login": "octocat",
|
||||
"id": 583231,
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/583231?v=4",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"committer": {
|
||||
"login": "octocat",
|
||||
"id": 583231,
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/583231?v=4",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"parents": [
|
||||
{
|
||||
"sha": "553c2077f0edc3d5dc5d17262f6aa498e69d6f8e",
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/commits/553c2077f0edc3d5dc5d17262f6aa498e69d6f8e",
|
||||
"html_url": "https://github.com/octocat/Hello-World/commit/553c2077f0edc3d5dc5d17262f6aa498e69d6f8e"
|
||||
},
|
||||
{
|
||||
"sha": "762941318ee16e59dabbacb1b4049eec22f0d303",
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/commits/762941318ee16e59dabbacb1b4049eec22f0d303",
|
||||
"html_url": "https://github.com/octocat/Hello-World/commit/762941318ee16e59dabbacb1b4049eec22f0d303"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
@ -0,0 +1,27 @@
|
||||
GET /repos/octocat/hello-world/contents/README?ref=7fd1a60b01f91b314f59955a4e4d4e80d8edf11d
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
|
||||
{
|
||||
"name": "README",
|
||||
"path": "README",
|
||||
"sha": "980a0d5f19a64b4b30a87d4206aade58726b60e3",
|
||||
"size": 13,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/contents/README?ref=7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
|
||||
"html_url": "https://github.com/octocat/Hello-World/blob/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d/README",
|
||||
"git_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs/980a0d5f19a64b4b30a87d4206aade58726b60e3",
|
||||
"download_url": "https://raw.githubusercontent.com/octocat/Hello-World/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d/README",
|
||||
"type": "file",
|
||||
"content": "SGVsbG8gV29ybGQhCg==\n",
|
||||
"encoding": "base64",
|
||||
"_links": {
|
||||
"self": "https://api.github.com/repos/octocat/Hello-World/contents/README?ref=7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
|
||||
"git": "https://api.github.com/repos/octocat/Hello-World/git/blobs/980a0d5f19a64b4b30a87d4206aade58726b60e3",
|
||||
"html": "https://github.com/octocat/Hello-World/blob/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d/README"
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
DELETE /repos/octocat/hello-world/hooks/1
|
||||
Status: 204
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
|
@ -0,0 +1,27 @@
|
||||
GET /repos/octocat/hello-world/hooks/1
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
|
||||
{
|
||||
"id": 1,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/hooks/1",
|
||||
"test_url": "https://api.github.com/repos/octocat/Hello-World/hooks/1/test",
|
||||
"ping_url": "https://api.github.com/repos/octocat/Hello-World/hooks/1/pings",
|
||||
"name": "web",
|
||||
"events": [
|
||||
"push",
|
||||
"pull_request"
|
||||
],
|
||||
"active": true,
|
||||
"config": {
|
||||
"url": "http://example.com/webhook",
|
||||
"content_type": "json"
|
||||
},
|
||||
"updated_at": "2011-09-06T20:39:23Z",
|
||||
"created_at": "2011-09-06T17:26:27Z"
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
GET /repos/octocat/hello-world/hooks?page=1&per_page=30
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
Link: <https://api.github.com/resource?page=2>; rel="next",
|
||||
<https://api.github.com/resource?page=1>; rel="prev",
|
||||
<https://api.github.com/resource?page=1>; rel="first",
|
||||
<https://api.github.com/resource?page=5>; rel="last"
|
||||
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/hooks/1",
|
||||
"test_url": "https://api.github.com/repos/octocat/Hello-World/hooks/1/test",
|
||||
"ping_url": "https://api.github.com/repos/octocat/Hello-World/hooks/1/pings",
|
||||
"name": "web",
|
||||
"events": [
|
||||
"push",
|
||||
"pull_request"
|
||||
],
|
||||
"active": true,
|
||||
"config": {
|
||||
"url": "http://example.com/webhook",
|
||||
"content_type": "json"
|
||||
},
|
||||
"updated_at": "2011-09-06T20:39:23Z",
|
||||
"created_at": "2011-09-06T17:26:27Z"
|
||||
}
|
||||
]
|
@ -0,0 +1,27 @@
|
||||
POST /repos/octocat/hello-world/hooks
|
||||
Status: 201
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
|
||||
{
|
||||
"id": 1,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/hooks/1",
|
||||
"test_url": "https://api.github.com/repos/octocat/Hello-World/hooks/1/test",
|
||||
"ping_url": "https://api.github.com/repos/octocat/Hello-World/hooks/1/pings",
|
||||
"name": "web",
|
||||
"events": [
|
||||
"push",
|
||||
"pull_request"
|
||||
],
|
||||
"active": true,
|
||||
"config": {
|
||||
"url": "http://example.com/webhook",
|
||||
"content_type": "json"
|
||||
},
|
||||
"updated_at": "2011-09-06T20:39:23Z",
|
||||
"created_at": "2011-09-06T17:26:27Z"
|
||||
}
|
@ -0,0 +1,155 @@
|
||||
PATCH /repos/octocat/hello-world/issues/1
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
|
||||
{
|
||||
"id": 1,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
|
||||
"repository_url": "https://api.github.com/repos/octocat/Hello-World",
|
||||
"labels_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/labels{/name}",
|
||||
"comments_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments",
|
||||
"events_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/events",
|
||||
"html_url": "https://github.com/octocat/Hello-World/issues/1347",
|
||||
"number": 1347,
|
||||
"state": "open",
|
||||
"title": "Found a bug",
|
||||
"body": "I'm having a problem with this.",
|
||||
"user": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"labels": [
|
||||
{
|
||||
"id": 208045946,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
|
||||
"name": "bug",
|
||||
"color": "f29513",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"assignee": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"assignees": [
|
||||
{
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
}
|
||||
],
|
||||
"milestone": {
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
|
||||
"html_url": "https://github.com/octocat/Hello-World/milestones/v1.0",
|
||||
"labels_url": "https://api.github.com/repos/octocat/Hello-World/milestones/1/labels",
|
||||
"id": 1002604,
|
||||
"number": 1,
|
||||
"state": "open",
|
||||
"title": "v1.0",
|
||||
"description": "Tracking milestone for version 1.0",
|
||||
"creator": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"open_issues": 4,
|
||||
"closed_issues": 8,
|
||||
"created_at": "2011-04-10T20:09:31Z",
|
||||
"updated_at": "2014-03-03T18:58:10Z",
|
||||
"closed_at": "2013-02-12T13:22:01Z",
|
||||
"due_on": "2012-10-09T23:39:01Z"
|
||||
},
|
||||
"locked": false,
|
||||
"comments": 0,
|
||||
"pull_request": {
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347",
|
||||
"html_url": "https://github.com/octocat/Hello-World/pull/1347",
|
||||
"diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff",
|
||||
"patch_url": "https://github.com/octocat/Hello-World/pull/1347.patch"
|
||||
},
|
||||
"closed_at": null,
|
||||
"created_at": "2011-04-22T13:33:48Z",
|
||||
"updated_at": "2011-04-22T13:33:48Z",
|
||||
"closed_by": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
DELETE /repos/octocat/hello-world/issues/comments/1
|
||||
Status: 204
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
@ -0,0 +1,36 @@
|
||||
GET /repos/octocat/hello-world/issues/comments/1
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
|
||||
{
|
||||
"id": 1,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/issues/comments/1",
|
||||
"html_url": "https://github.com/octocat/Hello-World/issues/1347#issuecomment-1",
|
||||
"body": "Me too",
|
||||
"user": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"created_at": "2011-04-14T16:00:49Z",
|
||||
"updated_at": "2011-04-14T16:00:49Z"
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
GET /repos/octocat/hello-world/issues/1/comments?page=1&per_page=30
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
Link: <https://api.github.com/resource?page=2>; rel="next",
|
||||
<https://api.github.com/resource?page=1>; rel="prev",
|
||||
<https://api.github.com/resource?page=1>; rel="first",
|
||||
<https://api.github.com/resource?page=5>; rel="last"
|
||||
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/issues/comments/1",
|
||||
"html_url": "https://github.com/octocat/Hello-World/issues/1347#issuecomment-1",
|
||||
"body": "Me too",
|
||||
"user": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"created_at": "2011-04-14T16:00:49Z",
|
||||
"updated_at": "2011-04-14T16:00:49Z"
|
||||
}
|
||||
]
|
@ -0,0 +1,36 @@
|
||||
POST /repos/octocat/hello-world/issues/1/comments
|
||||
Status: 201
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
|
||||
{
|
||||
"id": 1,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/issues/comments/1",
|
||||
"html_url": "https://github.com/octocat/Hello-World/issues/1347#issuecomment-1",
|
||||
"body": "Me too",
|
||||
"user": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"created_at": "2011-04-14T16:00:49Z",
|
||||
"updated_at": "2011-04-14T16:00:49Z"
|
||||
}
|
@ -0,0 +1,155 @@
|
||||
GET /repos/octocat/hello-world/issues/1
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
|
||||
{
|
||||
"id": 1,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
|
||||
"repository_url": "https://api.github.com/repos/octocat/Hello-World",
|
||||
"labels_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/labels{/name}",
|
||||
"comments_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments",
|
||||
"events_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/events",
|
||||
"html_url": "https://github.com/octocat/Hello-World/issues/1347",
|
||||
"number": 1347,
|
||||
"state": "open",
|
||||
"title": "Found a bug",
|
||||
"body": "I'm having a problem with this.",
|
||||
"user": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"labels": [
|
||||
{
|
||||
"id": 208045946,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
|
||||
"name": "bug",
|
||||
"color": "f29513",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"assignee": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"assignees": [
|
||||
{
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
}
|
||||
],
|
||||
"milestone": {
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
|
||||
"html_url": "https://github.com/octocat/Hello-World/milestones/v1.0",
|
||||
"labels_url": "https://api.github.com/repos/octocat/Hello-World/milestones/1/labels",
|
||||
"id": 1002604,
|
||||
"number": 1,
|
||||
"state": "open",
|
||||
"title": "v1.0",
|
||||
"description": "Tracking milestone for version 1.0",
|
||||
"creator": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"open_issues": 4,
|
||||
"closed_issues": 8,
|
||||
"created_at": "2011-04-10T20:09:31Z",
|
||||
"updated_at": "2014-03-03T18:58:10Z",
|
||||
"closed_at": "2013-02-12T13:22:01Z",
|
||||
"due_on": "2012-10-09T23:39:01Z"
|
||||
},
|
||||
"locked": false,
|
||||
"comments": 0,
|
||||
"pull_request": {
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347",
|
||||
"html_url": "https://github.com/octocat/Hello-World/pull/1347",
|
||||
"diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff",
|
||||
"patch_url": "https://github.com/octocat/Hello-World/pull/1347.patch"
|
||||
},
|
||||
"closed_at": null,
|
||||
"created_at": "2011-04-22T13:33:48Z",
|
||||
"updated_at": "2011-04-22T13:33:48Z",
|
||||
"closed_by": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
}
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
GET /repos/octocat/hello-world/issues?page=1&per_page=30&state=all
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
Link: <https://api.github.com/resource?page=2>; rel="next",
|
||||
<https://api.github.com/resource?page=1>; rel="prev",
|
||||
<https://api.github.com/resource?page=1>; rel="first",
|
||||
<https://api.github.com/resource?page=5>; rel="last"
|
||||
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
|
||||
"repository_url": "https://api.github.com/repos/octocat/Hello-World",
|
||||
"labels_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/labels{/name}",
|
||||
"comments_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments",
|
||||
"events_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/events",
|
||||
"html_url": "https://github.com/octocat/Hello-World/issues/1347",
|
||||
"number": 1347,
|
||||
"state": "open",
|
||||
"title": "Found a bug",
|
||||
"body": "I'm having a problem with this.",
|
||||
"user": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"labels": [
|
||||
{
|
||||
"id": 208045946,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
|
||||
"name": "bug",
|
||||
"color": "f29513",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"assignee": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"assignees": [
|
||||
{
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
}
|
||||
],
|
||||
"milestone": {
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
|
||||
"html_url": "https://github.com/octocat/Hello-World/milestones/v1.0",
|
||||
"labels_url": "https://api.github.com/repos/octocat/Hello-World/milestones/1/labels",
|
||||
"id": 1002604,
|
||||
"number": 1,
|
||||
"state": "open",
|
||||
"title": "v1.0",
|
||||
"description": "Tracking milestone for version 1.0",
|
||||
"creator": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"open_issues": 4,
|
||||
"closed_issues": 8,
|
||||
"created_at": "2011-04-10T20:09:31Z",
|
||||
"updated_at": "2014-03-03T18:58:10Z",
|
||||
"closed_at": "2013-02-12T13:22:01Z",
|
||||
"due_on": "2012-10-09T23:39:01Z"
|
||||
},
|
||||
"locked": false,
|
||||
"comments": 0,
|
||||
"pull_request": {
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347",
|
||||
"html_url": "https://github.com/octocat/Hello-World/pull/1347",
|
||||
"diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff",
|
||||
"patch_url": "https://github.com/octocat/Hello-World/pull/1347.patch"
|
||||
},
|
||||
"closed_at": null,
|
||||
"created_at": "2011-04-22T13:33:48Z",
|
||||
"updated_at": "2011-04-22T13:33:48Z"
|
||||
}
|
||||
]
|
@ -0,0 +1,9 @@
|
||||
PUT /repos/octocat/hello-world/issues/1/lock
|
||||
Status: 204
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
|
@ -0,0 +1,155 @@
|
||||
POST /repos/octocat/hello-world/issues
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
|
||||
{
|
||||
"id": 1,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
|
||||
"repository_url": "https://api.github.com/repos/octocat/Hello-World",
|
||||
"labels_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/labels{/name}",
|
||||
"comments_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments",
|
||||
"events_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/events",
|
||||
"html_url": "https://github.com/octocat/Hello-World/issues/1347",
|
||||
"number": 1347,
|
||||
"state": "open",
|
||||
"title": "Found a bug",
|
||||
"body": "I'm having a problem with this.",
|
||||
"user": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"labels": [
|
||||
{
|
||||
"id": 208045946,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
|
||||
"name": "bug",
|
||||
"color": "f29513",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"assignee": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"assignees": [
|
||||
{
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
}
|
||||
],
|
||||
"milestone": {
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
|
||||
"html_url": "https://github.com/octocat/Hello-World/milestones/v1.0",
|
||||
"labels_url": "https://api.github.com/repos/octocat/Hello-World/milestones/1/labels",
|
||||
"id": 1002604,
|
||||
"number": 1,
|
||||
"state": "open",
|
||||
"title": "v1.0",
|
||||
"description": "Tracking milestone for version 1.0",
|
||||
"creator": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"open_issues": 4,
|
||||
"closed_issues": 8,
|
||||
"created_at": "2011-04-10T20:09:31Z",
|
||||
"updated_at": "2014-03-03T18:58:10Z",
|
||||
"closed_at": "2013-02-12T13:22:01Z",
|
||||
"due_on": "2012-10-09T23:39:01Z"
|
||||
},
|
||||
"locked": false,
|
||||
"comments": 0,
|
||||
"pull_request": {
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347",
|
||||
"html_url": "https://github.com/octocat/Hello-World/pull/1347",
|
||||
"diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff",
|
||||
"patch_url": "https://github.com/octocat/Hello-World/pull/1347.patch"
|
||||
},
|
||||
"closed_at": null,
|
||||
"created_at": "2011-04-22T13:33:48Z",
|
||||
"updated_at": "2011-04-22T13:33:48Z",
|
||||
"closed_by": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
DELETE /repos/octocat/hello-world/issues/1/lock
|
||||
Status: 204
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
|
@ -0,0 +1,47 @@
|
||||
GET /orgs/github
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
|
||||
{
|
||||
"login": "github",
|
||||
"id": 1,
|
||||
"url": "https://api.github.com/orgs/github",
|
||||
"repos_url": "https://api.github.com/orgs/github/repos",
|
||||
"events_url": "https://api.github.com/orgs/github/events",
|
||||
"hooks_url": "https://api.github.com/orgs/github/hooks",
|
||||
"issues_url": "https://api.github.com/orgs/github/issues",
|
||||
"members_url": "https://api.github.com/orgs/github/members{/member}",
|
||||
"public_members_url": "https://api.github.com/orgs/github/public_members{/member}",
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"description": "A great organization",
|
||||
"name": "github",
|
||||
"company": "GitHub",
|
||||
"blog": "https://github.com/blog",
|
||||
"location": "San Francisco",
|
||||
"email": "octocat@github.com",
|
||||
"public_repos": 2,
|
||||
"public_gists": 1,
|
||||
"followers": 20,
|
||||
"following": 0,
|
||||
"html_url": "https://github.com/octocat",
|
||||
"created_at": "2008-01-14T04:33:35Z",
|
||||
"type": "Organization",
|
||||
"total_private_repos": 100,
|
||||
"owned_private_repos": 100,
|
||||
"private_gists": 81,
|
||||
"disk_usage": 10000,
|
||||
"collaborators": 8,
|
||||
"billing_email": "support@github.com",
|
||||
"plan": {
|
||||
"name": "Medium",
|
||||
"space": 400,
|
||||
"private_repos": 20
|
||||
},
|
||||
"default_repository_settings": "read",
|
||||
"members_can_create_repositories": true
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
GET /user/orgs?page=1&per_page=30
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
Link: <https://api.github.com/resource?page=2>; rel="next",
|
||||
<https://api.github.com/resource?page=1>; rel="prev",
|
||||
<https://api.github.com/resource?page=1>; rel="first",
|
||||
<https://api.github.com/resource?page=5>; rel="last"
|
||||
|
||||
[
|
||||
{
|
||||
"login": "github",
|
||||
"id": 1,
|
||||
"url": "https://api.github.com/orgs/github",
|
||||
"repos_url": "https://api.github.com/orgs/github/repos",
|
||||
"events_url": "https://api.github.com/orgs/github/events",
|
||||
"hooks_url": "https://api.github.com/orgs/github/hooks",
|
||||
"issues_url": "https://api.github.com/orgs/github/issues",
|
||||
"members_url": "https://api.github.com/orgs/github/members{/member}",
|
||||
"public_members_url": "https://api.github.com/orgs/github/public_members{/member}",
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"description": "A great organization"
|
||||
}
|
||||
]
|
@ -0,0 +1,382 @@
|
||||
PATCH /repos/octocat/hello-world/pulls/1347
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
|
||||
{
|
||||
"id": 1,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347",
|
||||
"html_url": "https://github.com/octocat/Hello-World/pull/1347",
|
||||
"diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff",
|
||||
"patch_url": "https://github.com/octocat/Hello-World/pull/1347.patch",
|
||||
"issue_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
|
||||
"commits_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits",
|
||||
"review_comments_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments",
|
||||
"review_comment_url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}",
|
||||
"comments_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments",
|
||||
"statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||
"number": 1347,
|
||||
"state": "open",
|
||||
"title": "new-feature",
|
||||
"body": "Please pull these awesome changes",
|
||||
"assignee": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"milestone": {
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
|
||||
"html_url": "https://github.com/octocat/Hello-World/milestones/v1.0",
|
||||
"labels_url": "https://api.github.com/repos/octocat/Hello-World/milestones/1/labels",
|
||||
"id": 1002604,
|
||||
"number": 1,
|
||||
"state": "open",
|
||||
"title": "v1.0",
|
||||
"description": "Tracking milestone for version 1.0",
|
||||
"creator": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"open_issues": 4,
|
||||
"closed_issues": 8,
|
||||
"created_at": "2011-04-10T20:09:31Z",
|
||||
"updated_at": "2014-03-03T18:58:10Z",
|
||||
"closed_at": "2013-02-12T13:22:01Z",
|
||||
"due_on": "2012-10-09T23:39:01Z"
|
||||
},
|
||||
"locked": false,
|
||||
"created_at": "2011-01-26T19:01:12Z",
|
||||
"updated_at": "2011-01-26T19:01:12Z",
|
||||
"closed_at": "2011-01-26T19:01:12Z",
|
||||
"merged_at": "2011-01-26T19:01:12Z",
|
||||
"head": {
|
||||
"label": "new-topic",
|
||||
"ref": "new-topic",
|
||||
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||
"user": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"repo": {
|
||||
"id": 1296269,
|
||||
"owner": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"name": "Hello-World",
|
||||
"full_name": "octocat/Hello-World",
|
||||
"description": "This your first repo!",
|
||||
"private": false,
|
||||
"fork": true,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World",
|
||||
"html_url": "https://github.com/octocat/Hello-World",
|
||||
"archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
|
||||
"assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
|
||||
"blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
|
||||
"branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
|
||||
"clone_url": "https://github.com/octocat/Hello-World.git",
|
||||
"collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
|
||||
"comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
|
||||
"commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
|
||||
"compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
|
||||
"contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
|
||||
"contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
|
||||
"deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
|
||||
"downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
|
||||
"events_url": "http://api.github.com/repos/octocat/Hello-World/events",
|
||||
"forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
|
||||
"git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
|
||||
"git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
|
||||
"git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
|
||||
"git_url": "git:github.com/octocat/Hello-World.git",
|
||||
"hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
|
||||
"issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
|
||||
"issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
|
||||
"issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
|
||||
"keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
|
||||
"labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
|
||||
"languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
|
||||
"merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
|
||||
"milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
|
||||
"mirror_url": "git:git.example.com/octocat/Hello-World",
|
||||
"notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since, all, participating}",
|
||||
"pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
|
||||
"releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
|
||||
"ssh_url": "git@github.com:octocat/Hello-World.git",
|
||||
"stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
|
||||
"statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
|
||||
"subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
|
||||
"subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
|
||||
"svn_url": "https://svn.github.com/octocat/Hello-World",
|
||||
"tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
|
||||
"teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
|
||||
"trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
|
||||
"homepage": "https://github.com",
|
||||
"language": null,
|
||||
"forks_count": 9,
|
||||
"stargazers_count": 80,
|
||||
"watchers_count": 80,
|
||||
"size": 108,
|
||||
"default_branch": "master",
|
||||
"open_issues_count": 0,
|
||||
"topics": [
|
||||
"octocat",
|
||||
"atom",
|
||||
"electron",
|
||||
"API"
|
||||
],
|
||||
"has_issues": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"has_downloads": true,
|
||||
"archived": false,
|
||||
"pushed_at": "2011-01-26T19:06:43Z",
|
||||
"created_at": "2011-01-26T19:01:12Z",
|
||||
"updated_at": "2011-01-26T19:14:43Z",
|
||||
"permissions": {
|
||||
"admin": false,
|
||||
"push": false,
|
||||
"pull": true
|
||||
},
|
||||
"allow_rebase_merge": true,
|
||||
"allow_squash_merge": true,
|
||||
"allow_merge_commit": true,
|
||||
"subscribers_count": 42,
|
||||
"network_count": 0
|
||||
}
|
||||
},
|
||||
"base": {
|
||||
"label": "master",
|
||||
"ref": "master",
|
||||
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||
"user": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"repo": {
|
||||
"id": 1296269,
|
||||
"owner": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"name": "Hello-World",
|
||||
"full_name": "octocat/Hello-World",
|
||||
"description": "This your first repo!",
|
||||
"private": false,
|
||||
"fork": true,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World",
|
||||
"html_url": "https://github.com/octocat/Hello-World",
|
||||
"archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
|
||||
"assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
|
||||
"blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
|
||||
"branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
|
||||
"clone_url": "https://github.com/octocat/Hello-World.git",
|
||||
"collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
|
||||
"comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
|
||||
"commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
|
||||
"compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
|
||||
"contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
|
||||
"contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
|
||||
"deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
|
||||
"downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
|
||||
"events_url": "http://api.github.com/repos/octocat/Hello-World/events",
|
||||
"forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
|
||||
"git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
|
||||
"git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
|
||||
"git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
|
||||
"git_url": "git:github.com/octocat/Hello-World.git",
|
||||
"hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
|
||||
"issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
|
||||
"issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
|
||||
"issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
|
||||
"keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
|
||||
"labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
|
||||
"languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
|
||||
"merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
|
||||
"milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
|
||||
"mirror_url": "git:git.example.com/octocat/Hello-World",
|
||||
"notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since, all, participating}",
|
||||
"pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
|
||||
"releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
|
||||
"ssh_url": "git@github.com:octocat/Hello-World.git",
|
||||
"stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
|
||||
"statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
|
||||
"subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
|
||||
"subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
|
||||
"svn_url": "https://svn.github.com/octocat/Hello-World",
|
||||
"tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
|
||||
"teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
|
||||
"trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
|
||||
"homepage": "https://github.com",
|
||||
"language": null,
|
||||
"forks_count": 9,
|
||||
"stargazers_count": 80,
|
||||
"watchers_count": 80,
|
||||
"size": 108,
|
||||
"default_branch": "master",
|
||||
"open_issues_count": 0,
|
||||
"topics": [
|
||||
"octocat",
|
||||
"atom",
|
||||
"electron",
|
||||
"API"
|
||||
],
|
||||
"has_issues": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"has_downloads": true,
|
||||
"archived": false,
|
||||
"pushed_at": "2011-01-26T19:06:43Z",
|
||||
"created_at": "2011-01-26T19:01:12Z",
|
||||
"updated_at": "2011-01-26T19:14:43Z",
|
||||
"permissions": {
|
||||
"admin": false,
|
||||
"push": false,
|
||||
"pull": true
|
||||
},
|
||||
"allow_rebase_merge": true,
|
||||
"allow_squash_merge": true,
|
||||
"allow_merge_commit": true,
|
||||
"subscribers_count": 42,
|
||||
"network_count": 0
|
||||
}
|
||||
},
|
||||
"_links": {
|
||||
"self": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/1347"
|
||||
},
|
||||
"html": {
|
||||
"href": "https://github.com/octocat/Hello-World/pull/1347"
|
||||
},
|
||||
"issue": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/issues/1347"
|
||||
},
|
||||
"comments": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments"
|
||||
},
|
||||
"review_comments": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments"
|
||||
},
|
||||
"review_comment": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}"
|
||||
},
|
||||
"commits": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits"
|
||||
},
|
||||
"statuses": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e"
|
||||
}
|
||||
},
|
||||
"user": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
POST /repos/octocat/hello-world/pulls/1/comments
|
||||
Status: 201
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
|
||||
{
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1",
|
||||
"id": 10,
|
||||
"pull_request_review_id": 42,
|
||||
"diff_hunk": "@@ -16,33 +16,40 @@ public class Connection : IConnection...",
|
||||
"path": "file1.txt",
|
||||
"position": 1,
|
||||
"original_position": 4,
|
||||
"commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||
"original_commit_id": "9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840",
|
||||
"in_reply_to_id": 8,
|
||||
"user": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"body": "Great stuff",
|
||||
"created_at": "2011-04-14T16:00:49Z",
|
||||
"updated_at": "2011-04-14T16:00:49Z",
|
||||
"html_url": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1",
|
||||
"pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1",
|
||||
"_links": {
|
||||
"self": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1"
|
||||
},
|
||||
"html": {
|
||||
"href": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1"
|
||||
},
|
||||
"pull_request": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/1"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
DELETE /repos/octocat/hello-world/pulls/1/comments/1
|
||||
Status: 204
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
|
@ -0,0 +1,55 @@
|
||||
GET /repos/octocat/hello-world/pulls/1/comments/1
|
||||
Status: 200
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
|
||||
{
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1",
|
||||
"id": 10,
|
||||
"pull_request_review_id": 42,
|
||||
"diff_hunk": "@@ -16,33 +16,40 @@ public class Connection : IConnection...",
|
||||
"path": "file1.txt",
|
||||
"position": 1,
|
||||
"original_position": 4,
|
||||
"commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||
"original_commit_id": "9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840",
|
||||
"in_reply_to_id": 8,
|
||||
"user": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"body": "Great stuff",
|
||||
"created_at": "2011-04-14T16:00:49Z",
|
||||
"updated_at": "2011-04-14T16:00:49Z",
|
||||
"html_url": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1",
|
||||
"pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1",
|
||||
"_links": {
|
||||
"self": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1"
|
||||
},
|
||||
"html": {
|
||||
"href": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1"
|
||||
},
|
||||
"pull_request": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/1"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
GET /repos/octocat/hello-world/pulls/1/comments?page=1&per_page=30
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
Link: <https://api.github.com/resource?page=2>; rel="next",
|
||||
<https://api.github.com/resource?page=1>; rel="prev",
|
||||
<https://api.github.com/resource?page=1>; rel="first",
|
||||
<https://api.github.com/resource?page=5>; rel="last"
|
||||
|
||||
[
|
||||
{
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1",
|
||||
"id": 10,
|
||||
"pull_request_review_id": 42,
|
||||
"diff_hunk": "@@ -16,33 +16,40 @@ public class Connection : IConnection...",
|
||||
"path": "file1.txt",
|
||||
"position": 1,
|
||||
"original_position": 4,
|
||||
"commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||
"original_commit_id": "9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840",
|
||||
"in_reply_to_id": 8,
|
||||
"user": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"body": "Great stuff",
|
||||
"created_at": "2011-04-14T16:00:49Z",
|
||||
"updated_at": "2011-04-14T16:00:49Z",
|
||||
"html_url": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1",
|
||||
"pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1",
|
||||
"_links": {
|
||||
"self": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1"
|
||||
},
|
||||
"html": {
|
||||
"href": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1"
|
||||
},
|
||||
"pull_request": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/1"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
@ -0,0 +1,27 @@
|
||||
GET /repos/octocat/hello-world/pulls/1347/files?page=1&per_page=30
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
Link: <https://api.github.com/resource?page=2>; rel="next",
|
||||
<https://api.github.com/resource?page=1>; rel="prev",
|
||||
<https://api.github.com/resource?page=1>; rel="first",
|
||||
<https://api.github.com/resource?page=5>; rel="last"
|
||||
|
||||
[
|
||||
{
|
||||
"sha": "bbcd538c8e72b8c175046e27cc8f907076331401",
|
||||
"filename": "file1.txt",
|
||||
"status": "added",
|
||||
"additions": 103,
|
||||
"deletions": 21,
|
||||
"changes": 124,
|
||||
"blob_url": "https://github.com/octocat/Hello-World/blob/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt",
|
||||
"raw_url": "https://github.com/octocat/Hello-World/raw/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt",
|
||||
"contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/file1.txt?ref=6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||
"patch": "@@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test"
|
||||
}
|
||||
]
|
@ -0,0 +1,410 @@
|
||||
GET /repos/octocat/hello-world/pulls/1347
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
|
||||
{
|
||||
"id": 1,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347",
|
||||
"html_url": "https://github.com/octocat/Hello-World/pull/1347",
|
||||
"diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff",
|
||||
"patch_url": "https://github.com/octocat/Hello-World/pull/1347.patch",
|
||||
"issue_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
|
||||
"commits_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits",
|
||||
"review_comments_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments",
|
||||
"review_comment_url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}",
|
||||
"comments_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments",
|
||||
"statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||
"number": 1347,
|
||||
"state": "open",
|
||||
"title": "new-feature",
|
||||
"body": "Please pull these awesome changes",
|
||||
"assignee": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"milestone": {
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
|
||||
"html_url": "https://github.com/octocat/Hello-World/milestones/v1.0",
|
||||
"labels_url": "https://api.github.com/repos/octocat/Hello-World/milestones/1/labels",
|
||||
"id": 1002604,
|
||||
"number": 1,
|
||||
"state": "open",
|
||||
"title": "v1.0",
|
||||
"description": "Tracking milestone for version 1.0",
|
||||
"creator": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"open_issues": 4,
|
||||
"closed_issues": 8,
|
||||
"created_at": "2011-04-10T20:09:31Z",
|
||||
"updated_at": "2014-03-03T18:58:10Z",
|
||||
"closed_at": "2013-02-12T13:22:01Z",
|
||||
"due_on": "2012-10-09T23:39:01Z"
|
||||
},
|
||||
"locked": false,
|
||||
"created_at": "2011-01-26T19:01:12Z",
|
||||
"updated_at": "2011-01-26T19:01:12Z",
|
||||
"closed_at": "2011-01-26T19:01:12Z",
|
||||
"merged_at": "2011-01-26T19:01:12Z",
|
||||
"head": {
|
||||
"label": "new-topic",
|
||||
"ref": "new-topic",
|
||||
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||
"user": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"repo": {
|
||||
"id": 1296269,
|
||||
"owner": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"name": "Hello-World",
|
||||
"full_name": "octocat/Hello-World",
|
||||
"description": "This your first repo!",
|
||||
"private": false,
|
||||
"fork": true,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World",
|
||||
"html_url": "https://github.com/octocat/Hello-World",
|
||||
"archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
|
||||
"assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
|
||||
"blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
|
||||
"branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
|
||||
"clone_url": "https://github.com/octocat/Hello-World.git",
|
||||
"collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
|
||||
"comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
|
||||
"commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
|
||||
"compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
|
||||
"contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
|
||||
"contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
|
||||
"deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
|
||||
"downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
|
||||
"events_url": "http://api.github.com/repos/octocat/Hello-World/events",
|
||||
"forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
|
||||
"git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
|
||||
"git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
|
||||
"git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
|
||||
"git_url": "git:github.com/octocat/Hello-World.git",
|
||||
"hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
|
||||
"issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
|
||||
"issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
|
||||
"issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
|
||||
"keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
|
||||
"labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
|
||||
"languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
|
||||
"merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
|
||||
"milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
|
||||
"mirror_url": "git:git.example.com/octocat/Hello-World",
|
||||
"notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since, all, participating}",
|
||||
"pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
|
||||
"releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
|
||||
"ssh_url": "git@github.com:octocat/Hello-World.git",
|
||||
"stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
|
||||
"statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
|
||||
"subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
|
||||
"subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
|
||||
"svn_url": "https://svn.github.com/octocat/Hello-World",
|
||||
"tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
|
||||
"teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
|
||||
"trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
|
||||
"homepage": "https://github.com",
|
||||
"language": null,
|
||||
"forks_count": 9,
|
||||
"stargazers_count": 80,
|
||||
"watchers_count": 80,
|
||||
"size": 108,
|
||||
"default_branch": "master",
|
||||
"open_issues_count": 0,
|
||||
"topics": [
|
||||
"octocat",
|
||||
"atom",
|
||||
"electron",
|
||||
"API"
|
||||
],
|
||||
"has_issues": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"has_downloads": true,
|
||||
"archived": false,
|
||||
"pushed_at": "2011-01-26T19:06:43Z",
|
||||
"created_at": "2011-01-26T19:01:12Z",
|
||||
"updated_at": "2011-01-26T19:14:43Z",
|
||||
"permissions": {
|
||||
"admin": false,
|
||||
"push": false,
|
||||
"pull": true
|
||||
},
|
||||
"allow_rebase_merge": true,
|
||||
"allow_squash_merge": true,
|
||||
"allow_merge_commit": true,
|
||||
"subscribers_count": 42,
|
||||
"network_count": 0
|
||||
}
|
||||
},
|
||||
"base": {
|
||||
"label": "master",
|
||||
"ref": "master",
|
||||
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||
"user": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"repo": {
|
||||
"id": 1296269,
|
||||
"owner": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"name": "Hello-World",
|
||||
"full_name": "octocat/Hello-World",
|
||||
"description": "This your first repo!",
|
||||
"private": false,
|
||||
"fork": true,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World",
|
||||
"html_url": "https://github.com/octocat/Hello-World",
|
||||
"archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
|
||||
"assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
|
||||
"blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
|
||||
"branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
|
||||
"clone_url": "https://github.com/octocat/Hello-World.git",
|
||||
"collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
|
||||
"comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
|
||||
"commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
|
||||
"compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
|
||||
"contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
|
||||
"contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
|
||||
"deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
|
||||
"downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
|
||||
"events_url": "http://api.github.com/repos/octocat/Hello-World/events",
|
||||
"forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
|
||||
"git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
|
||||
"git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
|
||||
"git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
|
||||
"git_url": "git:github.com/octocat/Hello-World.git",
|
||||
"hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
|
||||
"issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
|
||||
"issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
|
||||
"issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
|
||||
"keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
|
||||
"labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
|
||||
"languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
|
||||
"merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
|
||||
"milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
|
||||
"mirror_url": "git:git.example.com/octocat/Hello-World",
|
||||
"notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since, all, participating}",
|
||||
"pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
|
||||
"releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
|
||||
"ssh_url": "git@github.com:octocat/Hello-World.git",
|
||||
"stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
|
||||
"statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
|
||||
"subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
|
||||
"subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
|
||||
"svn_url": "https://svn.github.com/octocat/Hello-World",
|
||||
"tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
|
||||
"teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
|
||||
"trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
|
||||
"homepage": "https://github.com",
|
||||
"language": null,
|
||||
"forks_count": 9,
|
||||
"stargazers_count": 80,
|
||||
"watchers_count": 80,
|
||||
"size": 108,
|
||||
"default_branch": "master",
|
||||
"open_issues_count": 0,
|
||||
"topics": [
|
||||
"octocat",
|
||||
"atom",
|
||||
"electron",
|
||||
"API"
|
||||
],
|
||||
"has_issues": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"has_downloads": true,
|
||||
"archived": false,
|
||||
"pushed_at": "2011-01-26T19:06:43Z",
|
||||
"created_at": "2011-01-26T19:01:12Z",
|
||||
"updated_at": "2011-01-26T19:14:43Z",
|
||||
"permissions": {
|
||||
"admin": false,
|
||||
"push": false,
|
||||
"pull": true
|
||||
},
|
||||
"allow_rebase_merge": true,
|
||||
"allow_squash_merge": true,
|
||||
"allow_merge_commit": true,
|
||||
"subscribers_count": 42,
|
||||
"network_count": 0
|
||||
}
|
||||
},
|
||||
"_links": {
|
||||
"self": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/1347"
|
||||
},
|
||||
"html": {
|
||||
"href": "https://github.com/octocat/Hello-World/pull/1347"
|
||||
},
|
||||
"issue": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/issues/1347"
|
||||
},
|
||||
"comments": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments"
|
||||
},
|
||||
"review_comments": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments"
|
||||
},
|
||||
"review_comment": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}"
|
||||
},
|
||||
"commits": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits"
|
||||
},
|
||||
"statuses": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e"
|
||||
}
|
||||
},
|
||||
"user": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"merge_commit_sha": "e5bd3914e2e596debea16f433f57875b5b90bcd6",
|
||||
"merged": false,
|
||||
"mergeable": true,
|
||||
"merged_by": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"comments": 10,
|
||||
"commits": 3,
|
||||
"additions": 100,
|
||||
"deletions": 3,
|
||||
"changed_files": 5,
|
||||
"maintainer_can_modify": true
|
||||
}
|
@ -0,0 +1,388 @@
|
||||
GET /repos/octocat/hello-world/pulls?page=1&per_page=30&state=all
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
Link: <https://api.github.com/resource?page=2>; rel="next",
|
||||
<https://api.github.com/resource?page=1>; rel="prev",
|
||||
<https://api.github.com/resource?page=1>; rel="first",
|
||||
<https://api.github.com/resource?page=5>; rel="last"
|
||||
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347",
|
||||
"html_url": "https://github.com/octocat/Hello-World/pull/1347",
|
||||
"diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff",
|
||||
"patch_url": "https://github.com/octocat/Hello-World/pull/1347.patch",
|
||||
"issue_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
|
||||
"commits_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits",
|
||||
"review_comments_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments",
|
||||
"review_comment_url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}",
|
||||
"comments_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments",
|
||||
"statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||
"number": 1347,
|
||||
"state": "open",
|
||||
"title": "new-feature",
|
||||
"body": "Please pull these awesome changes",
|
||||
"assignee": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"milestone": {
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
|
||||
"html_url": "https://github.com/octocat/Hello-World/milestones/v1.0",
|
||||
"labels_url": "https://api.github.com/repos/octocat/Hello-World/milestones/1/labels",
|
||||
"id": 1002604,
|
||||
"number": 1,
|
||||
"state": "open",
|
||||
"title": "v1.0",
|
||||
"description": "Tracking milestone for version 1.0",
|
||||
"creator": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"open_issues": 4,
|
||||
"closed_issues": 8,
|
||||
"created_at": "2011-04-10T20:09:31Z",
|
||||
"updated_at": "2014-03-03T18:58:10Z",
|
||||
"closed_at": "2013-02-12T13:22:01Z",
|
||||
"due_on": "2012-10-09T23:39:01Z"
|
||||
},
|
||||
"locked": false,
|
||||
"created_at": "2011-01-26T19:01:12Z",
|
||||
"updated_at": "2011-01-26T19:01:12Z",
|
||||
"closed_at": "2011-01-26T19:01:12Z",
|
||||
"merged_at": "2011-01-26T19:01:12Z",
|
||||
"head": {
|
||||
"label": "new-topic",
|
||||
"ref": "new-topic",
|
||||
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||
"user": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"repo": {
|
||||
"id": 1296269,
|
||||
"owner": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"name": "Hello-World",
|
||||
"full_name": "octocat/Hello-World",
|
||||
"description": "This your first repo!",
|
||||
"private": false,
|
||||
"fork": true,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World",
|
||||
"html_url": "https://github.com/octocat/Hello-World",
|
||||
"archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
|
||||
"assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
|
||||
"blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
|
||||
"branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
|
||||
"clone_url": "https://github.com/octocat/Hello-World.git",
|
||||
"collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
|
||||
"comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
|
||||
"commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
|
||||
"compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
|
||||
"contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
|
||||
"contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
|
||||
"deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
|
||||
"downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
|
||||
"events_url": "http://api.github.com/repos/octocat/Hello-World/events",
|
||||
"forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
|
||||
"git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
|
||||
"git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
|
||||
"git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
|
||||
"git_url": "git:github.com/octocat/Hello-World.git",
|
||||
"hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
|
||||
"issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
|
||||
"issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
|
||||
"issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
|
||||
"keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
|
||||
"labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
|
||||
"languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
|
||||
"merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
|
||||
"milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
|
||||
"mirror_url": "git:git.example.com/octocat/Hello-World",
|
||||
"notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since, all, participating}",
|
||||
"pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
|
||||
"releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
|
||||
"ssh_url": "git@github.com:octocat/Hello-World.git",
|
||||
"stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
|
||||
"statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
|
||||
"subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
|
||||
"subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
|
||||
"svn_url": "https://svn.github.com/octocat/Hello-World",
|
||||
"tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
|
||||
"teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
|
||||
"trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
|
||||
"homepage": "https://github.com",
|
||||
"language": null,
|
||||
"forks_count": 9,
|
||||
"stargazers_count": 80,
|
||||
"watchers_count": 80,
|
||||
"size": 108,
|
||||
"default_branch": "master",
|
||||
"open_issues_count": 0,
|
||||
"topics": [
|
||||
"octocat",
|
||||
"atom",
|
||||
"electron",
|
||||
"API"
|
||||
],
|
||||
"has_issues": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"has_downloads": true,
|
||||
"archived": false,
|
||||
"pushed_at": "2011-01-26T19:06:43Z",
|
||||
"created_at": "2011-01-26T19:01:12Z",
|
||||
"updated_at": "2011-01-26T19:14:43Z",
|
||||
"permissions": {
|
||||
"admin": false,
|
||||
"push": false,
|
||||
"pull": true
|
||||
},
|
||||
"allow_rebase_merge": true,
|
||||
"allow_squash_merge": true,
|
||||
"allow_merge_commit": true,
|
||||
"subscribers_count": 42,
|
||||
"network_count": 0
|
||||
}
|
||||
},
|
||||
"base": {
|
||||
"label": "master",
|
||||
"ref": "master",
|
||||
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||
"user": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"repo": {
|
||||
"id": 1296269,
|
||||
"owner": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"name": "Hello-World",
|
||||
"full_name": "octocat/Hello-World",
|
||||
"description": "This your first repo!",
|
||||
"private": false,
|
||||
"fork": true,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World",
|
||||
"html_url": "https://github.com/octocat/Hello-World",
|
||||
"archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
|
||||
"assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
|
||||
"blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
|
||||
"branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
|
||||
"clone_url": "https://github.com/octocat/Hello-World.git",
|
||||
"collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
|
||||
"comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
|
||||
"commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
|
||||
"compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
|
||||
"contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
|
||||
"contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
|
||||
"deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
|
||||
"downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
|
||||
"events_url": "http://api.github.com/repos/octocat/Hello-World/events",
|
||||
"forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
|
||||
"git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
|
||||
"git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
|
||||
"git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
|
||||
"git_url": "git:github.com/octocat/Hello-World.git",
|
||||
"hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
|
||||
"issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
|
||||
"issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
|
||||
"issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
|
||||
"keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
|
||||
"labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
|
||||
"languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
|
||||
"merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
|
||||
"milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
|
||||
"mirror_url": "git:git.example.com/octocat/Hello-World",
|
||||
"notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since, all, participating}",
|
||||
"pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
|
||||
"releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
|
||||
"ssh_url": "git@github.com:octocat/Hello-World.git",
|
||||
"stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
|
||||
"statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
|
||||
"subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
|
||||
"subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
|
||||
"svn_url": "https://svn.github.com/octocat/Hello-World",
|
||||
"tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
|
||||
"teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
|
||||
"trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
|
||||
"homepage": "https://github.com",
|
||||
"language": null,
|
||||
"forks_count": 9,
|
||||
"stargazers_count": 80,
|
||||
"watchers_count": 80,
|
||||
"size": 108,
|
||||
"default_branch": "master",
|
||||
"open_issues_count": 0,
|
||||
"topics": [
|
||||
"octocat",
|
||||
"atom",
|
||||
"electron",
|
||||
"API"
|
||||
],
|
||||
"has_issues": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"has_downloads": true,
|
||||
"archived": false,
|
||||
"pushed_at": "2011-01-26T19:06:43Z",
|
||||
"created_at": "2011-01-26T19:01:12Z",
|
||||
"updated_at": "2011-01-26T19:14:43Z",
|
||||
"permissions": {
|
||||
"admin": false,
|
||||
"push": false,
|
||||
"pull": true
|
||||
},
|
||||
"allow_rebase_merge": true,
|
||||
"allow_squash_merge": true,
|
||||
"allow_merge_commit": true,
|
||||
"subscribers_count": 42,
|
||||
"network_count": 0
|
||||
}
|
||||
},
|
||||
"_links": {
|
||||
"self": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/1347"
|
||||
},
|
||||
"html": {
|
||||
"href": "https://github.com/octocat/Hello-World/pull/1347"
|
||||
},
|
||||
"issue": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/issues/1347"
|
||||
},
|
||||
"comments": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments"
|
||||
},
|
||||
"review_comments": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments"
|
||||
},
|
||||
"review_comment": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}"
|
||||
},
|
||||
"commits": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits"
|
||||
},
|
||||
"statuses": {
|
||||
"href": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e"
|
||||
}
|
||||
},
|
||||
"user": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
}
|
||||
}
|
||||
]
|
@ -0,0 +1,14 @@
|
||||
PUT /repos/octocat/hello-world/1347/merge
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
|
||||
{
|
||||
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||
"merged": true,
|
||||
"message": "Pull Request successfully merged"
|
||||
}
|
@ -0,0 +1,341 @@
|
||||
GET /repos/octocat/hello-world
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
|
||||
{
|
||||
"id": 1296269,
|
||||
"owner": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"name": "Hello-World",
|
||||
"full_name": "octocat/Hello-World",
|
||||
"description": "This your first repo!",
|
||||
"private": true,
|
||||
"fork": false,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World",
|
||||
"html_url": "https://github.com/octocat/Hello-World",
|
||||
"archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
|
||||
"assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
|
||||
"blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
|
||||
"branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
|
||||
"clone_url": "https://github.com/octocat/Hello-World.git",
|
||||
"collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
|
||||
"comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
|
||||
"commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
|
||||
"compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
|
||||
"contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
|
||||
"contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
|
||||
"deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
|
||||
"downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
|
||||
"events_url": "http://api.github.com/repos/octocat/Hello-World/events",
|
||||
"forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
|
||||
"git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
|
||||
"git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
|
||||
"git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
|
||||
"git_url": "git:github.com/octocat/Hello-World.git",
|
||||
"hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
|
||||
"issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
|
||||
"issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
|
||||
"issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
|
||||
"keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
|
||||
"labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
|
||||
"languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
|
||||
"merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
|
||||
"milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
|
||||
"mirror_url": "git:git.example.com/octocat/Hello-World",
|
||||
"notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since, all, participating}",
|
||||
"pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
|
||||
"releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
|
||||
"ssh_url": "git@github.com:octocat/Hello-World.git",
|
||||
"stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
|
||||
"statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
|
||||
"subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
|
||||
"subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
|
||||
"svn_url": "https://svn.github.com/octocat/Hello-World",
|
||||
"tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
|
||||
"teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
|
||||
"trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
|
||||
"homepage": "https://github.com",
|
||||
"language": null,
|
||||
"forks_count": 9,
|
||||
"stargazers_count": 80,
|
||||
"watchers_count": 80,
|
||||
"size": 108,
|
||||
"default_branch": "master",
|
||||
"open_issues_count": 0,
|
||||
"topics": [
|
||||
"octocat",
|
||||
"atom",
|
||||
"electron",
|
||||
"API"
|
||||
],
|
||||
"has_issues": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"has_downloads": true,
|
||||
"archived": false,
|
||||
"pushed_at": "2011-01-26T19:06:43Z",
|
||||
"created_at": "2011-01-26T19:01:12Z",
|
||||
"updated_at": "2011-01-26T19:14:43Z",
|
||||
"permissions": {
|
||||
"admin": true,
|
||||
"push": true,
|
||||
"pull": true
|
||||
},
|
||||
"allow_rebase_merge": true,
|
||||
"allow_squash_merge": true,
|
||||
"allow_merge_commit": true,
|
||||
"subscribers_count": 42,
|
||||
"network_count": 0,
|
||||
"license": {
|
||||
"key": "mit",
|
||||
"name": "MIT License",
|
||||
"spdx_id": "MIT",
|
||||
"url": "https://api.github.com/licenses/mit",
|
||||
"html_url": "http://choosealicense.com/licenses/mit/"
|
||||
},
|
||||
"organization": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "Organization",
|
||||
"site_admin": false
|
||||
},
|
||||
"parent": {
|
||||
"id": 1296269,
|
||||
"owner": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"name": "Hello-World",
|
||||
"full_name": "octocat/Hello-World",
|
||||
"description": "This your first repo!",
|
||||
"private": false,
|
||||
"fork": true,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World",
|
||||
"html_url": "https://github.com/octocat/Hello-World",
|
||||
"archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
|
||||
"assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
|
||||
"blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
|
||||
"branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
|
||||
"clone_url": "https://github.com/octocat/Hello-World.git",
|
||||
"collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
|
||||
"comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
|
||||
"commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
|
||||
"compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
|
||||
"contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
|
||||
"contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
|
||||
"deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
|
||||
"downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
|
||||
"events_url": "http://api.github.com/repos/octocat/Hello-World/events",
|
||||
"forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
|
||||
"git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
|
||||
"git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
|
||||
"git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
|
||||
"git_url": "git:github.com/octocat/Hello-World.git",
|
||||
"hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
|
||||
"issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
|
||||
"issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
|
||||
"issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
|
||||
"keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
|
||||
"labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
|
||||
"languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
|
||||
"merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
|
||||
"milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
|
||||
"mirror_url": "git:git.example.com/octocat/Hello-World",
|
||||
"notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since, all, participating}",
|
||||
"pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
|
||||
"releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
|
||||
"ssh_url": "git@github.com:octocat/Hello-World.git",
|
||||
"stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
|
||||
"statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
|
||||
"subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
|
||||
"subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
|
||||
"svn_url": "https://svn.github.com/octocat/Hello-World",
|
||||
"tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
|
||||
"teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
|
||||
"trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
|
||||
"homepage": "https://github.com",
|
||||
"language": null,
|
||||
"forks_count": 9,
|
||||
"stargazers_count": 80,
|
||||
"watchers_count": 80,
|
||||
"size": 108,
|
||||
"default_branch": "master",
|
||||
"open_issues_count": 0,
|
||||
"topics": [
|
||||
"octocat",
|
||||
"atom",
|
||||
"electron",
|
||||
"API"
|
||||
],
|
||||
"has_issues": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"has_downloads": true,
|
||||
"archived": false,
|
||||
"pushed_at": "2011-01-26T19:06:43Z",
|
||||
"created_at": "2011-01-26T19:01:12Z",
|
||||
"updated_at": "2011-01-26T19:14:43Z",
|
||||
"permissions": {
|
||||
"admin": false,
|
||||
"push": false,
|
||||
"pull": false
|
||||
},
|
||||
"allow_rebase_merge": true,
|
||||
"allow_squash_merge": true,
|
||||
"allow_merge_commit": true,
|
||||
"subscribers_count": 42,
|
||||
"network_count": 0
|
||||
},
|
||||
"source": {
|
||||
"id": 1296269,
|
||||
"owner": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"name": "Hello-World",
|
||||
"full_name": "octocat/Hello-World",
|
||||
"description": "This your first repo!",
|
||||
"private": false,
|
||||
"fork": true,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World",
|
||||
"html_url": "https://github.com/octocat/Hello-World",
|
||||
"archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
|
||||
"assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
|
||||
"blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
|
||||
"branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
|
||||
"clone_url": "https://github.com/octocat/Hello-World.git",
|
||||
"collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
|
||||
"comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
|
||||
"commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
|
||||
"compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
|
||||
"contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
|
||||
"contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
|
||||
"deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
|
||||
"downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
|
||||
"events_url": "http://api.github.com/repos/octocat/Hello-World/events",
|
||||
"forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
|
||||
"git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
|
||||
"git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
|
||||
"git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
|
||||
"git_url": "git:github.com/octocat/Hello-World.git",
|
||||
"hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
|
||||
"issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
|
||||
"issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
|
||||
"issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
|
||||
"keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
|
||||
"labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
|
||||
"languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
|
||||
"merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
|
||||
"milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
|
||||
"mirror_url": "git:git.example.com/octocat/Hello-World",
|
||||
"notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since, all, participating}",
|
||||
"pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
|
||||
"releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
|
||||
"ssh_url": "git@github.com:octocat/Hello-World.git",
|
||||
"stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
|
||||
"statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
|
||||
"subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
|
||||
"subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
|
||||
"svn_url": "https://svn.github.com/octocat/Hello-World",
|
||||
"tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
|
||||
"teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
|
||||
"trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
|
||||
"homepage": "https://github.com",
|
||||
"language": null,
|
||||
"forks_count": 9,
|
||||
"stargazers_count": 80,
|
||||
"watchers_count": 80,
|
||||
"size": 108,
|
||||
"default_branch": "master",
|
||||
"open_issues_count": 0,
|
||||
"topics": [
|
||||
"octocat",
|
||||
"atom",
|
||||
"electron",
|
||||
"API"
|
||||
],
|
||||
"has_issues": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"has_downloads": true,
|
||||
"archived": false,
|
||||
"pushed_at": "2011-01-26T19:06:43Z",
|
||||
"created_at": "2011-01-26T19:01:12Z",
|
||||
"updated_at": "2011-01-26T19:14:43Z",
|
||||
"permissions": {
|
||||
"admin": false,
|
||||
"push": false,
|
||||
"pull": false
|
||||
},
|
||||
"allow_rebase_merge": true,
|
||||
"allow_squash_merge": true,
|
||||
"allow_merge_commit": true,
|
||||
"subscribers_count": 42,
|
||||
"network_count": 0
|
||||
}
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
GET /user/repos?page=1&per_page=30
|
||||
Status: 200
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
Link: <https://api.github.com/resource?page=2>; rel="next",
|
||||
<https://api.github.com/resource?page=1>; rel="prev",
|
||||
<https://api.github.com/resource?page=1>; rel="first",
|
||||
<https://api.github.com/resource?page=5>; rel="last"
|
||||
|
||||
[
|
||||
{
|
||||
"id": 1296269,
|
||||
"owner": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"name": "Hello-World",
|
||||
"full_name": "octocat/Hello-World",
|
||||
"description": "This your first repo!",
|
||||
"private": true,
|
||||
"fork": true,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World",
|
||||
"html_url": "https://github.com/octocat/Hello-World",
|
||||
"archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
|
||||
"assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
|
||||
"blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
|
||||
"branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
|
||||
"clone_url": "https://github.com/octocat/Hello-World.git",
|
||||
"collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
|
||||
"comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
|
||||
"commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
|
||||
"compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
|
||||
"contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
|
||||
"contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
|
||||
"deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
|
||||
"downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
|
||||
"events_url": "http://api.github.com/repos/octocat/Hello-World/events",
|
||||
"forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
|
||||
"git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
|
||||
"git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
|
||||
"git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
|
||||
"git_url": "git:github.com/octocat/Hello-World.git",
|
||||
"hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
|
||||
"issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
|
||||
"issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
|
||||
"issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
|
||||
"keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
|
||||
"labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
|
||||
"languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
|
||||
"merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
|
||||
"milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
|
||||
"mirror_url": "git:git.example.com/octocat/Hello-World",
|
||||
"notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since, all, participating}",
|
||||
"pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
|
||||
"releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
|
||||
"ssh_url": "git@github.com:octocat/Hello-World.git",
|
||||
"stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
|
||||
"statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
|
||||
"subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
|
||||
"subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
|
||||
"svn_url": "https://svn.github.com/octocat/Hello-World",
|
||||
"tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
|
||||
"teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
|
||||
"trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
|
||||
"homepage": "https://github.com",
|
||||
"language": null,
|
||||
"forks_count": 9,
|
||||
"stargazers_count": 80,
|
||||
"watchers_count": 80,
|
||||
"size": 108,
|
||||
"default_branch": "master",
|
||||
"open_issues_count": 0,
|
||||
"topics": [
|
||||
"octocat",
|
||||
"atom",
|
||||
"electron",
|
||||
"API"
|
||||
],
|
||||
"has_issues": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"has_downloads": true,
|
||||
"archived": false,
|
||||
"pushed_at": "2011-01-26T19:06:43Z",
|
||||
"created_at": "2011-01-26T19:01:12Z",
|
||||
"updated_at": "2011-01-26T19:14:43Z",
|
||||
"permissions": {
|
||||
"admin": true,
|
||||
"push": true,
|
||||
"pull": true
|
||||
},
|
||||
"allow_rebase_merge": true,
|
||||
"allow_squash_merge": true,
|
||||
"allow_merge_commit": true,
|
||||
"subscribers_count": 42,
|
||||
"network_count": 0,
|
||||
"license": {
|
||||
"key": "mit",
|
||||
"name": "MIT License",
|
||||
"spdx_id": "MIT",
|
||||
"url": "https://api.github.com/licenses/mit",
|
||||
"html_url": "http://choosealicense.com/licenses/mit/"
|
||||
}
|
||||
}
|
||||
]
|
@ -0,0 +1,7 @@
|
||||
GET /repos/not/found
|
||||
Status: 404
|
||||
|
||||
{
|
||||
"message": "Not Found",
|
||||
"documentation_url": "https://developer.github.com/v3"
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
GET /repos/octocat/hello-world/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e?page=1&per_page=30
|
||||
Status: 200
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
Link: <https://api.github.com/resource?page=2>; rel="next",
|
||||
<https://api.github.com/resource?page=1>; rel="prev",
|
||||
<https://api.github.com/resource?page=1>; rel="first",
|
||||
<https://api.github.com/resource?page=5>; rel="last"
|
||||
|
||||
[
|
||||
{
|
||||
"created_at": "2012-07-20T01:19:13Z",
|
||||
"updated_at": "2012-07-20T01:19:13Z",
|
||||
"state": "success",
|
||||
"target_url": "https://ci.example.com/1000/output",
|
||||
"description": "Build has completed successfully",
|
||||
"id": 1,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||
"context": "continuous-integration/jenkins",
|
||||
"creator": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
}
|
||||
}
|
||||
]
|
@ -0,0 +1,38 @@
|
||||
POST /repos/octocat/hello-world/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e
|
||||
Status: 201
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
|
||||
{
|
||||
"created_at": "2012-07-20T01:19:13Z",
|
||||
"updated_at": "2012-07-20T01:19:13Z",
|
||||
"state": "success",
|
||||
"target_url": "https://ci.example.com/1000/output",
|
||||
"description": "Build has completed successfully",
|
||||
"id": 1,
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||
"context": "continuous-integration/jenkins",
|
||||
"creator": {
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
GET /repos/octocat/hello-world/tags?page=1&per_page=30
|
||||
Status: 200
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
Link: <https://api.github.com/resource?page=2>; rel="next",
|
||||
<https://api.github.com/resource?page=1>; rel="prev",
|
||||
<https://api.github.com/resource?page=1>; rel="first",
|
||||
<https://api.github.com/resource?page=5>; rel="last"
|
||||
|
||||
[
|
||||
{
|
||||
"name": "v0.1",
|
||||
"commit": {
|
||||
"sha": "c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc",
|
||||
"url": "https://api.github.com/repos/octocat/Hello-World/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc"
|
||||
},
|
||||
"zipball_url": "https://github.com/octocat/Hello-World/zipball/v0.1",
|
||||
"tarball_url": "https://github.com/octocat/Hello-World/tarball/v0.1"
|
||||
}
|
||||
]
|
@ -0,0 +1,41 @@
|
||||
GET /users/octocat
|
||||
Status: 200
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
|
||||
{
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false,
|
||||
"name": "monalisa octocat",
|
||||
"company": "GitHub",
|
||||
"blog": "https://github.com/blog",
|
||||
"location": "San Francisco",
|
||||
"email": "octocat@github.com",
|
||||
"hireable": false,
|
||||
"bio": "There once was...",
|
||||
"public_repos": 2,
|
||||
"public_gists": 1,
|
||||
"followers": 20,
|
||||
"following": 0,
|
||||
"created_at": "2008-01-14T04:33:35Z",
|
||||
"updated_at": "2008-01-14T04:33:35Z"
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
GET /user/emails
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
|
||||
[
|
||||
{
|
||||
"email": "octocat@github.com",
|
||||
"verified": true,
|
||||
"primary": true,
|
||||
"visibility": "public"
|
||||
}
|
||||
]
|
@ -0,0 +1,41 @@
|
||||
GET /user
|
||||
Status: 200
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
X-RateLimit-Limit: 60
|
||||
X-RateLimit-Remaining: 59
|
||||
X-RateLimit-Reset: 1512076018
|
||||
X-GitHub-Media-Type: github.v3; format=json
|
||||
X-GitHub-Request-Id: DD0E:6011:12F21A8:1926790:5A2064E2
|
||||
|
||||
{
|
||||
"login": "octocat",
|
||||
"id": 1,
|
||||
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/octocat",
|
||||
"html_url": "https://github.com/octocat",
|
||||
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false,
|
||||
"name": "monalisa octocat",
|
||||
"company": "GitHub",
|
||||
"blog": "https://github.com/blog",
|
||||
"location": "San Francisco",
|
||||
"email": "octocat@github.com",
|
||||
"hireable": false,
|
||||
"bio": "There once was...",
|
||||
"public_repos": 2,
|
||||
"public_gists": 1,
|
||||
"followers": 20,
|
||||
"following": 0,
|
||||
"created_at": "2008-01-14T04:33:35Z",
|
||||
"updated_at": "2008-01-14T04:33:35Z"
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package fixtures
|
||||
|
||||
//go:generate togo httptest --package=fixtures --output=fixtures_gen.go
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,148 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
)
|
||||
|
||||
type gitService struct {
|
||||
client *wrapper
|
||||
}
|
||||
|
||||
func (s *gitService) FindBranch(ctx context.Context, repo, name string) (*scm.Reference, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/branches/%s", repo, name)
|
||||
out := new(branch)
|
||||
res, err := s.client.do(ctx, "GET", path, nil, out)
|
||||
return convertBranch(out), res, err
|
||||
}
|
||||
|
||||
func (s *gitService) FindCommit(ctx context.Context, repo, ref string) (*scm.Commit, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/commits/%s", repo, ref)
|
||||
out := new(commit)
|
||||
res, err := s.client.do(ctx, "GET", path, nil, out)
|
||||
return convertCommit(out), res, err
|
||||
}
|
||||
|
||||
func (s *gitService) FindTag(ctx context.Context, repo, name string) (*scm.Reference, *scm.Response, error) {
|
||||
return nil, nil, scm.ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *gitService) ListBranches(ctx context.Context, repo string, opts scm.ListOptions) ([]*scm.Reference, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/branches?%s", repo, encodeListOptions(opts))
|
||||
out := []*branch{}
|
||||
res, err := s.client.do(ctx, "GET", path, nil, &out)
|
||||
return convertBranchList(out), res, err
|
||||
}
|
||||
|
||||
func (s *gitService) ListCommits(ctx context.Context, repo string, opts scm.CommitListOptions) ([]*scm.Commit, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/commits?%s", repo, encodeCommitListOptions(opts))
|
||||
out := []*commit{}
|
||||
res, err := s.client.do(ctx, "GET", path, nil, &out)
|
||||
return convertCommitList(out), res, err
|
||||
}
|
||||
|
||||
func (s *gitService) ListTags(ctx context.Context, repo string, opts scm.ListOptions) ([]*scm.Reference, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/tags?%s", repo, encodeListOptions(opts))
|
||||
out := []*branch{}
|
||||
res, err := s.client.do(ctx, "GET", path, nil, &out)
|
||||
return convertTagList(out), res, err
|
||||
}
|
||||
|
||||
type branch struct {
|
||||
Name string `json:"name"`
|
||||
Commit commit `json:"commit"`
|
||||
Protected bool `json:"protected"`
|
||||
}
|
||||
|
||||
type commit struct {
|
||||
Sha string `json:"sha"`
|
||||
URL string `json:"html_url"`
|
||||
Commit struct {
|
||||
Author struct {
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
Date time.Time `json:"date"`
|
||||
} `json:"author"`
|
||||
Committer struct {
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
Date time.Time `json:"date"`
|
||||
} `json:"committer"`
|
||||
Message string `json:"message"`
|
||||
} `json:"commit"`
|
||||
Author struct {
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
Login string `json:"login"`
|
||||
} `json:"author"`
|
||||
Committer struct {
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
Login string `json:"login"`
|
||||
} `json:"committer"`
|
||||
}
|
||||
|
||||
func convertCommitList(from []*commit) []*scm.Commit {
|
||||
to := []*scm.Commit{}
|
||||
for _, v := range from {
|
||||
to = append(to, convertCommit(v))
|
||||
}
|
||||
return to
|
||||
}
|
||||
|
||||
func convertCommit(from *commit) *scm.Commit {
|
||||
return &scm.Commit{
|
||||
Message: from.Commit.Message,
|
||||
Sha: from.Sha,
|
||||
Link: from.URL,
|
||||
Author: scm.Signature{
|
||||
Name: from.Commit.Author.Name,
|
||||
Email: from.Commit.Author.Email,
|
||||
Date: from.Commit.Author.Date,
|
||||
Login: from.Author.Login,
|
||||
Avatar: from.Author.AvatarURL,
|
||||
},
|
||||
Committer: scm.Signature{
|
||||
Name: from.Commit.Committer.Name,
|
||||
Email: from.Commit.Committer.Email,
|
||||
Date: from.Commit.Committer.Date,
|
||||
Login: from.Committer.Login,
|
||||
Avatar: from.Committer.AvatarURL,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func convertBranchList(from []*branch) []*scm.Reference {
|
||||
to := []*scm.Reference{}
|
||||
for _, v := range from {
|
||||
to = append(to, convertBranch(v))
|
||||
}
|
||||
return to
|
||||
}
|
||||
|
||||
func convertBranch(from *branch) *scm.Reference {
|
||||
return &scm.Reference{
|
||||
Name: from.Name,
|
||||
Sha: from.Commit.Sha,
|
||||
}
|
||||
}
|
||||
|
||||
func convertTagList(from []*branch) []*scm.Reference {
|
||||
to := []*scm.Reference{}
|
||||
for _, v := range from {
|
||||
to = append(to, convertTag(v))
|
||||
}
|
||||
return to
|
||||
}
|
||||
|
||||
func convertTag(from *branch) *scm.Reference {
|
||||
return &scm.Reference{
|
||||
Name: from.Name,
|
||||
Sha: from.Commit.Sha,
|
||||
}
|
||||
}
|
@ -0,0 +1,159 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
"github.com/drone/go-scm/scm/driver/github/fixtures"
|
||||
)
|
||||
|
||||
func TestGitFindCommit(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Git.FindCommit(context.Background(), "octocat/hello-world", "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Fields", testCommit(result))
|
||||
}
|
||||
|
||||
func TestGitFindBranch(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Git.FindBranch(context.Background(), "octocat/hello-world", "master")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Fields", testBranch(result))
|
||||
}
|
||||
|
||||
func TestGitFindTag(t *testing.T) {
|
||||
git := new(gitService)
|
||||
_, _, err := git.FindTag(context.Background(), "octocat/hello-world", "v1.0")
|
||||
if err != scm.ErrNotSupported {
|
||||
t.Errorf("Expect Not Supported error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGitListCommits(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Git.ListCommits(context.Background(), "octocat/hello-world", scm.CommitListOptions{Ref: "master"})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if got, want := len(result), 1; got != want {
|
||||
t.Errorf("Want %d commits, got %d", want, got)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Page", testPage(res))
|
||||
t.Run("Fields", testCommit(result[0]))
|
||||
}
|
||||
|
||||
func TestGitListBranches(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Git.ListBranches(context.Background(), "octocat/hello-world", scm.ListOptions{Page: 1, Size: 30})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if got, want := len(result), 1; got != want {
|
||||
t.Errorf("Want %d branches, got %d", want, got)
|
||||
return
|
||||
}
|
||||
if got, want := result[0].Name, "master"; got != want {
|
||||
t.Errorf("Want branch Name %q, got %q", want, got)
|
||||
}
|
||||
if got, want := result[0].Sha, "6dcb09b5b57875f334f61aebed695e2e4193db5e"; got != want {
|
||||
t.Errorf("Want branch Sha %q, got %q", want, got)
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Page", testPage(res))
|
||||
}
|
||||
|
||||
func TestGitListTags(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Git.ListTags(context.Background(), "octocat/hello-world", scm.ListOptions{Page: 1, Size: 30})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if got, want := len(result), 1; got != want {
|
||||
t.Errorf("Want %d tags, got %d", want, got)
|
||||
return
|
||||
}
|
||||
if got, want := result[0].Name, "v0.1"; got != want {
|
||||
t.Errorf("Want tag Name %q, got %q", want, got)
|
||||
}
|
||||
if got, want := result[0].Sha, "c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc"; got != want {
|
||||
t.Errorf("Want tag Sha %q, got %q", want, got)
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Page", testPage(res))
|
||||
}
|
||||
|
||||
func testCommit(commit *scm.Commit) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := commit.Sha, "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d"; got != want {
|
||||
t.Errorf("Want commit Sha %q, got %q", want, got)
|
||||
}
|
||||
if got, want := commit.Message, "Merge pull request #6 from Spaceghost/patch-1\n\nNew line at end of file."; got != want {
|
||||
t.Errorf("Want commit Message %q, got %q", want, got)
|
||||
}
|
||||
if got, want := commit.Author.Login, "octocat"; got != want {
|
||||
t.Errorf("Want commit author Login %q, got %q", want, got)
|
||||
}
|
||||
if got, want := commit.Author.Email, "octocat@nowhere.com"; got != want {
|
||||
t.Errorf("Want commit author Email %q, got %q", want, got)
|
||||
}
|
||||
if got, want := commit.Author.Date.Unix(), int64(1331075210); got != want {
|
||||
t.Errorf("Want commit Timestamp %d, got %d", want, got)
|
||||
}
|
||||
if got, want := commit.Committer.Login, "octocat"; got != want {
|
||||
t.Errorf("Want commit author Login %q, got %q", want, got)
|
||||
}
|
||||
if got, want := commit.Committer.Email, "octocat@nowhere.com"; got != want {
|
||||
t.Errorf("Want commit author Email %q, got %q", want, got)
|
||||
}
|
||||
if got, want := commit.Committer.Date.Unix(), int64(1331075210); got != want {
|
||||
t.Errorf("Want commit Timestamp %d, got %d", want, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testBranch(branch *scm.Reference) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := branch.Name, "master"; got != want {
|
||||
t.Errorf("Want branch Name %q, got %q", want, got)
|
||||
}
|
||||
if got, want := branch.Sha, "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d"; got != want {
|
||||
t.Errorf("Want branch Sha %q, got %q", want, got)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package github implements a GitHub client.
|
||||
package github
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
)
|
||||
|
||||
// New returns a new GitHub API client.
|
||||
func New(uri string) (*scm.Client, error) {
|
||||
base, err := url.Parse(uri)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !strings.HasSuffix(base.Path, "/") {
|
||||
base.Path = base.Path + "/"
|
||||
}
|
||||
client := &wrapper{new(scm.Client)}
|
||||
client.BaseURL = base
|
||||
// initialize services
|
||||
client.Contents = &contentService{client}
|
||||
client.Git = &gitService{client}
|
||||
client.Issues = &issueService{client}
|
||||
client.Organizations = &organizationService{client}
|
||||
client.PullRequests = &pullService{&issueService{client}}
|
||||
client.Repositories = &repositoryService{client}
|
||||
client.Reviews = &reviewService{client}
|
||||
client.Users = &userService{client}
|
||||
return client.Client, nil
|
||||
}
|
||||
|
||||
// NewDefault returns a new GitHub API client using the
|
||||
// default api.github.com address.
|
||||
func NewDefault() *scm.Client {
|
||||
client, _ := New("https://api.github.com")
|
||||
return client
|
||||
}
|
||||
|
||||
// wraper wraps the Client to provide high level helper functions
|
||||
// for making http requests and unmarshaling the response.
|
||||
type wrapper struct {
|
||||
*scm.Client
|
||||
}
|
||||
|
||||
// do wraps the Client.Do function by creating the Request and
|
||||
// unmarshalling the response.
|
||||
func (c *wrapper) do(ctx context.Context, method, path string, in, out interface{}) (*scm.Response, error) {
|
||||
req := &scm.Request{
|
||||
Method: method,
|
||||
Path: path,
|
||||
}
|
||||
// if we are posting or putting data, we need to
|
||||
// write it to the body of the request.
|
||||
if in != nil {
|
||||
buf := new(bytes.Buffer)
|
||||
json.NewEncoder(buf).Encode(in)
|
||||
req.Header = map[string][]string{
|
||||
"Content-Type": {"application/json"},
|
||||
}
|
||||
req.Body = buf
|
||||
}
|
||||
|
||||
// execute the http request
|
||||
res, err := c.Client.Do(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer res.Body.Close()
|
||||
|
||||
// parse the github request id.
|
||||
res.ID = res.Header.Get("X-GitHub-Request-Id")
|
||||
|
||||
// parse the github rate limit details.
|
||||
res.Rate.Limit, _ = strconv.Atoi(
|
||||
res.Header.Get("X-RateLimit-Limit"),
|
||||
)
|
||||
res.Rate.Remaining, _ = strconv.Atoi(
|
||||
res.Header.Get("X-RateLimit-Remaining"),
|
||||
)
|
||||
res.Rate.Reset, _ = strconv.ParseInt(
|
||||
res.Header.Get("X-RateLimit-Reset"), 10, 64,
|
||||
)
|
||||
|
||||
// if an error is encountered, unmarshal and return the
|
||||
// error response.
|
||||
if res.Status > 300 {
|
||||
err := new(Error)
|
||||
json.NewDecoder(res.Body).Decode(err)
|
||||
return res, err
|
||||
}
|
||||
|
||||
if out == nil {
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// if raw output is expected, copy to the provided
|
||||
// buffer and exit.
|
||||
if w, ok := out.(io.Writer); ok {
|
||||
io.Copy(w, res.Body)
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// if a json response is expected, parse and return
|
||||
// the json response.
|
||||
return res, json.NewDecoder(res.Body).Decode(out)
|
||||
}
|
||||
|
||||
// Error represents a Github error.
|
||||
type Error struct {
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
func (e *Error) Error() string {
|
||||
return e.Message
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
)
|
||||
|
||||
func testRate(res *scm.Response) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := res.Rate.Limit, 60; got != want {
|
||||
t.Errorf("Want X-RateLimit-Limit %d, got %d", want, got)
|
||||
}
|
||||
if got, want := res.Rate.Remaining, 59; got != want {
|
||||
t.Errorf("Want X-RateLimit-Remaining %d, got %d", want, got)
|
||||
}
|
||||
if got, want := res.Rate.Reset, int64(1512076018); got != want {
|
||||
t.Errorf("Want X-RateLimit-Reset %d, got %d", want, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testPage(res *scm.Response) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := res.Page.Next, 2; got != want {
|
||||
t.Errorf("Want next page %d, got %d", want, got)
|
||||
}
|
||||
if got, want := res.Page.Prev, 1; got != want {
|
||||
t.Errorf("Want prev page %d, got %d", want, got)
|
||||
}
|
||||
if got, want := res.Page.First, 1; got != want {
|
||||
t.Errorf("Want first page %d, got %d", want, got)
|
||||
}
|
||||
if got, want := res.Page.Last, 5; got != want {
|
||||
t.Errorf("Want last page %d, got %d", want, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testRequest(res *scm.Response) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := res.ID, "DD0E:6011:12F21A8:1926790:5A2064E2"; got != want {
|
||||
t.Errorf("Want X-GitHub-Request-Id %q, got %q", want, got)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
)
|
||||
|
||||
func testContents(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("Find", testContentFind(client))
|
||||
t.Run("Find/Branch", testContentFindBranch(client))
|
||||
}
|
||||
}
|
||||
|
||||
func testContentFind(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
result, _, err := client.Contents.Find(context.Background(), "octocat/Hello-World", "README", "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if got, want := result.Path, "README"; got != want {
|
||||
t.Errorf("Got file path %q, want %q", got, want)
|
||||
}
|
||||
if got, want := string(result.Data), "Hello World!\n"; got != want {
|
||||
t.Errorf("Got file data %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testContentFindBranch(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
result, _, err := client.Contents.Find(context.Background(), "octocat/Hello-World", "CONTRIBUTING.md", "test")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if got, want := result.Path, "CONTRIBUTING.md"; got != want {
|
||||
t.Errorf("Got file path %q, want %q", got, want)
|
||||
}
|
||||
if got, want := string(result.Data), "## Contributing\n"; got != want {
|
||||
t.Errorf("Got file data %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,208 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
)
|
||||
|
||||
//
|
||||
// git sub-tests
|
||||
//
|
||||
|
||||
func testGit(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("Branches", testBranches(client))
|
||||
t.Run("Commits", testCommits(client))
|
||||
t.Run("Tags", testTags(client))
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// branch sub-tests
|
||||
//
|
||||
|
||||
func testBranches(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("Find", testBranchFind(client))
|
||||
t.Run("List", testBranchList(client))
|
||||
}
|
||||
}
|
||||
|
||||
func testBranchFind(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
result, _, err := client.Git.FindBranch(context.Background(), "octocat/Hello-World", "master")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Run("Branch", testBranch(result))
|
||||
}
|
||||
}
|
||||
|
||||
func testBranchList(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
opts := scm.ListOptions{}
|
||||
result, _, err := client.Git.ListBranches(context.Background(), "octocat/Hello-World", opts)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if len(result) == 0 {
|
||||
t.Errorf("Want a non-empty branch list")
|
||||
}
|
||||
for _, branch := range result {
|
||||
if branch.Name == "master" {
|
||||
t.Run("Branch", testBranch(branch))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// branch sub-tests
|
||||
//
|
||||
|
||||
func testTags(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("Find", testTagFind(client))
|
||||
t.Run("List", testTagList(client))
|
||||
}
|
||||
}
|
||||
|
||||
func testTagFind(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Skipf("Not Supported")
|
||||
}
|
||||
}
|
||||
|
||||
func testTagList(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
opts := scm.ListOptions{}
|
||||
result, _, err := client.Git.ListTags(context.Background(), "octocat/linguist", opts)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if len(result) == 0 {
|
||||
t.Errorf("Want a non-empty tag list")
|
||||
}
|
||||
for _, tag := range result {
|
||||
if tag.Name == "v4.8.8" {
|
||||
t.Run("Tag", testTag(tag))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// commit sub-tests
|
||||
//
|
||||
|
||||
func testCommits(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("Find", testCommitFind(client))
|
||||
t.Run("List", testCommitList(client))
|
||||
}
|
||||
}
|
||||
|
||||
func testCommitFind(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
result, _, err := client.Git.FindCommit(context.Background(), "octocat/Hello-World", "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Run("Commit", testCommit(result))
|
||||
}
|
||||
}
|
||||
|
||||
func testCommitList(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
opts := scm.CommitListOptions{
|
||||
Ref: "master",
|
||||
}
|
||||
result, _, err := client.Git.ListCommits(context.Background(), "octocat/Hello-World", opts)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if len(result) == 0 {
|
||||
t.Errorf("Want a non-empty commit list")
|
||||
}
|
||||
for _, commit := range result {
|
||||
if commit.Sha == "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d" {
|
||||
t.Run("Commit", testCommit(commit))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// struct sub-tests
|
||||
//
|
||||
|
||||
func testBranch(branch *scm.Reference) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := branch.Name, "master"; got != want {
|
||||
t.Errorf("Want branch Name %q, got %q", want, got)
|
||||
}
|
||||
if got, want := branch.Sha, "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d"; got != want {
|
||||
t.Errorf("Want branch Avatar %q, got %q", want, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testTag(tag *scm.Reference) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := tag.Name, "v4.8.8"; got != want {
|
||||
t.Errorf("Want tag Name %q, got %q", want, got)
|
||||
}
|
||||
if got, want := tag.Sha, "3f4b8368e81430e3353cb5ad8b781cd044697347"; got != want {
|
||||
t.Errorf("Want tag Avatar %q, got %q", want, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testCommit(commit *scm.Commit) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := commit.Message, "Merge pull request #6 from Spaceghost/patch-1\n\nNew line at end of file."; got != want {
|
||||
t.Errorf("Want commit Message %q, got %q", want, got)
|
||||
}
|
||||
if got, want := commit.Sha, "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d"; got != want {
|
||||
t.Errorf("Want commit Sha %q, got %q", want, got)
|
||||
}
|
||||
if got, want := commit.Author.Name, "The Octocat"; got != want {
|
||||
t.Errorf("Want commit author Name %q, got %q", want, got)
|
||||
}
|
||||
if got, want := commit.Author.Email, "octocat@nowhere.com"; got != want {
|
||||
t.Errorf("Want commit author Email %q, got %q", want, got)
|
||||
}
|
||||
if got, want := commit.Author.Date.Unix(), int64(1331075210); got != want {
|
||||
t.Errorf("Want commit author Date %d, got %d", want, got)
|
||||
}
|
||||
if got, want := commit.Committer.Name, "The Octocat"; got != want {
|
||||
t.Errorf("Want commit author Name %q, got %q", want, got)
|
||||
}
|
||||
if got, want := commit.Committer.Email, "octocat@nowhere.com"; got != want {
|
||||
t.Errorf("Want commit author Email %q, got %q", want, got)
|
||||
}
|
||||
if got, want := commit.Committer.Date.Unix(), int64(1331075210); got != want {
|
||||
t.Errorf("Want commit author Date %d, got %d", want, got)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integration
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/go-scm/scm/driver/github"
|
||||
"github.com/drone/go-scm/scm/token"
|
||||
)
|
||||
|
||||
func TestGitLab(t *testing.T) {
|
||||
if os.Getenv("GITHUB_TOKEN") == "" {
|
||||
t.Skipf("missing GITHUB_TOKEN environment variable")
|
||||
return
|
||||
}
|
||||
|
||||
client := github.NewDefault()
|
||||
client.Client = &http.Client{
|
||||
Transport: &token.Transport{
|
||||
SetToken: func(r *http.Request) {
|
||||
r.Header.Set("Authorization", "Bearer "+os.Getenv("GITHUB_TOKEN"))
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
t.Run("Contents", testContents(client))
|
||||
t.Run("Git", testGit(client))
|
||||
t.Run("Issues", testIssues(client))
|
||||
t.Run("Organizations", testOrgs(client))
|
||||
t.Run("PullRequests", testPullRequests(client))
|
||||
t.Run("Repositories", testRepos(client))
|
||||
t.Run("Users", testUsers(client))
|
||||
}
|
@ -0,0 +1,148 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
)
|
||||
|
||||
//
|
||||
// issue sub-tests
|
||||
//
|
||||
|
||||
func testIssues(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("List", testIssueList(client))
|
||||
t.Run("Find", testIssueFind(client))
|
||||
t.Run("Comments", testIssueComments(client))
|
||||
}
|
||||
}
|
||||
|
||||
func testIssueList(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
opts := scm.IssueListOptions{
|
||||
Open: true,
|
||||
Closed: true,
|
||||
}
|
||||
result, _, err := client.Issues.List(context.Background(), "octocat/Hello-World", opts)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if len(result) == 0 {
|
||||
t.Errorf("Got empty issue list")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testIssueFind(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
result, _, err := client.Issues.Find(context.Background(), "octocat/Hello-World", 348)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Run("Issue", testIssue(result))
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// issue comment sub-tests
|
||||
//
|
||||
|
||||
func testIssueComments(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Run("List", testIssueCommentList(client))
|
||||
t.Run("Find", testIssueCommentFind(client))
|
||||
}
|
||||
}
|
||||
|
||||
func testIssueCommentList(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
opts := scm.ListOptions{}
|
||||
result, _, err := client.Issues.ListComments(context.Background(), "octocat/Hello-World", 348, opts)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if len(result) == 0 {
|
||||
t.Errorf("Want a non-empty issue comment list")
|
||||
}
|
||||
for _, comment := range result {
|
||||
if comment.ID == 304068667 {
|
||||
t.Run("Comment", testIssueComment(comment))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testIssueCommentFind(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
result, _, err := client.Issues.FindComment(context.Background(), "octocat/Hello-World", 348, 304068667)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Run("Comment", testIssueComment(result))
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// struct sub-tests
|
||||
//
|
||||
|
||||
func testIssue(issue *scm.Issue) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := issue.Number, 348; got != want {
|
||||
t.Errorf("Want issue Number %d, got %d", want, got)
|
||||
}
|
||||
if got, want := issue.Title, "Testing comments"; got != want {
|
||||
t.Errorf("Want issue Title %q, got %q", want, got)
|
||||
}
|
||||
if got, want := issue.Body, "Let's add some, shall we?"; got != want {
|
||||
t.Errorf("Want issue Body %q, got %q", want, got)
|
||||
}
|
||||
if got, want := issue.Link, "https://github.com/octocat/Hello-World/issues/348"; got != want {
|
||||
t.Errorf("Want issue Link %q, got %q", want, got)
|
||||
}
|
||||
if got, want := issue.Author.Login, "octocat"; got != want {
|
||||
t.Errorf("Want issue Author Login %q, got %q", want, got)
|
||||
}
|
||||
if got, want := issue.Author.Avatar, "https://avatars3.githubusercontent.com/u/583231?v=4"; got != want {
|
||||
t.Errorf("Want issue Author Name %q, got %q", want, got)
|
||||
}
|
||||
if got, want := issue.Closed, false; got != want {
|
||||
t.Errorf("Want issue Closed %v, got %v", want, got)
|
||||
}
|
||||
if got, want := issue.Created.Unix(), int64(1495478858); got != want {
|
||||
t.Errorf("Want issue Created %d, got %d", want, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testIssueComment(comment *scm.Comment) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := comment.ID, 304068667; got != want {
|
||||
t.Errorf("Want issue comment ID %d, got %d", want, got)
|
||||
}
|
||||
if got, want := comment.Body, "A shiny new comment! :tada:"; got != want {
|
||||
t.Errorf("Want issue comment Body %q, got %q", want, got)
|
||||
}
|
||||
if got, want := comment.Author.Login, "defualt"; got != want {
|
||||
t.Errorf("Want issue comment Author Login %q, got %q", want, got)
|
||||
}
|
||||
if got, want := comment.Author.Avatar, "https://avatars2.githubusercontent.com/u/399135?v=4"; got != want {
|
||||
t.Errorf("Want issue comment Author Name %q, got %q", want, got)
|
||||
}
|
||||
if got, want := comment.Created.Unix(), int64(1495732818); got != want {
|
||||
t.Errorf("Want issue comment Created %d, got %d", want, got)
|
||||
}
|
||||
if got, want := comment.Updated.Unix(), int64(1495732818); got != want {
|
||||
t.Errorf("Want issue comment Updated %d, got %d", want, got)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
)
|
||||
|
||||
//
|
||||
// organization sub-tests
|
||||
//
|
||||
|
||||
func testOrgs(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("Find", testOrgFind(client))
|
||||
}
|
||||
}
|
||||
|
||||
func testOrgFind(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
result, _, err := client.Organizations.Find(context.Background(), "github")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Run("Organization", testOrg(result))
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// struct sub-tests
|
||||
//
|
||||
|
||||
func testOrg(organization *scm.Organization) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
if got, want := organization.Name, "github"; got != want {
|
||||
t.Errorf("Want organization Name %q, got %q", want, got)
|
||||
}
|
||||
if got, want := organization.Avatar, "https://avatars1.githubusercontent.com/u/9919?v=4"; got != want {
|
||||
t.Errorf("Want organization Avatar %q, got %q", want, got)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,215 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
)
|
||||
|
||||
//
|
||||
// pull request sub-tests
|
||||
//
|
||||
|
||||
func testPullRequests(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("List", testPullRequestList(client))
|
||||
t.Run("Find", testPullRequestFind(client))
|
||||
t.Run("Changes", testPullRequestChanges(client))
|
||||
t.Run("Comments", testPullRequestComments(client))
|
||||
}
|
||||
}
|
||||
|
||||
func testPullRequestList(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
opts := scm.PullRequestListOptions{
|
||||
Open: true,
|
||||
Closed: true,
|
||||
}
|
||||
result, _, err := client.PullRequests.List(context.Background(), "octocat/Hello-World", opts)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if len(result) == 0 {
|
||||
t.Errorf("Got empty pull request list")
|
||||
}
|
||||
for _, pr := range result {
|
||||
if pr.Number == 1 {
|
||||
t.Run("PullRequest", testPullRequest(pr))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testPullRequestFind(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
result, _, err := client.PullRequests.Find(context.Background(), "octocat/Hello-World", 140)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Run("PullRequest", testPullRequest(result))
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// pull request comment sub-tests
|
||||
//
|
||||
|
||||
func testPullRequestComments(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("List", testPullRequestCommentFind(client))
|
||||
t.Run("Find", testPullRequestCommentList(client))
|
||||
}
|
||||
}
|
||||
|
||||
func testPullRequestCommentFind(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
result, _, err := client.PullRequests.FindComment(context.Background(), "octocat/Hello-World", 140, 60475333)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Run("Comment", testPullRequestComment(result))
|
||||
}
|
||||
}
|
||||
|
||||
func testPullRequestCommentList(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
opts := scm.ListOptions{}
|
||||
result, _, err := client.PullRequests.ListComments(context.Background(), "octocat/Hello-World", 140, opts)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if len(result) == 0 {
|
||||
t.Errorf("Got empty pull request comment list")
|
||||
}
|
||||
for _, comment := range result {
|
||||
if comment.ID == 2990882 {
|
||||
t.Run("Comment", testPullRequestComment(comment))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// pull request changes sub-tests
|
||||
//
|
||||
|
||||
func testPullRequestChanges(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
opts := scm.ListOptions{}
|
||||
result, _, err := client.PullRequests.ListChanges(context.Background(), "octocat/Hello-World", 140, opts)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if len(result) == 0 {
|
||||
t.Errorf("Got empty pull request change list")
|
||||
return
|
||||
}
|
||||
t.Run("File", testChange(result[0]))
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// struct sub-tests
|
||||
//
|
||||
|
||||
func testPullRequest(pr *scm.PullRequest) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := pr.Number, 140; got != want {
|
||||
t.Errorf("Want pr Number %d, got %d", want, got)
|
||||
}
|
||||
if got, want := pr.Title, "Create CONTRIBUTING.md"; got != want {
|
||||
t.Errorf("Want pr Title %q, got %q", want, got)
|
||||
}
|
||||
if got, want := pr.Body, ""; got != want {
|
||||
t.Errorf("Want pr Body %q, got %q", want, got)
|
||||
}
|
||||
if got, want := pr.Source, "test"; got != want {
|
||||
t.Errorf("Want pr Source %q, got %q", want, got)
|
||||
}
|
||||
if got, want := pr.Target, "master"; got != want {
|
||||
t.Errorf("Want pr Target %q, got %q", want, got)
|
||||
}
|
||||
if got, want := pr.Ref, "refs/pull/140/head"; got != want {
|
||||
t.Errorf("Want pr Ref %q, got %q", want, got)
|
||||
}
|
||||
if got, want := pr.Sha, "b3cbd5bbd7e81436d2eee04537ea2b4c0cad4cdf"; got != want {
|
||||
t.Errorf("Want pr Sha %q, got %q", want, got)
|
||||
}
|
||||
if got, want := pr.Link, "https://github.com/octocat/Hello-World/pull/140.diff"; got != want {
|
||||
t.Errorf("Want pr Link %q, got %q", want, got)
|
||||
}
|
||||
if got, want := pr.Author.Login, "octocat"; got != want {
|
||||
t.Errorf("Want pr Author Login %q, got %q", want, got)
|
||||
}
|
||||
if got, want := pr.Author.Avatar, "https://avatars3.githubusercontent.com/u/583231?v=4"; got != want {
|
||||
t.Errorf("Want pr Author Avatar %q, got %q", want, got)
|
||||
}
|
||||
if got, want := pr.Closed, true; got != want {
|
||||
t.Errorf("Want pr Closed %v, got %v", want, got)
|
||||
}
|
||||
if got, want := pr.Merged, false; got != want {
|
||||
t.Errorf("Want pr Merged %v, got %v", want, got)
|
||||
}
|
||||
if got, want := pr.Created.Unix(), int64(1402523517); got != want {
|
||||
t.Errorf("Want pr Created %d, got %d", want, got)
|
||||
}
|
||||
if got, want := pr.Updated.Unix(), int64(1414224441); got != want {
|
||||
t.Errorf("Want pr Updated %d, got %d", want, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testPullRequestComment(comment *scm.Comment) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := comment.ID, 60475333; got != want {
|
||||
t.Errorf("Want pr comment ID %d, got %d", want, got)
|
||||
}
|
||||
if got, want := comment.Body, "wwwwwwwaa\n"; got != want {
|
||||
t.Errorf("Want pr comment Body %q, got %q", want, got)
|
||||
}
|
||||
if got, want := comment.Author.Login, "tompang"; got != want {
|
||||
t.Errorf("Want pr comment Author Login %q, got %q", want, got)
|
||||
}
|
||||
if got, want := comment.Author.Name, ""; got != want {
|
||||
t.Errorf("Want pr comment Author Name %q, got %q", want, got)
|
||||
}
|
||||
if got, want := comment.Author.Avatar, "https://avatars3.githubusercontent.com/u/7744744?v=4"; got != want {
|
||||
t.Errorf("Want pr comment Author Avatar %q, got %q", want, got)
|
||||
}
|
||||
if got, want := comment.Created.Unix(), int64(1414224391); got != want {
|
||||
t.Errorf("Want pr comment Created %d, got %d", want, got)
|
||||
}
|
||||
if got, want := comment.Updated.Unix(), int64(1414224407); got != want {
|
||||
t.Errorf("Want pr comment Updated %d, got %d", want, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testChange(change *scm.Change) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := change.Path, "CONTRIBUTING.md"; got != want {
|
||||
t.Errorf("Want file change Path %q, got %q", want, got)
|
||||
}
|
||||
if got, want := change.Added, true; got != want {
|
||||
t.Errorf("Want file Added %v, got %v", want, got)
|
||||
}
|
||||
if got, want := change.Deleted, false; got != want {
|
||||
t.Errorf("Want file Deleted %v, got %v", want, got)
|
||||
}
|
||||
if got, want := change.Renamed, false; got != want {
|
||||
t.Errorf("Want file Renamed %v, got %v", want, got)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
)
|
||||
|
||||
//
|
||||
// repository sub-tests
|
||||
//
|
||||
|
||||
func testRepos(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("Find", testRepoFind(client))
|
||||
}
|
||||
}
|
||||
|
||||
func testRepoFind(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
result, _, err := client.Repositories.Find(context.Background(), "octocat/Hello-World")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Run("Repository", testRepo(result))
|
||||
t.Run("Permissions", testPerm(result.Perm))
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// struct sub-tests
|
||||
//
|
||||
|
||||
func testRepo(repository *scm.Repository) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
if got, want := repository.Name, "Hello-World"; got != want {
|
||||
t.Errorf("Want repository Name %q, got %q", want, got)
|
||||
}
|
||||
if got, want := repository.Namespace, "octocat"; got != want {
|
||||
t.Errorf("Want repository Namespace %q, got %q", want, got)
|
||||
}
|
||||
if got, want := repository.Branch, "master"; got != want {
|
||||
t.Errorf("Want repository Branch %q, got %q", want, got)
|
||||
}
|
||||
if got, want := repository.Clone, "https://github.com/octocat/Hello-World.git"; got != want {
|
||||
t.Errorf("Want repository Clone URL %q, got %q", want, got)
|
||||
}
|
||||
if got, want := repository.CloneSSH, "git@github.com:octocat/Hello-World.git"; got != want {
|
||||
t.Errorf("Want repository SSH URL %q, got %q", want, got)
|
||||
}
|
||||
if got, want := repository.Link, "https://github.com/octocat/Hello-World"; got != want {
|
||||
t.Errorf("Want repository Link %q, got %q", want, got)
|
||||
}
|
||||
if got, want := repository.Created.Unix(), int64(1296068472); got != want {
|
||||
t.Errorf("Want repository Created %d, got %d", want, got)
|
||||
}
|
||||
if got, want := repository.Private, false; got != want {
|
||||
t.Errorf("Want repository Private %v, got %v", want, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testPerm(perms *scm.Perm) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
if got, want := perms.Pull, true; got != want {
|
||||
t.Errorf("Want permission Pull %v, got %v", want, got)
|
||||
}
|
||||
if got, want := perms.Push, false; got != want {
|
||||
t.Errorf("Want permission Push %v, got %v", want, got)
|
||||
}
|
||||
if got, want := perms.Admin, false; got != want {
|
||||
t.Errorf("Want permission Admin %v, got %v", want, got)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
)
|
||||
|
||||
//
|
||||
// user sub-tests
|
||||
//
|
||||
|
||||
func testUsers(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("Find", testUserFind(client))
|
||||
}
|
||||
}
|
||||
|
||||
func testUserFind(client *scm.Client) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
result, _, err := client.Users.FindLogin(context.Background(), "octocat")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Run("User", testUser(result))
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// struct sub-tests
|
||||
//
|
||||
|
||||
func testUser(user *scm.User) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Parallel()
|
||||
if got, want := user.Login, "octocat"; got != want {
|
||||
t.Errorf("Want user Login %q, got %q", want, got)
|
||||
}
|
||||
if got, want := user.Name, "The Octocat"; got != want {
|
||||
t.Errorf("Want user Name %q, got %q", want, got)
|
||||
}
|
||||
if got, want := user.Avatar, "https://avatars3.githubusercontent.com/u/583231?v=4"; got != want {
|
||||
t.Errorf("Want user Avatar %q, got %q", want, got)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,195 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
)
|
||||
|
||||
type issueService struct {
|
||||
client *wrapper
|
||||
}
|
||||
|
||||
func (s *issueService) Find(ctx context.Context, repo string, number int) (*scm.Issue, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/issues/%d", repo, number)
|
||||
out := new(issue)
|
||||
res, err := s.client.do(ctx, "GET", path, nil, out)
|
||||
return convertIssue(out), res, err
|
||||
}
|
||||
|
||||
func (s *issueService) FindComment(ctx context.Context, repo string, index, id int) (*scm.Comment, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/issues/comments/%d", repo, id)
|
||||
out := new(issueComment)
|
||||
res, err := s.client.do(ctx, "GET", path, nil, out)
|
||||
return convertIssueComment(out), res, err
|
||||
}
|
||||
|
||||
func (s *issueService) List(ctx context.Context, repo string, opts scm.IssueListOptions) ([]*scm.Issue, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/issues?%s", repo, encodeIssueListOptions(opts))
|
||||
out := []*issue{}
|
||||
res, err := s.client.do(ctx, "GET", path, nil, &out)
|
||||
return convertIssueList(out), res, err
|
||||
}
|
||||
|
||||
func (s *issueService) ListComments(ctx context.Context, repo string, index int, opts scm.ListOptions) ([]*scm.Comment, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/issues/%d/comments?%s", repo, index, encodeListOptions(opts))
|
||||
out := []*issueComment{}
|
||||
res, err := s.client.do(ctx, "GET", path, nil, &out)
|
||||
return convertIssueCommentList(out), res, err
|
||||
}
|
||||
|
||||
func (s *issueService) Create(ctx context.Context, repo string, input *scm.IssueInput) (*scm.Issue, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/issues", repo)
|
||||
in := &issueInput{
|
||||
Title: input.Title,
|
||||
Body: input.Body,
|
||||
}
|
||||
out := new(issue)
|
||||
res, err := s.client.do(ctx, "POST", path, in, out)
|
||||
return convertIssue(out), res, err
|
||||
}
|
||||
|
||||
func (s *issueService) CreateComment(ctx context.Context, repo string, number int, input *scm.CommentInput) (*scm.Comment, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/issues/%d/comments", repo, number)
|
||||
in := &issueCommentInput{
|
||||
Body: input.Body,
|
||||
}
|
||||
out := new(issueComment)
|
||||
res, err := s.client.do(ctx, "POST", path, in, out)
|
||||
return convertIssueComment(out), res, err
|
||||
}
|
||||
|
||||
func (s *issueService) DeleteComment(ctx context.Context, repo string, number, id int) (*scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/issues/comments/%d", repo, id)
|
||||
return s.client.do(ctx, "DELETE", path, nil, nil)
|
||||
}
|
||||
|
||||
func (s *issueService) Close(ctx context.Context, repo string, number int) (*scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/issues/%d", repo, number)
|
||||
data := map[string]string{"state": "closed"}
|
||||
out := new(issue)
|
||||
res, err := s.client.do(ctx, "PATCH", path, &data, out)
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (s *issueService) Lock(ctx context.Context, repo string, number int) (*scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/issues/%d/lock", repo, number)
|
||||
res, err := s.client.do(ctx, "PUT", path, nil, nil)
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (s *issueService) Unlock(ctx context.Context, repo string, number int) (*scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/issues/%d/lock", repo, number)
|
||||
res, err := s.client.do(ctx, "DELETE", path, nil, nil)
|
||||
return res, err
|
||||
}
|
||||
|
||||
type issue struct {
|
||||
ID int `json:"id"`
|
||||
HTMLURL string `json:"html_url"`
|
||||
Number int `json:"number"`
|
||||
State string `json:"state"`
|
||||
Title string `json:"title"`
|
||||
Body string `json:"body"`
|
||||
User struct {
|
||||
Login string `json:"login"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
} `json:"user"`
|
||||
Labels []struct {
|
||||
Name string `json:"name"`
|
||||
} `json:"labels"`
|
||||
Locked bool `json:"locked"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
type issueInput struct {
|
||||
Title string `json:"title"`
|
||||
Body string `json:"body"`
|
||||
}
|
||||
|
||||
type issueComment struct {
|
||||
ID int `json:"id"`
|
||||
HTMLURL string `json:"html_url"`
|
||||
User struct {
|
||||
ID int `json:"id"`
|
||||
Login string `json:"login"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
} `json:"user"`
|
||||
Body string `json:"body"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
type issueCommentInput struct {
|
||||
Body string `json:"body"`
|
||||
}
|
||||
|
||||
// helper function to convert from the gogs issue list to
|
||||
// the common issue structure.
|
||||
func convertIssueList(from []*issue) []*scm.Issue {
|
||||
to := []*scm.Issue{}
|
||||
for _, v := range from {
|
||||
to = append(to, convertIssue(v))
|
||||
}
|
||||
return to
|
||||
}
|
||||
|
||||
// helper function to convert from the gogs issue structure to
|
||||
// the common issue structure.
|
||||
func convertIssue(from *issue) *scm.Issue {
|
||||
return &scm.Issue{
|
||||
Number: from.Number,
|
||||
Title: from.Title,
|
||||
Body: from.Body,
|
||||
Link: from.HTMLURL,
|
||||
Labels: convertLabels(from),
|
||||
Locked: from.Locked,
|
||||
Closed: from.State == "closed",
|
||||
Author: scm.User{
|
||||
Login: from.User.Login,
|
||||
Avatar: from.User.AvatarURL,
|
||||
},
|
||||
Created: from.CreatedAt,
|
||||
Updated: from.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
// helper function to convert from the gogs issue comment list
|
||||
// to the common issue structure.
|
||||
func convertIssueCommentList(from []*issueComment) []*scm.Comment {
|
||||
to := []*scm.Comment{}
|
||||
for _, v := range from {
|
||||
to = append(to, convertIssueComment(v))
|
||||
}
|
||||
return to
|
||||
}
|
||||
|
||||
// helper function to convert from the gogs issue comment to
|
||||
// the common issue comment structure.
|
||||
func convertIssueComment(from *issueComment) *scm.Comment {
|
||||
return &scm.Comment{
|
||||
ID: from.ID,
|
||||
Body: from.Body,
|
||||
Author: scm.User{
|
||||
Login: from.User.Login,
|
||||
Avatar: from.User.AvatarURL,
|
||||
},
|
||||
Created: from.CreatedAt,
|
||||
Updated: from.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
func convertLabels(from *issue) []string {
|
||||
var labels []string
|
||||
for _, label := range from.Labels {
|
||||
labels = append(labels, label.Name)
|
||||
}
|
||||
return labels
|
||||
}
|
@ -0,0 +1,212 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
"github.com/drone/go-scm/scm/driver/github/fixtures"
|
||||
)
|
||||
|
||||
func TestIssueFind(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Issues.Find(context.Background(), "octocat/hello-world", 1)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Fields", testIssue(result))
|
||||
}
|
||||
|
||||
func TestIssueCommentFind(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Issues.FindComment(context.Background(), "octocat/hello-world", 1, 1)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Fields", testIssueComment(result))
|
||||
}
|
||||
|
||||
func TestIssueList(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Issues.List(context.Background(), "octocat/hello-world", scm.IssueListOptions{Page: 1, Size: 30, Open: true, Closed: true})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if got, want := len(result), 1; got != want {
|
||||
t.Errorf("Want %d issues, got %d", want, got)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Page", testPage(res))
|
||||
t.Run("Fields", testIssue(result[0]))
|
||||
}
|
||||
|
||||
func TestIssueListComments(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Issues.ListComments(context.Background(), "octocat/hello-world", 1, scm.ListOptions{Size: 30, Page: 1})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if got, want := len(result), 1; got != want {
|
||||
t.Errorf("Want %d comments, got %d", want, got)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Page", testPage(res))
|
||||
t.Run("Fields", testIssueComment(result[0]))
|
||||
}
|
||||
|
||||
func TestIssueCreate(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
input := scm.IssueInput{
|
||||
Title: "Found a bug",
|
||||
Body: "I'm having a problem with this.",
|
||||
}
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Issues.Create(context.Background(), "octocat/hello-world", &input)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Fields", testIssue(result))
|
||||
}
|
||||
|
||||
func TestIssueCreateComment(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
input := &scm.CommentInput{
|
||||
Body: "what?",
|
||||
}
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Issues.CreateComment(context.Background(), "octocat/hello-world", 1, input)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Fields", testIssueComment(result))
|
||||
}
|
||||
|
||||
func TestIssueCommentDelete(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
res, err := client.Issues.DeleteComment(context.Background(), "octocat/hello-world", 1, 1)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if want, got := res.Status, 204; want != got {
|
||||
t.Errorf("Want status code %d, got %d", want, got)
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
}
|
||||
|
||||
func TestIssueClose(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
res, err := client.Issues.Close(context.Background(), "octocat/hello-world", 1)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if want, got := res.Status, 200; want != got {
|
||||
t.Errorf("Want status code %d, got %d", want, got)
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
}
|
||||
|
||||
func testIssue(issue *scm.Issue) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := issue.Number, 1347; got != want {
|
||||
t.Errorf("Want issue Number %d, got %d", want, got)
|
||||
}
|
||||
if got, want := issue.Title, "Found a bug"; got != want {
|
||||
t.Errorf("Want issue Title %q, got %q", want, got)
|
||||
}
|
||||
if got, want := issue.Body, "I'm having a problem with this."; got != want {
|
||||
t.Errorf("Want issue Title %q, got %q", want, got)
|
||||
}
|
||||
if got, want := issue.Labels, []string{"bug"}; !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("Want issue Created %v, got %v", want, got)
|
||||
}
|
||||
if got, want := issue.Closed, false; got != want {
|
||||
t.Errorf("Want issue Title %v, got %v", want, got)
|
||||
}
|
||||
if got, want := issue.Author.Login, "octocat"; got != want {
|
||||
t.Errorf("Want issue author Login %q, got %q", want, got)
|
||||
}
|
||||
if got, want := issue.Author.Avatar, "https://github.com/images/error/octocat_happy.gif"; got != want {
|
||||
t.Errorf("Want issue author Avatar %q, got %q", want, got)
|
||||
}
|
||||
if got, want := issue.Created.Unix(), int64(1303479228); got != want {
|
||||
t.Errorf("Want issue Created %d, got %d", want, got)
|
||||
}
|
||||
if got, want := issue.Updated.Unix(), int64(1303479228); got != want {
|
||||
t.Errorf("Want issue Created %d, got %d", want, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testIssueComment(comment *scm.Comment) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := comment.ID, 1; got != want {
|
||||
t.Errorf("Want issue comment ID %d, got %d", want, got)
|
||||
}
|
||||
if got, want := comment.Body, "Me too"; got != want {
|
||||
t.Errorf("Want issue comment Body %q, got %q", want, got)
|
||||
}
|
||||
if got, want := comment.Author.Login, "octocat"; got != want {
|
||||
t.Errorf("Want issue comment author Login %q, got %q", want, got)
|
||||
}
|
||||
if got, want := comment.Author.Avatar, "https://github.com/images/error/octocat_happy.gif"; got != want {
|
||||
t.Errorf("Want issue comment author Avatar %q, got %q", want, got)
|
||||
}
|
||||
if got, want := comment.Created.Unix(), int64(1302796849); got != want {
|
||||
t.Errorf("Want issue comment Created %d, got %d", want, got)
|
||||
}
|
||||
if got, want := comment.Updated.Unix(), int64(1302796849); got != want {
|
||||
t.Errorf("Want issue comment Updated %d, got %d", want, got)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
)
|
||||
|
||||
type organizationService struct {
|
||||
client *wrapper
|
||||
}
|
||||
|
||||
func (s *organizationService) Find(ctx context.Context, name string) (*scm.Organization, *scm.Response, error) {
|
||||
path := fmt.Sprintf("orgs/%s", name)
|
||||
out := new(organization)
|
||||
res, err := s.client.do(ctx, "GET", path, nil, out)
|
||||
return convertOrganization(out), res, err
|
||||
}
|
||||
|
||||
func (s *organizationService) List(ctx context.Context, opts scm.ListOptions) ([]*scm.Organization, *scm.Response, error) {
|
||||
path := fmt.Sprintf("user/orgs?%s", encodeListOptions(opts))
|
||||
out := []*organization{}
|
||||
res, err := s.client.do(ctx, "GET", path, nil, &out)
|
||||
return convertOrganizationList(out), res, err
|
||||
}
|
||||
|
||||
func convertOrganizationList(from []*organization) []*scm.Organization {
|
||||
to := []*scm.Organization{}
|
||||
for _, v := range from {
|
||||
to = append(to, convertOrganization(v))
|
||||
}
|
||||
return to
|
||||
}
|
||||
|
||||
type organization struct {
|
||||
Login string `json:"login"`
|
||||
Avatar string `json:"avatar_url"`
|
||||
}
|
||||
|
||||
func convertOrganization(from *organization) *scm.Organization {
|
||||
return &scm.Organization{
|
||||
Name: from.Login,
|
||||
Avatar: from.Avatar,
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
"github.com/drone/go-scm/scm/driver/github/fixtures"
|
||||
)
|
||||
|
||||
func TestOrganizationFind(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Organizations.Find(context.Background(), "github")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Fields", testOrganization(result))
|
||||
}
|
||||
|
||||
func TestOrganizationList(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Organizations.List(context.Background(), scm.ListOptions{Size: 30, Page: 1})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if got, want := len(result), 1; got != want {
|
||||
t.Errorf("Want %d organizations, got %d", want, got)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Page", testPage(res))
|
||||
t.Run("Fields", testOrganization(result[0]))
|
||||
}
|
||||
|
||||
func testOrganization(organization *scm.Organization) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := organization.Name, "github"; got != want {
|
||||
t.Errorf("Want organization Name %q, got %q", want, got)
|
||||
}
|
||||
if got, want := organization.Avatar, "https://github.com/images/error/octocat_happy.gif"; got != want {
|
||||
t.Errorf("Want organization Avatar %q, got %q", want, got)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
"github.com/drone/go-scm/scm/driver/internal/null"
|
||||
)
|
||||
|
||||
type pullService struct {
|
||||
*issueService
|
||||
}
|
||||
|
||||
func (s *pullService) Find(ctx context.Context, repo string, number int) (*scm.PullRequest, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/pulls/%d", repo, number)
|
||||
out := new(pr)
|
||||
res, err := s.client.do(ctx, "GET", path, nil, out)
|
||||
return convertPullRequest(out), res, err
|
||||
}
|
||||
|
||||
func (s *pullService) List(ctx context.Context, repo string, opts scm.PullRequestListOptions) ([]*scm.PullRequest, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/pulls?%s", repo, encodePullRequestListOptions(opts))
|
||||
out := []*pr{}
|
||||
res, err := s.client.do(ctx, "GET", path, nil, &out)
|
||||
return convertPullRequestList(out), res, err
|
||||
}
|
||||
|
||||
func (s *pullService) ListChanges(ctx context.Context, repo string, number int, opts scm.ListOptions) ([]*scm.Change, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/pulls/%d/files?%s", repo, number, encodeListOptions(opts))
|
||||
out := []*file{}
|
||||
res, err := s.client.do(ctx, "GET", path, nil, &out)
|
||||
return convertChangeList(out), res, err
|
||||
}
|
||||
|
||||
func (s *pullService) Merge(ctx context.Context, repo string, number int) (*scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/pulls/%d", repo, number)
|
||||
res, err := s.client.do(ctx, "PUT", path, nil, nil)
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (s *pullService) Close(ctx context.Context, repo string, number int) (*scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/pulls/%d", repo, number)
|
||||
data := map[string]string{"state": "closed"}
|
||||
res, err := s.client.do(ctx, "PATCH", path, &data, nil)
|
||||
return res, err
|
||||
}
|
||||
|
||||
type pr struct {
|
||||
Number int `json:"number"`
|
||||
State string `json:"state"`
|
||||
Title string `json:"title"`
|
||||
Body string `json:"body"`
|
||||
DiffURL string `json:"diff_url"`
|
||||
User struct {
|
||||
Login string `json:"login"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
} `json:"user"`
|
||||
Head struct {
|
||||
Ref string `json:"ref"`
|
||||
Sha string `json:"sha"`
|
||||
User struct {
|
||||
Login string `json:"login"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
}
|
||||
} `json:"head"`
|
||||
Base struct {
|
||||
Ref string `json:"ref"`
|
||||
Sha string `json:"sha"`
|
||||
User struct {
|
||||
Login string `json:"login"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
}
|
||||
} `json:"base"`
|
||||
MergedAt null.String `json:"merged_at"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
type file struct {
|
||||
Sha string `json:"sha"`
|
||||
Filename string `json:"filename"`
|
||||
Status string `json:"status"`
|
||||
Additions int `json:"additions"`
|
||||
Deletions int `json:"deletions"`
|
||||
Changes int `json:"changes"`
|
||||
}
|
||||
|
||||
func convertPullRequestList(from []*pr) []*scm.PullRequest {
|
||||
to := []*scm.PullRequest{}
|
||||
for _, v := range from {
|
||||
to = append(to, convertPullRequest(v))
|
||||
}
|
||||
return to
|
||||
}
|
||||
|
||||
func convertPullRequest(from *pr) *scm.PullRequest {
|
||||
return &scm.PullRequest{
|
||||
Number: from.Number,
|
||||
Title: from.Title,
|
||||
Body: from.Body,
|
||||
Sha: from.Head.Sha,
|
||||
Ref: fmt.Sprintf("refs/pull/%d/head", from.Number),
|
||||
Source: from.Head.Ref,
|
||||
Target: from.Base.Ref,
|
||||
Link: from.DiffURL,
|
||||
Closed: from.State != "open",
|
||||
Merged: from.MergedAt.String != "",
|
||||
Author: scm.User{
|
||||
Login: from.User.Login,
|
||||
Avatar: from.User.AvatarURL,
|
||||
},
|
||||
Created: from.CreatedAt,
|
||||
Updated: from.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
func convertChangeList(from []*file) []*scm.Change {
|
||||
to := []*scm.Change{}
|
||||
for _, v := range from {
|
||||
to = append(to, convertChange(v))
|
||||
}
|
||||
return to
|
||||
}
|
||||
|
||||
func convertChange(from *file) *scm.Change {
|
||||
return &scm.Change{
|
||||
Path: from.Filename,
|
||||
Added: from.Status == "added",
|
||||
Deleted: from.Status == "deleted",
|
||||
Renamed: from.Status == "moved",
|
||||
}
|
||||
}
|
@ -0,0 +1,195 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
"github.com/drone/go-scm/scm/driver/github/fixtures"
|
||||
)
|
||||
|
||||
func TestPullFind(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.PullRequests.Find(context.Background(), "octocat/hello-world", 1347)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Fields", testPullRequest(result))
|
||||
}
|
||||
|
||||
// func TestPullFindComment(t *testing.T) {
|
||||
// service := new(pullService)
|
||||
// _, _, err := service.FindComment(context.Background(), "gogits/gogs", 1, 1)
|
||||
// if err == nil || err.Error() != "Not Supported" {
|
||||
// t.Errorf("Expect Not Supported error")
|
||||
// }
|
||||
// }
|
||||
|
||||
func TestPullList(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.PullRequests.List(context.Background(), "octocat/hello-world", scm.PullRequestListOptions{Page: 1, Size: 30, Open: true, Closed: true})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if got, want := len(result), 1; got != want {
|
||||
t.Errorf("Want %d pull requests, got %d", want, got)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Page", testPage(res))
|
||||
t.Run("Fields", testPullRequest(result[0]))
|
||||
}
|
||||
|
||||
func TestPullListChanges(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.PullRequests.ListChanges(context.Background(), "octocat/hello-world", 1347, scm.ListOptions{Page: 1, Size: 30})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if got, want := len(result), 1; got != want {
|
||||
t.Errorf("Want %d pull request changes, got %d", want, got)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Page", testPage(res))
|
||||
t.Run("Fields", testChange(result[0]))
|
||||
}
|
||||
|
||||
// func TestPullListComments(t *testing.T) {
|
||||
// service := new(pullService)
|
||||
// _, _, err := service.ListComments(context.Background(), "gogits/gogs", 1, scm.ListOptions{Page: 1, Size: 30})
|
||||
// if err == nil || err.Error() != "Not Supported" {
|
||||
// t.Errorf("Expect Not Supported error")
|
||||
// }
|
||||
// }
|
||||
|
||||
func TestPullMerge(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
res, err := client.PullRequests.Close(context.Background(), "octocat/hello-world", 1347)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if want, got := res.Status, 200; want != got {
|
||||
t.Errorf("Want status code %d, got %d", want, got)
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
}
|
||||
|
||||
func TestPullClose(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
res, err := client.PullRequests.Close(context.Background(), "octocat/hello-world", 1347)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if want, got := res.Status, 200; want != got {
|
||||
t.Errorf("Want status code %d, got %d", want, got)
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
}
|
||||
|
||||
// func TestCreateComment(t *testing.T) {
|
||||
// service := new(pullService)
|
||||
// _, _, err := service.CreateComment(context.Background(), "gogits/gogs", 1, &scm.CommentInput{})
|
||||
// if err == nil || err.Error() != "Not Supported" {
|
||||
// t.Errorf("Expect Not Supported error")
|
||||
// }
|
||||
// }
|
||||
|
||||
// func TestDeleteComment(t *testing.T) {
|
||||
// service := new(pullService)
|
||||
// _, err := service.DeleteComment(context.Background(), "gogits/gogs", 1, 1)
|
||||
// if err == nil || err.Error() != "Not Supported" {
|
||||
// t.Errorf("Expect Not Supported error")
|
||||
// }
|
||||
// }
|
||||
|
||||
func testPullRequest(pr *scm.PullRequest) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := pr.Number, 1347; got != want {
|
||||
t.Errorf("Want pr Number %d, got %d", want, got)
|
||||
}
|
||||
if got, want := pr.Title, "new-feature"; got != want {
|
||||
t.Errorf("Want pr Body %q, got %q", want, got)
|
||||
}
|
||||
if got, want := pr.Body, "Please pull these awesome changes"; got != want {
|
||||
t.Errorf("Want pr Body %q, got %q", want, got)
|
||||
}
|
||||
if got, want := pr.Sha, "6dcb09b5b57875f334f61aebed695e2e4193db5e"; got != want {
|
||||
t.Errorf("Want pr Sha %v, got %v", want, got)
|
||||
}
|
||||
if got, want := pr.Ref, "refs/pull/1347/head"; got != want {
|
||||
t.Errorf("Want pr Ref %v, got %v", want, got)
|
||||
}
|
||||
if got, want := pr.Source, "new-topic"; got != want {
|
||||
t.Errorf("Want pr Source %v, got %v", want, got)
|
||||
}
|
||||
if got, want := pr.Target, "master"; got != want {
|
||||
t.Errorf("Want pr Target %v, got %v", want, got)
|
||||
}
|
||||
if got, want := pr.Merged, true; got != want {
|
||||
t.Errorf("Want pr Merged %v, got %v", want, got)
|
||||
}
|
||||
if got, want := pr.Closed, false; got != want {
|
||||
t.Errorf("Want pr Closed %v, got %v", want, got)
|
||||
}
|
||||
if got, want := pr.Author.Login, "octocat"; got != want {
|
||||
t.Errorf("Want pr Author Login %v, got %v", want, got)
|
||||
}
|
||||
if got, want := pr.Author.Avatar, "https://github.com/images/error/octocat_happy.gif"; got != want {
|
||||
t.Errorf("Want pr Author Avatar %v, got %v", want, got)
|
||||
}
|
||||
if got, want := pr.Created.Unix(), int64(1296068472); got != want {
|
||||
t.Errorf("Want pr Created %d, got %d", want, got)
|
||||
}
|
||||
if got, want := pr.Updated.Unix(), int64(1296068472); got != want {
|
||||
t.Errorf("Want pr Updated %d, got %d", want, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testChange(change *scm.Change) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := change.Added, true; got != want {
|
||||
t.Errorf("Want file Added %v, got %v", want, got)
|
||||
}
|
||||
if got, want := change.Deleted, false; got != want {
|
||||
t.Errorf("Want file Deleted %v, got %v", want, got)
|
||||
}
|
||||
if got, want := change.Renamed, false; got != want {
|
||||
t.Errorf("Want file Renamed %v, got %v", want, got)
|
||||
}
|
||||
if got, want := change.Path, "file1.txt"; got != want {
|
||||
t.Errorf("Want file Path %q, got %q", want, got)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,262 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
)
|
||||
|
||||
type repository struct {
|
||||
ID int `json:"id"`
|
||||
Owner struct {
|
||||
ID int `json:"id"`
|
||||
Login string `json:"login"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
} `json:"owner"`
|
||||
Name string `json:"name"`
|
||||
FullName string `json:"full_name"`
|
||||
Private bool `json:"private"`
|
||||
Fork bool `json:"fork"`
|
||||
HTMLURL string `json:"html_url"`
|
||||
SSHURL string `json:"ssh_url"`
|
||||
CloneURL string `json:"clone_url"`
|
||||
DefaultBranch string `json:"default_branch"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
Permissions struct {
|
||||
Admin bool `json:"admin"`
|
||||
Push bool `json:"push"`
|
||||
Pull bool `json:"pull"`
|
||||
} `json:"permissions"`
|
||||
}
|
||||
|
||||
type hook struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Events []string `json:"events"`
|
||||
Active bool `json:"active"`
|
||||
Config struct {
|
||||
URL string `json:"url"`
|
||||
Secret string `json:"secret"`
|
||||
ContentType string `json:"content_type"`
|
||||
} `json:"config"`
|
||||
}
|
||||
|
||||
type repositoryService struct {
|
||||
client *wrapper
|
||||
}
|
||||
|
||||
// Find returns the repository by name.
|
||||
func (s *repositoryService) Find(ctx context.Context, repo string) (*scm.Repository, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s", repo)
|
||||
out := new(repository)
|
||||
res, err := s.client.do(ctx, "GET", path, nil, out)
|
||||
return convertRepository(out), res, err
|
||||
}
|
||||
|
||||
// FindHook returns a repository hook.
|
||||
func (s *repositoryService) FindHook(ctx context.Context, repo string, id int) (*scm.Hook, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/hooks/%d", repo, id)
|
||||
out := new(hook)
|
||||
res, err := s.client.do(ctx, "GET", path, nil, out)
|
||||
return convertHook(out), res, err
|
||||
}
|
||||
|
||||
// FindPerms returns the repository permissions.
|
||||
func (s *repositoryService) FindPerms(ctx context.Context, repo string) (*scm.Perm, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s", repo)
|
||||
out := new(repository)
|
||||
res, err := s.client.do(ctx, "GET", path, nil, out)
|
||||
return convertRepository(out).Perm, res, err
|
||||
}
|
||||
|
||||
// List returns the user repository list.
|
||||
func (s *repositoryService) List(ctx context.Context, opts scm.ListOptions) ([]*scm.Repository, *scm.Response, error) {
|
||||
path := fmt.Sprintf("user/repos?%s", encodeListOptions(opts))
|
||||
out := []*repository{}
|
||||
res, err := s.client.do(ctx, "GET", path, nil, &out)
|
||||
return convertRepositoryList(out), res, err
|
||||
}
|
||||
|
||||
// ListHooks returns a list or repository hooks.
|
||||
func (s *repositoryService) ListHooks(ctx context.Context, repo string, opts scm.ListOptions) ([]*scm.Hook, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/hooks?%s", repo, encodeListOptions(opts))
|
||||
out := []*hook{}
|
||||
res, err := s.client.do(ctx, "GET", path, nil, &out)
|
||||
return convertHookList(out), res, err
|
||||
}
|
||||
|
||||
// ListStatus returns a list of commit statuses.
|
||||
func (s *repositoryService) ListStatus(ctx context.Context, repo, ref string, opts scm.ListOptions) ([]*scm.Status, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/statuses/%s?%s", repo, ref, encodeListOptions(opts))
|
||||
out := []*status{}
|
||||
res, err := s.client.do(ctx, "GET", path, nil, &out)
|
||||
return convertStatusList(out), res, err
|
||||
}
|
||||
|
||||
// CreateHook creates a new repository webhook.
|
||||
func (s *repositoryService) CreateHook(ctx context.Context, repo string, input *scm.HookInput) (*scm.Hook, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/hooks", repo)
|
||||
in := new(hook)
|
||||
in.Active = true
|
||||
in.Name = "web"
|
||||
in.Config.Secret = input.Secret
|
||||
in.Config.ContentType = "json"
|
||||
in.Config.URL = input.Target
|
||||
in.Events = append(
|
||||
input.NativeEvents,
|
||||
convertHookEvents(input.Events)...,
|
||||
)
|
||||
out := new(hook)
|
||||
res, err := s.client.do(ctx, "POST", path, in, out)
|
||||
return convertHook(out), res, err
|
||||
}
|
||||
|
||||
// CreateStatus creates a new commit status.
|
||||
func (s *repositoryService) CreateStatus(ctx context.Context, repo, ref string, input *scm.StatusInput) (*scm.Status, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/statuses/%s", repo, ref)
|
||||
in := &status{
|
||||
State: convertFromState(input.State),
|
||||
Context: input.Label,
|
||||
Description: input.Desc,
|
||||
TargetURL: input.Target,
|
||||
}
|
||||
out := new(status)
|
||||
res, err := s.client.do(ctx, "POST", path, in, out)
|
||||
return convertStatus(out), res, err
|
||||
}
|
||||
|
||||
// DeleteHook deletes a repository webhook.
|
||||
func (s *repositoryService) DeleteHook(ctx context.Context, repo string, id int) (*scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/hooks/%d", repo, id)
|
||||
return s.client.do(ctx, "DELETE", path, nil, nil)
|
||||
}
|
||||
|
||||
// helper function to convert from the gogs repository list to
|
||||
// the common repository structure.
|
||||
func convertRepositoryList(from []*repository) []*scm.Repository {
|
||||
to := []*scm.Repository{}
|
||||
for _, v := range from {
|
||||
to = append(to, convertRepository(v))
|
||||
}
|
||||
return to
|
||||
}
|
||||
|
||||
// helper function to convert from the gogs repository structure
|
||||
// to the common repository structure.
|
||||
func convertRepository(from *repository) *scm.Repository {
|
||||
return &scm.Repository{
|
||||
Name: from.Name,
|
||||
Namespace: from.Owner.Login,
|
||||
Perm: &scm.Perm{
|
||||
Push: from.Permissions.Push,
|
||||
Pull: from.Permissions.Pull,
|
||||
Admin: from.Permissions.Admin,
|
||||
},
|
||||
Link: from.HTMLURL,
|
||||
Branch: from.DefaultBranch,
|
||||
Private: from.Private,
|
||||
Clone: from.CloneURL,
|
||||
CloneSSH: from.SSHURL,
|
||||
Created: from.CreatedAt,
|
||||
Updated: from.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
func convertHookList(from []*hook) []*scm.Hook {
|
||||
to := []*scm.Hook{}
|
||||
for _, v := range from {
|
||||
to = append(to, convertHook(v))
|
||||
}
|
||||
return to
|
||||
}
|
||||
|
||||
func convertHook(from *hook) *scm.Hook {
|
||||
return &scm.Hook{
|
||||
ID: from.ID,
|
||||
Active: from.Active,
|
||||
Target: from.Config.URL,
|
||||
Events: from.Events,
|
||||
}
|
||||
}
|
||||
|
||||
func convertHookEvents(from scm.HookEvents) []string {
|
||||
var events []string
|
||||
if from.PullRequest {
|
||||
events = append(events, "pull_request")
|
||||
}
|
||||
if from.PullRequestComment {
|
||||
events = append(events, "pull_request_review_comment")
|
||||
}
|
||||
if from.Issue {
|
||||
events = append(events, "issues")
|
||||
}
|
||||
if from.IssueComment || from.PullRequestComment {
|
||||
events = append(events, "issue_comment")
|
||||
}
|
||||
if from.Branch || from.Tag {
|
||||
events = append(events, "create")
|
||||
events = append(events, "delete")
|
||||
}
|
||||
return events
|
||||
}
|
||||
|
||||
type status struct {
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
State string `json:"state"`
|
||||
TargetURL string `json:"target_url"`
|
||||
Description string `json:"description"`
|
||||
Context string `json:"context"`
|
||||
}
|
||||
|
||||
func convertStatusList(from []*status) []*scm.Status {
|
||||
to := []*scm.Status{}
|
||||
for _, v := range from {
|
||||
to = append(to, convertStatus(v))
|
||||
}
|
||||
return to
|
||||
}
|
||||
|
||||
func convertStatus(from *status) *scm.Status {
|
||||
return &scm.Status{
|
||||
State: convertState(from.State),
|
||||
Label: from.Context,
|
||||
Desc: from.Description,
|
||||
Target: from.TargetURL,
|
||||
}
|
||||
}
|
||||
|
||||
func convertState(from string) scm.State {
|
||||
switch from {
|
||||
case "error":
|
||||
return scm.StateError
|
||||
case "failure":
|
||||
return scm.StateFailure
|
||||
case "pending":
|
||||
return scm.StatePending
|
||||
case "success":
|
||||
return scm.StateSuccess
|
||||
default:
|
||||
return scm.StateUnknown
|
||||
}
|
||||
}
|
||||
|
||||
func convertFromState(from scm.State) string {
|
||||
switch from {
|
||||
case scm.StatePending, scm.StateRunning:
|
||||
return "pending"
|
||||
case scm.StateSuccess:
|
||||
return "success"
|
||||
case scm.StateFailure:
|
||||
return "failure"
|
||||
default:
|
||||
return "error"
|
||||
}
|
||||
}
|
@ -0,0 +1,245 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
"github.com/drone/go-scm/scm/driver/github/fixtures"
|
||||
)
|
||||
|
||||
func TestRepositoryFind(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Repositories.Find(context.Background(), "octocat/hello-world")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Repository", testRepository(result))
|
||||
t.Run("Permissions", testPermissions(result.Perm))
|
||||
}
|
||||
|
||||
func TestRepositoryPerms(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Repositories.FindPerms(context.Background(), "octocat/hello-world")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Permissions", testPermissions(result))
|
||||
}
|
||||
|
||||
func TestRepositoryNotFound(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
_, _, err := client.Repositories.FindPerms(context.Background(), "not/found")
|
||||
if err == nil {
|
||||
t.Errorf("Expect Not Found error")
|
||||
return
|
||||
}
|
||||
if got, want := err.Error(), "Not Found"; got != want {
|
||||
t.Errorf("Want error %q, got %q", want, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRepositoryList(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Repositories.List(context.Background(), scm.ListOptions{Page: 1, Size: 30})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if got, want := len(result), 1; got != want {
|
||||
t.Errorf("Want %d repositories, got %d", want, got)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Page", testPage(res))
|
||||
t.Run("Repository", testRepository(result[0]))
|
||||
t.Run("Permissions", testPermissions(result[0].Perm))
|
||||
}
|
||||
|
||||
func TestStatusList(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Repositories.ListStatus(context.Background(), "octocat/hello-world", "6dcb09b5b57875f334f61aebed695e2e4193db5e", scm.ListOptions{Size: 30, Page: 1})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if got, want := len(result), 1; got != want {
|
||||
t.Errorf("Want %d statuses, got %d", want, got)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Page", testPage(res))
|
||||
t.Run("Status", testStatus(result[0]))
|
||||
}
|
||||
|
||||
func TestStatusCreate(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
in := &scm.StatusInput{
|
||||
Desc: "Build has completed successfully",
|
||||
Label: "continuous-integration/jenkins",
|
||||
State: scm.StateSuccess,
|
||||
Target: "https://ci.example.com/1000/output",
|
||||
}
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Repositories.CreateStatus(context.Background(), "octocat/hello-world", "6dcb09b5b57875f334f61aebed695e2e4193db5e", in)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Status", testStatus(result))
|
||||
}
|
||||
|
||||
func TestRepositoryHookFind(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Repositories.FindHook(context.Background(), "octocat/hello-world", 1)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Hook", testHook(result))
|
||||
}
|
||||
|
||||
func TestRepositoryHookList(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Repositories.ListHooks(context.Background(), "octocat/hello-world", scm.ListOptions{Page: 1, Size: 30})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if got, want := len(result), 1; got != want {
|
||||
t.Errorf("Want %d hooks, got %d", want, got)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Page", testPage(res))
|
||||
t.Run("Hook", testHook(result[0]))
|
||||
}
|
||||
|
||||
func TestRepositoryHookDelete(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
_, err := client.Repositories.DeleteHook(context.Background(), "octocat/hello-world", 1)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRepositoryHookCreate(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Repositories.CreateHook(context.Background(), "octocat/hello-world", &scm.HookInput{})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Hook", testHook(result))
|
||||
}
|
||||
|
||||
func testRepository(repository *scm.Repository) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := repository.Name, "Hello-World"; got != want {
|
||||
t.Errorf("Want repository Name %q, got %q", want, got)
|
||||
}
|
||||
if got, want := repository.Namespace, "octocat"; got != want {
|
||||
t.Errorf("Want repository Namespace %q, got %q", want, got)
|
||||
}
|
||||
if got, want := repository.Branch, "master"; got != want {
|
||||
t.Errorf("Want repository Branch %q, got %q", want, got)
|
||||
}
|
||||
if got, want := repository.Private, true; got != want {
|
||||
t.Errorf("Want repository Private %v, got %v", want, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testPermissions(perms *scm.Perm) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := perms.Pull, true; got != want {
|
||||
t.Errorf("Want permission Pull %v, got %v", want, got)
|
||||
}
|
||||
if got, want := perms.Push, true; got != want {
|
||||
t.Errorf("Want permission Push %v, got %v", want, got)
|
||||
}
|
||||
if got, want := perms.Admin, true; got != want {
|
||||
t.Errorf("Want permission Admin %v, got %v", want, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testHook(hook *scm.Hook) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := hook.ID, 1; got != want {
|
||||
t.Errorf("Want hook ID %v, got %v", want, got)
|
||||
}
|
||||
if got, want := hook.Active, true; got != want {
|
||||
t.Errorf("Want hook Active %v, got %v", want, got)
|
||||
}
|
||||
if got, want := hook.Target, "http://example.com/webhook"; got != want {
|
||||
t.Errorf("Want hook Target %v, got %v", want, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testStatus(status *scm.Status) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := status.Target, "https://ci.example.com/1000/output"; got != want {
|
||||
t.Errorf("Want status Target %v, got %v", want, got)
|
||||
}
|
||||
if got, want := status.State, scm.StateSuccess; got != want {
|
||||
t.Errorf("Want status State %v, got %v", want, got)
|
||||
}
|
||||
if got, want := status.Label, "continuous-integration/jenkins"; got != want {
|
||||
t.Errorf("Want status Label %v, got %v", want, got)
|
||||
}
|
||||
if got, want := status.Desc, "Build has completed successfully"; got != want {
|
||||
t.Errorf("Want status Desc %v, got %v", want, got)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
)
|
||||
|
||||
type reviewService struct {
|
||||
client *wrapper
|
||||
}
|
||||
|
||||
func (s *reviewService) Find(ctx context.Context, repo string, number, id int) (*scm.Review, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/pulls/%d/comments/%d", repo, number, id)
|
||||
out := new(review)
|
||||
res, err := s.client.do(ctx, "GET", path, nil, out)
|
||||
return convertReview(out), res, err
|
||||
}
|
||||
|
||||
func (s *reviewService) List(ctx context.Context, repo string, number int, opts scm.ListOptions) ([]*scm.Review, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/pulls/%d/comments?%s", repo, number, encodeListOptions(opts))
|
||||
out := []*review{}
|
||||
res, err := s.client.do(ctx, "GET", path, nil, &out)
|
||||
return convertReviewList(out), res, err
|
||||
}
|
||||
|
||||
func (s *reviewService) Create(ctx context.Context, repo string, number int, input *scm.ReviewInput) (*scm.Review, *scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/pulls/%d/comments", repo, number)
|
||||
in := &reviewInput{
|
||||
Body: input.Body,
|
||||
Path: input.Path,
|
||||
Position: input.Line,
|
||||
CommitID: input.Sha,
|
||||
}
|
||||
out := new(review)
|
||||
res, err := s.client.do(ctx, "POST", path, in, out)
|
||||
return convertReview(out), res, err
|
||||
}
|
||||
|
||||
func (s *reviewService) Delete(ctx context.Context, repo string, number, id int) (*scm.Response, error) {
|
||||
path := fmt.Sprintf("repos/%s/pulls/%d/comments/%d", repo, number, id)
|
||||
return s.client.do(ctx, "DELETE", path, nil, nil)
|
||||
}
|
||||
|
||||
type review struct {
|
||||
ID int `json:"id"`
|
||||
CommitID string `json:"commit_id"`
|
||||
Position int `json:"position"`
|
||||
Path string `json:"path"`
|
||||
User struct {
|
||||
ID int `json:"id"`
|
||||
Login string `json:"login"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
} `json:"user"`
|
||||
Body string `json:"body"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
type reviewInput struct {
|
||||
Body string `json:"body"`
|
||||
Path string `json:"path"`
|
||||
CommitID string `json:"commit_id"`
|
||||
Position int `json:"position"`
|
||||
}
|
||||
|
||||
func convertReviewList(from []*review) []*scm.Review {
|
||||
to := []*scm.Review{}
|
||||
for _, v := range from {
|
||||
to = append(to, convertReview(v))
|
||||
}
|
||||
return to
|
||||
}
|
||||
|
||||
func convertReview(from *review) *scm.Review {
|
||||
return &scm.Review{
|
||||
ID: from.ID,
|
||||
Body: from.Body,
|
||||
Path: from.Path,
|
||||
Line: from.Position,
|
||||
Sha: from.CommitID,
|
||||
Author: scm.User{
|
||||
Login: from.User.Login,
|
||||
Avatar: from.User.AvatarURL,
|
||||
},
|
||||
Created: from.CreatedAt,
|
||||
Updated: from.UpdatedAt,
|
||||
}
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
"github.com/drone/go-scm/scm/driver/github/fixtures"
|
||||
)
|
||||
|
||||
func TestReviewFind(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Reviews.Find(context.Background(), "octocat/hello-world", 1, 1)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Fields", testReview(result))
|
||||
}
|
||||
|
||||
func TestReviewList(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Reviews.List(context.Background(), "octocat/hello-world", 1, scm.ListOptions{Page: 1, Size: 30})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if got, want := len(result), 1; got != want {
|
||||
t.Errorf("Want %d review comments, got %d", want, got)
|
||||
return
|
||||
}
|
||||
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Page", testPage(res))
|
||||
t.Run("Fields", testReview(result[0]))
|
||||
}
|
||||
|
||||
func TestReviewCreate(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
input := &scm.ReviewInput{
|
||||
Body: "what?",
|
||||
Line: 1,
|
||||
Path: "file1.txt",
|
||||
Sha: "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||
}
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Reviews.Create(context.Background(), "octocat/hello-world", 1, input)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if want, got := res.Status, 201; want != got {
|
||||
t.Errorf("Want status code %d, got %d", want, got)
|
||||
}
|
||||
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Fields", testReview(result))
|
||||
}
|
||||
|
||||
func TestReviewDelete(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
res, err := client.Reviews.Delete(context.Background(), "octocat/hello-world", 1, 1)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if want, got := res.Status, 204; want != got {
|
||||
t.Errorf("Want status code %d, got %d", want, got)
|
||||
}
|
||||
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
}
|
||||
|
||||
func testReview(comment *scm.Review) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := comment.ID, 10; got != want {
|
||||
t.Errorf("Want issue comment ID %d, got %d", want, got)
|
||||
}
|
||||
if got, want := comment.Line, 1; got != want {
|
||||
t.Errorf("Want issue comment Line %d, got %d", want, got)
|
||||
}
|
||||
if got, want := comment.Path, "file1.txt"; got != want {
|
||||
t.Errorf("Want issue Path Body %q, got %q", want, got)
|
||||
}
|
||||
if got, want := comment.Sha, "6dcb09b5b57875f334f61aebed695e2e4193db5e"; got != want {
|
||||
t.Errorf("Want issue comment Body %q, got %q", want, got)
|
||||
}
|
||||
if got, want := comment.Body, "Great stuff"; got != want {
|
||||
t.Errorf("Want issue comment Body %q, got %q", want, got)
|
||||
}
|
||||
if got, want := comment.Author.Login, "octocat"; got != want {
|
||||
t.Errorf("Want issue comment author Login %q, got %q", want, got)
|
||||
}
|
||||
if got, want := comment.Author.Avatar, "https://github.com/images/error/octocat_happy.gif"; got != want {
|
||||
t.Errorf("Want issue comment author Avatar %q, got %q", want, got)
|
||||
}
|
||||
if got, want := comment.Created.Unix(), int64(1302796849); got != want {
|
||||
t.Errorf("Want issue comment Created %d, got %d", want, got)
|
||||
}
|
||||
if got, want := comment.Updated.Unix(), int64(1302796849); got != want {
|
||||
t.Errorf("Want issue comment Updated %d, got %d", want, got)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
"github.com/drone/go-scm/scm/driver/internal/null"
|
||||
)
|
||||
|
||||
type userService struct {
|
||||
client *wrapper
|
||||
}
|
||||
|
||||
func (s *userService) Find(ctx context.Context) (*scm.User, *scm.Response, error) {
|
||||
out := new(user)
|
||||
res, err := s.client.do(ctx, "GET", "user", nil, out)
|
||||
return convertUser(out), res, err
|
||||
}
|
||||
|
||||
func (s *userService) FindLogin(ctx context.Context, login string) (*scm.User, *scm.Response, error) {
|
||||
path := fmt.Sprintf("users/%s", login)
|
||||
out := new(user)
|
||||
res, err := s.client.do(ctx, "GET", path, nil, out)
|
||||
return convertUser(out), res, err
|
||||
}
|
||||
|
||||
func (s *userService) FindEmail(ctx context.Context) (string, *scm.Response, error) {
|
||||
user, res, err := s.Find(ctx)
|
||||
return user.Email, res, err
|
||||
}
|
||||
|
||||
type user struct {
|
||||
ID int `json:"id"`
|
||||
Login string `json:"login"`
|
||||
Name string `json:"name"`
|
||||
Email null.String `json:"email"`
|
||||
Avatar string `json:"avatar_url"`
|
||||
}
|
||||
|
||||
func convertUser(from *user) *scm.User {
|
||||
return &scm.User{
|
||||
Avatar: from.Avatar,
|
||||
Email: from.Email.String,
|
||||
Login: from.Login,
|
||||
Name: from.Name,
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
"github.com/drone/go-scm/scm/driver/github/fixtures"
|
||||
)
|
||||
|
||||
func TestUserFind(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Users.Find(context.Background())
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Fields", testUser(result))
|
||||
}
|
||||
|
||||
func TestUserLoginFind(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Users.FindLogin(context.Background(), "octocat")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
t.Run("Fields", testUser(result))
|
||||
}
|
||||
|
||||
func TestUserEmailFind(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, res, err := client.Users.FindEmail(context.Background())
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if got, want := result, "octocat@github.com"; got != want {
|
||||
t.Errorf("Want user Email %q, got %q", want, got)
|
||||
}
|
||||
t.Run("Request", testRequest(res))
|
||||
t.Run("Rate", testRate(res))
|
||||
}
|
||||
|
||||
func testUser(user *scm.User) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := user.Login, "octocat"; got != want {
|
||||
t.Errorf("Want user Login %v, got %v", want, got)
|
||||
}
|
||||
if got, want := user.Email, "octocat@github.com"; got != want {
|
||||
t.Errorf("Want user Email %v, got %v", want, got)
|
||||
}
|
||||
if got, want := user.Avatar, "https://github.com/images/error/octocat_happy.gif"; got != want {
|
||||
t.Errorf("Want user Avatar %v, got %v", want, got)
|
||||
}
|
||||
if got, want := user.Name, "monalisa octocat"; got != want {
|
||||
t.Errorf("Want user Name %v, got %v", want, got)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
)
|
||||
|
||||
func encodeListOptions(opts scm.ListOptions) string {
|
||||
params := url.Values{}
|
||||
if opts.Page != 0 {
|
||||
params.Set("page", strconv.Itoa(opts.Page))
|
||||
}
|
||||
if opts.Size != 0 {
|
||||
params.Set("per_page", strconv.Itoa(opts.Size))
|
||||
}
|
||||
return params.Encode()
|
||||
}
|
||||
|
||||
func encodeCommitListOptions(opts scm.CommitListOptions) string {
|
||||
params := url.Values{}
|
||||
if opts.Page != 0 {
|
||||
params.Set("page", strconv.Itoa(opts.Page))
|
||||
}
|
||||
if opts.Size != 0 {
|
||||
params.Set("per_page", strconv.Itoa(opts.Size))
|
||||
}
|
||||
if opts.Ref != "" {
|
||||
params.Set("ref", opts.Ref)
|
||||
}
|
||||
return params.Encode()
|
||||
}
|
||||
|
||||
func encodeIssueListOptions(opts scm.IssueListOptions) string {
|
||||
params := url.Values{}
|
||||
if opts.Page != 0 {
|
||||
params.Set("page", strconv.Itoa(opts.Page))
|
||||
}
|
||||
if opts.Size != 0 {
|
||||
params.Set("per_page", strconv.Itoa(opts.Size))
|
||||
}
|
||||
if opts.Open && opts.Closed {
|
||||
params.Set("state", "all")
|
||||
} else if opts.Closed {
|
||||
params.Set("state", "closed")
|
||||
}
|
||||
return params.Encode()
|
||||
}
|
||||
|
||||
func encodePullRequestListOptions(opts scm.PullRequestListOptions) string {
|
||||
params := url.Values{}
|
||||
if opts.Page != 0 {
|
||||
params.Set("page", strconv.Itoa(opts.Page))
|
||||
}
|
||||
if opts.Size != 0 {
|
||||
params.Set("per_page", strconv.Itoa(opts.Size))
|
||||
}
|
||||
if opts.Open && opts.Closed {
|
||||
params.Set("state", "all")
|
||||
} else if opts.Closed {
|
||||
params.Set("state", "closed")
|
||||
}
|
||||
return params.Encode()
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
)
|
||||
|
||||
func Test_encodeListOptions(t *testing.T) {
|
||||
opts := scm.ListOptions{
|
||||
Page: 10,
|
||||
Size: 30,
|
||||
}
|
||||
want := "page=10&per_page=30"
|
||||
got := encodeListOptions(opts)
|
||||
if got != want {
|
||||
t.Errorf("Want encoded list options %q, got %q", want, got)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_encodeCommitListOptions(t *testing.T) {
|
||||
opts := scm.CommitListOptions{
|
||||
Page: 10,
|
||||
Size: 30,
|
||||
Ref: "master",
|
||||
}
|
||||
want := "page=10&per_page=30&ref=master"
|
||||
got := encodeCommitListOptions(opts)
|
||||
if got != want {
|
||||
t.Errorf("Want encoded commit list options %q, got %q", want, got)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_encodeIssueListOptions(t *testing.T) {
|
||||
opts := scm.IssueListOptions{
|
||||
Page: 10,
|
||||
Size: 30,
|
||||
Open: true,
|
||||
Closed: true,
|
||||
}
|
||||
want := "page=10&per_page=30&state=all"
|
||||
got := encodeIssueListOptions(opts)
|
||||
if got != want {
|
||||
t.Errorf("Want encoded issue list options %q, got %q", want, got)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_encodePullRequestListOptions(t *testing.T) {
|
||||
t.Parallel()
|
||||
opts := scm.PullRequestListOptions{
|
||||
Page: 10,
|
||||
Size: 30,
|
||||
Open: true,
|
||||
Closed: true,
|
||||
}
|
||||
want := "page=10&per_page=30&state=all"
|
||||
got := encodePullRequestListOptions(opts)
|
||||
if got != want {
|
||||
t.Errorf("Want encoded pr list options %q, got %q", want, got)
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
)
|
||||
|
||||
type contentService struct {
|
||||
client *wrapper
|
||||
}
|
||||
|
||||
func (s *contentService) Find(ctx context.Context, repo, path, ref string) (*scm.Content, *scm.Response, error) {
|
||||
path = url.QueryEscape(path)
|
||||
path = strings.Replace(path, ".", "%2E", -1)
|
||||
endpoint := fmt.Sprintf("api/v4/projects/%s/repository/files/%s?ref=%s", encode(repo), path, ref)
|
||||
out := new(content)
|
||||
res, err := s.client.do(ctx, "GET", endpoint, nil, out)
|
||||
raw, _ := base64.RawURLEncoding.DecodeString(out.Content)
|
||||
return &scm.Content{
|
||||
Path: out.FilePath,
|
||||
Data: raw,
|
||||
}, res, err
|
||||
}
|
||||
|
||||
func (s *contentService) Create(ctx context.Context, repo, path string, params *scm.ContentParams) (*scm.Response, error) {
|
||||
return nil, scm.ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *contentService) Update(ctx context.Context, repo, path string, params *scm.ContentParams) (*scm.Response, error) {
|
||||
return nil, scm.ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *contentService) Delete(ctx context.Context, repo, path, ref string) (*scm.Response, error) {
|
||||
return nil, scm.ErrNotSupported
|
||||
}
|
||||
|
||||
type content struct {
|
||||
FileName string `json:"file_name"`
|
||||
FilePath string `json:"file_path"`
|
||||
Size int `json:"size"`
|
||||
Encoding string `json:"encoding"`
|
||||
Content string `json:"content"`
|
||||
Ref string `json:"ref"`
|
||||
BlobID string `json:"blob_id"`
|
||||
CommitID string `json:"commit_id"`
|
||||
LastCommitID string `json:"last_commit_id"`
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
// Copyright 2017 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/go-scm/scm"
|
||||
"github.com/drone/go-scm/scm/driver/gitlab/fixtures"
|
||||
)
|
||||
|
||||
func TestContentFind(t *testing.T) {
|
||||
server := fixtures.NewServer()
|
||||
defer server.Close()
|
||||
|
||||
client, _ := New(server.URL)
|
||||
result, _, err := client.Contents.Find(context.Background(), "diaspora/diaspora", "app/models/key.rb", "d5a3ff139356ce33e37e73add446f16869741b50")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if got, want := result.Path, "app/models/key.rb"; got != want {
|
||||
t.Errorf("Want content Path %q, got %q", want, got)
|
||||
}
|
||||
if !bytes.Equal(result.Data, fileContent) {
|
||||
t.Errorf("Downloaded content does not match")
|
||||
}
|
||||
}
|
||||
|
||||
func TestContentCreate(t *testing.T) {
|
||||
content := new(contentService)
|
||||
_, err := content.Create(context.Background(), "octocat/hello-world", "README", nil)
|
||||
if err != scm.ErrNotSupported {
|
||||
t.Errorf("Expect Not Supported error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestContentUpdate(t *testing.T) {
|
||||
content := new(contentService)
|
||||
_, err := content.Update(context.Background(), "octocat/hello-world", "README", nil)
|
||||
if err != scm.ErrNotSupported {
|
||||
t.Errorf("Expect Not Supported error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestContentDelete(t *testing.T) {
|
||||
content := new(contentService)
|
||||
_, err := content.Delete(context.Background(), "octocat/hello-world", "README", "master")
|
||||
if err != scm.ErrNotSupported {
|
||||
t.Errorf("Expect Not Supported error")
|
||||
}
|
||||
}
|
||||
|
||||
var fileContent = []byte(`require 'digest/md5'
|
||||
|
||||
class Key < ActiveRecord::Base
|
||||
include Gitlab::CurrentSettings
|
||||
include Sortable
|
||||
|
||||
belongs_to :user
|
||||
|
||||
before_validation :generate_fingerprint
|
||||
|
||||
validates :title,
|
||||
presence: true,
|
||||
length: { maximum: 255 }
|
||||
|
||||
validates :key,
|
||||
presence: true,
|
||||
length: { maximum: 5000 },
|
||||
format: { with: /\A(ssh|ecdsa)-.*\Z/ }
|
||||
|
||||
validates :fingerprint,
|
||||
uniqueness: true,
|
||||
presence: { message: 'cannot be generated' }
|
||||
|
||||
validate :key_meets_restrictions
|
||||
|
||||
delegate :name, :email, to: :user, prefix: true
|
||||
|
||||
after_commit :add_to_shell, on: :create
|
||||
after_create :post_create_hook
|
||||
after_create :refresh_user_cache
|
||||
after_commit :remove_from_shell, on: :destroy
|
||||
after_destroy :post_destroy_hook
|
||||
after_destroy :refresh_user_cache
|
||||
|
||||
def key=(value)
|
||||
value&.delete!("\n\r")
|
||||
value.strip! unless value.blank`)
|
@ -0,0 +1,32 @@
|
||||
GET /api/v4/projects/diaspora%2Fdiaspora/repository/branches/master
|
||||
Status: 200
|
||||
Content-Type: application/json
|
||||
RateLimit-Limit:600
|
||||
RateLimit-Observed:1
|
||||
RateLimit-Remaining:599
|
||||
RateLimit-Reset:1512454441
|
||||
RateLimit-ResetTime:Wed, 05 Dec 2017 06:14:01 GMT
|
||||
X-Request-Id:0d511a76-2ade-4c34-af0d-d17e84adb255
|
||||
|
||||
{
|
||||
"name": "master",
|
||||
"merged": false,
|
||||
"protected": true,
|
||||
"developers_can_push": false,
|
||||
"developers_can_merge": false,
|
||||
"commit": {
|
||||
"author_email": "john@example.com",
|
||||
"author_name": "John Smith",
|
||||
"authored_date": "2012-06-27T05:51:39-07:00",
|
||||
"committed_date": "2012-06-28T03:44:20-07:00",
|
||||
"committer_email": "john@example.com",
|
||||
"committer_name": "John Smith",
|
||||
"id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c",
|
||||
"short_id": "7b5c3cc",
|
||||
"title": "add projects API",
|
||||
"message": "add projects API",
|
||||
"parent_ids": [
|
||||
"4ad91d3c1144c406e50c7b33bae684bd6837faf8"
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
GET /api/v4/projects/diaspora%2Fdiaspora/repository/branches?page=1&per_page=30
|
||||
Status: 200
|
||||
Content-Type: application/json
|
||||
RateLimit-Limit:600
|
||||
RateLimit-Observed:1
|
||||
RateLimit-Remaining:599
|
||||
RateLimit-Reset:1512454441
|
||||
RateLimit-ResetTime:Wed, 05 Dec 2017 06:14:01 GMT
|
||||
X-Request-Id:0d511a76-2ade-4c34-af0d-d17e84adb255
|
||||
Link: <https://api.github.com/resource?page=2>; rel="next",
|
||||
<https://api.github.com/resource?page=1>; rel="prev",
|
||||
<https://api.github.com/resource?page=1>; rel="first",
|
||||
<https://api.github.com/resource?page=5>; rel="last"
|
||||
|
||||
[
|
||||
{
|
||||
"name": "master",
|
||||
"merged": false,
|
||||
"protected": true,
|
||||
"developers_can_push": false,
|
||||
"developers_can_merge": false,
|
||||
"commit": {
|
||||
"author_email": "john@example.com",
|
||||
"author_name": "John Smith",
|
||||
"authored_date": "2012-06-27T05:51:39-07:00",
|
||||
"committed_date": "2012-06-28T03:44:20-07:00",
|
||||
"committer_email": "john@example.com",
|
||||
"committer_name": "John Smith",
|
||||
"id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c",
|
||||
"short_id": "7b5c3cc",
|
||||
"title": "add projects API",
|
||||
"message": "add projects API",
|
||||
"parent_ids": [
|
||||
"4ad91d3c1144c406e50c7b33bae684bd6837faf8"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
@ -0,0 +1,38 @@
|
||||
GET /api/v4/projects/diaspora%2Fdiaspora/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6
|
||||
Status: 200
|
||||
Content-Type: application/json
|
||||
RateLimit-Limit:600
|
||||
RateLimit-Observed:1
|
||||
RateLimit-Remaining:599
|
||||
RateLimit-Reset:1512454441
|
||||
RateLimit-ResetTime:Wed, 05 Dec 2017 06:14:01 GMT
|
||||
X-Request-Id:0d511a76-2ade-4c34-af0d-d17e84adb255
|
||||
|
||||
{
|
||||
"id": "6104942438c14ec7bd21c6cd5bd995272b3faff6",
|
||||
"short_id": "6104942438c",
|
||||
"title": "Sanitize for network graph",
|
||||
"author_name": "randx",
|
||||
"author_email": "dmitriy.zaporozhets@gmail.com",
|
||||
"committer_name": "Dmitriy",
|
||||
"committer_email": "dmitriy.zaporozhets@gmail.com",
|
||||
"created_at": "2012-06-28T03:44:20-07:00",
|
||||
"message": "Sanitize for network graph",
|
||||
"committed_date": "2012-06-28T03:44:20-07:00",
|
||||
"authored_date": "2012-06-28T03:44:20-07:00",
|
||||
"parent_ids": [
|
||||
"ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba"
|
||||
],
|
||||
"last_pipeline" : {
|
||||
"id": 8,
|
||||
"ref": "master",
|
||||
"sha": "2dc6aa325a317eda67812f05600bdf0fcdc70ab0",
|
||||
"status": "created"
|
||||
},
|
||||
"stats": {
|
||||
"additions": 15,
|
||||
"deletions": 10,
|
||||
"total": 25
|
||||
},
|
||||
"status": "running"
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
GET /api/v4/projects/diaspora%2Fdiaspora/repository/commits?page=1&per_page=30&ref_name=master
|
||||
Status: 200
|
||||
Content-Type: application/json
|
||||
RateLimit-Limit:600
|
||||
RateLimit-Observed:1
|
||||
RateLimit-Remaining:599
|
||||
RateLimit-Reset:1512454441
|
||||
RateLimit-ResetTime:Wed, 05 Dec 2017 06:14:01 GMT
|
||||
X-Request-Id:0d511a76-2ade-4c34-af0d-d17e84adb255
|
||||
Link: <https://api.github.com/resource?page=2>; rel="next",
|
||||
<https://api.github.com/resource?page=1>; rel="prev",
|
||||
<https://api.github.com/resource?page=1>; rel="first",
|
||||
<https://api.github.com/resource?page=5>; rel="last"
|
||||
|
||||
[
|
||||
{
|
||||
"id": "6104942438c14ec7bd21c6cd5bd995272b3faff6",
|
||||
"short_id": "6104942438c",
|
||||
"title": "Sanitize for network graph",
|
||||
"author_name": "randx",
|
||||
"author_email": "dmitriy.zaporozhets@gmail.com",
|
||||
"authored_date": "2012-06-28T03:44:20-07:00",
|
||||
"committer_name": "Dmitriy",
|
||||
"committer_email": "dmitriy.zaporozhets@gmail.com",
|
||||
"committed_date": "2012-06-28T03:44:20-07:00",
|
||||
"created_at": "2012-09-20T09:06:12+03:00",
|
||||
"message": "Sanitize for network graph",
|
||||
"parent_ids": [
|
||||
"ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba"
|
||||
]
|
||||
}
|
||||
]
|
@ -0,0 +1,20 @@
|
||||
GET /api/v4/projects/diaspora%2Fdiaspora/repository/files/app%2Fmodels%2Fkey%2Erb?ref=d5a3ff139356ce33e37e73add446f16869741b50
|
||||
Status: 200
|
||||
RateLimit-Limit:600
|
||||
RateLimit-Observed:1
|
||||
RateLimit-Remaining:599
|
||||
RateLimit-Reset:1512454441
|
||||
RateLimit-ResetTime:Wed, 05 Dec 2017 06:14:01 GMT
|
||||
X-Request-Id:0d511a76-2ade-4c34-af0d-d17e84adb255
|
||||
|
||||
{
|
||||
"file_name": "key.rb",
|
||||
"file_path": "app/models/key.rb",
|
||||
"size": 1476,
|
||||
"encoding": "base64",
|
||||
"content": "cmVxdWlyZSAnZGlnZXN0L21kNScKCmNsYXNzIEtleSA8IEFjdGl2ZVJlY29yZDo6QmFzZQogIGluY2x1ZGUgR2l0bGFiOjpDdXJyZW50U2V0dGluZ3MKICBpbmNsdWRlIFNvcnRhYmxlCgogIGJlbG9uZ3NfdG8gOnVzZXIKCiAgYmVmb3JlX3ZhbGlkYXRpb24gOmdlbmVyYXRlX2ZpbmdlcnByaW50CgogIHZhbGlkYXRlcyA6dGl0bGUsCiAgICBwcmVzZW5jZTogdHJ1ZSwKICAgIGxlbmd0aDogeyBtYXhpbXVtOiAyNTUgfQoKICB2YWxpZGF0ZXMgOmtleSwKICAgIHByZXNlbmNlOiB0cnVlLAogICAgbGVuZ3RoOiB7IG1heGltdW06IDUwMDAgfSwKICAgIGZvcm1hdDogeyB3aXRoOiAvXEEoc3NofGVjZHNhKS0uKlxaLyB9CgogIHZhbGlkYXRlcyA6ZmluZ2VycHJpbnQsCiAgICB1bmlxdWVuZXNzOiB0cnVlLAogICAgcHJlc2VuY2U6IHsgbWVzc2FnZTogJ2Nhbm5vdCBiZSBnZW5lcmF0ZWQnIH0KCiAgdmFsaWRhdGUgOmtleV9tZWV0c19yZXN0cmljdGlvbnMKCiAgZGVsZWdhdGUgOm5hbWUsIDplbWFpbCwgdG86IDp1c2VyLCBwcmVmaXg6IHRydWUKCiAgYWZ0ZXJfY29tbWl0IDphZGRfdG9fc2hlbGwsIG9uOiA6Y3JlYXRlCiAgYWZ0ZXJfY3JlYXRlIDpwb3N0X2NyZWF0ZV9ob29rCiAgYWZ0ZXJfY3JlYXRlIDpyZWZyZXNoX3VzZXJfY2FjaGUKICBhZnRlcl9jb21taXQgOnJlbW92ZV9mcm9tX3NoZWxsLCBvbjogOmRlc3Ryb3kKICBhZnRlcl9kZXN0cm95IDpwb3N0X2Rlc3Ryb3lfaG9vawogIGFmdGVyX2Rlc3Ryb3kgOnJlZnJlc2hfdXNlcl9jYWNoZQoKICBkZWYga2V5PSh2YWx1ZSkKICAgIHZhbHVlJi5kZWxldGUhKCJcblxyIikKICAgIHZhbHVlLnN0cmlwISB1bmxlc3MgdmFsdWUuYmxhbms",
|
||||
"ref": "master",
|
||||
"blob_id": "79f7bbd25901e8334750839545a9bd021f0e4c83",
|
||||
"commit_id": "d5a3ff139356ce33e37e73add446f16869741b50",
|
||||
"last_commit_id": "570e7b2abdd848b95f2f578043fc23bd6f6fd24d"
|
||||
}
|
@ -0,0 +1,151 @@
|
||||
GET /api/v4/groups/Twitter
|
||||
Status: 200
|
||||
Content-Type: application/json
|
||||
RateLimit-Limit:600
|
||||
RateLimit-Observed:1
|
||||
RateLimit-Remaining:599
|
||||
RateLimit-Reset:1512454441
|
||||
RateLimit-ResetTime:Wed, 05 Dec 2017 06:14:01 GMT
|
||||
X-Request-Id:0d511a76-2ade-4c34-af0d-d17e84adb255
|
||||
|
||||
{
|
||||
"id": 4,
|
||||
"name": "Twitter",
|
||||
"path": "twitter",
|
||||
"description": "Aliquid qui quis dignissimos distinctio ut commodi voluptas est.",
|
||||
"visibility": "public",
|
||||
"avatar_url": "http://localhost:3000/uploads/group/avatar/1/twitter.jpg",
|
||||
"web_url": "https://gitlab.example.com/groups/twitter",
|
||||
"request_access_enabled": false,
|
||||
"full_name": "Twitter",
|
||||
"full_path": "twitter",
|
||||
"parent_id": null,
|
||||
"projects": [
|
||||
{
|
||||
"id": 7,
|
||||
"description": "Voluptas veniam qui et beatae voluptas doloremque explicabo facilis.",
|
||||
"default_branch": "master",
|
||||
"tag_list": [],
|
||||
"archived": false,
|
||||
"visibility": "public",
|
||||
"ssh_url_to_repo": "git@gitlab.example.com:twitter/typeahead-js.git",
|
||||
"http_url_to_repo": "https://gitlab.example.com/twitter/typeahead-js.git",
|
||||
"web_url": "https://gitlab.example.com/twitter/typeahead-js",
|
||||
"name": "Typeahead.Js",
|
||||
"name_with_namespace": "Twitter / Typeahead.Js",
|
||||
"path": "typeahead-js",
|
||||
"path_with_namespace": "twitter/typeahead-js",
|
||||
"issues_enabled": true,
|
||||
"merge_requests_enabled": true,
|
||||
"wiki_enabled": true,
|
||||
"jobs_enabled": true,
|
||||
"snippets_enabled": false,
|
||||
"container_registry_enabled": true,
|
||||
"created_at": "2016-06-17T07:47:25.578Z",
|
||||
"last_activity_at": "2016-06-17T07:47:25.881Z",
|
||||
"shared_runners_enabled": true,
|
||||
"creator_id": 1,
|
||||
"namespace": {
|
||||
"id": 4,
|
||||
"name": "Twitter",
|
||||
"path": "twitter",
|
||||
"kind": "group"
|
||||
},
|
||||
"avatar_url": null,
|
||||
"star_count": 0,
|
||||
"forks_count": 0,
|
||||
"open_issues_count": 3,
|
||||
"public_jobs": true,
|
||||
"shared_with_groups": [],
|
||||
"request_access_enabled": false
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"description": "Aspernatur omnis repudiandae qui voluptatibus eaque.",
|
||||
"default_branch": "master",
|
||||
"tag_list": [],
|
||||
"archived": false,
|
||||
"visibility": "internal",
|
||||
"ssh_url_to_repo": "git@gitlab.example.com:twitter/flight.git",
|
||||
"http_url_to_repo": "https://gitlab.example.com/twitter/flight.git",
|
||||
"web_url": "https://gitlab.example.com/twitter/flight",
|
||||
"name": "Flight",
|
||||
"name_with_namespace": "Twitter / Flight",
|
||||
"path": "flight",
|
||||
"path_with_namespace": "twitter/flight",
|
||||
"issues_enabled": true,
|
||||
"merge_requests_enabled": true,
|
||||
"wiki_enabled": true,
|
||||
"jobs_enabled": true,
|
||||
"snippets_enabled": false,
|
||||
"container_registry_enabled": true,
|
||||
"created_at": "2016-06-17T07:47:24.661Z",
|
||||
"last_activity_at": "2016-06-17T07:47:24.838Z",
|
||||
"shared_runners_enabled": true,
|
||||
"creator_id": 1,
|
||||
"namespace": {
|
||||
"id": 4,
|
||||
"name": "Twitter",
|
||||
"path": "twitter",
|
||||
"kind": "group"
|
||||
},
|
||||
"avatar_url": null,
|
||||
"star_count": 0,
|
||||
"forks_count": 0,
|
||||
"open_issues_count": 8,
|
||||
"public_jobs": true,
|
||||
"shared_with_groups": [],
|
||||
"request_access_enabled": false
|
||||
}
|
||||
],
|
||||
"shared_projects": [
|
||||
{
|
||||
"id": 8,
|
||||
"description": "Velit eveniet provident fugiat saepe eligendi autem.",
|
||||
"default_branch": "master",
|
||||
"tag_list": [],
|
||||
"archived": false,
|
||||
"visibility": "private",
|
||||
"ssh_url_to_repo": "git@gitlab.example.com:h5bp/html5-boilerplate.git",
|
||||
"http_url_to_repo": "https://gitlab.example.com/h5bp/html5-boilerplate.git",
|
||||
"web_url": "https://gitlab.example.com/h5bp/html5-boilerplate",
|
||||
"name": "Html5 Boilerplate",
|
||||
"name_with_namespace": "H5bp / Html5 Boilerplate",
|
||||
"path": "html5-boilerplate",
|
||||
"path_with_namespace": "h5bp/html5-boilerplate",
|
||||
"issues_enabled": true,
|
||||
"merge_requests_enabled": true,
|
||||
"wiki_enabled": true,
|
||||
"jobs_enabled": true,
|
||||
"snippets_enabled": false,
|
||||
"container_registry_enabled": true,
|
||||
"created_at": "2016-06-17T07:47:27.089Z",
|
||||
"last_activity_at": "2016-06-17T07:47:27.310Z",
|
||||
"shared_runners_enabled": true,
|
||||
"creator_id": 1,
|
||||
"namespace": {
|
||||
"id": 5,
|
||||
"name": "H5bp",
|
||||
"path": "h5bp",
|
||||
"kind": "group"
|
||||
},
|
||||
"avatar_url": null,
|
||||
"star_count": 0,
|
||||
"forks_count": 0,
|
||||
"open_issues_count": 4,
|
||||
"public_jobs": true,
|
||||
"shared_with_groups": [
|
||||
{
|
||||
"group_id": 4,
|
||||
"group_name": "Twitter",
|
||||
"group_access_level": 30
|
||||
},
|
||||
{
|
||||
"group_id": 3,
|
||||
"group_name": "Gitlab Org",
|
||||
"group_access_level": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
GET /api/v4/groups?page=1&per_page=30
|
||||
Status: 200
|
||||
Content-Type: application/json
|
||||
RateLimit-Limit:600
|
||||
RateLimit-Observed:1
|
||||
RateLimit-Remaining:599
|
||||
RateLimit-Reset:1512454441
|
||||
RateLimit-ResetTime:Wed, 05 Dec 2017 06:14:01 GMT
|
||||
X-Request-Id:0d511a76-2ade-4c34-af0d-d17e84adb255
|
||||
Link: <https://api.github.com/resource?page=2>; rel="next",
|
||||
<https://api.github.com/resource?page=1>; rel="prev",
|
||||
<https://api.github.com/resource?page=1>; rel="first",
|
||||
<https://api.github.com/resource?page=5>; rel="last"
|
||||
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Twitter",
|
||||
"path": "twitter",
|
||||
"description": "An interesting group",
|
||||
"visibility": "public",
|
||||
"lfs_enabled": true,
|
||||
"avatar_url": "http://localhost:3000/uploads/group/avatar/1/twitter.jpg",
|
||||
"web_url": "http://localhost:3000/groups/twitter",
|
||||
"request_access_enabled": false,
|
||||
"full_name": "Twitter",
|
||||
"full_path": "twitter",
|
||||
"parent_id": null
|
||||
}
|
||||
]
|
@ -0,0 +1,25 @@
|
||||
POST /api/v4/projects/diaspora%2Fdiaspora/hooks?push_events=true&url=http%3A%2F%2Fexample.com%2Fhook
|
||||
Status: 200
|
||||
Content-Type: application/json
|
||||
RateLimit-Limit:600
|
||||
RateLimit-Observed:1
|
||||
RateLimit-Remaining:599
|
||||
RateLimit-Reset:1512454441
|
||||
RateLimit-ResetTime:Wed, 05 Dec 2017 06:14:01 GMT
|
||||
X-Request-Id:0d511a76-2ade-4c34-af0d-d17e84adb255
|
||||
|
||||
{
|
||||
"id": 1,
|
||||
"url": "http://example.com/hook",
|
||||
"project_id": 3,
|
||||
"push_events": true,
|
||||
"issues_events": true,
|
||||
"merge_requests_events": true,
|
||||
"tag_push_events": true,
|
||||
"note_events": true,
|
||||
"job_events": true,
|
||||
"pipeline_events": true,
|
||||
"wiki_page_events": true,
|
||||
"enable_ssl_verification": true,
|
||||
"created_at": "2012-10-12T17:04:47Z"
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
DELETE /api/v4/projects/diaspora%2Fdiaspora/hooks/1
|
||||
Status: 200
|
||||
Content-Type: application/json
|
||||
RateLimit-Limit:600
|
||||
RateLimit-Observed:1
|
||||
RateLimit-Remaining:599
|
||||
RateLimit-Reset:1512454441
|
||||
RateLimit-ResetTime:Wed, 05 Dec 2017 06:14:01 GMT
|
||||
X-Request-Id:0d511a76-2ade-4c34-af0d-d17e84adb255
|
||||
|
@ -0,0 +1,25 @@
|
||||
GET /api/v4/projects/diaspora%2Fdiaspora/hooks/1
|
||||
Status: 200
|
||||
Content-Type: application/json
|
||||
RateLimit-Limit:600
|
||||
RateLimit-Observed:1
|
||||
RateLimit-Remaining:599
|
||||
RateLimit-Reset:1512454441
|
||||
RateLimit-ResetTime:Wed, 05 Dec 2017 06:14:01 GMT
|
||||
X-Request-Id:0d511a76-2ade-4c34-af0d-d17e84adb255
|
||||
|
||||
{
|
||||
"id": 1,
|
||||
"url": "http://example.com/hook",
|
||||
"project_id": 3,
|
||||
"push_events": true,
|
||||
"issues_events": true,
|
||||
"merge_requests_events": true,
|
||||
"tag_push_events": true,
|
||||
"note_events": true,
|
||||
"job_events": true,
|
||||
"pipeline_events": true,
|
||||
"wiki_page_events": true,
|
||||
"enable_ssl_verification": true,
|
||||
"created_at": "2012-10-12T17:04:47Z"
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
GET /api/v4/projects/diaspora%2Fdiaspora/hooks?page=1&per_page=30
|
||||
Status: 200
|
||||
Content-Type: application/json
|
||||
RateLimit-Limit:600
|
||||
RateLimit-Observed:1
|
||||
RateLimit-Remaining:599
|
||||
RateLimit-Reset:1512454441
|
||||
RateLimit-ResetTime:Wed, 05 Dec 2017 06:14:01 GMT
|
||||
X-Request-Id:0d511a76-2ade-4c34-af0d-d17e84adb255
|
||||
Link: <https://api.github.com/resource?page=2>; rel="next",
|
||||
<https://api.github.com/resource?page=1>; rel="prev",
|
||||
<https://api.github.com/resource?page=1>; rel="first",
|
||||
<https://api.github.com/resource?page=5>; rel="last"
|
||||
|
||||
[{
|
||||
"id": 1,
|
||||
"url": "http://example.com/hook",
|
||||
"project_id": 3,
|
||||
"push_events": true,
|
||||
"issues_events": true,
|
||||
"merge_requests_events": true,
|
||||
"tag_push_events": true,
|
||||
"note_events": true,
|
||||
"job_events": true,
|
||||
"pipeline_events": true,
|
||||
"wiki_page_events": true,
|
||||
"enable_ssl_verification": true,
|
||||
"created_at": "2012-10-12T17:04:47Z"
|
||||
}]
|
@ -0,0 +1,75 @@
|
||||
POST /api/v4/projects/diaspora%2Fdiaspora/issues?description=I%27m+having+a+problem+with+this.&title=Found+a+bug
|
||||
Status: 200
|
||||
Content-Type: application/json
|
||||
RateLimit-Limit:600
|
||||
RateLimit-Observed:1
|
||||
RateLimit-Remaining:599
|
||||
RateLimit-Reset:1512454441
|
||||
RateLimit-ResetTime:Wed, 05 Dec 2017 06:14:01 GMT
|
||||
X-Request-Id:0d511a76-2ade-4c34-af0d-d17e84adb255
|
||||
|
||||
{
|
||||
"project_id" : 4,
|
||||
"milestone" : {
|
||||
"due_date" : null,
|
||||
"project_id" : 4,
|
||||
"state" : "closed",
|
||||
"description" : "Rerum est voluptatem provident consequuntur molestias similique ipsum dolor.",
|
||||
"iid" : 3,
|
||||
"id" : 11,
|
||||
"title" : "v3.0",
|
||||
"created_at" : "2016-01-04T15:31:39.788Z",
|
||||
"updated_at" : "2016-01-04T15:31:39.788Z",
|
||||
"closed_at" : "2016-01-05T15:31:46.176Z"
|
||||
},
|
||||
"author" : {
|
||||
"state" : "active",
|
||||
"web_url" : "https://gitlab.example.com/root",
|
||||
"avatar_url" : null,
|
||||
"username" : "root",
|
||||
"id" : 1,
|
||||
"name" : "Administrator"
|
||||
},
|
||||
"description" : "Omnis vero earum sunt corporis dolor et placeat.",
|
||||
"state" : "closed",
|
||||
"iid" : 1,
|
||||
"assignees" : [{
|
||||
"avatar_url" : null,
|
||||
"web_url" : "https://gitlab.example.com/lennie",
|
||||
"state" : "active",
|
||||
"username" : "lennie",
|
||||
"id" : 9,
|
||||
"name" : "Dr. Luella Kovacek"
|
||||
}],
|
||||
"assignee" : {
|
||||
"avatar_url" : null,
|
||||
"web_url" : "https://gitlab.example.com/lennie",
|
||||
"state" : "active",
|
||||
"username" : "lennie",
|
||||
"id" : 9,
|
||||
"name" : "Dr. Luella Kovacek"
|
||||
},
|
||||
"labels" : [],
|
||||
"id" : 41,
|
||||
"title" : "Ut commodi ullam eos dolores perferendis nihil sunt.",
|
||||
"updated_at" : "2016-01-04T15:31:46.176Z",
|
||||
"created_at" : "2016-01-04T15:31:46.176Z",
|
||||
"subscribed": false,
|
||||
"user_notes_count": 1,
|
||||
"due_date": null,
|
||||
"web_url": "http://example.com/example/example/issues/1",
|
||||
"time_stats": {
|
||||
"time_estimate": 0,
|
||||
"total_time_spent": 0,
|
||||
"human_time_estimate": null,
|
||||
"human_total_time_spent": null
|
||||
},
|
||||
"confidential": false,
|
||||
"discussion_locked": false,
|
||||
"_links": {
|
||||
"self": "http://example.com/api/v4/projects/1/issues/2",
|
||||
"notes": "http://example.com/api/v4/projects/1/issues/2/notes",
|
||||
"award_emoji": "http://example.com/api/v4/projects/1/issues/2/award_emoji",
|
||||
"project": "http://example.com/api/v4/projects/1"
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
PUT /api/v4/projects/diaspora%2Fdiaspora/issues/1?state_event=close
|
||||
Status: 200
|
||||
Content-Type: application/json
|
||||
RateLimit-Limit:600
|
||||
RateLimit-Observed:1
|
||||
RateLimit-Remaining:599
|
||||
RateLimit-Reset:1512454441
|
||||
RateLimit-ResetTime:Wed, 05 Dec 2017 06:14:01 GMT
|
||||
X-Request-Id:0d511a76-2ade-4c34-af0d-d17e84adb255
|
@ -0,0 +1,75 @@
|
||||
GET /api/v4/projects/diaspora%2Fdiaspora/issues/1
|
||||
Status: 200
|
||||
Content-Type: application/json
|
||||
RateLimit-Limit:600
|
||||
RateLimit-Observed:1
|
||||
RateLimit-Remaining:599
|
||||
RateLimit-Reset:1512454441
|
||||
RateLimit-ResetTime:Wed, 05 Dec 2017 06:14:01 GMT
|
||||
X-Request-Id:0d511a76-2ade-4c34-af0d-d17e84adb255
|
||||
|
||||
{
|
||||
"project_id" : 4,
|
||||
"milestone" : {
|
||||
"due_date" : null,
|
||||
"project_id" : 4,
|
||||
"state" : "closed",
|
||||
"description" : "Rerum est voluptatem provident consequuntur molestias similique ipsum dolor.",
|
||||
"iid" : 3,
|
||||
"id" : 11,
|
||||
"title" : "v3.0",
|
||||
"created_at" : "2016-01-04T15:31:39.788Z",
|
||||
"updated_at" : "2016-01-04T15:31:39.788Z",
|
||||
"closed_at" : "2016-01-05T15:31:46.176Z"
|
||||
},
|
||||
"author" : {
|
||||
"state" : "active",
|
||||
"web_url" : "https://gitlab.example.com/root",
|
||||
"avatar_url" : null,
|
||||
"username" : "root",
|
||||
"id" : 1,
|
||||
"name" : "Administrator"
|
||||
},
|
||||
"description" : "Omnis vero earum sunt corporis dolor et placeat.",
|
||||
"state" : "closed",
|
||||
"iid" : 1,
|
||||
"assignees" : [{
|
||||
"avatar_url" : null,
|
||||
"web_url" : "https://gitlab.example.com/lennie",
|
||||
"state" : "active",
|
||||
"username" : "lennie",
|
||||
"id" : 9,
|
||||
"name" : "Dr. Luella Kovacek"
|
||||
}],
|
||||
"assignee" : {
|
||||
"avatar_url" : null,
|
||||
"web_url" : "https://gitlab.example.com/lennie",
|
||||
"state" : "active",
|
||||
"username" : "lennie",
|
||||
"id" : 9,
|
||||
"name" : "Dr. Luella Kovacek"
|
||||
},
|
||||
"labels" : [],
|
||||
"id" : 41,
|
||||
"title" : "Ut commodi ullam eos dolores perferendis nihil sunt.",
|
||||
"updated_at" : "2016-01-04T15:31:46.176Z",
|
||||
"created_at" : "2016-01-04T15:31:46.176Z",
|
||||
"subscribed": false,
|
||||
"user_notes_count": 1,
|
||||
"due_date": null,
|
||||
"web_url": "http://example.com/example/example/issues/1",
|
||||
"time_stats": {
|
||||
"time_estimate": 0,
|
||||
"total_time_spent": 0,
|
||||
"human_time_estimate": null,
|
||||
"human_total_time_spent": null
|
||||
},
|
||||
"confidential": false,
|
||||
"discussion_locked": false,
|
||||
"_links": {
|
||||
"self": "http://example.com/api/v4/projects/1/issues/2",
|
||||
"notes": "http://example.com/api/v4/projects/1/issues/2/notes",
|
||||
"award_emoji": "http://example.com/api/v4/projects/1/issues/2/award_emoji",
|
||||
"project": "http://example.com/api/v4/projects/1"
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
GET /api/v4/projects/diaspora%2Fdiaspora/issues?page=1&per_page=30&state=opened
|
||||
Status: 200
|
||||
Content-Type: application/json
|
||||
RateLimit-Limit:600
|
||||
RateLimit-Observed:1
|
||||
RateLimit-Remaining:599
|
||||
RateLimit-Reset:1512454441
|
||||
RateLimit-ResetTime:Wed, 05 Dec 2017 06:14:01 GMT
|
||||
X-Request-Id:0d511a76-2ade-4c34-af0d-d17e84adb255
|
||||
Link: <https://api.github.com/resource?page=2>; rel="next",
|
||||
<https://api.github.com/resource?page=1>; rel="prev",
|
||||
<https://api.github.com/resource?page=1>; rel="first",
|
||||
<https://api.github.com/resource?page=5>; rel="last"
|
||||
|
||||
[
|
||||
{
|
||||
"project_id" : 4,
|
||||
"milestone" : {
|
||||
"due_date" : null,
|
||||
"project_id" : 4,
|
||||
"state" : "closed",
|
||||
"description" : "Rerum est voluptatem provident consequuntur molestias similique ipsum dolor.",
|
||||
"iid" : 3,
|
||||
"id" : 11,
|
||||
"title" : "v3.0",
|
||||
"created_at" : "2016-01-04T15:31:39.788Z",
|
||||
"updated_at" : "2016-01-04T15:31:39.788Z"
|
||||
},
|
||||
"author" : {
|
||||
"state" : "active",
|
||||
"web_url" : "https://gitlab.example.com/root",
|
||||
"avatar_url" : null,
|
||||
"username" : "root",
|
||||
"id" : 1,
|
||||
"name" : "Administrator"
|
||||
},
|
||||
"description" : "Omnis vero earum sunt corporis dolor et placeat.",
|
||||
"state" : "closed",
|
||||
"iid" : 1,
|
||||
"assignees" : [{
|
||||
"avatar_url" : null,
|
||||
"web_url" : "https://gitlab.example.com/lennie",
|
||||
"state" : "active",
|
||||
"username" : "lennie",
|
||||
"id" : 9,
|
||||
"name" : "Dr. Luella Kovacek"
|
||||
}],
|
||||
"assignee" : {
|
||||
"avatar_url" : null,
|
||||
"web_url" : "https://gitlab.example.com/lennie",
|
||||
"state" : "active",
|
||||
"username" : "lennie",
|
||||
"id" : 9,
|
||||
"name" : "Dr. Luella Kovacek"
|
||||
},
|
||||
"labels" : [],
|
||||
"id" : 41,
|
||||
"title" : "Ut commodi ullam eos dolores perferendis nihil sunt.",
|
||||
"updated_at" : "2016-01-04T15:31:46.176Z",
|
||||
"created_at" : "2016-01-04T15:31:46.176Z",
|
||||
"closed_at" : "2016-01-05T15:31:46.176Z",
|
||||
"user_notes_count": 1,
|
||||
"due_date": "2016-07-22",
|
||||
"web_url": "http://example.com/example/example/issues/1",
|
||||
"time_stats": {
|
||||
"time_estimate": 0,
|
||||
"total_time_spent": 0,
|
||||
"human_time_estimate": null,
|
||||
"human_total_time_spent": null
|
||||
},
|
||||
"confidential": false,
|
||||
"discussion_locked": false
|
||||
}
|
||||
]
|
@ -0,0 +1,9 @@
|
||||
PUT /api/v4/projects/diaspora%2Fdiaspora/issues/1?discussion_locked=true
|
||||
Status: 200
|
||||
Content-Type: application/json
|
||||
RateLimit-Limit:600
|
||||
RateLimit-Observed:1
|
||||
RateLimit-Remaining:599
|
||||
RateLimit-Reset:1512454441
|
||||
RateLimit-ResetTime:Wed, 05 Dec 2017 06:14:01 GMT
|
||||
X-Request-Id:0d511a76-2ade-4c34-af0d-d17e84adb255
|
@ -0,0 +1,29 @@
|
||||
POST /api/v4/projects/diaspora%2Fdiaspora/issues/1/notes?body=what%3F
|
||||
Status: 200
|
||||
Content-Type: application/json
|
||||
RateLimit-Limit:600
|
||||
RateLimit-Observed:1
|
||||
RateLimit-Remaining:599
|
||||
RateLimit-Reset:1512454441
|
||||
RateLimit-ResetTime:Wed, 05 Dec 2017 06:14:01 GMT
|
||||
X-Request-Id:0d511a76-2ade-4c34-af0d-d17e84adb255
|
||||
|
||||
{
|
||||
"id": 302,
|
||||
"body": "closed",
|
||||
"attachment": null,
|
||||
"author": {
|
||||
"id": 1,
|
||||
"username": "pipin",
|
||||
"email": "admin@example.com",
|
||||
"name": "Pip",
|
||||
"state": "active",
|
||||
"created_at": "2013-09-30T13:46:01Z"
|
||||
},
|
||||
"created_at": "2013-10-02T09:22:45Z",
|
||||
"updated_at": "2013-10-02T10:22:45Z",
|
||||
"system": true,
|
||||
"noteable_id": 377,
|
||||
"noteable_type": "Issue",
|
||||
"noteable_iid": 377
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
DELETE /api/v4/projects/diaspora%2Fdiaspora/issues/1/notes/1
|
||||
Status: 200
|
||||
Content-Type: application/json
|
||||
RateLimit-Limit:600
|
||||
RateLimit-Observed:1
|
||||
RateLimit-Remaining:599
|
||||
RateLimit-Reset:1512454441
|
||||
RateLimit-ResetTime:Wed, 05 Dec 2017 06:14:01 GMT
|
||||
X-Request-Id:0d511a76-2ade-4c34-af0d-d17e84adb255
|
@ -0,0 +1,29 @@
|
||||
GET /api/v4/projects/diaspora%2Fdiaspora/issues/1/notes/302
|
||||
Status: 200
|
||||
Content-Type: application/json
|
||||
RateLimit-Limit:600
|
||||
RateLimit-Observed:1
|
||||
RateLimit-Remaining:599
|
||||
RateLimit-Reset:1512454441
|
||||
RateLimit-ResetTime:Wed, 05 Dec 2017 06:14:01 GMT
|
||||
X-Request-Id:0d511a76-2ade-4c34-af0d-d17e84adb255
|
||||
|
||||
{
|
||||
"id": 302,
|
||||
"body": "closed",
|
||||
"attachment": null,
|
||||
"author": {
|
||||
"id": 1,
|
||||
"username": "pipin",
|
||||
"email": "admin@example.com",
|
||||
"name": "Pip",
|
||||
"state": "active",
|
||||
"created_at": "2013-09-30T13:46:01Z"
|
||||
},
|
||||
"created_at": "2013-10-02T09:22:45Z",
|
||||
"updated_at": "2013-10-02T10:22:45Z",
|
||||
"system": true,
|
||||
"noteable_id": 377,
|
||||
"noteable_type": "Issue",
|
||||
"noteable_iid": 377
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
GET /api/v4/projects/diaspora%2Fdiaspora/issues/1/notes?page=1&per_page=30
|
||||
Status: 200
|
||||
Content-Type: application/json
|
||||
RateLimit-Limit:600
|
||||
RateLimit-Observed:1
|
||||
RateLimit-Remaining:599
|
||||
RateLimit-Reset:1512454441
|
||||
RateLimit-ResetTime:Wed, 05 Dec 2017 06:14:01 GMT
|
||||
X-Request-Id:0d511a76-2ade-4c34-af0d-d17e84adb255
|
||||
Link: <https://api.github.com/resource?page=2>; rel="next",
|
||||
<https://api.github.com/resource?page=1>; rel="prev",
|
||||
<https://api.github.com/resource?page=1>; rel="first",
|
||||
<https://api.github.com/resource?page=5>; rel="last"
|
||||
|
||||
[
|
||||
{
|
||||
"id": 302,
|
||||
"body": "closed",
|
||||
"attachment": null,
|
||||
"author": {
|
||||
"id": 1,
|
||||
"username": "pipin",
|
||||
"email": "admin@example.com",
|
||||
"name": "Pip",
|
||||
"state": "active",
|
||||
"created_at": "2013-09-30T13:46:01Z"
|
||||
},
|
||||
"created_at": "2013-10-02T09:22:45Z",
|
||||
"updated_at": "2013-10-02T10:22:45Z",
|
||||
"system": true,
|
||||
"noteable_id": 377,
|
||||
"noteable_type": "Issue",
|
||||
"noteable_iid": 377
|
||||
}
|
||||
]
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue