Documentation

Overview

    Package httpclient contains issues.Service implementation over HTTP.

    Index

    Examples

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    func NewIssues

    func NewIssues(httpClient *http.Client, scheme, host string) issues.Service

      NewIssues creates a client that implements issues.Service remotely over HTTP. If a nil httpClient is provided, http.DefaultClient will be used. scheme and host can be empty strings to target local service.

      Example
      Output:
      
      
      Example (Authenticated)
      Output:
      
      

      Types

      type Issues

      type Issues struct {
      	// contains filtered or unexported fields
      }

        Issues implements issues.Service remotely over HTTP. Use NewIssues for creation, zero value of Issues is unfit for use.

        func (*Issues) Count

        func (i *Issues) Count(ctx context.Context, repo issues.RepoSpec, opt issues.IssueListOptions) (uint64, error)
        Example
        Output:
        
        1
        

        func (*Issues) Create

        func (*Issues) Create(_ context.Context, repo issues.RepoSpec, issue issues.Issue) (issues.Issue, error)

        func (*Issues) CreateComment

        func (*Issues) CreateComment(_ context.Context, repo issues.RepoSpec, id uint64, comment issues.Comment) (issues.Comment, error)

        func (*Issues) Edit

        func (*Issues) EditComment

        func (i *Issues) EditComment(ctx context.Context, repo issues.RepoSpec, id uint64, cr issues.CommentRequest) (issues.Comment, error)

        func (*Issues) Get

        func (*Issues) Get(_ context.Context, repo issues.RepoSpec, id uint64) (issues.Issue, error)

        func (*Issues) List

        Example
        Output:
        
        [
        	{
        		"ID": 1,
        		"State": "open",
        		"Title": "Sample title",
        		"Labels": null,
        		"User": {
        			"ID": 1,
        			"Domain": "example.org",
        			"CanonicalMe": "",
        			"Elsewhere": null,
        			"Login": "gopher",
        			"Name": "Sample Gopher",
        			"Email": "gopher@example.org",
        			"AvatarURL": "",
        			"HTMLURL": "",
        			"SiteAdmin": false
        		},
        		"CreatedAt": "2016-09-24T22:00:50.642521756Z",
        		"Edited": null,
        		"Body": "",
        		"Reactions": null,
        		"Editable": false,
        		"Replies": 2
        	}
        ]
        

        func (*Issues) ListComments

        func (i *Issues) ListComments(ctx context.Context, repo issues.RepoSpec, id uint64, opt *issues.ListOptions) ([]issues.Comment, error)
        Example
        Output:
        
        [
        	{
        		"ID": 0,
        		"User": {
        			"ID": 1,
        			"Domain": "example.org",
        			"CanonicalMe": "",
        			"Elsewhere": null,
        			"Login": "gopher",
        			"Name": "Sample Gopher",
        			"Email": "gopher@example.org",
        			"AvatarURL": "",
        			"HTMLURL": "",
        			"SiteAdmin": false
        		},
        		"CreatedAt": "2016-09-24T22:00:50.642521756Z",
        		"Edited": null,
        		"Body": "Sample body.",
        		"Reactions": [
        			{
        				"Reaction": "grinning",
        				"Users": [
        					{
        						"ID": 1,
        						"Domain": "example.org",
        						"CanonicalMe": "",
        						"Elsewhere": null,
        						"Login": "gopher",
        						"Name": "Sample Gopher",
        						"Email": "gopher@example.org",
        						"AvatarURL": "",
        						"HTMLURL": "",
        						"SiteAdmin": false
        					}
        				]
        			},
        			{
        				"Reaction": "+1",
        				"Users": [
        					{
        						"ID": 2,
        						"Domain": "example.org",
        						"CanonicalMe": "",
        						"Elsewhere": null,
        						"Login": "2@example.org",
        						"Name": "",
        						"Email": "",
        						"AvatarURL": "https://secure.gravatar.com/avatar?d=mm\u0026f=y\u0026s=96",
        						"HTMLURL": "",
        						"SiteAdmin": false
        					},
        					{
        						"ID": 1,
        						"Domain": "example.org",
        						"CanonicalMe": "",
        						"Elsewhere": null,
        						"Login": "gopher",
        						"Name": "Sample Gopher",
        						"Email": "gopher@example.org",
        						"AvatarURL": "",
        						"HTMLURL": "",
        						"SiteAdmin": false
        					},
        					{
        						"ID": 3,
        						"Domain": "example.org",
        						"CanonicalMe": "",
        						"Elsewhere": null,
        						"Login": "3@example.org",
        						"Name": "",
        						"Email": "",
        						"AvatarURL": "https://secure.gravatar.com/avatar?d=mm\u0026f=y\u0026s=96",
        						"HTMLURL": "",
        						"SiteAdmin": false
        					}
        				]
        			},
        			{
        				"Reaction": "mushroom",
        				"Users": [
        					{
        						"ID": 3,
        						"Domain": "example.org",
        						"CanonicalMe": "",
        						"Elsewhere": null,
        						"Login": "3@example.org",
        						"Name": "",
        						"Email": "",
        						"AvatarURL": "https://secure.gravatar.com/avatar?d=mm\u0026f=y\u0026s=96",
        						"HTMLURL": "",
        						"SiteAdmin": false
        					}
        				]
        			}
        		],
        		"Editable": true
        	},
        	{
        		"ID": 1,
        		"User": {
        			"ID": 2,
        			"Domain": "example.org",
        			"CanonicalMe": "",
        			"Elsewhere": null,
        			"Login": "2@example.org",
        			"Name": "",
        			"Email": "",
        			"AvatarURL": "https://secure.gravatar.com/avatar?d=mm\u0026f=y\u0026s=96",
        			"HTMLURL": "",
        			"SiteAdmin": false
        		},
        		"CreatedAt": "2016-10-02T12:31:50.813167602Z",
        		"Edited": null,
        		"Body": "Sample reply.",
        		"Reactions": null,
        		"Editable": false
        	},
        	{
        		"ID": 2,
        		"User": {
        			"ID": 1,
        			"Domain": "example.org",
        			"CanonicalMe": "",
        			"Elsewhere": null,
        			"Login": "gopher",
        			"Name": "Sample Gopher",
        			"Email": "gopher@example.org",
        			"AvatarURL": "",
        			"HTMLURL": "",
        			"SiteAdmin": false
        		},
        		"CreatedAt": "2016-10-02T18:51:14.250725508Z",
        		"Edited": {
        			"By": {
        				"ID": 1,
        				"Domain": "example.org",
        				"CanonicalMe": "",
        				"Elsewhere": null,
        				"Login": "gopher",
        				"Name": "Sample Gopher",
        				"Email": "gopher@example.org",
        				"AvatarURL": "",
        				"HTMLURL": "",
        				"SiteAdmin": false
        			},
        			"At": "2016-10-02T18:57:47.938813179Z"
        		},
        		"Body": "Sample another reply.",
        		"Reactions": null,
        		"Editable": true
        	}
        ]
        

        func (*Issues) ListEvents

        func (i *Issues) ListEvents(ctx context.Context, repo issues.RepoSpec, id uint64, opt *issues.ListOptions) ([]issues.Event, error)

        Source Files