mirror of
https://github.com/documize/community.git
synced 2025-07-19 13:19:43 +02:00
Moved from Dep to Go Modules
We have finally dropped go dep and moved over to go mod ! During the move, some dependencies have been bumped.
This commit is contained in:
parent
2c164a135a
commit
b826852137
164 changed files with 18268 additions and 10658 deletions
3
vendor/github.com/google/go-github/AUTHORS
generated
vendored
3
vendor/github.com/google/go-github/AUTHORS
generated
vendored
|
@ -40,6 +40,7 @@ Bryan Boreham <bryan@weave.works>
|
|||
Cami Diez <diezcami@gmail.com>
|
||||
Carlos Alexandro Becker <caarlos0@gmail.com>
|
||||
chandresh-pancholi <chandreshpancholi007@gmail.com>
|
||||
Charles Fenwick Elliott <Charles@FenwickElliott.io>
|
||||
Charlie Yan <charlieyan08@gmail.com>
|
||||
Chris King <chriskingnet@gmail.com>
|
||||
Chris Roche <chris@vsco.co>
|
||||
|
@ -133,6 +134,7 @@ Pierre Carrier <pierre@meteor.com>
|
|||
Piotr Zurek <p.zurek@gmail.com>
|
||||
Quinn Slack <qslack@qslack.com>
|
||||
Rackspace US, Inc.
|
||||
Rajendra arora <rajendraarora16@yahoo.com>
|
||||
RaviTeja Pothana <ravi-teja@live.com>
|
||||
rc1140 <jameel@republiccommandos.co.za>
|
||||
Red Hat, Inc.
|
||||
|
@ -144,6 +146,7 @@ Sahil Dua <sahildua2305@gmail.com>
|
|||
saisi <saisi@users.noreply.github.com>
|
||||
Sam Minnée <sam@silverstripe.com>
|
||||
Sander van Harmelen <svanharmelen@schubergphilis.com>
|
||||
Sanket Payghan <sanket.payghan8@gmail.com>
|
||||
Sarasa Kisaragi <lingsamuelgrace@gmail.com>
|
||||
Sean Wang <sean@decrypted.org>
|
||||
Sebastian Mandrean <sebastian.mandrean@gmail.com>
|
||||
|
|
314
vendor/github.com/google/go-github/LICENSE
generated
vendored
314
vendor/github.com/google/go-github/LICENSE
generated
vendored
|
@ -25,317 +25,3 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
----------
|
||||
|
||||
Some documentation is taken from the GitHub Developer site
|
||||
<https://developer.github.com/>, which is available under the following Creative
|
||||
Commons Attribution 3.0 License. This applies only to the go-github source
|
||||
code and would not apply to any compiled binaries.
|
||||
|
||||
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE
|
||||
COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY
|
||||
COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS
|
||||
AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
|
||||
|
||||
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE
|
||||
TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY
|
||||
BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS
|
||||
CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND
|
||||
CONDITIONS.
|
||||
|
||||
1. Definitions
|
||||
|
||||
a. "Adaptation" means a work based upon the Work, or upon the Work and
|
||||
other pre-existing works, such as a translation, adaptation,
|
||||
derivative work, arrangement of music or other alterations of a
|
||||
literary or artistic work, or phonogram or performance and includes
|
||||
cinematographic adaptations or any other form in which the Work may be
|
||||
recast, transformed, or adapted including in any form recognizably
|
||||
derived from the original, except that a work that constitutes a
|
||||
Collection will not be considered an Adaptation for the purpose of
|
||||
this License. For the avoidance of doubt, where the Work is a musical
|
||||
work, performance or phonogram, the synchronization of the Work in
|
||||
timed-relation with a moving image ("synching") will be considered an
|
||||
Adaptation for the purpose of this License.
|
||||
b. "Collection" means a collection of literary or artistic works, such as
|
||||
encyclopedias and anthologies, or performances, phonograms or
|
||||
broadcasts, or other works or subject matter other than works listed
|
||||
in Section 1(f) below, which, by reason of the selection and
|
||||
arrangement of their contents, constitute intellectual creations, in
|
||||
which the Work is included in its entirety in unmodified form along
|
||||
with one or more other contributions, each constituting separate and
|
||||
independent works in themselves, which together are assembled into a
|
||||
collective whole. A work that constitutes a Collection will not be
|
||||
considered an Adaptation (as defined above) for the purposes of this
|
||||
License.
|
||||
c. "Distribute" means to make available to the public the original and
|
||||
copies of the Work or Adaptation, as appropriate, through sale or
|
||||
other transfer of ownership.
|
||||
d. "Licensor" means the individual, individuals, entity or entities that
|
||||
offer(s) the Work under the terms of this License.
|
||||
e. "Original Author" means, in the case of a literary or artistic work,
|
||||
the individual, individuals, entity or entities who created the Work
|
||||
or if no individual or entity can be identified, the publisher; and in
|
||||
addition (i) in the case of a performance the actors, singers,
|
||||
musicians, dancers, and other persons who act, sing, deliver, declaim,
|
||||
play in, interpret or otherwise perform literary or artistic works or
|
||||
expressions of folklore; (ii) in the case of a phonogram the producer
|
||||
being the person or legal entity who first fixes the sounds of a
|
||||
performance or other sounds; and, (iii) in the case of broadcasts, the
|
||||
organization that transmits the broadcast.
|
||||
f. "Work" means the literary and/or artistic work offered under the terms
|
||||
of this License including without limitation any production in the
|
||||
literary, scientific and artistic domain, whatever may be the mode or
|
||||
form of its expression including digital form, such as a book,
|
||||
pamphlet and other writing; a lecture, address, sermon or other work
|
||||
of the same nature; a dramatic or dramatico-musical work; a
|
||||
choreographic work or entertainment in dumb show; a musical
|
||||
composition with or without words; a cinematographic work to which are
|
||||
assimilated works expressed by a process analogous to cinematography;
|
||||
a work of drawing, painting, architecture, sculpture, engraving or
|
||||
lithography; a photographic work to which are assimilated works
|
||||
expressed by a process analogous to photography; a work of applied
|
||||
art; an illustration, map, plan, sketch or three-dimensional work
|
||||
relative to geography, topography, architecture or science; a
|
||||
performance; a broadcast; a phonogram; a compilation of data to the
|
||||
extent it is protected as a copyrightable work; or a work performed by
|
||||
a variety or circus performer to the extent it is not otherwise
|
||||
considered a literary or artistic work.
|
||||
g. "You" means an individual or entity exercising rights under this
|
||||
License who has not previously violated the terms of this License with
|
||||
respect to the Work, or who has received express permission from the
|
||||
Licensor to exercise rights under this License despite a previous
|
||||
violation.
|
||||
h. "Publicly Perform" means to perform public recitations of the Work and
|
||||
to communicate to the public those public recitations, by any means or
|
||||
process, including by wire or wireless means or public digital
|
||||
performances; to make available to the public Works in such a way that
|
||||
members of the public may access these Works from a place and at a
|
||||
place individually chosen by them; to perform the Work to the public
|
||||
by any means or process and the communication to the public of the
|
||||
performances of the Work, including by public digital performance; to
|
||||
broadcast and rebroadcast the Work by any means including signs,
|
||||
sounds or images.
|
||||
i. "Reproduce" means to make copies of the Work by any means including
|
||||
without limitation by sound or visual recordings and the right of
|
||||
fixation and reproducing fixations of the Work, including storage of a
|
||||
protected performance or phonogram in digital form or other electronic
|
||||
medium.
|
||||
|
||||
2. Fair Dealing Rights. Nothing in this License is intended to reduce,
|
||||
limit, or restrict any uses free from copyright or rights arising from
|
||||
limitations or exceptions that are provided for in connection with the
|
||||
copyright protection under copyright law or other applicable laws.
|
||||
|
||||
3. License Grant. Subject to the terms and conditions of this License,
|
||||
Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
|
||||
perpetual (for the duration of the applicable copyright) license to
|
||||
exercise the rights in the Work as stated below:
|
||||
|
||||
a. to Reproduce the Work, to incorporate the Work into one or more
|
||||
Collections, and to Reproduce the Work as incorporated in the
|
||||
Collections;
|
||||
b. to create and Reproduce Adaptations provided that any such Adaptation,
|
||||
including any translation in any medium, takes reasonable steps to
|
||||
clearly label, demarcate or otherwise identify that changes were made
|
||||
to the original Work. For example, a translation could be marked "The
|
||||
original work was translated from English to Spanish," or a
|
||||
modification could indicate "The original work has been modified.";
|
||||
c. to Distribute and Publicly Perform the Work including as incorporated
|
||||
in Collections; and,
|
||||
d. to Distribute and Publicly Perform Adaptations.
|
||||
e. For the avoidance of doubt:
|
||||
|
||||
i. Non-waivable Compulsory License Schemes. In those jurisdictions in
|
||||
which the right to collect royalties through any statutory or
|
||||
compulsory licensing scheme cannot be waived, the Licensor
|
||||
reserves the exclusive right to collect such royalties for any
|
||||
exercise by You of the rights granted under this License;
|
||||
ii. Waivable Compulsory License Schemes. In those jurisdictions in
|
||||
which the right to collect royalties through any statutory or
|
||||
compulsory licensing scheme can be waived, the Licensor waives the
|
||||
exclusive right to collect such royalties for any exercise by You
|
||||
of the rights granted under this License; and,
|
||||
iii. Voluntary License Schemes. The Licensor waives the right to
|
||||
collect royalties, whether individually or, in the event that the
|
||||
Licensor is a member of a collecting society that administers
|
||||
voluntary licensing schemes, via that society, from any exercise
|
||||
by You of the rights granted under this License.
|
||||
|
||||
The above rights may be exercised in all media and formats whether now
|
||||
known or hereafter devised. The above rights include the right to make
|
||||
such modifications as are technically necessary to exercise the rights in
|
||||
other media and formats. Subject to Section 8(f), all rights not expressly
|
||||
granted by Licensor are hereby reserved.
|
||||
|
||||
4. Restrictions. The license granted in Section 3 above is expressly made
|
||||
subject to and limited by the following restrictions:
|
||||
|
||||
a. You may Distribute or Publicly Perform the Work only under the terms
|
||||
of this License. You must include a copy of, or the Uniform Resource
|
||||
Identifier (URI) for, this License with every copy of the Work You
|
||||
Distribute or Publicly Perform. You may not offer or impose any terms
|
||||
on the Work that restrict the terms of this License or the ability of
|
||||
the recipient of the Work to exercise the rights granted to that
|
||||
recipient under the terms of the License. You may not sublicense the
|
||||
Work. You must keep intact all notices that refer to this License and
|
||||
to the disclaimer of warranties with every copy of the Work You
|
||||
Distribute or Publicly Perform. When You Distribute or Publicly
|
||||
Perform the Work, You may not impose any effective technological
|
||||
measures on the Work that restrict the ability of a recipient of the
|
||||
Work from You to exercise the rights granted to that recipient under
|
||||
the terms of the License. This Section 4(a) applies to the Work as
|
||||
incorporated in a Collection, but this does not require the Collection
|
||||
apart from the Work itself to be made subject to the terms of this
|
||||
License. If You create a Collection, upon notice from any Licensor You
|
||||
must, to the extent practicable, remove from the Collection any credit
|
||||
as required by Section 4(b), as requested. If You create an
|
||||
Adaptation, upon notice from any Licensor You must, to the extent
|
||||
practicable, remove from the Adaptation any credit as required by
|
||||
Section 4(b), as requested.
|
||||
b. If You Distribute, or Publicly Perform the Work or any Adaptations or
|
||||
Collections, You must, unless a request has been made pursuant to
|
||||
Section 4(a), keep intact all copyright notices for the Work and
|
||||
provide, reasonable to the medium or means You are utilizing: (i) the
|
||||
name of the Original Author (or pseudonym, if applicable) if supplied,
|
||||
and/or if the Original Author and/or Licensor designate another party
|
||||
or parties (e.g., a sponsor institute, publishing entity, journal) for
|
||||
attribution ("Attribution Parties") in Licensor's copyright notice,
|
||||
terms of service or by other reasonable means, the name of such party
|
||||
or parties; (ii) the title of the Work if supplied; (iii) to the
|
||||
extent reasonably practicable, the URI, if any, that Licensor
|
||||
specifies to be associated with the Work, unless such URI does not
|
||||
refer to the copyright notice or licensing information for the Work;
|
||||
and (iv) , consistent with Section 3(b), in the case of an Adaptation,
|
||||
a credit identifying the use of the Work in the Adaptation (e.g.,
|
||||
"French translation of the Work by Original Author," or "Screenplay
|
||||
based on original Work by Original Author"). The credit required by
|
||||
this Section 4 (b) may be implemented in any reasonable manner;
|
||||
provided, however, that in the case of a Adaptation or Collection, at
|
||||
a minimum such credit will appear, if a credit for all contributing
|
||||
authors of the Adaptation or Collection appears, then as part of these
|
||||
credits and in a manner at least as prominent as the credits for the
|
||||
other contributing authors. For the avoidance of doubt, You may only
|
||||
use the credit required by this Section for the purpose of attribution
|
||||
in the manner set out above and, by exercising Your rights under this
|
||||
License, You may not implicitly or explicitly assert or imply any
|
||||
connection with, sponsorship or endorsement by the Original Author,
|
||||
Licensor and/or Attribution Parties, as appropriate, of You or Your
|
||||
use of the Work, without the separate, express prior written
|
||||
permission of the Original Author, Licensor and/or Attribution
|
||||
Parties.
|
||||
c. Except as otherwise agreed in writing by the Licensor or as may be
|
||||
otherwise permitted by applicable law, if You Reproduce, Distribute or
|
||||
Publicly Perform the Work either by itself or as part of any
|
||||
Adaptations or Collections, You must not distort, mutilate, modify or
|
||||
take other derogatory action in relation to the Work which would be
|
||||
prejudicial to the Original Author's honor or reputation. Licensor
|
||||
agrees that in those jurisdictions (e.g. Japan), in which any exercise
|
||||
of the right granted in Section 3(b) of this License (the right to
|
||||
make Adaptations) would be deemed to be a distortion, mutilation,
|
||||
modification or other derogatory action prejudicial to the Original
|
||||
Author's honor and reputation, the Licensor will waive or not assert,
|
||||
as appropriate, this Section, to the fullest extent permitted by the
|
||||
applicable national law, to enable You to reasonably exercise Your
|
||||
right under Section 3(b) of this License (right to make Adaptations)
|
||||
but not otherwise.
|
||||
|
||||
5. Representations, Warranties and Disclaimer
|
||||
|
||||
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR
|
||||
OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY
|
||||
KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE,
|
||||
INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF
|
||||
LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS,
|
||||
WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION
|
||||
OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
|
||||
|
||||
6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE
|
||||
LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR
|
||||
ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES
|
||||
ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS
|
||||
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
7. Termination
|
||||
|
||||
a. This License and the rights granted hereunder will terminate
|
||||
automatically upon any breach by You of the terms of this License.
|
||||
Individuals or entities who have received Adaptations or Collections
|
||||
from You under this License, however, will not have their licenses
|
||||
terminated provided such individuals or entities remain in full
|
||||
compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will
|
||||
survive any termination of this License.
|
||||
b. Subject to the above terms and conditions, the license granted here is
|
||||
perpetual (for the duration of the applicable copyright in the Work).
|
||||
Notwithstanding the above, Licensor reserves the right to release the
|
||||
Work under different license terms or to stop distributing the Work at
|
||||
any time; provided, however that any such election will not serve to
|
||||
withdraw this License (or any other license that has been, or is
|
||||
required to be, granted under the terms of this License), and this
|
||||
License will continue in full force and effect unless terminated as
|
||||
stated above.
|
||||
|
||||
8. Miscellaneous
|
||||
|
||||
a. Each time You Distribute or Publicly Perform the Work or a Collection,
|
||||
the Licensor offers to the recipient a license to the Work on the same
|
||||
terms and conditions as the license granted to You under this License.
|
||||
b. Each time You Distribute or Publicly Perform an Adaptation, Licensor
|
||||
offers to the recipient a license to the original Work on the same
|
||||
terms and conditions as the license granted to You under this License.
|
||||
c. If any provision of this License is invalid or unenforceable under
|
||||
applicable law, it shall not affect the validity or enforceability of
|
||||
the remainder of the terms of this License, and without further action
|
||||
by the parties to this agreement, such provision shall be reformed to
|
||||
the minimum extent necessary to make such provision valid and
|
||||
enforceable.
|
||||
d. No term or provision of this License shall be deemed waived and no
|
||||
breach consented to unless such waiver or consent shall be in writing
|
||||
and signed by the party to be charged with such waiver or consent.
|
||||
e. This License constitutes the entire agreement between the parties with
|
||||
respect to the Work licensed here. There are no understandings,
|
||||
agreements or representations with respect to the Work not specified
|
||||
here. Licensor shall not be bound by any additional provisions that
|
||||
may appear in any communication from You. This License may not be
|
||||
modified without the mutual written agreement of the Licensor and You.
|
||||
f. The rights granted under, and the subject matter referenced, in this
|
||||
License were drafted utilizing the terminology of the Berne Convention
|
||||
for the Protection of Literary and Artistic Works (as amended on
|
||||
September 28, 1979), the Rome Convention of 1961, the WIPO Copyright
|
||||
Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996
|
||||
and the Universal Copyright Convention (as revised on July 24, 1971).
|
||||
These rights and subject matter take effect in the relevant
|
||||
jurisdiction in which the License terms are sought to be enforced
|
||||
according to the corresponding provisions of the implementation of
|
||||
those treaty provisions in the applicable national law. If the
|
||||
standard suite of rights granted under applicable copyright law
|
||||
includes additional rights not granted under this License, such
|
||||
additional rights are deemed to be included in the License; this
|
||||
License is not intended to restrict the license of any rights under
|
||||
applicable law.
|
||||
|
||||
|
||||
Creative Commons Notice
|
||||
|
||||
Creative Commons is not a party to this License, and makes no warranty
|
||||
whatsoever in connection with the Work. Creative Commons will not be
|
||||
liable to You or any party on any legal theory for any damages
|
||||
whatsoever, including without limitation any general, special,
|
||||
incidental or consequential damages arising in connection to this
|
||||
license. Notwithstanding the foregoing two (2) sentences, if Creative
|
||||
Commons has expressly identified itself as the Licensor hereunder, it
|
||||
shall have all rights and obligations of Licensor.
|
||||
|
||||
Except for the limited purpose of indicating to the public that the
|
||||
Work is licensed under the CCPL, Creative Commons does not authorize
|
||||
the use by either party of the trademark "Creative Commons" or any
|
||||
related trademark or logo of Creative Commons without the prior
|
||||
written consent of Creative Commons. Any permitted use will be in
|
||||
compliance with Creative Commons' then-current trademark usage
|
||||
guidelines, as may be published on its website or otherwise made
|
||||
available upon request from time to time. For the avoidance of doubt,
|
||||
this trademark restriction does not form part of this License.
|
||||
|
||||
Creative Commons may be contacted at http://creativecommons.org/.
|
||||
|
|
4
vendor/github.com/google/go-github/github/activity_events.go
generated
vendored
4
vendor/github.com/google/go-github/github/activity_events.go
generated
vendored
|
@ -32,6 +32,10 @@ func (e Event) String() string {
|
|||
// a value of the corresponding struct type will be returned.
|
||||
func (e *Event) ParsePayload() (payload interface{}, err error) {
|
||||
switch *e.Type {
|
||||
case "CheckRunEvent":
|
||||
payload = &CheckRunEvent{}
|
||||
case "CheckSuiteEvent":
|
||||
payload = &CheckSuiteEvent{}
|
||||
case "CommitCommentEvent":
|
||||
payload = &CommitCommentEvent{}
|
||||
case "CreateEvent":
|
||||
|
|
2
vendor/github.com/google/go-github/github/admin_stats.go
generated
vendored
2
vendor/github.com/google/go-github/github/admin_stats.go
generated
vendored
|
@ -108,7 +108,7 @@ func (s UserStats) String() string {
|
|||
return Stringify(s)
|
||||
}
|
||||
|
||||
//GistStats represents the number of total, private and public gists.
|
||||
// GistStats represents the number of total, private and public gists.
|
||||
type GistStats struct {
|
||||
TotalGists *int `json:"total_gists,omitempty"`
|
||||
PrivateGists *int `json:"private_gists,omitempty"`
|
||||
|
|
88
vendor/github.com/google/go-github/github/apps.go
generated
vendored
88
vendor/github.com/google/go-github/github/apps.go
generated
vendored
|
@ -20,6 +20,7 @@ type AppsService service
|
|||
// App represents a GitHub App.
|
||||
type App struct {
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
NodeID *string `json:"node_id,omitempty"`
|
||||
Owner *User `json:"owner,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
|
@ -35,6 +36,36 @@ type InstallationToken struct {
|
|||
ExpiresAt *time.Time `json:"expires_at,omitempty"`
|
||||
}
|
||||
|
||||
// InstallationPermissions lists the permissions for metadata, contents, issues and single file for an installation.
|
||||
type InstallationPermissions struct {
|
||||
Metadata *string `json:"metadata,omitempty"`
|
||||
Contents *string `json:"contents,omitempty"`
|
||||
Issues *string `json:"issues,omitempty"`
|
||||
SingleFile *string `json:"single_file,omitempty"`
|
||||
}
|
||||
|
||||
// Installation represents a GitHub Apps installation.
|
||||
type Installation struct {
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
AppID *int64 `json:"app_id,omitempty"`
|
||||
TargetID *int64 `json:"target_id,omitempty"`
|
||||
Account *User `json:"account,omitempty"`
|
||||
AccessTokensURL *string `json:"access_tokens_url,omitempty"`
|
||||
RepositoriesURL *string `json:"repositories_url,omitempty"`
|
||||
HTMLURL *string `json:"html_url,omitempty"`
|
||||
TargetType *string `json:"target_type,omitempty"`
|
||||
SingleFileName *string `json:"single_file_name,omitempty"`
|
||||
RepositorySelection *string `json:"repository_selection,omitempty"`
|
||||
Events []string `json:"events,omitempty"`
|
||||
Permissions *InstallationPermissions `json:"permissions,omitempty"`
|
||||
CreatedAt *Timestamp `json:"created_at,omitempty"`
|
||||
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
|
||||
}
|
||||
|
||||
func (i Installation) String() string {
|
||||
return Stringify(i)
|
||||
}
|
||||
|
||||
// Get a single GitHub App. Passing the empty string will get
|
||||
// the authenticated GitHub App.
|
||||
//
|
||||
|
@ -98,23 +129,7 @@ func (s *AppsService) ListInstallations(ctx context.Context, opt *ListOptions) (
|
|||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/apps/#get-a-single-installation
|
||||
func (s *AppsService) GetInstallation(ctx context.Context, id int64) (*Installation, *Response, error) {
|
||||
u := fmt.Sprintf("app/installations/%v", id)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeIntegrationPreview)
|
||||
|
||||
i := new(Installation)
|
||||
resp, err := s.client.Do(ctx, req, i)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return i, resp, nil
|
||||
return s.getInstallation(ctx, fmt.Sprintf("app/installations/%v", id))
|
||||
}
|
||||
|
||||
// ListUserInstallations lists installations that are accessible to the authenticated user.
|
||||
|
@ -167,3 +182,42 @@ func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64) (*I
|
|||
|
||||
return t, resp, nil
|
||||
}
|
||||
|
||||
// FindOrganizationInstallation finds the organization's installation information.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/apps/#find-organization-installation
|
||||
func (s *AppsService) FindOrganizationInstallation(ctx context.Context, org string) (*Installation, *Response, error) {
|
||||
return s.getInstallation(ctx, fmt.Sprintf("orgs/%v/installation", org))
|
||||
}
|
||||
|
||||
// FindRepositoryInstallation finds the repository's installation information.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/apps/#find-repository-installation
|
||||
func (s *AppsService) FindRepositoryInstallation(ctx context.Context, owner, repo string) (*Installation, *Response, error) {
|
||||
return s.getInstallation(ctx, fmt.Sprintf("repos/%v/%v/installation", owner, repo))
|
||||
}
|
||||
|
||||
// FindUserInstallation finds the user's installation information.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/apps/#find-repository-installation
|
||||
func (s *AppsService) FindUserInstallation(ctx context.Context, user string) (*Installation, *Response, error) {
|
||||
return s.getInstallation(ctx, fmt.Sprintf("users/%v/installation", user))
|
||||
}
|
||||
|
||||
func (s *AppsService) getInstallation(ctx context.Context, url string) (*Installation, *Response, error) {
|
||||
req, err := s.client.NewRequest("GET", url, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeIntegrationPreview)
|
||||
|
||||
i := new(Installation)
|
||||
resp, err := s.client.Do(ctx, req, i)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return i, resp, nil
|
||||
}
|
||||
|
|
13
vendor/github.com/google/go-github/github/apps_installation.go
generated
vendored
13
vendor/github.com/google/go-github/github/apps_installation.go
generated
vendored
|
@ -10,19 +10,6 @@ import (
|
|||
"fmt"
|
||||
)
|
||||
|
||||
// Installation represents a GitHub Apps installation.
|
||||
type Installation struct {
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
Account *User `json:"account,omitempty"`
|
||||
AccessTokensURL *string `json:"access_tokens_url,omitempty"`
|
||||
RepositoriesURL *string `json:"repositories_url,omitempty"`
|
||||
HTMLURL *string `json:"html_url,omitempty"`
|
||||
}
|
||||
|
||||
func (i Installation) String() string {
|
||||
return Stringify(i)
|
||||
}
|
||||
|
||||
// ListRepos lists the repositories that are accessible to the authenticated installation.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/apps/installations/#list-repositories
|
||||
|
|
12
vendor/github.com/google/go-github/github/apps_marketplace.go
generated
vendored
12
vendor/github.com/google/go-github/github/apps_marketplace.go
generated
vendored
|
@ -74,9 +74,6 @@ func (s *MarketplaceService) ListPlans(ctx context.Context, opt *ListOptions) ([
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeMarketplacePreview)
|
||||
|
||||
var plans []*MarketplacePlan
|
||||
resp, err := s.client.Do(ctx, req, &plans)
|
||||
if err != nil {
|
||||
|
@ -101,9 +98,6 @@ func (s *MarketplaceService) ListPlanAccountsForPlan(ctx context.Context, planID
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeMarketplacePreview)
|
||||
|
||||
var accounts []*MarketplacePlanAccount
|
||||
resp, err := s.client.Do(ctx, req, &accounts)
|
||||
if err != nil {
|
||||
|
@ -128,9 +122,6 @@ func (s *MarketplaceService) ListPlanAccountsForAccount(ctx context.Context, acc
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeMarketplacePreview)
|
||||
|
||||
var accounts []*MarketplacePlanAccount
|
||||
resp, err := s.client.Do(ctx, req, &accounts)
|
||||
if err != nil {
|
||||
|
@ -159,9 +150,6 @@ func (s *MarketplaceService) ListMarketplacePurchasesForUser(ctx context.Context
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeMarketplacePreview)
|
||||
|
||||
var purchases []*MarketplacePurchase
|
||||
resp, err := s.client.Do(ctx, req, &purchases)
|
||||
if err != nil {
|
||||
|
|
428
vendor/github.com/google/go-github/github/checks.go
generated
vendored
Normal file
428
vendor/github.com/google/go-github/github/checks.go
generated
vendored
Normal file
|
@ -0,0 +1,428 @@
|
|||
// Copyright 2018 The go-github AUTHORS. 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"
|
||||
)
|
||||
|
||||
// ChecksService provides access to the Checks API in the
|
||||
// GitHub API.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/checks/
|
||||
type ChecksService service
|
||||
|
||||
// CheckRun represents a GitHub check run on a repository associated with a GitHub app.
|
||||
type CheckRun struct {
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
HeadSHA *string `json:"head_sha,omitempty"`
|
||||
ExternalID *string `json:"external_id,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
HTMLURL *string `json:"html_url,omitempty"`
|
||||
Status *string `json:"status,omitempty"`
|
||||
Conclusion *string `json:"conclusion,omitempty"`
|
||||
StartedAt *Timestamp `json:"started_at,omitempty"`
|
||||
CompletedAt *Timestamp `json:"completed_at,omitempty"`
|
||||
Output *CheckRunOutput `json:"output,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
CheckSuite *CheckSuite `json:"check_suite,omitempty"`
|
||||
App *App `json:"app,omitempty"`
|
||||
PullRequests []*PullRequest `json:"pull_requests,omitempty"`
|
||||
}
|
||||
|
||||
// CheckRunOutput represents the output of a CheckRun.
|
||||
type CheckRunOutput struct {
|
||||
Title *string `json:"title,omitempty"`
|
||||
Summary *string `json:"summary,omitempty"`
|
||||
Text *string `json:"text,omitempty"`
|
||||
AnnotationsCount *int `json:"annotations_count,omitempty"`
|
||||
AnnotationsURL *string `json:"annotations_url,omitempty"`
|
||||
Annotations []*CheckRunAnnotation `json:"annotations,omitempty"`
|
||||
Images []*CheckRunImage `json:"images,omitempty"`
|
||||
}
|
||||
|
||||
// CheckRunAnnotation represents an annotation object for a CheckRun output.
|
||||
type CheckRunAnnotation struct {
|
||||
FileName *string `json:"filename,omitempty"`
|
||||
BlobHRef *string `json:"blob_href,omitempty"`
|
||||
StartLine *int `json:"start_line,omitempty"`
|
||||
EndLine *int `json:"end_line,omitempty"`
|
||||
WarningLevel *string `json:"warning_level,omitempty"`
|
||||
Message *string `json:"message,omitempty"`
|
||||
Title *string `json:"title,omitempty"`
|
||||
RawDetails *string `json:"raw_details,omitempty"`
|
||||
}
|
||||
|
||||
// CheckRunImage represents an image object for a CheckRun output.
|
||||
type CheckRunImage struct {
|
||||
Alt *string `json:"alt,omitempty"`
|
||||
ImageURL *string `json:"image_url,omitempty"`
|
||||
Caption *string `json:"caption,omitempty"`
|
||||
}
|
||||
|
||||
// CheckSuite represents a suite of check runs.
|
||||
type CheckSuite struct {
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
HeadBranch *string `json:"head_branch,omitempty"`
|
||||
HeadSHA *string `json:"head_sha,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
BeforeSHA *string `json:"before,omitempty"`
|
||||
AfterSHA *string `json:"after,omitempty"`
|
||||
Status *string `json:"status,omitempty"`
|
||||
Conclusion *string `json:"conclusion,omitempty"`
|
||||
App *App `json:"app,omitempty"`
|
||||
Repository *Repository `json:"repository,omitempty"`
|
||||
PullRequests []*PullRequest `json:"pull_requests,omitempty"`
|
||||
}
|
||||
|
||||
func (c CheckRun) String() string {
|
||||
return Stringify(c)
|
||||
}
|
||||
|
||||
func (c CheckSuite) String() string {
|
||||
return Stringify(c)
|
||||
}
|
||||
|
||||
// GetCheckRun gets a check-run for a repository.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/checks/runs/#get-a-single-check-run
|
||||
func (s *ChecksService) GetCheckRun(ctx context.Context, owner, repo string, checkRunID int64) (*CheckRun, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/check-runs/%v", owner, repo, checkRunID)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
|
||||
|
||||
checkRun := new(CheckRun)
|
||||
resp, err := s.client.Do(ctx, req, checkRun)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return checkRun, resp, nil
|
||||
}
|
||||
|
||||
// GetCheckSuite gets a single check suite.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/checks/suites/#get-a-single-check-suite
|
||||
func (s *ChecksService) GetCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64) (*CheckSuite, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/check-suites/%v", owner, repo, checkSuiteID)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
|
||||
|
||||
checkSuite := new(CheckSuite)
|
||||
resp, err := s.client.Do(ctx, req, checkSuite)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return checkSuite, resp, nil
|
||||
}
|
||||
|
||||
// CreateCheckRunOptions sets up parameters needed to create a CheckRun.
|
||||
type CreateCheckRunOptions struct {
|
||||
Name string `json:"name"` // The name of the check (e.g., "code-coverage"). (Required.)
|
||||
HeadBranch string `json:"head_branch"` // The name of the branch to perform a check against. (Required.)
|
||||
HeadSHA string `json:"head_sha"` // The SHA of the commit. (Required.)
|
||||
DetailsURL *string `json:"details_url,omitempty"` // The URL of the integrator's site that has the full details of the check. (Optional.)
|
||||
ExternalID *string `json:"external_id,omitempty"` // A reference for the run on the integrator's system. (Optional.)
|
||||
Status *string `json:"status,omitempty"` // The current status. Can be one of "queued", "in_progress", or "completed". Default: "queued". (Optional.)
|
||||
Conclusion *string `json:"conclusion,omitempty"` // Can be one of "success", "failure", "neutral", "cancelled", "timed_out", or "action_required". (Optional. Required if you provide a status of "completed".)
|
||||
StartedAt *Timestamp `json:"started_at,omitempty"` // The time that the check run began. (Optional.)
|
||||
CompletedAt *Timestamp `json:"completed_at,omitempty"` // The time the check completed. (Optional. Required if you provide conclusion.)
|
||||
Output *CheckRunOutput `json:"output,omitempty"` // Provide descriptive details about the run. (Optional)
|
||||
}
|
||||
|
||||
// CreateCheckRun creates a check run for repository.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/checks/runs/#create-a-check-run
|
||||
func (s *ChecksService) CreateCheckRun(ctx context.Context, owner, repo string, opt CreateCheckRunOptions) (*CheckRun, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/check-runs", owner, repo)
|
||||
req, err := s.client.NewRequest("POST", u, opt)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
|
||||
|
||||
checkRun := new(CheckRun)
|
||||
resp, err := s.client.Do(ctx, req, checkRun)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return checkRun, resp, nil
|
||||
}
|
||||
|
||||
// UpdateCheckRunOptions sets up parameters needed to update a CheckRun.
|
||||
type UpdateCheckRunOptions struct {
|
||||
Name string `json:"name"` // The name of the check (e.g., "code-coverage"). (Required.)
|
||||
HeadBranch *string `json:"head_branch,omitempty"` // The name of the branch to perform a check against. (Optional.)
|
||||
HeadSHA *string `json:"head_sha,omitempty"` // The SHA of the commit. (Optional.)
|
||||
DetailsURL *string `json:"details_url,omitempty"` // The URL of the integrator's site that has the full details of the check. (Optional.)
|
||||
ExternalID *string `json:"external_id,omitempty"` // A reference for the run on the integrator's system. (Optional.)
|
||||
Status *string `json:"status,omitempty"` // The current status. Can be one of "queued", "in_progress", or "completed". Default: "queued". (Optional.)
|
||||
Conclusion *string `json:"conclusion,omitempty"` // Can be one of "success", "failure", "neutral", "cancelled", "timed_out", or "action_required". (Optional. Required if you provide a status of "completed".)
|
||||
CompletedAt *Timestamp `json:"completed_at,omitempty"` // The time the check completed. (Optional. Required if you provide conclusion.)
|
||||
Output *CheckRunOutput `json:"output,omitempty"` // Provide descriptive details about the run. (Optional)
|
||||
}
|
||||
|
||||
// UpdateCheckRun updates a check run for a specific commit in a repository.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/checks/runs/#update-a-check-run
|
||||
func (s *ChecksService) UpdateCheckRun(ctx context.Context, owner, repo string, checkRunID int64, opt UpdateCheckRunOptions) (*CheckRun, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/check-runs/%v", owner, repo, checkRunID)
|
||||
req, err := s.client.NewRequest("PATCH", u, opt)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
|
||||
|
||||
checkRun := new(CheckRun)
|
||||
resp, err := s.client.Do(ctx, req, checkRun)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return checkRun, resp, nil
|
||||
}
|
||||
|
||||
// ListCheckRunAnnotations lists the annotations for a check run.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/checks/runs/#list-annotations-for-a-check-run
|
||||
func (s *ChecksService) ListCheckRunAnnotations(ctx context.Context, owner, repo string, checkRunID int64, opt *ListOptions) ([]*CheckRunAnnotation, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/check-runs/%v/annotations", owner, repo, checkRunID)
|
||||
u, err := addOptions(u, opt)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
|
||||
|
||||
var checkRunAnnotations []*CheckRunAnnotation
|
||||
resp, err := s.client.Do(ctx, req, &checkRunAnnotations)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return checkRunAnnotations, resp, nil
|
||||
}
|
||||
|
||||
// ListCheckRunsOptions represents parameters to list check runs.
|
||||
type ListCheckRunsOptions struct {
|
||||
CheckName *string `url:"check_name,omitempty"` // Returns check runs with the specified name.
|
||||
Status *string `url:"status,omitempty"` // Returns check runs with the specified status. Can be one of "queued", "in_progress", or "completed".
|
||||
Filter *string `url:"filter,omitempty"` // Filters check runs by their completed_at timestamp. Can be one of "latest" (returning the most recent check runs) or "all". Default: "latest"
|
||||
|
||||
ListOptions
|
||||
}
|
||||
|
||||
// ListCheckRunsResults represents the result of a check run list.
|
||||
type ListCheckRunsResults struct {
|
||||
Total *int `json:"total_count,omitempty"`
|
||||
CheckRuns []*CheckRun `json:"check_runs,omitempty"`
|
||||
}
|
||||
|
||||
// ListCheckRunsForRef lists check runs for a specific ref.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-specific-ref
|
||||
func (s *ChecksService) ListCheckRunsForRef(ctx context.Context, owner, repo, ref string, opt *ListCheckRunsOptions) (*ListCheckRunsResults, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/commits/%v/check-runs", owner, repo, ref)
|
||||
u, err := addOptions(u, opt)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
|
||||
|
||||
var checkRunResults *ListCheckRunsResults
|
||||
resp, err := s.client.Do(ctx, req, &checkRunResults)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return checkRunResults, resp, nil
|
||||
}
|
||||
|
||||
// ListCheckRunsCheckSuite lists check runs for a check suite.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/checks/runs/#list-check-runs-in-a-check-suite
|
||||
func (s *ChecksService) ListCheckRunsCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64, opt *ListCheckRunsOptions) (*ListCheckRunsResults, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/check-suites/%v/check-runs", owner, repo, checkSuiteID)
|
||||
u, err := addOptions(u, opt)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
|
||||
|
||||
var checkRunResults *ListCheckRunsResults
|
||||
resp, err := s.client.Do(ctx, req, &checkRunResults)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return checkRunResults, resp, nil
|
||||
}
|
||||
|
||||
// ListCheckSuiteOptions represents parameters to list check suites.
|
||||
type ListCheckSuiteOptions struct {
|
||||
CheckName *string `url:"check_name,omitempty"` // Filters checks suites by the name of the check run.
|
||||
AppID *int `url:"app_id,omitempty"` // Filters check suites by GitHub App id.
|
||||
|
||||
ListOptions
|
||||
}
|
||||
|
||||
// ListCheckSuiteResults represents the result of a check run list.
|
||||
type ListCheckSuiteResults struct {
|
||||
Total *int `json:"total_count,omitempty"`
|
||||
CheckSuites []*CheckSuite `json:"check_suites,omitempty"`
|
||||
}
|
||||
|
||||
// ListCheckSuitesForRef lists check suite for a specific ref.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/checks/suites/#list-check-suites-for-a-specific-ref
|
||||
func (s *ChecksService) ListCheckSuitesForRef(ctx context.Context, owner, repo, ref string, opt *ListCheckSuiteOptions) (*ListCheckSuiteResults, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/commits/%v/check-suites", owner, repo, ref)
|
||||
u, err := addOptions(u, opt)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
|
||||
|
||||
var checkSuiteResults *ListCheckSuiteResults
|
||||
resp, err := s.client.Do(ctx, req, &checkSuiteResults)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return checkSuiteResults, resp, nil
|
||||
}
|
||||
|
||||
// AutoTriggerCheck enables or disables automatic creation of CheckSuite events upon pushes to the repository.
|
||||
type AutoTriggerCheck struct {
|
||||
AppID *int64 `json:"app_id,omitempty"` // The id of the GitHub App. (Required.)
|
||||
Setting *bool `json:"setting,omitempty"` // Set to "true" to enable automatic creation of CheckSuite events upon pushes to the repository, or "false" to disable them. Default: "true" (Required.)
|
||||
}
|
||||
|
||||
// CheckSuitePreferenceOptions set options for check suite preferences for a repository.
|
||||
type CheckSuitePreferenceOptions struct {
|
||||
PreferenceList *PreferenceList `json:"auto_trigger_checks,omitempty"` // A list of auto trigger checks that can be set for a check suite in a repository.
|
||||
}
|
||||
|
||||
// CheckSuitePreferenceResults represents the results of the preference set operation.
|
||||
type CheckSuitePreferenceResults struct {
|
||||
Preferences *PreferenceList `json:"preferences,omitempty"`
|
||||
Repository *Repository `json:"repository,omitempty"`
|
||||
}
|
||||
|
||||
// PreferenceList represents a list of auto trigger checks for repository
|
||||
type PreferenceList struct {
|
||||
AutoTriggerChecks []*AutoTriggerCheck `json:"auto_trigger_checks,omitempty"` // A slice of auto trigger checks that can be set for a check suite in a repository.
|
||||
}
|
||||
|
||||
// SetCheckSuitePreferences changes the default automatic flow when creating check suites.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/checks/suites/#set-preferences-for-check-suites-on-a-repository
|
||||
func (s *ChecksService) SetCheckSuitePreferences(ctx context.Context, owner, repo string, opt CheckSuitePreferenceOptions) (*CheckSuitePreferenceResults, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/check-suites/preferences", owner, repo)
|
||||
req, err := s.client.NewRequest("PATCH", u, opt)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
|
||||
|
||||
var checkSuitePrefResults *CheckSuitePreferenceResults
|
||||
resp, err := s.client.Do(ctx, req, &checkSuitePrefResults)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return checkSuitePrefResults, resp, nil
|
||||
}
|
||||
|
||||
// CreateCheckSuiteOptions sets up parameters to manually create a check suites
|
||||
type CreateCheckSuiteOptions struct {
|
||||
HeadSHA string `json:"head_sha"` // The sha of the head commit. (Required.)
|
||||
HeadBranch *string `json:"head_branch,omitempty"` // The name of the head branch where the code changes are implemented.
|
||||
}
|
||||
|
||||
// CreateCheckSuite manually creates a check suite for a repository.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/checks/suites/#create-a-check-suite
|
||||
func (s *ChecksService) CreateCheckSuite(ctx context.Context, owner, repo string, opt CreateCheckSuiteOptions) (*CheckSuite, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/check-suites", owner, repo)
|
||||
req, err := s.client.NewRequest("POST", u, opt)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
|
||||
|
||||
checkSuite := new(CheckSuite)
|
||||
resp, err := s.client.Do(ctx, req, checkSuite)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return checkSuite, resp, nil
|
||||
}
|
||||
|
||||
// RequestCheckSuiteOptions sets up the parameters for a request check suite endpoint.
|
||||
type RequestCheckSuiteOptions struct {
|
||||
HeadSHA string `json:"head_sha"` // The sha of the head commit. (Required.)
|
||||
}
|
||||
|
||||
// RequestCheckSuite triggers GitHub to create a new check suite, without pushing new code to a repository.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/checks/suites/#request-check-suites
|
||||
func (s *ChecksService) RequestCheckSuite(ctx context.Context, owner, repo string, opt RequestCheckSuiteOptions) (*Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/check-suite-requests", owner, repo)
|
||||
u, err := addOptions(u, opt)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
|
||||
|
||||
resp, err := s.client.Do(ctx, req, nil)
|
||||
return resp, err
|
||||
}
|
18
vendor/github.com/google/go-github/github/doc.go
generated
vendored
18
vendor/github.com/google/go-github/github/doc.go
generated
vendored
|
@ -30,6 +30,13 @@ The services of a client divide the API into logical chunks and correspond to
|
|||
the structure of the GitHub API documentation at
|
||||
https://developer.github.com/v3/.
|
||||
|
||||
NOTE: Using the https://godoc.org/context package, one can easily
|
||||
pass cancelation signals and deadlines to various services of the client for
|
||||
handling a request. In case there is no context available, then context.Background()
|
||||
can be used as a starting point.
|
||||
|
||||
For more sample code snippets, head over to the https://github.com/google/go-github/tree/master/example directory.
|
||||
|
||||
Authentication
|
||||
|
||||
The go-github library does not directly handle authentication. Instead, when
|
||||
|
@ -176,16 +183,5 @@ github.Response struct.
|
|||
opt.Page = resp.NextPage
|
||||
}
|
||||
|
||||
Google App Engine
|
||||
|
||||
Go on App Engine Classic (which as of this writing uses Go 1.6) can not use
|
||||
the "context" import and still relies on "golang.org/x/net/context".
|
||||
As a result, if you wish to continue to use "go-github" on App Engine Classic,
|
||||
you will need to rewrite all the "context" imports using the following command:
|
||||
|
||||
gofmt -w -r '"context" -> "golang.org/x/net/context"' *.go
|
||||
|
||||
See "with_appengine.go" for more details.
|
||||
|
||||
*/
|
||||
package github
|
||||
|
|
48
vendor/github.com/google/go-github/github/event_types.go
generated
vendored
48
vendor/github.com/google/go-github/github/event_types.go
generated
vendored
|
@ -7,6 +7,38 @@
|
|||
|
||||
package github
|
||||
|
||||
// CheckRunEvent is triggered when a check run is "created", "updated", or "re-requested".
|
||||
// The Webhook event name is "check_run".
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#checkrunevent
|
||||
type CheckRunEvent struct {
|
||||
CheckRun *CheckRun `json:"check_run,omitempty"`
|
||||
// The action performed. Can be "created", "updated" or "re-requested".
|
||||
Action *string `json:"action,omitempty"`
|
||||
|
||||
// The following fields are only populated by Webhook events.
|
||||
Repo *Repository `json:"repository,omitempty"`
|
||||
Org *Organization `json:"organization,omitempty"`
|
||||
Sender *User `json:"sender,omitempty"`
|
||||
Installation *Installation `json:"installation,omitempty"`
|
||||
}
|
||||
|
||||
// CheckSuiteEvent is triggered when a check suite is "completed", "requested", or "re-requested".
|
||||
// The Webhook event name is "check_suite".
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#checksuiteevent
|
||||
type CheckSuiteEvent struct {
|
||||
CheckSuite *CheckSuite `json:"check_suite,omitempty"`
|
||||
// The action performed. Can be "completed", "requested" or "re-requested".
|
||||
Action *string `json:"action,omitempty"`
|
||||
|
||||
// The following fields are only populated by Webhook events.
|
||||
Repo *Repository `json:"repository,omitempty"`
|
||||
Org *Organization `json:"organization,omitempty"`
|
||||
Sender *User `json:"sender,omitempty"`
|
||||
Installation *Installation `json:"installation,omitempty"`
|
||||
}
|
||||
|
||||
// CommitCommentEvent is triggered when a commit comment is created.
|
||||
// The Webhook event name is "commit_comment".
|
||||
//
|
||||
|
@ -194,6 +226,7 @@ type TeamChange struct {
|
|||
type InstallationEvent struct {
|
||||
// The action that was performed. Can be either "created" or "deleted".
|
||||
Action *string `json:"action,omitempty"`
|
||||
Repositories []*Repository `json:"repositories,omitempty"`
|
||||
Sender *User `json:"sender,omitempty"`
|
||||
Installation *Installation `json:"installation,omitempty"`
|
||||
}
|
||||
|
@ -490,11 +523,15 @@ type PullRequestEvent struct {
|
|||
PullRequest *PullRequest `json:"pull_request,omitempty"`
|
||||
|
||||
// The following fields are only populated by Webhook events.
|
||||
Changes *EditChange `json:"changes,omitempty"`
|
||||
RequestedReviewers []*User `json:"requested_reviewers,omitempty"` // Populated in "review_requested", "review_request_removed" event deliveries.
|
||||
Repo *Repository `json:"repository,omitempty"`
|
||||
Sender *User `json:"sender,omitempty"`
|
||||
Installation *Installation `json:"installation,omitempty"`
|
||||
Changes *EditChange `json:"changes,omitempty"`
|
||||
// RequestedReviewer is populated in "review_requested", "review_request_removed" event deliveries.
|
||||
// A request affecting multiple reviewers at once is split into multiple
|
||||
// such event deliveries, each with a single, different RequestedReviewer.
|
||||
RequestedReviewer *User `json:"requested_reviewer,omitempty"`
|
||||
Repo *Repository `json:"repository,omitempty"`
|
||||
Sender *User `json:"sender,omitempty"`
|
||||
Installation *Installation `json:"installation,omitempty"`
|
||||
Label *Label `json:"label,omitempty"` // Populated in "labeled" event deliveries.
|
||||
}
|
||||
|
||||
// PullRequestReviewEvent is triggered when a review is submitted on a pull
|
||||
|
@ -594,6 +631,7 @@ func (p PushEventCommit) String() string {
|
|||
// PushEventRepository represents the repo object in a PushEvent payload.
|
||||
type PushEventRepository struct {
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
NodeID *string `json:"node_id,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
FullName *string `json:"full_name,omitempty"`
|
||||
Owner *PushEventRepoOwner `json:"owner,omitempty"`
|
||||
|
|
332
vendor/github.com/google/go-github/github/gen-accessors.go
generated
vendored
332
vendor/github.com/google/go-github/github/gen-accessors.go
generated
vendored
|
@ -1,332 +0,0 @@
|
|||
// Copyright 2017 The go-github AUTHORS. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build ignore
|
||||
|
||||
// gen-accessors generates accessor methods for structs with pointer fields.
|
||||
//
|
||||
// It is meant to be used by the go-github authors in conjunction with the
|
||||
// go generate tool before sending a commit to GitHub.
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"flag"
|
||||
"fmt"
|
||||
"go/ast"
|
||||
"go/format"
|
||||
"go/parser"
|
||||
"go/token"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
const (
|
||||
fileSuffix = "-accessors.go"
|
||||
)
|
||||
|
||||
var (
|
||||
verbose = flag.Bool("v", false, "Print verbose log messages")
|
||||
|
||||
sourceTmpl = template.Must(template.New("source").Parse(source))
|
||||
|
||||
// blacklistStructMethod lists "struct.method" combos to skip.
|
||||
blacklistStructMethod = map[string]bool{
|
||||
"RepositoryContent.GetContent": true,
|
||||
"Client.GetBaseURL": true,
|
||||
"Client.GetUploadURL": true,
|
||||
"ErrorResponse.GetResponse": true,
|
||||
"RateLimitError.GetResponse": true,
|
||||
"AbuseRateLimitError.GetResponse": true,
|
||||
}
|
||||
// blacklistStruct lists structs to skip.
|
||||
blacklistStruct = map[string]bool{
|
||||
"Client": true,
|
||||
}
|
||||
)
|
||||
|
||||
func logf(fmt string, args ...interface{}) {
|
||||
if *verbose {
|
||||
log.Printf(fmt, args...)
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
fset := token.NewFileSet()
|
||||
|
||||
pkgs, err := parser.ParseDir(fset, ".", sourceFilter, 0)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
return
|
||||
}
|
||||
|
||||
for pkgName, pkg := range pkgs {
|
||||
t := &templateData{
|
||||
filename: pkgName + fileSuffix,
|
||||
Year: 2017,
|
||||
Package: pkgName,
|
||||
Imports: map[string]string{},
|
||||
}
|
||||
for filename, f := range pkg.Files {
|
||||
logf("Processing %v...", filename)
|
||||
if err := t.processAST(f); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
if err := t.dump(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
logf("Done.")
|
||||
}
|
||||
|
||||
func (t *templateData) processAST(f *ast.File) error {
|
||||
for _, decl := range f.Decls {
|
||||
gd, ok := decl.(*ast.GenDecl)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
for _, spec := range gd.Specs {
|
||||
ts, ok := spec.(*ast.TypeSpec)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
// Skip unexported identifiers.
|
||||
if !ts.Name.IsExported() {
|
||||
logf("Struct %v is unexported; skipping.", ts.Name)
|
||||
continue
|
||||
}
|
||||
// Check if the struct is blacklisted.
|
||||
if blacklistStruct[ts.Name.Name] {
|
||||
logf("Struct %v is blacklisted; skipping.", ts.Name)
|
||||
continue
|
||||
}
|
||||
st, ok := ts.Type.(*ast.StructType)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
for _, field := range st.Fields.List {
|
||||
se, ok := field.Type.(*ast.StarExpr)
|
||||
if len(field.Names) == 0 || !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
fieldName := field.Names[0]
|
||||
// Skip unexported identifiers.
|
||||
if !fieldName.IsExported() {
|
||||
logf("Field %v is unexported; skipping.", fieldName)
|
||||
continue
|
||||
}
|
||||
// Check if "struct.method" is blacklisted.
|
||||
if key := fmt.Sprintf("%v.Get%v", ts.Name, fieldName); blacklistStructMethod[key] {
|
||||
logf("Method %v is blacklisted; skipping.", key)
|
||||
continue
|
||||
}
|
||||
|
||||
switch x := se.X.(type) {
|
||||
case *ast.ArrayType:
|
||||
t.addArrayType(x, ts.Name.String(), fieldName.String())
|
||||
case *ast.Ident:
|
||||
t.addIdent(x, ts.Name.String(), fieldName.String())
|
||||
case *ast.MapType:
|
||||
t.addMapType(x, ts.Name.String(), fieldName.String())
|
||||
case *ast.SelectorExpr:
|
||||
t.addSelectorExpr(x, ts.Name.String(), fieldName.String())
|
||||
default:
|
||||
logf("processAST: type %q, field %q, unknown %T: %+v", ts.Name, fieldName, x, x)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func sourceFilter(fi os.FileInfo) bool {
|
||||
return !strings.HasSuffix(fi.Name(), "_test.go") && !strings.HasSuffix(fi.Name(), fileSuffix)
|
||||
}
|
||||
|
||||
func (t *templateData) dump() error {
|
||||
if len(t.Getters) == 0 {
|
||||
logf("No getters for %v; skipping.", t.filename)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Sort getters by ReceiverType.FieldName.
|
||||
sort.Sort(byName(t.Getters))
|
||||
|
||||
var buf bytes.Buffer
|
||||
if err := sourceTmpl.Execute(&buf, t); err != nil {
|
||||
return err
|
||||
}
|
||||
clean, err := format.Source(buf.Bytes())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
logf("Writing %v...", t.filename)
|
||||
return ioutil.WriteFile(t.filename, clean, 0644)
|
||||
}
|
||||
|
||||
func newGetter(receiverType, fieldName, fieldType, zeroValue string, namedStruct bool) *getter {
|
||||
return &getter{
|
||||
sortVal: strings.ToLower(receiverType) + "." + strings.ToLower(fieldName),
|
||||
ReceiverVar: strings.ToLower(receiverType[:1]),
|
||||
ReceiverType: receiverType,
|
||||
FieldName: fieldName,
|
||||
FieldType: fieldType,
|
||||
ZeroValue: zeroValue,
|
||||
NamedStruct: namedStruct,
|
||||
}
|
||||
}
|
||||
|
||||
func (t *templateData) addArrayType(x *ast.ArrayType, receiverType, fieldName string) {
|
||||
var eltType string
|
||||
switch elt := x.Elt.(type) {
|
||||
case *ast.Ident:
|
||||
eltType = elt.String()
|
||||
default:
|
||||
logf("addArrayType: type %q, field %q: unknown elt type: %T %+v; skipping.", receiverType, fieldName, elt, elt)
|
||||
return
|
||||
}
|
||||
|
||||
t.Getters = append(t.Getters, newGetter(receiverType, fieldName, "[]"+eltType, "nil", false))
|
||||
}
|
||||
|
||||
func (t *templateData) addIdent(x *ast.Ident, receiverType, fieldName string) {
|
||||
var zeroValue string
|
||||
var namedStruct = false
|
||||
switch x.String() {
|
||||
case "int", "int64":
|
||||
zeroValue = "0"
|
||||
case "string":
|
||||
zeroValue = `""`
|
||||
case "bool":
|
||||
zeroValue = "false"
|
||||
case "Timestamp":
|
||||
zeroValue = "Timestamp{}"
|
||||
default:
|
||||
zeroValue = "nil"
|
||||
namedStruct = true
|
||||
}
|
||||
|
||||
t.Getters = append(t.Getters, newGetter(receiverType, fieldName, x.String(), zeroValue, namedStruct))
|
||||
}
|
||||
|
||||
func (t *templateData) addMapType(x *ast.MapType, receiverType, fieldName string) {
|
||||
var keyType string
|
||||
switch key := x.Key.(type) {
|
||||
case *ast.Ident:
|
||||
keyType = key.String()
|
||||
default:
|
||||
logf("addMapType: type %q, field %q: unknown key type: %T %+v; skipping.", receiverType, fieldName, key, key)
|
||||
return
|
||||
}
|
||||
|
||||
var valueType string
|
||||
switch value := x.Value.(type) {
|
||||
case *ast.Ident:
|
||||
valueType = value.String()
|
||||
default:
|
||||
logf("addMapType: type %q, field %q: unknown value type: %T %+v; skipping.", receiverType, fieldName, value, value)
|
||||
return
|
||||
}
|
||||
|
||||
fieldType := fmt.Sprintf("map[%v]%v", keyType, valueType)
|
||||
zeroValue := fmt.Sprintf("map[%v]%v{}", keyType, valueType)
|
||||
t.Getters = append(t.Getters, newGetter(receiverType, fieldName, fieldType, zeroValue, false))
|
||||
}
|
||||
|
||||
func (t *templateData) addSelectorExpr(x *ast.SelectorExpr, receiverType, fieldName string) {
|
||||
if strings.ToLower(fieldName[:1]) == fieldName[:1] { // Non-exported field.
|
||||
return
|
||||
}
|
||||
|
||||
var xX string
|
||||
if xx, ok := x.X.(*ast.Ident); ok {
|
||||
xX = xx.String()
|
||||
}
|
||||
|
||||
switch xX {
|
||||
case "time", "json":
|
||||
if xX == "json" {
|
||||
t.Imports["encoding/json"] = "encoding/json"
|
||||
} else {
|
||||
t.Imports[xX] = xX
|
||||
}
|
||||
fieldType := fmt.Sprintf("%v.%v", xX, x.Sel.Name)
|
||||
zeroValue := fmt.Sprintf("%v.%v{}", xX, x.Sel.Name)
|
||||
if xX == "time" && x.Sel.Name == "Duration" {
|
||||
zeroValue = "0"
|
||||
}
|
||||
t.Getters = append(t.Getters, newGetter(receiverType, fieldName, fieldType, zeroValue, false))
|
||||
default:
|
||||
logf("addSelectorExpr: xX %q, type %q, field %q: unknown x=%+v; skipping.", xX, receiverType, fieldName, x)
|
||||
}
|
||||
}
|
||||
|
||||
type templateData struct {
|
||||
filename string
|
||||
Year int
|
||||
Package string
|
||||
Imports map[string]string
|
||||
Getters []*getter
|
||||
}
|
||||
|
||||
type getter struct {
|
||||
sortVal string // Lower-case version of "ReceiverType.FieldName".
|
||||
ReceiverVar string // The one-letter variable name to match the ReceiverType.
|
||||
ReceiverType string
|
||||
FieldName string
|
||||
FieldType string
|
||||
ZeroValue string
|
||||
NamedStruct bool // Getter for named struct.
|
||||
}
|
||||
|
||||
type byName []*getter
|
||||
|
||||
func (b byName) Len() int { return len(b) }
|
||||
func (b byName) Less(i, j int) bool { return b[i].sortVal < b[j].sortVal }
|
||||
func (b byName) Swap(i, j int) { b[i], b[j] = b[j], b[i] }
|
||||
|
||||
const source = `// Copyright {{.Year}} The go-github AUTHORS. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Code generated by gen-accessors; DO NOT EDIT.
|
||||
|
||||
package {{.Package}}
|
||||
{{with .Imports}}
|
||||
import (
|
||||
{{- range . -}}
|
||||
"{{.}}"
|
||||
{{end -}}
|
||||
)
|
||||
{{end}}
|
||||
{{range .Getters}}
|
||||
{{if .NamedStruct}}
|
||||
// Get{{.FieldName}} returns the {{.FieldName}} field.
|
||||
func ({{.ReceiverVar}} *{{.ReceiverType}}) Get{{.FieldName}}() *{{.FieldType}} {
|
||||
if {{.ReceiverVar}} == nil {
|
||||
return {{.ZeroValue}}
|
||||
}
|
||||
return {{.ReceiverVar}}.{{.FieldName}}
|
||||
}
|
||||
{{else}}
|
||||
// Get{{.FieldName}} returns the {{.FieldName}} field if it's non-nil, zero value otherwise.
|
||||
func ({{.ReceiverVar}} *{{.ReceiverType}}) Get{{.FieldName}}() {{.FieldType}} {
|
||||
if {{.ReceiverVar}} == nil || {{.ReceiverVar}}.{{.FieldName}} == nil {
|
||||
return {{.ZeroValue}}
|
||||
}
|
||||
return *{{.ReceiverVar}}.{{.FieldName}}
|
||||
}
|
||||
{{end}}
|
||||
{{end}}
|
||||
`
|
30
vendor/github.com/google/go-github/github/gists.go
generated
vendored
30
vendor/github.com/google/go-github/github/gists.go
generated
vendored
|
@ -114,9 +114,6 @@ func (s *GistsService) List(ctx context.Context, user string, opt *GistListOptio
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
var gists []*Gist
|
||||
resp, err := s.client.Do(ctx, req, &gists)
|
||||
if err != nil {
|
||||
|
@ -140,9 +137,6 @@ func (s *GistsService) ListAll(ctx context.Context, opt *GistListOptions) ([]*Gi
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
var gists []*Gist
|
||||
resp, err := s.client.Do(ctx, req, &gists)
|
||||
if err != nil {
|
||||
|
@ -166,9 +160,6 @@ func (s *GistsService) ListStarred(ctx context.Context, opt *GistListOptions) ([
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
var gists []*Gist
|
||||
resp, err := s.client.Do(ctx, req, &gists)
|
||||
if err != nil {
|
||||
|
@ -188,9 +179,6 @@ func (s *GistsService) Get(ctx context.Context, id string) (*Gist, *Response, er
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
gist := new(Gist)
|
||||
resp, err := s.client.Do(ctx, req, gist)
|
||||
if err != nil {
|
||||
|
@ -210,9 +198,6 @@ func (s *GistsService) GetRevision(ctx context.Context, id, sha string) (*Gist,
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
gist := new(Gist)
|
||||
resp, err := s.client.Do(ctx, req, gist)
|
||||
if err != nil {
|
||||
|
@ -232,9 +217,6 @@ func (s *GistsService) Create(ctx context.Context, gist *Gist) (*Gist, *Response
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
g := new(Gist)
|
||||
resp, err := s.client.Do(ctx, req, g)
|
||||
if err != nil {
|
||||
|
@ -254,9 +236,6 @@ func (s *GistsService) Edit(ctx context.Context, id string, gist *Gist) (*Gist,
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
g := new(Gist)
|
||||
resp, err := s.client.Do(ctx, req, g)
|
||||
if err != nil {
|
||||
|
@ -281,9 +260,6 @@ func (s *GistsService) ListCommits(ctx context.Context, id string, opt *ListOpti
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
var gistCommits []*GistCommit
|
||||
resp, err := s.client.Do(ctx, req, &gistCommits)
|
||||
if err != nil {
|
||||
|
@ -353,9 +329,6 @@ func (s *GistsService) Fork(ctx context.Context, id string) (*Gist, *Response, e
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
g := new(Gist)
|
||||
resp, err := s.client.Do(ctx, req, g)
|
||||
if err != nil {
|
||||
|
@ -375,9 +348,6 @@ func (s *GistsService) ListForks(ctx context.Context, id string) ([]*GistFork, *
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
var gistForks []*GistFork
|
||||
resp, err := s.client.Do(ctx, req, &gistForks)
|
||||
if err != nil {
|
||||
|
|
26
vendor/github.com/google/go-github/github/git_blobs.go
generated
vendored
26
vendor/github.com/google/go-github/github/git_blobs.go
generated
vendored
|
@ -6,6 +6,7 @@
|
|||
package github
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
)
|
||||
|
@ -20,7 +21,7 @@ type Blob struct {
|
|||
NodeID *string `json:"node_id,omitempty"`
|
||||
}
|
||||
|
||||
// GetBlob fetchs a blob from a repo given a SHA.
|
||||
// GetBlob fetches a blob from a repo given a SHA.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/git/blobs/#get-a-blob
|
||||
func (s *GitService) GetBlob(ctx context.Context, owner string, repo string, sha string) (*Blob, *Response, error) {
|
||||
|
@ -30,14 +31,28 @@ func (s *GitService) GetBlob(ctx context.Context, owner string, repo string, sha
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
blob := new(Blob)
|
||||
resp, err := s.client.Do(ctx, req, blob)
|
||||
return blob, resp, err
|
||||
}
|
||||
|
||||
// GetBlobRaw fetches a blob's contents from a repo.
|
||||
// Unlike GetBlob, it returns the raw bytes rather than the base64-encoded data.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/git/blobs/#get-a-blob
|
||||
func (s *GitService) GetBlobRaw(ctx context.Context, owner, repo, sha string) ([]byte, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/git/blobs/%v", owner, repo, sha)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
req.Header.Set("Accept", "application/vnd.github.v3.raw")
|
||||
|
||||
var buf bytes.Buffer
|
||||
resp, err := s.client.Do(ctx, req, &buf)
|
||||
return buf.Bytes(), resp, err
|
||||
}
|
||||
|
||||
// CreateBlob creates a blob object.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/git/blobs/#create-a-blob
|
||||
|
@ -48,9 +63,6 @@ func (s *GitService) CreateBlob(ctx context.Context, owner string, repo string,
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
t := new(Blob)
|
||||
resp, err := s.client.Do(ctx, req, t)
|
||||
return t, resp, err
|
||||
|
|
7
vendor/github.com/google/go-github/github/git_commits.go
generated
vendored
7
vendor/github.com/google/go-github/github/git_commits.go
generated
vendored
|
@ -8,7 +8,6 @@ package github
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -70,8 +69,7 @@ func (s *GitService) GetCommit(ctx context.Context, owner string, repo string, s
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
acceptHeaders := []string{mediaTypeGitSigningPreview, mediaTypeGraphQLNodeIDPreview}
|
||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
||||
req.Header.Set("Accept", mediaTypeGitSigningPreview)
|
||||
|
||||
c := new(Commit)
|
||||
resp, err := s.client.Do(ctx, req, c)
|
||||
|
@ -126,9 +124,6 @@ func (s *GitService) CreateCommit(ctx context.Context, owner string, repo string
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
c := new(Commit)
|
||||
resp, err := s.client.Do(ctx, req, c)
|
||||
if err != nil {
|
||||
|
|
15
vendor/github.com/google/go-github/github/git_refs.go
generated
vendored
15
vendor/github.com/google/go-github/github/git_refs.go
generated
vendored
|
@ -63,9 +63,6 @@ func (s *GitService) GetRef(ctx context.Context, owner string, repo string, ref
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
r := new(Reference)
|
||||
resp, err := s.client.Do(ctx, req, r)
|
||||
if _, ok := err.(*json.UnmarshalTypeError); ok {
|
||||
|
@ -97,9 +94,6 @@ func (s *GitService) GetRefs(ctx context.Context, owner string, repo string, ref
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
var rawJSON json.RawMessage
|
||||
resp, err := s.client.Do(ctx, req, &rawJSON)
|
||||
if err != nil {
|
||||
|
@ -154,9 +148,6 @@ func (s *GitService) ListRefs(ctx context.Context, owner, repo string, opt *Refe
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
var rs []*Reference
|
||||
resp, err := s.client.Do(ctx, req, &rs)
|
||||
if err != nil {
|
||||
|
@ -180,9 +171,6 @@ func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, r
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
r := new(Reference)
|
||||
resp, err := s.client.Do(ctx, req, r)
|
||||
if err != nil {
|
||||
|
@ -206,9 +194,6 @@ func (s *GitService) UpdateRef(ctx context.Context, owner string, repo string, r
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
r := new(Reference)
|
||||
resp, err := s.client.Do(ctx, req, r)
|
||||
if err != nil {
|
||||
|
|
7
vendor/github.com/google/go-github/github/git_tags.go
generated
vendored
7
vendor/github.com/google/go-github/github/git_tags.go
generated
vendored
|
@ -8,7 +8,6 @@ package github
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Tag represents a tag object.
|
||||
|
@ -45,8 +44,7 @@ func (s *GitService) GetTag(ctx context.Context, owner string, repo string, sha
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
acceptHeaders := []string{mediaTypeGitSigningPreview, mediaTypeGraphQLNodeIDPreview}
|
||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
||||
req.Header.Set("Accept", mediaTypeGitSigningPreview)
|
||||
|
||||
tag := new(Tag)
|
||||
resp, err := s.client.Do(ctx, req, tag)
|
||||
|
@ -75,9 +73,6 @@ func (s *GitService) CreateTag(ctx context.Context, owner string, repo string, t
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
t := new(Tag)
|
||||
resp, err := s.client.Do(ctx, req, t)
|
||||
return t, resp, err
|
||||
|
|
6
vendor/github.com/google/go-github/github/git_trees.go
generated
vendored
6
vendor/github.com/google/go-github/github/git_trees.go
generated
vendored
|
@ -14,6 +14,12 @@ import (
|
|||
type Tree struct {
|
||||
SHA *string `json:"sha,omitempty"`
|
||||
Entries []TreeEntry `json:"tree,omitempty"`
|
||||
|
||||
// Truncated is true if the number of items in the tree
|
||||
// exceeded GitHub's maximum limit and the Entries were truncated
|
||||
// in the response. Only populated for requests that fetch
|
||||
// trees like Git.GetTree.
|
||||
Truncated *bool `json:"truncated,omitempty"`
|
||||
}
|
||||
|
||||
func (t Tree) String() string {
|
||||
|
|
1432
vendor/github.com/google/go-github/github/github-accessors.go
generated
vendored
1432
vendor/github.com/google/go-github/github/github-accessors.go
generated
vendored
File diff suppressed because it is too large
Load diff
72
vendor/github.com/google/go-github/github/github.go
generated
vendored
72
vendor/github.com/google/go-github/github/github.go
generated
vendored
|
@ -27,10 +27,9 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
libraryVersion = "15"
|
||||
defaultBaseURL = "https://api.github.com/"
|
||||
uploadBaseURL = "https://uploads.github.com/"
|
||||
userAgent = "go-github/" + libraryVersion
|
||||
userAgent = "go-github"
|
||||
|
||||
headerRateLimit = "X-RateLimit-Limit"
|
||||
headerRateRemaining = "X-RateLimit-Remaining"
|
||||
|
@ -46,15 +45,9 @@ const (
|
|||
|
||||
// Media Type values to access preview APIs
|
||||
|
||||
// https://developer.github.com/changes/2015-03-09-licenses-api/
|
||||
mediaTypeLicensesPreview = "application/vnd.github.drax-preview+json"
|
||||
|
||||
// https://developer.github.com/changes/2014-12-09-new-attributes-for-stars-api/
|
||||
mediaTypeStarringPreview = "application/vnd.github.v3.star+json"
|
||||
|
||||
// https://developer.github.com/changes/2015-11-11-protected-branches-api/
|
||||
mediaTypeProtectedBranchesPreview = "application/vnd.github.loki-preview+json"
|
||||
|
||||
// https://help.github.com/enterprise/2.4/admin/guides/migrations/exporting-the-github-com-organization-s-repositories/
|
||||
mediaTypeMigrationsPreview = "application/vnd.github.wyandotte-preview+json"
|
||||
|
||||
|
@ -100,20 +93,35 @@ const (
|
|||
// https://developer.github.com/changes/2017-07-17-update-topics-on-repositories/
|
||||
mediaTypeTopicsPreview = "application/vnd.github.mercy-preview+json"
|
||||
|
||||
// https://developer.github.com/changes/2017-07-26-team-review-request-thor-preview/
|
||||
mediaTypeTeamReviewPreview = "application/vnd.github.thor-preview+json"
|
||||
|
||||
// https://developer.github.com/v3/apps/marketplace/
|
||||
mediaTypeMarketplacePreview = "application/vnd.github.valkyrie-preview+json"
|
||||
|
||||
// https://developer.github.com/changes/2017-08-30-preview-nested-teams/
|
||||
mediaTypeNestedTeamsPreview = "application/vnd.github.hellcat-preview+json"
|
||||
|
||||
// https://developer.github.com/changes/2017-11-09-repository-transfer-api-preview/
|
||||
mediaTypeRepositoryTransferPreview = "application/vnd.github.nightshade-preview+json"
|
||||
|
||||
// https://developer.github.com/changes/2017-12-19-graphql-node-id/
|
||||
mediaTypeGraphQLNodeIDPreview = "application/vnd.github.jean-grey-preview+json"
|
||||
// https://developer.github.com/changes/2018-01-25-organization-invitation-api-preview/
|
||||
mediaTypeOrganizationInvitationPreview = "application/vnd.github.dazzler-preview+json"
|
||||
|
||||
// https://developer.github.com/changes/2018-03-16-protected-branches-required-approving-reviews/
|
||||
mediaTypeRequiredApprovingReviewsPreview = "application/vnd.github.luke-cage-preview+json"
|
||||
|
||||
// https://developer.github.com/changes/2018-02-22-label-description-search-preview/
|
||||
mediaTypeLabelDescriptionSearchPreview = "application/vnd.github.symmetra-preview+json"
|
||||
|
||||
// https://developer.github.com/changes/2018-02-07-team-discussions-api/
|
||||
mediaTypeTeamDiscussionsPreview = "application/vnd.github.echo-preview+json"
|
||||
|
||||
// https://developer.github.com/changes/2018-03-21-hovercard-api-preview/
|
||||
mediaTypeHovercardPreview = "application/vnd.github.hagar-preview+json"
|
||||
|
||||
// https://developer.github.com/changes/2018-01-10-lock-reason-api-preview/
|
||||
mediaTypeLockReasonPreview = "application/vnd.github.sailor-v-preview+json"
|
||||
|
||||
// https://developer.github.com/changes/2018-05-07-new-checks-api-public-beta/
|
||||
mediaTypeCheckRunsPreview = "application/vnd.github.antiope-preview+json"
|
||||
|
||||
// https://developer.github.com/enterprise/2.13/v3/repos/pre_receive_hooks/
|
||||
mediaTypePreReceiveHooksPreview = "application/vnd.github.eye-scream-preview"
|
||||
)
|
||||
|
||||
// A Client manages communication with the GitHub API.
|
||||
|
@ -142,6 +150,7 @@ type Client struct {
|
|||
Admin *AdminService
|
||||
Apps *AppsService
|
||||
Authorizations *AuthorizationsService
|
||||
Checks *ChecksService
|
||||
Gists *GistsService
|
||||
Git *GitService
|
||||
Gitignores *GitignoresService
|
||||
|
@ -155,6 +164,7 @@ type Client struct {
|
|||
Reactions *ReactionsService
|
||||
Repositories *RepositoriesService
|
||||
Search *SearchService
|
||||
Teams *TeamsService
|
||||
Users *UsersService
|
||||
}
|
||||
|
||||
|
@ -232,6 +242,7 @@ func NewClient(httpClient *http.Client) *Client {
|
|||
c.Admin = (*AdminService)(&c.common)
|
||||
c.Apps = (*AppsService)(&c.common)
|
||||
c.Authorizations = (*AuthorizationsService)(&c.common)
|
||||
c.Checks = (*ChecksService)(&c.common)
|
||||
c.Gists = (*GistsService)(&c.common)
|
||||
c.Git = (*GitService)(&c.common)
|
||||
c.Gitignores = (*GitignoresService)(&c.common)
|
||||
|
@ -245,6 +256,7 @@ func NewClient(httpClient *http.Client) *Client {
|
|||
c.Reactions = (*ReactionsService)(&c.common)
|
||||
c.Repositories = (*RepositoriesService)(&c.common)
|
||||
c.Search = (*SearchService)(&c.common)
|
||||
c.Teams = (*TeamsService)(&c.common)
|
||||
c.Users = (*UsersService)(&c.common)
|
||||
return c
|
||||
}
|
||||
|
@ -478,12 +490,7 @@ func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Res
|
|||
|
||||
return nil, err
|
||||
}
|
||||
|
||||
defer func() {
|
||||
// Drain up to 512 bytes and close the body to let the Transport reuse the connection
|
||||
io.CopyN(ioutil.Discard, resp.Body, 512)
|
||||
resp.Body.Close()
|
||||
}()
|
||||
defer resp.Body.Close()
|
||||
|
||||
response := newResponse(resp)
|
||||
|
||||
|
@ -493,18 +500,25 @@ func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Res
|
|||
|
||||
err = CheckResponse(resp)
|
||||
if err != nil {
|
||||
// even though there was an error, we still return the response
|
||||
// in case the caller wants to inspect it further
|
||||
return response, err
|
||||
// Even though there was an error, we still return the response
|
||||
// in case the caller wants to inspect it further.
|
||||
// However, if the error is AcceptedError, decode it below before
|
||||
// returning from this function and closing the response body.
|
||||
if _, ok := err.(*AcceptedError); !ok {
|
||||
return response, err
|
||||
}
|
||||
}
|
||||
|
||||
if v != nil {
|
||||
if w, ok := v.(io.Writer); ok {
|
||||
io.Copy(w, resp.Body)
|
||||
} else {
|
||||
err = json.NewDecoder(resp.Body).Decode(v)
|
||||
if err == io.EOF {
|
||||
err = nil // ignore EOF errors caused by empty response body
|
||||
decErr := json.NewDecoder(resp.Body).Decode(v)
|
||||
if decErr == io.EOF {
|
||||
decErr = nil // ignore EOF errors caused by empty response body
|
||||
}
|
||||
if decErr != nil {
|
||||
err = decErr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -693,7 +707,7 @@ func CheckResponse(r *http.Response) error {
|
|||
Response: errorResponse.Response,
|
||||
Message: errorResponse.Message,
|
||||
}
|
||||
case r.StatusCode == http.StatusForbidden && errorResponse.DocumentationURL == "https://developer.github.com/v3/#abuse-rate-limits":
|
||||
case r.StatusCode == http.StatusForbidden && strings.HasSuffix(errorResponse.DocumentationURL, "/v3/#abuse-rate-limits"):
|
||||
abuseRateLimitError := &AbuseRateLimitError{
|
||||
Response: errorResponse.Response,
|
||||
Message: errorResponse.Message,
|
||||
|
|
31
vendor/github.com/google/go-github/github/issues.go
generated
vendored
31
vendor/github.com/google/go-github/github/issues.go
generated
vendored
|
@ -56,6 +56,10 @@ type Issue struct {
|
|||
// TextMatches is only populated from search results that request text matches
|
||||
// See: search.go and https://developer.github.com/v3/search/#text-match-metadata
|
||||
TextMatches []TextMatch `json:"text_matches,omitempty"`
|
||||
|
||||
// ActiveLockReason is populated only when LockReason is provided while locking the issue.
|
||||
// Possible values are: "off-topic", "too heated", "resolved", and "spam".
|
||||
ActiveLockReason *string `json:"active_lock_reason,omitempty"`
|
||||
}
|
||||
|
||||
func (i Issue) String() string {
|
||||
|
@ -156,7 +160,7 @@ func (s *IssuesService) listIssues(ctx context.Context, u string, opt *IssueList
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeGraphQLNodeIDPreview}
|
||||
acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview}
|
||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
||||
|
||||
var issues []*Issue
|
||||
|
@ -224,7 +228,7 @@ func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo strin
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeGraphQLNodeIDPreview}
|
||||
acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview}
|
||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
||||
|
||||
var issues []*Issue
|
||||
|
@ -247,7 +251,7 @@ func (s *IssuesService) Get(ctx context.Context, owner string, repo string, numb
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeGraphQLNodeIDPreview}
|
||||
acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview}
|
||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
||||
|
||||
issue := new(Issue)
|
||||
|
@ -270,7 +274,7 @@ func (s *IssuesService) Create(ctx context.Context, owner string, repo string, i
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview)
|
||||
|
||||
i := new(Issue)
|
||||
resp, err := s.client.Do(ctx, req, i)
|
||||
|
@ -292,7 +296,7 @@ func (s *IssuesService) Edit(ctx context.Context, owner string, repo string, num
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview)
|
||||
|
||||
i := new(Issue)
|
||||
resp, err := s.client.Do(ctx, req, i)
|
||||
|
@ -303,16 +307,29 @@ func (s *IssuesService) Edit(ctx context.Context, owner string, repo string, num
|
|||
return i, resp, nil
|
||||
}
|
||||
|
||||
// LockIssueOptions specifies the optional parameters to the
|
||||
// IssuesService.Lock method.
|
||||
type LockIssueOptions struct {
|
||||
// LockReason specifies the reason to lock this issue.
|
||||
// Providing a lock reason can help make it clearer to contributors why an issue
|
||||
// was locked. Possible values are: "off-topic", "too heated", "resolved", and "spam".
|
||||
LockReason string `json:"lock_reason,omitempty"`
|
||||
}
|
||||
|
||||
// Lock an issue's conversation.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/issues/#lock-an-issue
|
||||
func (s *IssuesService) Lock(ctx context.Context, owner string, repo string, number int) (*Response, error) {
|
||||
func (s *IssuesService) Lock(ctx context.Context, owner string, repo string, number int, opt *LockIssueOptions) (*Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number)
|
||||
req, err := s.client.NewRequest("PUT", u, nil)
|
||||
req, err := s.client.NewRequest("PUT", u, opt)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if opt != nil {
|
||||
req.Header.Set("Accept", mediaTypeLockReasonPreview)
|
||||
}
|
||||
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
||||
|
|
22
vendor/github.com/google/go-github/github/issues_comments.go
generated
vendored
22
vendor/github.com/google/go-github/github/issues_comments.go
generated
vendored
|
@ -19,9 +19,12 @@ type IssueComment struct {
|
|||
Reactions *Reactions `json:"reactions,omitempty"`
|
||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
HTMLURL *string `json:"html_url,omitempty"`
|
||||
IssueURL *string `json:"issue_url,omitempty"`
|
||||
// AuthorAssociation is the comment author's relationship to the issue's repository.
|
||||
// Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE".
|
||||
AuthorAssociation *string `json:"author_association,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
HTMLURL *string `json:"html_url,omitempty"`
|
||||
IssueURL *string `json:"issue_url,omitempty"`
|
||||
}
|
||||
|
||||
func (i IssueComment) String() string {
|
||||
|
@ -79,8 +82,8 @@ func (s *IssuesService) ListComments(ctx context.Context, owner string, repo str
|
|||
// GetComment fetches the specified issue comment.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/issues/comments/#get-a-single-comment
|
||||
func (s *IssuesService) GetComment(ctx context.Context, owner string, repo string, id int) (*IssueComment, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, id)
|
||||
func (s *IssuesService) GetComment(ctx context.Context, owner string, repo string, commentID int64) (*IssueComment, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
|
@ -118,10 +121,11 @@ func (s *IssuesService) CreateComment(ctx context.Context, owner string, repo st
|
|||
}
|
||||
|
||||
// EditComment updates an issue comment.
|
||||
// A non-nil comment.Body must be provided. Other comment fields should be left nil.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/issues/comments/#edit-a-comment
|
||||
func (s *IssuesService) EditComment(ctx context.Context, owner string, repo string, id int, comment *IssueComment) (*IssueComment, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, id)
|
||||
func (s *IssuesService) EditComment(ctx context.Context, owner string, repo string, commentID int64, comment *IssueComment) (*IssueComment, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID)
|
||||
req, err := s.client.NewRequest("PATCH", u, comment)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
|
@ -138,8 +142,8 @@ func (s *IssuesService) EditComment(ctx context.Context, owner string, repo stri
|
|||
// DeleteComment deletes an issue comment.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/issues/comments/#delete-a-comment
|
||||
func (s *IssuesService) DeleteComment(ctx context.Context, owner string, repo string, id int) (*Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, id)
|
||||
func (s *IssuesService) DeleteComment(ctx context.Context, owner string, repo string, commentID int64) (*Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID)
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
21
vendor/github.com/google/go-github/github/issues_events.go
generated
vendored
21
vendor/github.com/google/go-github/github/issues_events.go
generated
vendored
|
@ -34,9 +34,13 @@ type IssueEvent struct {
|
|||
// The Actor committed to master a commit mentioning the issue in its commit message.
|
||||
// CommitID holds the SHA1 of the commit.
|
||||
//
|
||||
// reopened, locked, unlocked
|
||||
// reopened, unlocked
|
||||
// The Actor did that to the issue.
|
||||
//
|
||||
// locked
|
||||
// The Actor locked the issue.
|
||||
// LockReason holds the reason of locking the issue (if provided while locking).
|
||||
//
|
||||
// renamed
|
||||
// The Actor changed the issue title from Rename.From to Rename.To.
|
||||
//
|
||||
|
@ -64,12 +68,13 @@ type IssueEvent struct {
|
|||
Issue *Issue `json:"issue,omitempty"`
|
||||
|
||||
// Only present on certain events; see above.
|
||||
Assignee *User `json:"assignee,omitempty"`
|
||||
Assigner *User `json:"assigner,omitempty"`
|
||||
CommitID *string `json:"commit_id,omitempty"`
|
||||
Milestone *Milestone `json:"milestone,omitempty"`
|
||||
Label *Label `json:"label,omitempty"`
|
||||
Rename *Rename `json:"rename,omitempty"`
|
||||
Assignee *User `json:"assignee,omitempty"`
|
||||
Assigner *User `json:"assigner,omitempty"`
|
||||
CommitID *string `json:"commit_id,omitempty"`
|
||||
Milestone *Milestone `json:"milestone,omitempty"`
|
||||
Label *Label `json:"label,omitempty"`
|
||||
Rename *Rename `json:"rename,omitempty"`
|
||||
LockReason *string `json:"lock_reason,omitempty"`
|
||||
}
|
||||
|
||||
// ListIssueEvents lists events for the specified issue.
|
||||
|
@ -87,6 +92,8 @@ func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string,
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
req.Header.Set("Accept", mediaTypeLockReasonPreview)
|
||||
|
||||
var events []*IssueEvent
|
||||
resp, err := s.client.Do(ctx, req, &events)
|
||||
if err != nil {
|
||||
|
|
36
vendor/github.com/google/go-github/github/issues_labels.go
generated
vendored
36
vendor/github.com/google/go-github/github/issues_labels.go
generated
vendored
|
@ -12,11 +12,13 @@ import (
|
|||
|
||||
// Label represents a GitHub label on an Issue
|
||||
type Label struct {
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Color *string `json:"color,omitempty"`
|
||||
NodeID *string `json:"node_id,omitempty"`
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Color *string `json:"color,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Default *bool `json:"default,omitempty"`
|
||||
NodeID *string `json:"node_id,omitempty"`
|
||||
}
|
||||
|
||||
func (l Label) String() string {
|
||||
|
@ -39,7 +41,7 @@ func (s *IssuesService) ListLabels(ctx context.Context, owner string, repo strin
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview)
|
||||
|
||||
var labels []*Label
|
||||
resp, err := s.client.Do(ctx, req, &labels)
|
||||
|
@ -61,7 +63,7 @@ func (s *IssuesService) GetLabel(ctx context.Context, owner string, repo string,
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview)
|
||||
|
||||
label := new(Label)
|
||||
resp, err := s.client.Do(ctx, req, label)
|
||||
|
@ -83,7 +85,7 @@ func (s *IssuesService) CreateLabel(ctx context.Context, owner string, repo stri
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview)
|
||||
|
||||
l := new(Label)
|
||||
resp, err := s.client.Do(ctx, req, l)
|
||||
|
@ -105,7 +107,7 @@ func (s *IssuesService) EditLabel(ctx context.Context, owner string, repo string
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview)
|
||||
|
||||
l := new(Label)
|
||||
resp, err := s.client.Do(ctx, req, l)
|
||||
|
@ -144,7 +146,7 @@ func (s *IssuesService) ListLabelsByIssue(ctx context.Context, owner string, rep
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview)
|
||||
|
||||
var labels []*Label
|
||||
resp, err := s.client.Do(ctx, req, &labels)
|
||||
|
@ -166,7 +168,7 @@ func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner string, repo
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview)
|
||||
|
||||
var l []*Label
|
||||
resp, err := s.client.Do(ctx, req, &l)
|
||||
|
@ -186,6 +188,10 @@ func (s *IssuesService) RemoveLabelForIssue(ctx context.Context, owner string, r
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview)
|
||||
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
||||
|
@ -200,7 +206,7 @@ func (s *IssuesService) ReplaceLabelsForIssue(ctx context.Context, owner string,
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview)
|
||||
|
||||
var l []*Label
|
||||
resp, err := s.client.Do(ctx, req, &l)
|
||||
|
@ -220,6 +226,10 @@ func (s *IssuesService) RemoveLabelsForIssue(ctx context.Context, owner string,
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview)
|
||||
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
||||
|
@ -239,7 +249,7 @@ func (s *IssuesService) ListLabelsForMilestone(ctx context.Context, owner string
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview)
|
||||
|
||||
var labels []*Label
|
||||
resp, err := s.client.Do(ctx, req, &labels)
|
||||
|
|
12
vendor/github.com/google/go-github/github/issues_milestones.go
generated
vendored
12
vendor/github.com/google/go-github/github/issues_milestones.go
generated
vendored
|
@ -68,9 +68,6 @@ func (s *IssuesService) ListMilestones(ctx context.Context, owner string, repo s
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
var milestones []*Milestone
|
||||
resp, err := s.client.Do(ctx, req, &milestones)
|
||||
if err != nil {
|
||||
|
@ -90,9 +87,6 @@ func (s *IssuesService) GetMilestone(ctx context.Context, owner string, repo str
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
milestone := new(Milestone)
|
||||
resp, err := s.client.Do(ctx, req, milestone)
|
||||
if err != nil {
|
||||
|
@ -112,9 +106,6 @@ func (s *IssuesService) CreateMilestone(ctx context.Context, owner string, repo
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
m := new(Milestone)
|
||||
resp, err := s.client.Do(ctx, req, m)
|
||||
if err != nil {
|
||||
|
@ -134,9 +125,6 @@ func (s *IssuesService) EditMilestone(ctx context.Context, owner string, repo st
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
m := new(Milestone)
|
||||
resp, err := s.client.Do(ctx, req, m)
|
||||
if err != nil {
|
||||
|
|
6
vendor/github.com/google/go-github/github/licenses.go
generated
vendored
6
vendor/github.com/google/go-github/github/licenses.go
generated
vendored
|
@ -67,9 +67,6 @@ func (s *LicensesService) List(ctx context.Context) ([]*License, *Response, erro
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeLicensesPreview)
|
||||
|
||||
var licenses []*License
|
||||
resp, err := s.client.Do(ctx, req, &licenses)
|
||||
if err != nil {
|
||||
|
@ -90,9 +87,6 @@ func (s *LicensesService) Get(ctx context.Context, licenseName string) (*License
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeLicensesPreview)
|
||||
|
||||
license := new(License)
|
||||
resp, err := s.client.Do(ctx, req, license)
|
||||
if err != nil {
|
||||
|
|
2
vendor/github.com/google/go-github/github/messages.go
generated
vendored
2
vendor/github.com/google/go-github/github/messages.go
generated
vendored
|
@ -41,6 +41,8 @@ const (
|
|||
var (
|
||||
// eventTypeMapping maps webhooks types to their corresponding go-github struct types.
|
||||
eventTypeMapping = map[string]string{
|
||||
"check_run": "CheckRunEvent",
|
||||
"check_suite": "CheckSuiteEvent",
|
||||
"commit_comment": "CommitCommentEvent",
|
||||
"create": "CreateEvent",
|
||||
"delete": "DeleteEvent",
|
||||
|
|
214
vendor/github.com/google/go-github/github/migrations_user.go
generated
vendored
Normal file
214
vendor/github.com/google/go-github/github/migrations_user.go
generated
vendored
Normal file
|
@ -0,0 +1,214 @@
|
|||
// Copyright 2018 The go-github AUTHORS. 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"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// UserMigration represents a GitHub migration (archival).
|
||||
type UserMigration struct {
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
GUID *string `json:"guid,omitempty"`
|
||||
// State is the current state of a migration.
|
||||
// Possible values are:
|
||||
// "pending" which means the migration hasn't started yet,
|
||||
// "exporting" which means the migration is in progress,
|
||||
// "exported" which means the migration finished successfully, or
|
||||
// "failed" which means the migration failed.
|
||||
State *string `json:"state,omitempty"`
|
||||
// LockRepositories indicates whether repositories are locked (to prevent
|
||||
// manipulation) while migrating data.
|
||||
LockRepositories *bool `json:"lock_repositories,omitempty"`
|
||||
// ExcludeAttachments indicates whether attachments should be excluded from
|
||||
// the migration (to reduce migration archive file size).
|
||||
ExcludeAttachments *bool `json:"exclude_attachments,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
CreatedAt *string `json:"created_at,omitempty"`
|
||||
UpdatedAt *string `json:"updated_at,omitempty"`
|
||||
Repositories []*Repository `json:"repositories,omitempty"`
|
||||
}
|
||||
|
||||
func (m UserMigration) String() string {
|
||||
return Stringify(m)
|
||||
}
|
||||
|
||||
// UserMigrationOptions specifies the optional parameters to Migration methods.
|
||||
type UserMigrationOptions struct {
|
||||
// LockRepositories indicates whether repositories should be locked (to prevent
|
||||
// manipulation) while migrating data.
|
||||
LockRepositories bool
|
||||
|
||||
// ExcludeAttachments indicates whether attachments should be excluded from
|
||||
// the migration (to reduce migration archive file size).
|
||||
ExcludeAttachments bool
|
||||
}
|
||||
|
||||
// startUserMigration represents the body of a StartMigration request.
|
||||
type startUserMigration struct {
|
||||
// Repositories is a slice of repository names to migrate.
|
||||
Repositories []string `json:"repositories,omitempty"`
|
||||
|
||||
// LockRepositories indicates whether repositories should be locked (to prevent
|
||||
// manipulation) while migrating data.
|
||||
LockRepositories *bool `json:"lock_repositories,omitempty"`
|
||||
|
||||
// ExcludeAttachments indicates whether attachments should be excluded from
|
||||
// the migration (to reduce migration archive file size).
|
||||
ExcludeAttachments *bool `json:"exclude_attachments,omitempty"`
|
||||
}
|
||||
|
||||
// StartUserMigration starts the generation of a migration archive.
|
||||
// repos is a slice of repository names to migrate.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/migrations/users/#start-a-user-migration
|
||||
func (s *MigrationService) StartUserMigration(ctx context.Context, repos []string, opt *UserMigrationOptions) (*UserMigration, *Response, error) {
|
||||
u := "user/migrations"
|
||||
|
||||
body := &startUserMigration{Repositories: repos}
|
||||
if opt != nil {
|
||||
body.LockRepositories = Bool(opt.LockRepositories)
|
||||
body.ExcludeAttachments = Bool(opt.ExcludeAttachments)
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, body)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeMigrationsPreview)
|
||||
|
||||
m := &UserMigration{}
|
||||
resp, err := s.client.Do(ctx, req, m)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return m, resp, nil
|
||||
}
|
||||
|
||||
// ListUserMigrations lists the most recent migrations.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/migrations/users/#get-a-list-of-user-migrations
|
||||
func (s *MigrationService) ListUserMigrations(ctx context.Context) ([]*UserMigration, *Response, error) {
|
||||
u := "user/migrations"
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeMigrationsPreview)
|
||||
|
||||
var m []*UserMigration
|
||||
resp, err := s.client.Do(ctx, req, &m)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return m, resp, nil
|
||||
}
|
||||
|
||||
// UserMigrationStatus gets the status of a specific migration archive.
|
||||
// id is the migration ID.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/migrations/users/#get-the-status-of-a-user-migration
|
||||
func (s *MigrationService) UserMigrationStatus(ctx context.Context, id int64) (*UserMigration, *Response, error) {
|
||||
u := fmt.Sprintf("user/migrations/%v", id)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeMigrationsPreview)
|
||||
|
||||
m := &UserMigration{}
|
||||
resp, err := s.client.Do(ctx, req, m)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return m, resp, nil
|
||||
}
|
||||
|
||||
// UserMigrationArchiveURL gets the URL for a specific migration archive.
|
||||
// id is the migration ID.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/migrations/users/#download-a-user-migration-archive
|
||||
func (s *MigrationService) UserMigrationArchiveURL(ctx context.Context, id int64) (string, error) {
|
||||
url := fmt.Sprintf("user/migrations/%v/archive", id)
|
||||
|
||||
req, err := s.client.NewRequest("GET", url, nil)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeMigrationsPreview)
|
||||
|
||||
m := &UserMigration{}
|
||||
|
||||
var loc string
|
||||
originalRedirect := s.client.client.CheckRedirect
|
||||
s.client.client.CheckRedirect = func(req *http.Request, via []*http.Request) error {
|
||||
loc = req.URL.String()
|
||||
return http.ErrUseLastResponse
|
||||
}
|
||||
defer func() {
|
||||
s.client.client.CheckRedirect = originalRedirect
|
||||
}()
|
||||
resp, err := s.client.Do(ctx, req, m)
|
||||
if err == nil {
|
||||
return "", errors.New("expected redirect, none provided")
|
||||
}
|
||||
loc = resp.Header.Get("Location")
|
||||
return loc, nil
|
||||
}
|
||||
|
||||
// DeleteUserMigration will delete a previous migration archive.
|
||||
// id is the migration ID.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/migrations/users/#delete-a-user-migration-archive
|
||||
func (s *MigrationService) DeleteUserMigration(ctx context.Context, id int64) (*Response, error) {
|
||||
url := fmt.Sprintf("user/migrations/%v/archive", id)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", url, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeMigrationsPreview)
|
||||
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
||||
// UnlockUserRepository will unlock a repo that was locked for migration.
|
||||
// id is migration ID.
|
||||
// You should unlock each migrated repository and delete them when the migration
|
||||
// is complete and you no longer need the source data.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/migrations/users/#unlock-a-user-repository
|
||||
func (s *MigrationService) UnlockUserRepo(ctx context.Context, id int64, repo string) (*Response, error) {
|
||||
url := fmt.Sprintf("user/migrations/%v/repos/%v/lock", id, repo)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", url, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeMigrationsPreview)
|
||||
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
4
vendor/github.com/google/go-github/github/misc.go
generated
vendored
4
vendor/github.com/google/go-github/github/misc.go
generated
vendored
|
@ -158,6 +158,10 @@ type APIMeta struct {
|
|||
// An array of IP addresses in CIDR format specifying the addresses
|
||||
// which serve GitHub Pages websites.
|
||||
Pages []string `json:"pages,omitempty"`
|
||||
|
||||
// An Array of IP addresses specifying the addresses that source imports
|
||||
// will originate from on GitHub.com.
|
||||
Importer []string `json:"importer,omitempty"`
|
||||
}
|
||||
|
||||
// APIMeta returns information about GitHub.com, the service. Or, if you access
|
||||
|
|
22
vendor/github.com/google/go-github/github/orgs.go
generated
vendored
22
vendor/github.com/google/go-github/github/orgs.go
generated
vendored
|
@ -21,6 +21,7 @@ type OrganizationsService service
|
|||
type Organization struct {
|
||||
Login *string `json:"login,omitempty"`
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
NodeID *string `json:"node_id,omitempty"`
|
||||
AvatarURL *string `json:"avatar_url,omitempty"`
|
||||
HTMLURL *string `json:"html_url,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
|
@ -43,7 +44,6 @@ type Organization struct {
|
|||
BillingEmail *string `json:"billing_email,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Plan *Plan `json:"plan,omitempty"`
|
||||
NodeID *string `json:"node_id,omitempty"`
|
||||
|
||||
// API URLs
|
||||
URL *string `json:"url,omitempty"`
|
||||
|
@ -75,8 +75,11 @@ func (p Plan) String() string {
|
|||
// OrganizationsService.ListAll method.
|
||||
type OrganizationsListOptions struct {
|
||||
// Since filters Organizations by ID.
|
||||
Since int `url:"since,omitempty"`
|
||||
Since int64 `url:"since,omitempty"`
|
||||
|
||||
// Note: Pagination is powered exclusively by the Since parameter,
|
||||
// ListOptions.Page has no effect.
|
||||
// ListOptions.PerPage controls an undocumented GitHub API parameter.
|
||||
ListOptions
|
||||
}
|
||||
|
||||
|
@ -98,9 +101,6 @@ func (s *OrganizationsService) ListAll(ctx context.Context, opt *OrganizationsLi
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
orgs := []*Organization{}
|
||||
resp, err := s.client.Do(ctx, req, &orgs)
|
||||
if err != nil {
|
||||
|
@ -130,9 +130,6 @@ func (s *OrganizationsService) List(ctx context.Context, user string, opt *ListO
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
var orgs []*Organization
|
||||
resp, err := s.client.Do(ctx, req, &orgs)
|
||||
if err != nil {
|
||||
|
@ -152,9 +149,6 @@ func (s *OrganizationsService) Get(ctx context.Context, org string) (*Organizati
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
organization := new(Organization)
|
||||
resp, err := s.client.Do(ctx, req, organization)
|
||||
if err != nil {
|
||||
|
@ -174,9 +168,6 @@ func (s *OrganizationsService) GetByID(ctx context.Context, id int64) (*Organiza
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
organization := new(Organization)
|
||||
resp, err := s.client.Do(ctx, req, organization)
|
||||
if err != nil {
|
||||
|
@ -196,9 +187,6 @@ func (s *OrganizationsService) Edit(ctx context.Context, name string, org *Organ
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
o := new(Organization)
|
||||
resp, err := s.client.Do(ctx, req, o)
|
||||
if err != nil {
|
||||
|
|
8
vendor/github.com/google/go-github/github/orgs_hooks.go
generated
vendored
8
vendor/github.com/google/go-github/github/orgs_hooks.go
generated
vendored
|
@ -37,7 +37,7 @@ func (s *OrganizationsService) ListHooks(ctx context.Context, org string, opt *L
|
|||
// GetHook returns a single specified Hook.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#get-single-hook
|
||||
func (s *OrganizationsService) GetHook(ctx context.Context, org string, id int) (*Hook, *Response, error) {
|
||||
func (s *OrganizationsService) GetHook(ctx context.Context, org string, id int64) (*Hook, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/hooks/%d", org, id)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
|
@ -71,7 +71,7 @@ func (s *OrganizationsService) CreateHook(ctx context.Context, org string, hook
|
|||
// EditHook updates a specified Hook.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#edit-a-hook
|
||||
func (s *OrganizationsService) EditHook(ctx context.Context, org string, id int, hook *Hook) (*Hook, *Response, error) {
|
||||
func (s *OrganizationsService) EditHook(ctx context.Context, org string, id int64, hook *Hook) (*Hook, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/hooks/%d", org, id)
|
||||
req, err := s.client.NewRequest("PATCH", u, hook)
|
||||
if err != nil {
|
||||
|
@ -85,7 +85,7 @@ func (s *OrganizationsService) EditHook(ctx context.Context, org string, id int,
|
|||
// PingHook triggers a 'ping' event to be sent to the Hook.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#ping-a-hook
|
||||
func (s *OrganizationsService) PingHook(ctx context.Context, org string, id int) (*Response, error) {
|
||||
func (s *OrganizationsService) PingHook(ctx context.Context, org string, id int64) (*Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/hooks/%d/pings", org, id)
|
||||
req, err := s.client.NewRequest("POST", u, nil)
|
||||
if err != nil {
|
||||
|
@ -97,7 +97,7 @@ func (s *OrganizationsService) PingHook(ctx context.Context, org string, id int)
|
|||
// DeleteHook deletes a specified Hook.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#delete-a-hook
|
||||
func (s *OrganizationsService) DeleteHook(ctx context.Context, org string, id int) (*Response, error) {
|
||||
func (s *OrganizationsService) DeleteHook(ctx context.Context, org string, id int64) (*Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/hooks/%d", org, id)
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
if err != nil {
|
||||
|
|
73
vendor/github.com/google/go-github/github/orgs_members.go
generated
vendored
73
vendor/github.com/google/go-github/github/orgs_members.go
generated
vendored
|
@ -59,7 +59,7 @@ type ListMembersOptions struct {
|
|||
// Possible values are:
|
||||
// all - all members of the organization, regardless of role
|
||||
// admin - organization owners
|
||||
// member - non-organization members
|
||||
// member - non-owner organization members
|
||||
//
|
||||
// Default is "all".
|
||||
Role string `url:"role,omitempty"`
|
||||
|
@ -297,3 +297,74 @@ func (s *OrganizationsService) ListPendingOrgInvitations(ctx context.Context, or
|
|||
}
|
||||
return pendingInvitations, resp, nil
|
||||
}
|
||||
|
||||
// CreateOrgInvitationOptions specifies the parameters to the OrganizationService.Invite
|
||||
// method.
|
||||
type CreateOrgInvitationOptions struct {
|
||||
// GitHub user ID for the person you are inviting. Not required if you provide Email.
|
||||
InviteeID *int64 `json:"invitee_id,omitempty"`
|
||||
// Email address of the person you are inviting, which can be an existing GitHub user.
|
||||
// Not required if you provide InviteeID
|
||||
Email *string `json:"email,omitempty"`
|
||||
// Specify role for new member. Can be one of:
|
||||
// * admin - Organization owners with full administrative rights to the
|
||||
// organization and complete access to all repositories and teams.
|
||||
// * direct_member - Non-owner organization members with ability to see
|
||||
// other members and join teams by invitation.
|
||||
// * billing_manager - Non-owner organization members with ability to
|
||||
// manage the billing settings of your organization.
|
||||
// Default is "direct_member".
|
||||
Role *string `json:"role"`
|
||||
TeamID []int64 `json:"team_ids"`
|
||||
}
|
||||
|
||||
// CreateOrgInvitation invites people to an organization by using their GitHub user ID or their email address.
|
||||
// In order to create invitations in an organization,
|
||||
// the authenticated user must be an organization owner.
|
||||
//
|
||||
// https://developer.github.com/v3/orgs/members/#create-organization-invitation
|
||||
func (s *OrganizationsService) CreateOrgInvitation(ctx context.Context, org string, opt *CreateOrgInvitationOptions) (*Invitation, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/invitations", org)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeOrganizationInvitationPreview)
|
||||
|
||||
var invitation *Invitation
|
||||
resp, err := s.client.Do(ctx, req, &invitation)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
return invitation, resp, nil
|
||||
}
|
||||
|
||||
// ListOrgInvitationTeams lists all teams associated with an invitation. In order to see invitations in an organization,
|
||||
// the authenticated user must be an organization owner.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/orgs/members/#list-organization-invitation-teams
|
||||
func (s *OrganizationsService) ListOrgInvitationTeams(ctx context.Context, org, invitationID string, opt *ListOptions) ([]*Team, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/invitations/%v/teams", org, invitationID)
|
||||
u, err := addOptions(u, opt)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeOrganizationInvitationPreview)
|
||||
|
||||
var orgInvitationTeams []*Team
|
||||
resp, err := s.client.Do(ctx, req, &orgInvitationTeams)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
return orgInvitationTeams, resp, nil
|
||||
}
|
||||
|
|
39
vendor/github.com/google/go-github/github/projects.go
generated
vendored
39
vendor/github.com/google/go-github/github/projects.go
generated
vendored
|
@ -26,6 +26,7 @@ type Project struct {
|
|||
Number *int `json:"number,omitempty"`
|
||||
CreatedAt *Timestamp `json:"created_at,omitempty"`
|
||||
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
|
||||
NodeID *string `json:"node_id,omitempty"`
|
||||
|
||||
// The User object that generated the project.
|
||||
Creator *User `json:"creator,omitempty"`
|
||||
|
@ -45,7 +46,7 @@ func (s *ProjectsService) GetProject(ctx context.Context, id int64) (*Project, *
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
req.Header.Set("Accept", mediaTypeProjectsPreview)
|
||||
|
||||
project := &Project{}
|
||||
|
@ -83,7 +84,7 @@ func (s *ProjectsService) UpdateProject(ctx context.Context, id int64, opt *Proj
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
req.Header.Set("Accept", mediaTypeProjectsPreview)
|
||||
|
||||
project := &Project{}
|
||||
|
@ -120,6 +121,7 @@ type ProjectColumn struct {
|
|||
ProjectURL *string `json:"project_url,omitempty"`
|
||||
CreatedAt *Timestamp `json:"created_at,omitempty"`
|
||||
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
|
||||
NodeID *string `json:"node_id,omitempty"`
|
||||
}
|
||||
|
||||
// ListProjectColumns lists the columns of a GitHub Project for a repo.
|
||||
|
@ -137,7 +139,7 @@ func (s *ProjectsService) ListProjectColumns(ctx context.Context, projectID int6
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
req.Header.Set("Accept", mediaTypeProjectsPreview)
|
||||
|
||||
columns := []*ProjectColumn{}
|
||||
|
@ -159,7 +161,7 @@ func (s *ProjectsService) GetProjectColumn(ctx context.Context, id int64) (*Proj
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
req.Header.Set("Accept", mediaTypeProjectsPreview)
|
||||
|
||||
column := &ProjectColumn{}
|
||||
|
@ -189,7 +191,7 @@ func (s *ProjectsService) CreateProjectColumn(ctx context.Context, projectID int
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
req.Header.Set("Accept", mediaTypeProjectsPreview)
|
||||
|
||||
column := &ProjectColumn{}
|
||||
|
@ -211,7 +213,7 @@ func (s *ProjectsService) UpdateProjectColumn(ctx context.Context, columnID int6
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
req.Header.Set("Accept", mediaTypeProjectsPreview)
|
||||
|
||||
column := &ProjectColumn{}
|
||||
|
@ -275,15 +277,27 @@ type ProjectCard struct {
|
|||
Creator *User `json:"creator,omitempty"`
|
||||
CreatedAt *Timestamp `json:"created_at,omitempty"`
|
||||
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
|
||||
NodeID *string `json:"node_id,omitempty"`
|
||||
Archived *bool `json:"archived,omitempty"`
|
||||
|
||||
// The following fields are only populated by Webhook events.
|
||||
ColumnID *int64 `json:"column_id,omitempty"`
|
||||
}
|
||||
|
||||
// ProjectCardListOptions specifies the optional parameters to the
|
||||
// ProjectsService.ListProjectCards method.
|
||||
type ProjectCardListOptions struct {
|
||||
// ArchivedState is used to list all, archived, or not_archived project cards.
|
||||
// Defaults to not_archived when you omit this parameter.
|
||||
ArchivedState *string `url:"archived_state,omitempty"`
|
||||
|
||||
ListOptions
|
||||
}
|
||||
|
||||
// ListProjectCards lists the cards in a column of a GitHub Project.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/projects/cards/#list-project-cards
|
||||
func (s *ProjectsService) ListProjectCards(ctx context.Context, columnID int64, opt *ListOptions) ([]*ProjectCard, *Response, error) {
|
||||
func (s *ProjectsService) ListProjectCards(ctx context.Context, columnID int64, opt *ProjectCardListOptions) ([]*ProjectCard, *Response, error) {
|
||||
u := fmt.Sprintf("projects/columns/%v/cards", columnID)
|
||||
u, err := addOptions(u, opt)
|
||||
if err != nil {
|
||||
|
@ -295,7 +309,7 @@ func (s *ProjectsService) ListProjectCards(ctx context.Context, columnID int64,
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
req.Header.Set("Accept", mediaTypeProjectsPreview)
|
||||
|
||||
cards := []*ProjectCard{}
|
||||
|
@ -317,7 +331,7 @@ func (s *ProjectsService) GetProjectCard(ctx context.Context, columnID int64) (*
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
req.Header.Set("Accept", mediaTypeProjectsPreview)
|
||||
|
||||
card := &ProjectCard{}
|
||||
|
@ -340,6 +354,9 @@ type ProjectCardOptions struct {
|
|||
ContentID int64 `json:"content_id,omitempty"`
|
||||
// The type of content to associate with this card. Possible values are: "Issue".
|
||||
ContentType string `json:"content_type,omitempty"`
|
||||
// Use true to archive a project card.
|
||||
// Specify false if you need to restore a previously archived project card.
|
||||
Archived *bool `json:"archived,omitempty"`
|
||||
}
|
||||
|
||||
// CreateProjectCard creates a card in the specified column of a GitHub Project.
|
||||
|
@ -352,7 +369,7 @@ func (s *ProjectsService) CreateProjectCard(ctx context.Context, columnID int64,
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
req.Header.Set("Accept", mediaTypeProjectsPreview)
|
||||
|
||||
card := &ProjectCard{}
|
||||
|
@ -374,7 +391,7 @@ func (s *ProjectsService) UpdateProjectCard(ctx context.Context, cardID int64, o
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
req.Header.Set("Accept", mediaTypeProjectsPreview)
|
||||
|
||||
card := &ProjectCard{}
|
||||
|
|
20
vendor/github.com/google/go-github/github/pulls.go
generated
vendored
20
vendor/github.com/google/go-github/github/pulls.go
generated
vendored
|
@ -9,6 +9,7 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -29,6 +30,7 @@ type PullRequest struct {
|
|||
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
||||
ClosedAt *time.Time `json:"closed_at,omitempty"`
|
||||
MergedAt *time.Time `json:"merged_at,omitempty"`
|
||||
Labels []*Label `json:"labels,omitempty"`
|
||||
User *User `json:"user,omitempty"`
|
||||
Merged *bool `json:"merged,omitempty"`
|
||||
Mergeable *bool `json:"mergeable,omitempty"`
|
||||
|
@ -46,6 +48,8 @@ type PullRequest struct {
|
|||
StatusesURL *string `json:"statuses_url,omitempty"`
|
||||
DiffURL *string `json:"diff_url,omitempty"`
|
||||
PatchURL *string `json:"patch_url,omitempty"`
|
||||
CommitsURL *string `json:"commits_url,omitempty"`
|
||||
CommentsURL *string `json:"comments_url,omitempty"`
|
||||
ReviewCommentsURL *string `json:"review_comments_url,omitempty"`
|
||||
ReviewCommentURL *string `json:"review_comment_url,omitempty"`
|
||||
Assignee *User `json:"assignee,omitempty"`
|
||||
|
@ -54,9 +58,14 @@ type PullRequest struct {
|
|||
MaintainerCanModify *bool `json:"maintainer_can_modify,omitempty"`
|
||||
AuthorAssociation *string `json:"author_association,omitempty"`
|
||||
NodeID *string `json:"node_id,omitempty"`
|
||||
RequestedReviewers []*User `json:"requested_reviewers,omitempty"`
|
||||
|
||||
Head *PullRequestBranch `json:"head,omitempty"`
|
||||
Base *PullRequestBranch `json:"base,omitempty"`
|
||||
|
||||
// ActiveLockReason is populated only when LockReason is provided while locking the pull request.
|
||||
// Possible values are: "off-topic", "too heated", "resolved", and "spam".
|
||||
ActiveLockReason *string `json:"active_lock_reason,omitempty"`
|
||||
}
|
||||
|
||||
func (p PullRequest) String() string {
|
||||
|
@ -114,7 +123,8 @@ func (s *PullRequestsService) List(ctx context.Context, owner string, repo strin
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
acceptHeaders := []string{mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview}
|
||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
||||
|
||||
var pulls []*PullRequest
|
||||
resp, err := s.client.Do(ctx, req, &pulls)
|
||||
|
@ -136,7 +146,8 @@ func (s *PullRequestsService) Get(ctx context.Context, owner string, repo string
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
acceptHeaders := []string{mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview}
|
||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
||||
|
||||
pull := new(PullRequest)
|
||||
resp, err := s.client.Do(ctx, req, pull)
|
||||
|
@ -194,7 +205,7 @@ func (s *PullRequestsService) Create(ctx context.Context, owner string, repo str
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview)
|
||||
|
||||
p := new(PullRequest)
|
||||
resp, err := s.client.Do(ctx, req, p)
|
||||
|
@ -243,7 +254,8 @@ func (s *PullRequestsService) Edit(ctx context.Context, owner string, repo strin
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
acceptHeaders := []string{mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview}
|
||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
||||
|
||||
p := new(PullRequest)
|
||||
resp, err := s.client.Do(ctx, req, p)
|
||||
|
|
75
vendor/github.com/google/go-github/github/pulls_comments.go
generated
vendored
75
vendor/github.com/google/go-github/github/pulls_comments.go
generated
vendored
|
@ -13,22 +13,26 @@ import (
|
|||
|
||||
// PullRequestComment represents a comment left on a pull request.
|
||||
type PullRequestComment struct {
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
InReplyTo *int64 `json:"in_reply_to,omitempty"`
|
||||
Body *string `json:"body,omitempty"`
|
||||
Path *string `json:"path,omitempty"`
|
||||
DiffHunk *string `json:"diff_hunk,omitempty"`
|
||||
Position *int `json:"position,omitempty"`
|
||||
OriginalPosition *int `json:"original_position,omitempty"`
|
||||
CommitID *string `json:"commit_id,omitempty"`
|
||||
OriginalCommitID *string `json:"original_commit_id,omitempty"`
|
||||
User *User `json:"user,omitempty"`
|
||||
Reactions *Reactions `json:"reactions,omitempty"`
|
||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
HTMLURL *string `json:"html_url,omitempty"`
|
||||
PullRequestURL *string `json:"pull_request_url,omitempty"`
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
InReplyTo *int64 `json:"in_reply_to_id,omitempty"`
|
||||
Body *string `json:"body,omitempty"`
|
||||
Path *string `json:"path,omitempty"`
|
||||
DiffHunk *string `json:"diff_hunk,omitempty"`
|
||||
PullRequestReviewID *int64 `json:"pull_request_review_id,omitempty"`
|
||||
Position *int `json:"position,omitempty"`
|
||||
OriginalPosition *int `json:"original_position,omitempty"`
|
||||
CommitID *string `json:"commit_id,omitempty"`
|
||||
OriginalCommitID *string `json:"original_commit_id,omitempty"`
|
||||
User *User `json:"user,omitempty"`
|
||||
Reactions *Reactions `json:"reactions,omitempty"`
|
||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
||||
// AuthorAssociation is the comment author's relationship to the pull request's repository.
|
||||
// Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE".
|
||||
AuthorAssociation *string `json:"author_association,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
HTMLURL *string `json:"html_url,omitempty"`
|
||||
PullRequestURL *string `json:"pull_request_url,omitempty"`
|
||||
}
|
||||
|
||||
func (p PullRequestComment) String() string {
|
||||
|
@ -87,8 +91,8 @@ func (s *PullRequestsService) ListComments(ctx context.Context, owner string, re
|
|||
// GetComment fetches the specified pull request comment.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/pulls/comments/#get-a-single-comment
|
||||
func (s *PullRequestsService) GetComment(ctx context.Context, owner string, repo string, number int) (*PullRequestComment, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, number)
|
||||
func (s *PullRequestsService) GetComment(ctx context.Context, owner string, repo string, commentID int64) (*PullRequestComment, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
|
@ -125,11 +129,38 @@ func (s *PullRequestsService) CreateComment(ctx context.Context, owner string, r
|
|||
return c, resp, nil
|
||||
}
|
||||
|
||||
// CreateCommentInReplyTo creates a new comment as a reply to an existing pull request comment.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/pulls/comments/#alternative-input
|
||||
func (s *PullRequestsService) CreateCommentInReplyTo(ctx context.Context, owner string, repo string, number int, body string, commentID int64) (*PullRequestComment, *Response, error) {
|
||||
comment := &struct {
|
||||
Body string `json:"body,omitempty"`
|
||||
InReplyTo int64 `json:"in_reply_to,omitempty"`
|
||||
}{
|
||||
Body: body,
|
||||
InReplyTo: commentID,
|
||||
}
|
||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/comments", owner, repo, number)
|
||||
req, err := s.client.NewRequest("POST", u, comment)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
c := new(PullRequestComment)
|
||||
resp, err := s.client.Do(ctx, req, c)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return c, resp, nil
|
||||
}
|
||||
|
||||
// EditComment updates a pull request comment.
|
||||
// A non-nil comment.Body must be provided. Other comment fields should be left nil.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/pulls/comments/#edit-a-comment
|
||||
func (s *PullRequestsService) EditComment(ctx context.Context, owner string, repo string, number int, comment *PullRequestComment) (*PullRequestComment, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, number)
|
||||
func (s *PullRequestsService) EditComment(ctx context.Context, owner string, repo string, commentID int64, comment *PullRequestComment) (*PullRequestComment, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID)
|
||||
req, err := s.client.NewRequest("PATCH", u, comment)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
|
@ -147,8 +178,8 @@ func (s *PullRequestsService) EditComment(ctx context.Context, owner string, rep
|
|||
// DeleteComment deletes a pull request comment.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/pulls/comments/#delete-a-comment
|
||||
func (s *PullRequestsService) DeleteComment(ctx context.Context, owner string, repo string, number int) (*Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, number)
|
||||
func (s *PullRequestsService) DeleteComment(ctx context.Context, owner string, repo string, commentID int64) (*Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID)
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
9
vendor/github.com/google/go-github/github/pulls_reviewers.go
generated
vendored
9
vendor/github.com/google/go-github/github/pulls_reviewers.go
generated
vendored
|
@ -32,9 +32,6 @@ func (s *PullRequestsService) RequestReviewers(ctx context.Context, owner, repo
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeTeamReviewPreview)
|
||||
|
||||
r := new(PullRequest)
|
||||
resp, err := s.client.Do(ctx, req, r)
|
||||
if err != nil {
|
||||
|
@ -59,9 +56,6 @@ func (s *PullRequestsService) ListReviewers(ctx context.Context, owner, repo str
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeTeamReviewPreview)
|
||||
|
||||
reviewers := new(Reviewers)
|
||||
resp, err := s.client.Do(ctx, req, reviewers)
|
||||
if err != nil {
|
||||
|
@ -81,8 +75,5 @@ func (s *PullRequestsService) RemoveReviewers(ctx context.Context, owner, repo s
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeTeamReviewPreview)
|
||||
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
|
10
vendor/github.com/google/go-github/github/pulls_reviews.go
generated
vendored
10
vendor/github.com/google/go-github/github/pulls_reviews.go
generated
vendored
|
@ -94,7 +94,7 @@ func (s *PullRequestsService) ListReviews(ctx context.Context, owner, repo strin
|
|||
// Read more about it here - https://github.com/google/go-github/issues/540
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#get-a-single-review
|
||||
func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string, number, reviewID int64) (*PullRequestReview, *Response, error) {
|
||||
func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string, number int, reviewID int64) (*PullRequestReview, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
|
@ -118,7 +118,7 @@ func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string,
|
|||
// Read more about it here - https://github.com/google/go-github/issues/540
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#delete-a-pending-review
|
||||
func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, repo string, number, reviewID int64) (*PullRequestReview, *Response, error) {
|
||||
func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, repo string, number int, reviewID int64) (*PullRequestReview, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
|
@ -142,7 +142,7 @@ func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, re
|
|||
// Read more about it here - https://github.com/google/go-github/issues/540
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#get-comments-for-a-single-review
|
||||
func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, repo string, number, reviewID int64, opt *ListOptions) ([]*PullRequestComment, *Response, error) {
|
||||
func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, repo string, number int, reviewID int64, opt *ListOptions) ([]*PullRequestComment, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/comments", owner, repo, number, reviewID)
|
||||
u, err := addOptions(u, opt)
|
||||
if err != nil {
|
||||
|
@ -194,7 +194,7 @@ func (s *PullRequestsService) CreateReview(ctx context.Context, owner, repo stri
|
|||
// Read more about it here - https://github.com/google/go-github/issues/540
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#submit-a-pull-request-review
|
||||
func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo string, number, reviewID int64, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) {
|
||||
func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo string, number int, reviewID int64, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/events", owner, repo, number, reviewID)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, review)
|
||||
|
@ -218,7 +218,7 @@ func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo stri
|
|||
// Read more about it here - https://github.com/google/go-github/issues/540
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#dismiss-a-pull-request-review
|
||||
func (s *PullRequestsService) DismissReview(ctx context.Context, owner, repo string, number, reviewID int64, review *PullRequestReviewDismissalRequest) (*PullRequestReview, *Response, error) {
|
||||
func (s *PullRequestsService) DismissReview(ctx context.Context, owner, repo string, number int, reviewID int64, review *PullRequestReviewDismissalRequest) (*PullRequestReview, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/dismissals", owner, repo, number, reviewID)
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, review)
|
||||
|
|
21
vendor/github.com/google/go-github/github/reactions.go
generated
vendored
21
vendor/github.com/google/go-github/github/reactions.go
generated
vendored
|
@ -19,8 +19,9 @@ type ReactionsService service
|
|||
// Reaction represents a GitHub reaction.
|
||||
type Reaction struct {
|
||||
// ID is the Reaction ID.
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
User *User `json:"user,omitempty"`
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
User *User `json:"user,omitempty"`
|
||||
NodeID *string `json:"node_id,omitempty"`
|
||||
// Content is the type of reaction.
|
||||
// Possible values are:
|
||||
// "+1", "-1", "laugh", "confused", "heart", "hooray".
|
||||
|
@ -58,7 +59,7 @@ func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||
|
||||
var m []*Reaction
|
||||
|
@ -84,7 +85,7 @@ func (s ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||
|
||||
m := &Reaction{}
|
||||
|
@ -111,7 +112,7 @@ func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo s
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||
|
||||
var m []*Reaction
|
||||
|
@ -137,7 +138,7 @@ func (s ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo s
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||
|
||||
m := &Reaction{}
|
||||
|
@ -164,7 +165,7 @@ func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner,
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||
|
||||
var m []*Reaction
|
||||
|
@ -190,7 +191,7 @@ func (s ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner,
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||
|
||||
m := &Reaction{}
|
||||
|
@ -217,7 +218,7 @@ func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context,
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||
|
||||
var m []*Reaction
|
||||
|
@ -243,7 +244,7 @@ func (s ReactionsService) CreatePullRequestCommentReaction(ctx context.Context,
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||
|
||||
m := &Reaction{}
|
||||
|
|
118
vendor/github.com/google/go-github/github/repos.go
generated
vendored
118
vendor/github.com/google/go-github/github/repos.go
generated
vendored
|
@ -7,7 +7,6 @@ package github
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
@ -21,6 +20,7 @@ type RepositoriesService service
|
|||
// Repository represents a GitHub repository.
|
||||
type Repository struct {
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
NodeID *string `json:"node_id,omitempty"`
|
||||
Owner *User `json:"owner,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
FullName *string `json:"full_name,omitempty"`
|
||||
|
@ -179,7 +179,7 @@ func (s *RepositoriesService) List(ctx context.Context, user string, opt *Reposi
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
acceptHeaders := []string{mediaTypeLicensesPreview, mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
|
||||
acceptHeaders := []string{mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
|
||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
||||
|
||||
var repos []*Repository
|
||||
|
@ -217,7 +217,7 @@ func (s *RepositoriesService) ListByOrg(ctx context.Context, org string, opt *Re
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
acceptHeaders := []string{mediaTypeLicensesPreview, mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
|
||||
acceptHeaders := []string{mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
|
||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
||||
|
||||
var repos []*Repository
|
||||
|
@ -298,7 +298,7 @@ func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Rep
|
|||
|
||||
// TODO: remove custom Accept header when the license support fully launches
|
||||
// https://developer.github.com/v3/licenses/#get-a-repositorys-license
|
||||
acceptHeaders := []string{mediaTypeLicensesPreview, mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
|
||||
acceptHeaders := []string{mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
|
||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
||||
|
||||
repository := new(Repository)
|
||||
|
@ -342,10 +342,6 @@ func (s *RepositoriesService) GetByID(ctx context.Context, id int64) (*Repositor
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when the license support fully launches
|
||||
// https://developer.github.com/v3/licenses/#get-a-repositorys-license
|
||||
req.Header.Set("Accept", mediaTypeLicensesPreview)
|
||||
|
||||
repository := new(Repository)
|
||||
resp, err := s.client.Do(ctx, req, repository)
|
||||
if err != nil {
|
||||
|
@ -558,6 +554,12 @@ type RequiredStatusChecks struct {
|
|||
Contexts []string `json:"contexts"`
|
||||
}
|
||||
|
||||
// RequiredStatusChecksRequest represents a request to edit a protected branch's status checks.
|
||||
type RequiredStatusChecksRequest struct {
|
||||
Strict *bool `json:"strict,omitempty"`
|
||||
Contexts []string `json:"contexts,omitempty"`
|
||||
}
|
||||
|
||||
// PullRequestReviewsEnforcement represents the pull request reviews enforcement of a protected branch.
|
||||
type PullRequestReviewsEnforcement struct {
|
||||
// Specifies which users and teams can dismiss pull request reviews.
|
||||
|
@ -566,45 +568,26 @@ type PullRequestReviewsEnforcement struct {
|
|||
DismissStaleReviews bool `json:"dismiss_stale_reviews"`
|
||||
// RequireCodeOwnerReviews specifies if an approved review is required in pull requests including files with a designated code owner.
|
||||
RequireCodeOwnerReviews bool `json:"require_code_owner_reviews"`
|
||||
// RequiredApprovingReviewCount specifies the number of approvals required before the pull request can be merged.
|
||||
// Valid values are 1-6.
|
||||
RequiredApprovingReviewCount int `json:"required_approving_review_count"`
|
||||
}
|
||||
|
||||
// PullRequestReviewsEnforcementRequest represents request to set the pull request review
|
||||
// enforcement of a protected branch. It is separate from PullRequestReviewsEnforcement above
|
||||
// because the request structure is different from the response structure.
|
||||
type PullRequestReviewsEnforcementRequest struct {
|
||||
// Specifies which users and teams should be allowed to dismiss pull request reviews. Can be nil to disable the restrictions.
|
||||
DismissalRestrictionsRequest *DismissalRestrictionsRequest `json:"dismissal_restrictions"`
|
||||
// Specifies which users and teams should be allowed to dismiss pull request reviews.
|
||||
// User and team dismissal restrictions are only available for
|
||||
// organization-owned repositories. Must be nil for personal repositories.
|
||||
DismissalRestrictionsRequest *DismissalRestrictionsRequest `json:"dismissal_restrictions,omitempty"`
|
||||
// Specifies if approved reviews can be dismissed automatically, when a new commit is pushed. (Required)
|
||||
DismissStaleReviews bool `json:"dismiss_stale_reviews"`
|
||||
// RequireCodeOwnerReviews specifies if an approved review is required in pull requests including files with a designated code owner.
|
||||
RequireCodeOwnerReviews bool `json:"require_code_owner_reviews"`
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaler interface.
|
||||
// Converts nil value of PullRequestReviewsEnforcementRequest.DismissalRestrictionsRequest to empty array
|
||||
func (req PullRequestReviewsEnforcementRequest) MarshalJSON() ([]byte, error) {
|
||||
if req.DismissalRestrictionsRequest == nil {
|
||||
newReq := struct {
|
||||
R []interface{} `json:"dismissal_restrictions"`
|
||||
D bool `json:"dismiss_stale_reviews"`
|
||||
O bool `json:"require_code_owner_reviews"`
|
||||
}{
|
||||
R: []interface{}{},
|
||||
D: req.DismissStaleReviews,
|
||||
O: req.RequireCodeOwnerReviews,
|
||||
}
|
||||
return json.Marshal(newReq)
|
||||
}
|
||||
newReq := struct {
|
||||
R *DismissalRestrictionsRequest `json:"dismissal_restrictions"`
|
||||
D bool `json:"dismiss_stale_reviews"`
|
||||
O bool `json:"require_code_owner_reviews"`
|
||||
}{
|
||||
R: req.DismissalRestrictionsRequest,
|
||||
D: req.DismissStaleReviews,
|
||||
O: req.RequireCodeOwnerReviews,
|
||||
}
|
||||
return json.Marshal(newReq)
|
||||
// RequiredApprovingReviewCount specifies the number of approvals required before the pull request can be merged.
|
||||
// Valid values are 1-6.
|
||||
RequiredApprovingReviewCount int `json:"required_approving_review_count"`
|
||||
}
|
||||
|
||||
// PullRequestReviewsEnforcementUpdate represents request to patch the pull request review
|
||||
|
@ -617,6 +600,9 @@ type PullRequestReviewsEnforcementUpdate struct {
|
|||
DismissStaleReviews *bool `json:"dismiss_stale_reviews,omitempty"`
|
||||
// RequireCodeOwnerReviews specifies if an approved review is required in pull requests including files with a designated code owner.
|
||||
RequireCodeOwnerReviews bool `json:"require_code_owner_reviews,omitempty"`
|
||||
// RequiredApprovingReviewCount specifies the number of approvals required before the pull request can be merged.
|
||||
// Valid values are 1 - 6.
|
||||
RequiredApprovingReviewCount int `json:"required_approving_review_count"`
|
||||
}
|
||||
|
||||
// AdminEnforcement represents the configuration to enforce required status checks for repository administrators.
|
||||
|
@ -657,11 +643,12 @@ type DismissalRestrictions struct {
|
|||
// restriction to allows only specific users or teams to dimiss pull request reviews. It is
|
||||
// separate from DismissalRestrictions above because the request structure is
|
||||
// different from the response structure.
|
||||
// Note: Both Users and Teams must be nil, or both must be non-nil.
|
||||
type DismissalRestrictionsRequest struct {
|
||||
// The list of user logins who can dismiss pull request reviews. (Required; use []string{} instead of nil for empty list.)
|
||||
Users []string `json:"users"`
|
||||
// The list of team slugs which can dismiss pull request reviews. (Required; use []string{} instead of nil for empty list.)
|
||||
Teams []string `json:"teams"`
|
||||
// The list of user logins who can dismiss pull request reviews. (Required; use nil to disable dismissal_restrictions or &[]string{} otherwise.)
|
||||
Users *[]string `json:"users,omitempty"`
|
||||
// The list of team slugs which can dismiss pull request reviews. (Required; use nil to disable dismissal_restrictions or &[]string{} otherwise.)
|
||||
Teams *[]string `json:"teams,omitempty"`
|
||||
}
|
||||
|
||||
// ListBranches lists branches for the specified repository.
|
||||
|
@ -680,7 +667,7 @@ func (s *RepositoriesService) ListBranches(ctx context.Context, owner string, re
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
var branches []*Branch
|
||||
resp, err := s.client.Do(ctx, req, &branches)
|
||||
|
@ -702,7 +689,7 @@ func (s *RepositoriesService) GetBranch(ctx context.Context, owner, repo, branch
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
b := new(Branch)
|
||||
resp, err := s.client.Do(ctx, req, b)
|
||||
|
@ -724,7 +711,7 @@ func (s *RepositoriesService) GetBranchProtection(ctx context.Context, owner, re
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
p := new(Protection)
|
||||
resp, err := s.client.Do(ctx, req, p)
|
||||
|
@ -746,7 +733,7 @@ func (s *RepositoriesService) GetRequiredStatusChecks(ctx context.Context, owner
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
p := new(RequiredStatusChecks)
|
||||
resp, err := s.client.Do(ctx, req, p)
|
||||
|
@ -768,7 +755,7 @@ func (s *RepositoriesService) ListRequiredStatusChecksContexts(ctx context.Conte
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
resp, err = s.client.Do(ctx, req, &contexts)
|
||||
if err != nil {
|
||||
|
@ -789,7 +776,7 @@ func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner,
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
p := new(Protection)
|
||||
resp, err := s.client.Do(ctx, req, p)
|
||||
|
@ -811,11 +798,30 @@ func (s *RepositoriesService) RemoveBranchProtection(ctx context.Context, owner,
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
||||
// UpdateRequiredStatusChecks updates the required status checks for a given protected branch.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#update-required-status-checks-of-protected-branch
|
||||
func (s *RepositoriesService) UpdateRequiredStatusChecks(ctx context.Context, owner, repo, branch string, sreq *RequiredStatusChecksRequest) (*RequiredStatusChecks, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, branch)
|
||||
req, err := s.client.NewRequest("PATCH", u, sreq)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
sc := new(RequiredStatusChecks)
|
||||
resp, err := s.client.Do(ctx, req, sc)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return sc, resp, nil
|
||||
}
|
||||
|
||||
// License gets the contents of a repository's license if one is detected.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/licenses/#get-the-contents-of-a-repositorys-license
|
||||
|
@ -846,7 +852,7 @@ func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Contex
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
r := new(PullRequestReviewsEnforcement)
|
||||
resp, err := s.client.Do(ctx, req, r)
|
||||
|
@ -869,7 +875,7 @@ func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Con
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
r := new(PullRequestReviewsEnforcement)
|
||||
resp, err := s.client.Do(ctx, req, r)
|
||||
|
@ -897,7 +903,7 @@ func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context,
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
r := new(PullRequestReviewsEnforcement)
|
||||
resp, err := s.client.Do(ctx, req, r)
|
||||
|
@ -919,7 +925,7 @@ func (s *RepositoriesService) RemovePullRequestReviewEnforcement(ctx context.Con
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
@ -935,7 +941,7 @@ func (s *RepositoriesService) GetAdminEnforcement(ctx context.Context, owner, re
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
r := new(AdminEnforcement)
|
||||
resp, err := s.client.Do(ctx, req, r)
|
||||
|
@ -958,7 +964,7 @@ func (s *RepositoriesService) AddAdminEnforcement(ctx context.Context, owner, re
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
r := new(AdminEnforcement)
|
||||
resp, err := s.client.Do(ctx, req, r)
|
||||
|
@ -980,7 +986,7 @@ func (s *RepositoriesService) RemoveAdminEnforcement(ctx context.Context, owner,
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
@ -1043,7 +1049,7 @@ func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo
|
|||
// TransferRequest represents a request to transfer a repository.
|
||||
type TransferRequest struct {
|
||||
NewOwner string `json:"new_owner"`
|
||||
TeamID []int64 `json:"team_id,omitempty"`
|
||||
TeamID []int64 `json:"team_ids,omitempty"`
|
||||
}
|
||||
|
||||
// Transfer transfers a repository from one account or organization to another.
|
||||
|
|
2
vendor/github.com/google/go-github/github/repos_commits.go
generated
vendored
2
vendor/github.com/google/go-github/github/repos_commits.go
generated
vendored
|
@ -218,7 +218,7 @@ func (s *RepositoriesService) GetCommitSHA1(ctx context.Context, owner, repo, re
|
|||
// CompareCommits compares a range of commits with each other.
|
||||
// todo: support media formats - https://github.com/google/go-github/issues/6
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/repos/commits/index.html#compare-two-commits
|
||||
// GitHub API docs: https://developer.github.com/v3/repos/commits/#compare-two-commits
|
||||
func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo string, base, head string) (*CommitsComparison, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/compare/%v...%v", owner, repo, base, head)
|
||||
|
||||
|
|
10
vendor/github.com/google/go-github/github/repos_community_health.go
generated
vendored
10
vendor/github.com/google/go-github/github/repos_community_health.go
generated
vendored
|
@ -21,10 +21,12 @@ type Metric struct {
|
|||
|
||||
// CommunityHealthFiles represents the different files in the community health metrics response.
|
||||
type CommunityHealthFiles struct {
|
||||
CodeOfConduct *Metric `json:"code_of_conduct"`
|
||||
Contributing *Metric `json:"contributing"`
|
||||
License *Metric `json:"license"`
|
||||
Readme *Metric `json:"readme"`
|
||||
CodeOfConduct *Metric `json:"code_of_conduct"`
|
||||
Contributing *Metric `json:"contributing"`
|
||||
IssueTemplate *Metric `json:"issue_template"`
|
||||
PullRequestTemplate *Metric `json:"pull_request_template"`
|
||||
License *Metric `json:"license"`
|
||||
Readme *Metric `json:"readme"`
|
||||
}
|
||||
|
||||
// CommunityHealthMetrics represents a response containing the community metrics of a repository.
|
||||
|
|
19
vendor/github.com/google/go-github/github/repos_deployments.go
generated
vendored
19
vendor/github.com/google/go-github/github/repos_deployments.go
generated
vendored
|
@ -9,7 +9,6 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Deployment represents a deployment in a repo
|
||||
|
@ -76,9 +75,6 @@ func (s *RepositoriesService) ListDeployments(ctx context.Context, owner, repo s
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
var deployments []*Deployment
|
||||
resp, err := s.client.Do(ctx, req, &deployments)
|
||||
if err != nil {
|
||||
|
@ -99,9 +95,6 @@ func (s *RepositoriesService) GetDeployment(ctx context.Context, owner, repo str
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
deployment := new(Deployment)
|
||||
resp, err := s.client.Do(ctx, req, deployment)
|
||||
if err != nil {
|
||||
|
@ -123,8 +116,7 @@ func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeGraphQLNodeIDPreview}
|
||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
||||
req.Header.Set("Accept", mediaTypeDeploymentStatusPreview)
|
||||
|
||||
d := new(Deployment)
|
||||
resp, err := s.client.Do(ctx, req, d)
|
||||
|
@ -176,9 +168,6 @@ func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner,
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
|
||||
|
||||
var statuses []*DeploymentStatus
|
||||
resp, err := s.client.Do(ctx, req, &statuses)
|
||||
if err != nil {
|
||||
|
@ -200,8 +189,7 @@ func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, re
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeGraphQLNodeIDPreview}
|
||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
||||
req.Header.Set("Accept", mediaTypeDeploymentStatusPreview)
|
||||
|
||||
d := new(DeploymentStatus)
|
||||
resp, err := s.client.Do(ctx, req, d)
|
||||
|
@ -224,8 +212,7 @@ func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner,
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeGraphQLNodeIDPreview}
|
||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
||||
req.Header.Set("Accept", mediaTypeDeploymentStatusPreview)
|
||||
|
||||
d := new(DeploymentStatus)
|
||||
resp, err := s.client.Do(ctx, req, d)
|
||||
|
|
6
vendor/github.com/google/go-github/github/repos_forks.go
generated
vendored
6
vendor/github.com/google/go-github/github/repos_forks.go
generated
vendored
|
@ -58,7 +58,8 @@ type RepositoryCreateForkOptions struct {
|
|||
//
|
||||
// This method might return an *AcceptedError and a status code of
|
||||
// 202. This is because this is the status that GitHub returns to signify that
|
||||
// it is now computing creating the fork in a background task.
|
||||
// it is now computing creating the fork in a background task. In this event,
|
||||
// the Repository value will be returned, which includes the details about the pending fork.
|
||||
// A follow up request, after a delay of a second or so, should result
|
||||
// in a successful request.
|
||||
//
|
||||
|
@ -77,6 +78,9 @@ func (s *RepositoriesService) CreateFork(ctx context.Context, owner, repo string
|
|||
|
||||
fork := new(Repository)
|
||||
resp, err := s.client.Do(ctx, req, fork)
|
||||
if _, ok := err.(*AcceptedError); ok {
|
||||
return fork, resp, err
|
||||
}
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
|
16
vendor/github.com/google/go-github/github/repos_hooks.go
generated
vendored
16
vendor/github.com/google/go-github/github/repos_hooks.go
generated
vendored
|
@ -136,9 +136,13 @@ func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, i
|
|||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
hook := new(Hook)
|
||||
resp, err := s.client.Do(ctx, req, hook)
|
||||
return hook, resp, err
|
||||
h := new(Hook)
|
||||
resp, err := s.client.Do(ctx, req, h)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return h, resp, nil
|
||||
}
|
||||
|
||||
// EditHook updates a specified Hook.
|
||||
|
@ -152,7 +156,11 @@ func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string,
|
|||
}
|
||||
h := new(Hook)
|
||||
resp, err := s.client.Do(ctx, req, h)
|
||||
return h, resp, err
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return h, resp, nil
|
||||
}
|
||||
|
||||
// DeleteHook deletes a specified Hook.
|
||||
|
|
4
vendor/github.com/google/go-github/github/repos_keys.go
generated
vendored
4
vendor/github.com/google/go-github/github/repos_keys.go
generated
vendored
|
@ -79,7 +79,7 @@ func (s *RepositoriesService) CreateKey(ctx context.Context, owner string, repo
|
|||
// EditKey edits a deploy key.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/repos/keys/#edit
|
||||
func (s *RepositoriesService) EditKey(ctx context.Context, owner string, repo string, id int, key *Key) (*Key, *Response, error) {
|
||||
func (s *RepositoriesService) EditKey(ctx context.Context, owner string, repo string, id int64, key *Key) (*Key, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id)
|
||||
|
||||
req, err := s.client.NewRequest("PATCH", u, key)
|
||||
|
@ -99,7 +99,7 @@ func (s *RepositoriesService) EditKey(ctx context.Context, owner string, repo st
|
|||
// DeleteKey deletes a deploy key.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/repos/keys/#delete
|
||||
func (s *RepositoriesService) DeleteKey(ctx context.Context, owner string, repo string, id int) (*Response, error) {
|
||||
func (s *RepositoriesService) DeleteKey(ctx context.Context, owner string, repo string, id int64) (*Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
|
|
110
vendor/github.com/google/go-github/github/repos_prereceive_hooks.go
generated
vendored
Normal file
110
vendor/github.com/google/go-github/github/repos_prereceive_hooks.go
generated
vendored
Normal file
|
@ -0,0 +1,110 @@
|
|||
// Copyright 2018 The go-github AUTHORS. 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"
|
||||
)
|
||||
|
||||
// PreReceiveHook represents a GitHub pre-receive hook for a repository.
|
||||
type PreReceiveHook struct {
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Enforcement *string `json:"enforcement,omitempty"`
|
||||
ConfigURL *string `json:"configuration_url,omitempty"`
|
||||
}
|
||||
|
||||
func (p PreReceiveHook) String() string {
|
||||
return Stringify(p)
|
||||
}
|
||||
|
||||
// ListPreReceiveHooks lists all pre-receive hooks for the specified repository.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/enterprise/2.13/v3/repos/pre_receive_hooks/#list-pre-receive-hooks
|
||||
func (s *RepositoriesService) ListPreReceiveHooks(ctx context.Context, owner, repo string, opt *ListOptions) ([]*PreReceiveHook, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks", owner, repo)
|
||||
u, err := addOptions(u, opt)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypePreReceiveHooksPreview)
|
||||
|
||||
var hooks []*PreReceiveHook
|
||||
resp, err := s.client.Do(ctx, req, &hooks)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return hooks, resp, nil
|
||||
}
|
||||
|
||||
// GetPreReceiveHook returns a single specified pre-receive hook.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/enterprise/2.13/v3/repos/pre_receive_hooks/#get-a-single-pre-receive-hook
|
||||
func (s *RepositoriesService) GetPreReceiveHook(ctx context.Context, owner, repo string, id int64) (*PreReceiveHook, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%d", owner, repo, id)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypePreReceiveHooksPreview)
|
||||
|
||||
h := new(PreReceiveHook)
|
||||
resp, err := s.client.Do(ctx, req, h)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return h, resp, nil
|
||||
}
|
||||
|
||||
// UpdatePreReceiveHook updates a specified pre-receive hook.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/enterprise/2.13/v3/repos/pre_receive_hooks/#update-pre-receive-hook-enforcement
|
||||
func (s *RepositoriesService) UpdatePreReceiveHook(ctx context.Context, owner, repo string, id int64, hook *PreReceiveHook) (*PreReceiveHook, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%d", owner, repo, id)
|
||||
req, err := s.client.NewRequest("PATCH", u, hook)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypePreReceiveHooksPreview)
|
||||
|
||||
h := new(PreReceiveHook)
|
||||
resp, err := s.client.Do(ctx, req, h)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return h, resp, nil
|
||||
}
|
||||
|
||||
// DeletePreReceiveHook deletes a specified pre-receive hook.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/enterprise/2.13/v3/repos/pre_receive_hooks/#remove-enforcement-overrides-for-a-pre-receive-hook
|
||||
func (s *RepositoriesService) DeletePreReceiveHook(ctx context.Context, owner, repo string, id int64) (*Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%d", owner, repo, id)
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypePreReceiveHooksPreview)
|
||||
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
4
vendor/github.com/google/go-github/github/repos_projects.go
generated
vendored
4
vendor/github.com/google/go-github/github/repos_projects.go
generated
vendored
|
@ -34,7 +34,7 @@ func (s *RepositoriesService) ListProjects(ctx context.Context, owner, repo stri
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
req.Header.Set("Accept", mediaTypeProjectsPreview)
|
||||
|
||||
var projects []*Project
|
||||
|
@ -56,7 +56,7 @@ func (s *RepositoriesService) CreateProject(ctx context.Context, owner, repo str
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
req.Header.Set("Accept", mediaTypeProjectsPreview)
|
||||
|
||||
project := &Project{}
|
||||
|
|
2
vendor/github.com/google/go-github/github/repos_releases.go
generated
vendored
2
vendor/github.com/google/go-github/github/repos_releases.go
generated
vendored
|
@ -36,6 +36,7 @@ type RepositoryRelease struct {
|
|||
ZipballURL *string `json:"zipball_url,omitempty"`
|
||||
TarballURL *string `json:"tarball_url,omitempty"`
|
||||
Author *User `json:"author,omitempty"`
|
||||
NodeID *string `json:"node_id,omitempty"`
|
||||
}
|
||||
|
||||
func (r RepositoryRelease) String() string {
|
||||
|
@ -56,6 +57,7 @@ type ReleaseAsset struct {
|
|||
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
|
||||
BrowserDownloadURL *string `json:"browser_download_url,omitempty"`
|
||||
Uploader *User `json:"uploader,omitempty"`
|
||||
NodeID *string `json:"node_id,omitempty"`
|
||||
}
|
||||
|
||||
func (r ReleaseAsset) String() string {
|
||||
|
|
69
vendor/github.com/google/go-github/github/search.go
generated
vendored
69
vendor/github.com/google/go-github/github/search.go
generated
vendored
|
@ -8,6 +8,9 @@ package github
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
qs "github.com/google/go-querystring/query"
|
||||
)
|
||||
|
@ -48,6 +51,12 @@ type SearchOptions struct {
|
|||
ListOptions
|
||||
}
|
||||
|
||||
// Common search parameters.
|
||||
type searchParameters struct {
|
||||
Query string
|
||||
RepositoryID *int64 // Sent if non-nil.
|
||||
}
|
||||
|
||||
// RepositoriesSearchResult represents the result of a repositories search.
|
||||
type RepositoriesSearchResult struct {
|
||||
Total *int `json:"total_count,omitempty"`
|
||||
|
@ -60,7 +69,7 @@ type RepositoriesSearchResult struct {
|
|||
// GitHub API docs: https://developer.github.com/v3/search/#search-repositories
|
||||
func (s *SearchService) Repositories(ctx context.Context, query string, opt *SearchOptions) (*RepositoriesSearchResult, *Response, error) {
|
||||
result := new(RepositoriesSearchResult)
|
||||
resp, err := s.search(ctx, "repositories", query, opt, result)
|
||||
resp, err := s.search(ctx, "repositories", &searchParameters{Query: query}, opt, result)
|
||||
return result, resp, err
|
||||
}
|
||||
|
||||
|
@ -91,7 +100,7 @@ type CommitResult struct {
|
|||
// GitHub API docs: https://developer.github.com/v3/search/#search-commits
|
||||
func (s *SearchService) Commits(ctx context.Context, query string, opt *SearchOptions) (*CommitsSearchResult, *Response, error) {
|
||||
result := new(CommitsSearchResult)
|
||||
resp, err := s.search(ctx, "commits", query, opt, result)
|
||||
resp, err := s.search(ctx, "commits", &searchParameters{Query: query}, opt, result)
|
||||
return result, resp, err
|
||||
}
|
||||
|
||||
|
@ -107,7 +116,7 @@ type IssuesSearchResult struct {
|
|||
// GitHub API docs: https://developer.github.com/v3/search/#search-issues
|
||||
func (s *SearchService) Issues(ctx context.Context, query string, opt *SearchOptions) (*IssuesSearchResult, *Response, error) {
|
||||
result := new(IssuesSearchResult)
|
||||
resp, err := s.search(ctx, "issues", query, opt, result)
|
||||
resp, err := s.search(ctx, "issues", &searchParameters{Query: query}, opt, result)
|
||||
return result, resp, err
|
||||
}
|
||||
|
||||
|
@ -123,7 +132,7 @@ type UsersSearchResult struct {
|
|||
// GitHub API docs: https://developer.github.com/v3/search/#search-users
|
||||
func (s *SearchService) Users(ctx context.Context, query string, opt *SearchOptions) (*UsersSearchResult, *Response, error) {
|
||||
result := new(UsersSearchResult)
|
||||
resp, err := s.search(ctx, "users", query, opt, result)
|
||||
resp, err := s.search(ctx, "users", &searchParameters{Query: query}, opt, result)
|
||||
return result, resp, err
|
||||
}
|
||||
|
||||
|
@ -172,19 +181,57 @@ func (c CodeResult) String() string {
|
|||
// GitHub API docs: https://developer.github.com/v3/search/#search-code
|
||||
func (s *SearchService) Code(ctx context.Context, query string, opt *SearchOptions) (*CodeSearchResult, *Response, error) {
|
||||
result := new(CodeSearchResult)
|
||||
resp, err := s.search(ctx, "code", query, opt, result)
|
||||
resp, err := s.search(ctx, "code", &searchParameters{Query: query}, opt, result)
|
||||
return result, resp, err
|
||||
}
|
||||
|
||||
// LabelsSearchResult represents the result of a code search.
|
||||
type LabelsSearchResult struct {
|
||||
Total *int `json:"total_count,omitempty"`
|
||||
IncompleteResults *bool `json:"incomplete_results,omitempty"`
|
||||
Labels []*LabelResult `json:"items,omitempty"`
|
||||
}
|
||||
|
||||
// LabelResult represents a single search result.
|
||||
type LabelResult struct {
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Color *string `json:"color,omitempty"`
|
||||
Default *bool `json:"default,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Score *float64 `json:"score,omitempty"`
|
||||
}
|
||||
|
||||
func (l LabelResult) String() string {
|
||||
return Stringify(l)
|
||||
}
|
||||
|
||||
// Labels searches labels in the repository with ID repoID via various criteria.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/search/#search-labels
|
||||
func (s *SearchService) Labels(ctx context.Context, repoID int64, query string, opt *SearchOptions) (*LabelsSearchResult, *Response, error) {
|
||||
result := new(LabelsSearchResult)
|
||||
resp, err := s.search(ctx, "labels", &searchParameters{RepositoryID: &repoID, Query: query}, opt, result)
|
||||
return result, resp, err
|
||||
}
|
||||
|
||||
// Helper function that executes search queries against different
|
||||
// GitHub search types (repositories, commits, code, issues, users)
|
||||
func (s *SearchService) search(ctx context.Context, searchType string, query string, opt *SearchOptions, result interface{}) (*Response, error) {
|
||||
// GitHub search types (repositories, commits, code, issues, users, labels)
|
||||
func (s *SearchService) search(ctx context.Context, searchType string, parameters *searchParameters, opt *SearchOptions, result interface{}) (*Response, error) {
|
||||
params, err := qs.Values(opt)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
params.Set("q", query)
|
||||
u := fmt.Sprintf("search/%s?%s", searchType, params.Encode())
|
||||
q := strings.Replace(parameters.Query, " ", "+", -1)
|
||||
if parameters.RepositoryID != nil {
|
||||
params.Set("repository_id", strconv.FormatInt(*parameters.RepositoryID, 10))
|
||||
}
|
||||
query := "q=" + url.PathEscape(q)
|
||||
if v := params.Encode(); v != "" {
|
||||
query = query + "&" + v
|
||||
}
|
||||
u := fmt.Sprintf("search/%s?%s", searchType, query)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
|
@ -200,6 +247,10 @@ func (s *SearchService) search(ctx context.Context, searchType string, query str
|
|||
// Accept header for search repositories based on topics preview endpoint
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeTopicsPreview)
|
||||
case searchType == "labels":
|
||||
// Accept header for search labels based on label description preview endpoint.
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeLabelDescriptionSearchPreview)
|
||||
case opt != nil && opt.TextMatch:
|
||||
// Accept header defaults to "application/vnd.github.v3+json"
|
||||
// We change it here to fetch back text-match metadata
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2013 The go-github AUTHORS. All rights reserved.
|
||||
// Copyright 2018 The go-github AUTHORS. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
@ -12,6 +12,12 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
// TeamsService provides access to the team-related functions
|
||||
// in the GitHub API.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/
|
||||
type TeamsService service
|
||||
|
||||
// Team represents a team within a GitHub organization. Teams are used to
|
||||
// manage access to an organization's repositories.
|
||||
type Team struct {
|
||||
|
@ -53,9 +59,11 @@ type Invitation struct {
|
|||
Login *string `json:"login,omitempty"`
|
||||
Email *string `json:"email,omitempty"`
|
||||
// Role can be one of the values - 'direct_member', 'admin', 'billing_manager', 'hiring_manager', or 'reinstate'.
|
||||
Role *string `json:"role,omitempty"`
|
||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||
Inviter *User `json:"inviter,omitempty"`
|
||||
Role *string `json:"role,omitempty"`
|
||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||
Inviter *User `json:"inviter,omitempty"`
|
||||
TeamCount *int `json:"team_count,omitempty"`
|
||||
InvitationTeamURL *string `json:"invitation_team_url,omitempty"`
|
||||
}
|
||||
|
||||
func (i Invitation) String() string {
|
||||
|
@ -64,8 +72,8 @@ func (i Invitation) String() string {
|
|||
|
||||
// ListTeams lists all of the teams for an organization.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/orgs/teams/#list-teams
|
||||
func (s *OrganizationsService) ListTeams(ctx context.Context, org string, opt *ListOptions) ([]*Team, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/#list-teams
|
||||
func (s *TeamsService) ListTeams(ctx context.Context, org string, opt *ListOptions) ([]*Team, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/teams", org)
|
||||
u, err := addOptions(u, opt)
|
||||
if err != nil {
|
||||
|
@ -91,8 +99,8 @@ func (s *OrganizationsService) ListTeams(ctx context.Context, org string, opt *L
|
|||
|
||||
// GetTeam fetches a team by ID.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/orgs/teams/#get-team
|
||||
func (s *OrganizationsService) GetTeam(ctx context.Context, team int64) (*Team, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/#get-team
|
||||
func (s *TeamsService) GetTeam(ctx context.Context, team int64) (*Team, *Response, error) {
|
||||
u := fmt.Sprintf("teams/%v", team)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
|
@ -144,8 +152,8 @@ func (s NewTeam) String() string {
|
|||
|
||||
// CreateTeam creates a new team within an organization.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/orgs/teams/#create-team
|
||||
func (s *OrganizationsService) CreateTeam(ctx context.Context, org string, team *NewTeam) (*Team, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/#create-team
|
||||
func (s *TeamsService) CreateTeam(ctx context.Context, org string, team NewTeam) (*Team, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/teams", org)
|
||||
req, err := s.client.NewRequest("POST", u, team)
|
||||
if err != nil {
|
||||
|
@ -166,8 +174,8 @@ func (s *OrganizationsService) CreateTeam(ctx context.Context, org string, team
|
|||
|
||||
// EditTeam edits a team.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/orgs/teams/#edit-team
|
||||
func (s *OrganizationsService) EditTeam(ctx context.Context, id int64, team *NewTeam) (*Team, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/#edit-team
|
||||
func (s *TeamsService) EditTeam(ctx context.Context, id int64, team NewTeam) (*Team, *Response, error) {
|
||||
u := fmt.Sprintf("teams/%v", id)
|
||||
req, err := s.client.NewRequest("PATCH", u, team)
|
||||
if err != nil {
|
||||
|
@ -188,8 +196,8 @@ func (s *OrganizationsService) EditTeam(ctx context.Context, id int64, team *New
|
|||
|
||||
// DeleteTeam deletes a team.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/orgs/teams/#delete-team
|
||||
func (s *OrganizationsService) DeleteTeam(ctx context.Context, team int64) (*Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/#delete-team
|
||||
func (s *TeamsService) DeleteTeam(ctx context.Context, team int64) (*Response, error) {
|
||||
u := fmt.Sprintf("teams/%v", team)
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
if err != nil {
|
||||
|
@ -201,20 +209,10 @@ func (s *OrganizationsService) DeleteTeam(ctx context.Context, team int64) (*Res
|
|||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
||||
// OrganizationListTeamMembersOptions specifies the optional parameters to the
|
||||
// OrganizationsService.ListTeamMembers method.
|
||||
type OrganizationListTeamMembersOptions struct {
|
||||
// Role filters members returned by their role in the team. Possible
|
||||
// values are "all", "member", "maintainer". Default is "all".
|
||||
Role string `url:"role,omitempty"`
|
||||
|
||||
ListOptions
|
||||
}
|
||||
|
||||
// ListChildTeams lists child teams for a team.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/orgs/teams/#list-child-teams
|
||||
func (s *OrganizationsService) ListChildTeams(ctx context.Context, teamID int64, opt *ListOptions) ([]*Team, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/#list-child-teams
|
||||
func (s *TeamsService) ListChildTeams(ctx context.Context, teamID int64, opt *ListOptions) ([]*Team, *Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/teams", teamID)
|
||||
u, err := addOptions(u, opt)
|
||||
if err != nil {
|
||||
|
@ -237,55 +235,10 @@ func (s *OrganizationsService) ListChildTeams(ctx context.Context, teamID int64,
|
|||
return teams, resp, nil
|
||||
}
|
||||
|
||||
// ListTeamMembers lists all of the users who are members of the specified
|
||||
// team.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/orgs/teams/#list-team-members
|
||||
func (s *OrganizationsService) ListTeamMembers(ctx context.Context, team int64, opt *OrganizationListTeamMembersOptions) ([]*User, *Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/members", team)
|
||||
u, err := addOptions(u, opt)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req.Header.Set("Accept", mediaTypeNestedTeamsPreview)
|
||||
|
||||
var members []*User
|
||||
resp, err := s.client.Do(ctx, req, &members)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return members, resp, nil
|
||||
}
|
||||
|
||||
// IsTeamMember checks if a user is a member of the specified team.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/orgs/teams/#get-team-member
|
||||
//
|
||||
// Deprecated: This API has been marked as deprecated in the Github API docs,
|
||||
// OrganizationsService.GetTeamMembership method should be used instead.
|
||||
func (s *OrganizationsService) IsTeamMember(ctx context.Context, team int64, user string) (bool, *Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/members/%v", team, user)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return false, nil, err
|
||||
}
|
||||
|
||||
resp, err := s.client.Do(ctx, req, nil)
|
||||
member, err := parseBoolResponse(err)
|
||||
return member, resp, err
|
||||
}
|
||||
|
||||
// ListTeamRepos lists the repositories that the specified team has access to.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/orgs/teams/#list-team-repos
|
||||
func (s *OrganizationsService) ListTeamRepos(ctx context.Context, team int64, opt *ListOptions) ([]*Repository, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/#list-team-repos
|
||||
func (s *TeamsService) ListTeamRepos(ctx context.Context, team int64, opt *ListOptions) ([]*Repository, *Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/repos", team)
|
||||
u, err := addOptions(u, opt)
|
||||
if err != nil {
|
||||
|
@ -314,8 +267,8 @@ func (s *OrganizationsService) ListTeamRepos(ctx context.Context, team int64, op
|
|||
// repository is managed by team, a Repository is returned which includes the
|
||||
// permissions team has for that repo.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/orgs/teams/#check-if-a-team-manages-a-repository
|
||||
func (s *OrganizationsService) IsTeamRepo(ctx context.Context, team int64, owner string, repo string) (*Repository, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/#check-if-a-team-manages-a-repository
|
||||
func (s *TeamsService) IsTeamRepo(ctx context.Context, team int64, owner string, repo string) (*Repository, *Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/repos/%v/%v", team, owner, repo)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
|
@ -334,9 +287,9 @@ func (s *OrganizationsService) IsTeamRepo(ctx context.Context, team int64, owner
|
|||
return repository, resp, nil
|
||||
}
|
||||
|
||||
// OrganizationAddTeamRepoOptions specifies the optional parameters to the
|
||||
// OrganizationsService.AddTeamRepo method.
|
||||
type OrganizationAddTeamRepoOptions struct {
|
||||
// TeamAddTeamRepoOptions specifies the optional parameters to the
|
||||
// TeamsService.AddTeamRepo method.
|
||||
type TeamAddTeamRepoOptions struct {
|
||||
// Permission specifies the permission to grant the team on this repository.
|
||||
// Possible values are:
|
||||
// pull - team members can pull, but not push to or administer this repository
|
||||
|
@ -351,8 +304,8 @@ type OrganizationAddTeamRepoOptions struct {
|
|||
// specified repository must be owned by the organization to which the team
|
||||
// belongs, or a direct fork of a repository owned by the organization.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/orgs/teams/#add-team-repo
|
||||
func (s *OrganizationsService) AddTeamRepo(ctx context.Context, team int64, owner string, repo string, opt *OrganizationAddTeamRepoOptions) (*Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/#add-team-repo
|
||||
func (s *TeamsService) AddTeamRepo(ctx context.Context, team int64, owner string, repo string, opt *TeamAddTeamRepoOptions) (*Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/repos/%v/%v", team, owner, repo)
|
||||
req, err := s.client.NewRequest("PUT", u, opt)
|
||||
if err != nil {
|
||||
|
@ -366,8 +319,8 @@ func (s *OrganizationsService) AddTeamRepo(ctx context.Context, team int64, owne
|
|||
// team. Note that this does not delete the repository, it just removes it
|
||||
// from the team.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/orgs/teams/#remove-team-repo
|
||||
func (s *OrganizationsService) RemoveTeamRepo(ctx context.Context, team int64, owner string, repo string) (*Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/#remove-team-repo
|
||||
func (s *TeamsService) RemoveTeamRepo(ctx context.Context, team int64, owner string, repo string) (*Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/repos/%v/%v", team, owner, repo)
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
if err != nil {
|
||||
|
@ -378,8 +331,8 @@ func (s *OrganizationsService) RemoveTeamRepo(ctx context.Context, team int64, o
|
|||
}
|
||||
|
||||
// ListUserTeams lists a user's teams
|
||||
// GitHub API docs: https://developer.github.com/v3/orgs/teams/#list-user-teams
|
||||
func (s *OrganizationsService) ListUserTeams(ctx context.Context, opt *ListOptions) ([]*Team, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/#list-user-teams
|
||||
func (s *TeamsService) ListUserTeams(ctx context.Context, opt *ListOptions) ([]*Team, *Response, error) {
|
||||
u := "user/teams"
|
||||
u, err := addOptions(u, opt)
|
||||
if err != nil {
|
||||
|
@ -402,111 +355,3 @@ func (s *OrganizationsService) ListUserTeams(ctx context.Context, opt *ListOptio
|
|||
|
||||
return teams, resp, nil
|
||||
}
|
||||
|
||||
// GetTeamMembership returns the membership status for a user in a team.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/orgs/teams/#get-team-membership
|
||||
func (s *OrganizationsService) GetTeamMembership(ctx context.Context, team int64, user string) (*Membership, *Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/memberships/%v", team, user)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req.Header.Set("Accept", mediaTypeNestedTeamsPreview)
|
||||
|
||||
t := new(Membership)
|
||||
resp, err := s.client.Do(ctx, req, t)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return t, resp, nil
|
||||
}
|
||||
|
||||
// OrganizationAddTeamMembershipOptions does stuff specifies the optional
|
||||
// parameters to the OrganizationsService.AddTeamMembership method.
|
||||
type OrganizationAddTeamMembershipOptions struct {
|
||||
// Role specifies the role the user should have in the team. Possible
|
||||
// values are:
|
||||
// member - a normal member of the team
|
||||
// maintainer - a team maintainer. Able to add/remove other team
|
||||
// members, promote other team members to team
|
||||
// maintainer, and edit the team’s name and description
|
||||
//
|
||||
// Default value is "member".
|
||||
Role string `json:"role,omitempty"`
|
||||
}
|
||||
|
||||
// AddTeamMembership adds or invites a user to a team.
|
||||
//
|
||||
// In order to add a membership between a user and a team, the authenticated
|
||||
// user must have 'admin' permissions to the team or be an owner of the
|
||||
// organization that the team is associated with.
|
||||
//
|
||||
// If the user is already a part of the team's organization (meaning they're on
|
||||
// at least one other team in the organization), this endpoint will add the
|
||||
// user to the team.
|
||||
//
|
||||
// If the user is completely unaffiliated with the team's organization (meaning
|
||||
// they're on none of the organization's teams), this endpoint will send an
|
||||
// invitation to the user via email. This newly-created membership will be in
|
||||
// the "pending" state until the user accepts the invitation, at which point
|
||||
// the membership will transition to the "active" state and the user will be
|
||||
// added as a member of the team.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/orgs/teams/#add-team-membership
|
||||
func (s *OrganizationsService) AddTeamMembership(ctx context.Context, team int64, user string, opt *OrganizationAddTeamMembershipOptions) (*Membership, *Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/memberships/%v", team, user)
|
||||
req, err := s.client.NewRequest("PUT", u, opt)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
t := new(Membership)
|
||||
resp, err := s.client.Do(ctx, req, t)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return t, resp, nil
|
||||
}
|
||||
|
||||
// RemoveTeamMembership removes a user from a team.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/orgs/teams/#remove-team-membership
|
||||
func (s *OrganizationsService) RemoveTeamMembership(ctx context.Context, team int64, user string) (*Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/memberships/%v", team, user)
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
||||
// ListPendingTeamInvitations get pending invitaion list in team.
|
||||
// Warning: The API may change without advance notice during the preview period.
|
||||
// Preview features are not supported for production use.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/orgs/teams/#list-pending-team-invitations
|
||||
func (s *OrganizationsService) ListPendingTeamInvitations(ctx context.Context, team int64, opt *ListOptions) ([]*Invitation, *Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/invitations", team)
|
||||
u, err := addOptions(u, opt)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var pendingInvitations []*Invitation
|
||||
resp, err := s.client.Do(ctx, req, &pendingInvitations)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return pendingInvitations, resp, nil
|
||||
}
|
154
vendor/github.com/google/go-github/github/teams_discussion_comments.go
generated
vendored
Normal file
154
vendor/github.com/google/go-github/github/teams_discussion_comments.go
generated
vendored
Normal file
|
@ -0,0 +1,154 @@
|
|||
// Copyright 2018 The go-github AUTHORS. 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"
|
||||
)
|
||||
|
||||
// DiscussionComment represents a GitHub dicussion in a team.
|
||||
type DiscussionComment struct {
|
||||
Author *User `json:"author,omitempty"`
|
||||
Body *string `json:"body,omitempty"`
|
||||
BodyHTML *string `json:"body_html,omitempty"`
|
||||
BodyVersion *string `json:"body_version,omitempty"`
|
||||
CreatedAt *Timestamp `json:"created_at,omitempty"`
|
||||
LastEditedAt *Timestamp `json:"last_edited_at,omitempty"`
|
||||
DiscussionURL *string `json:"discussion_url,omitempty"`
|
||||
HTMLURL *string `json:"html_url,omitempty"`
|
||||
NodeID *string `json:"node_id,omitempty"`
|
||||
Number *int `json:"number,omitempty"`
|
||||
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
func (c DiscussionComment) String() string {
|
||||
return Stringify(c)
|
||||
}
|
||||
|
||||
// DiscussionCommentListOptions specifies optional parameters to the
|
||||
// TeamServices.ListComments method.
|
||||
type DiscussionCommentListOptions struct {
|
||||
// Sorts the discussion comments by the date they were created.
|
||||
// Accepted values are asc and desc. Default is desc.
|
||||
Direction string `url:"direction,omitempty"`
|
||||
}
|
||||
|
||||
// ListComments lists all comments on a team discussion.
|
||||
// Authenticated user must grant read:discussion scope.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/discussion_comments/#list-comments
|
||||
func (s *TeamsService) ListComments(ctx context.Context, teamID int64, discussionNumber int, options *DiscussionCommentListOptions) ([]*DiscussionComment, *Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/discussions/%v/comments", teamID, discussionNumber)
|
||||
u, err := addOptions(u, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeTeamDiscussionsPreview)
|
||||
|
||||
var comments []*DiscussionComment
|
||||
resp, err := s.client.Do(ctx, req, &comments)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return comments, resp, nil
|
||||
}
|
||||
|
||||
// GetComment gets a specific comment on a team discussion.
|
||||
// Authenticated user must grant read:discussion scope.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/discussion_comments/#get-a-single-comment
|
||||
func (s *TeamsService) GetComment(ctx context.Context, teamID int64, discussionNumber, commentNumber int) (*DiscussionComment, *Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v", teamID, discussionNumber, commentNumber)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeTeamDiscussionsPreview)
|
||||
|
||||
discussionComment := &DiscussionComment{}
|
||||
resp, err := s.client.Do(ctx, req, discussionComment)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return discussionComment, resp, nil
|
||||
}
|
||||
|
||||
// CreateComment creates a new discussion post on a team discussion.
|
||||
// Authenticated user must grant write:discussion scope.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/discussion_comments/#create-a-comment
|
||||
func (s *TeamsService) CreateComment(ctx context.Context, teamID int64, discsusionNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/discussions/%v/comments", teamID, discsusionNumber)
|
||||
req, err := s.client.NewRequest("POST", u, comment)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeTeamDiscussionsPreview)
|
||||
|
||||
discussionComment := &DiscussionComment{}
|
||||
resp, err := s.client.Do(ctx, req, discussionComment)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return discussionComment, resp, nil
|
||||
}
|
||||
|
||||
// EditComment edits the body text of a discussion comment.
|
||||
// Authenticated user must grant write:discussion scope.
|
||||
// User is allowed to edit body of a comment only.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/discussion_comments/#edit-a-comment
|
||||
func (s *TeamsService) EditComment(ctx context.Context, teamID int64, discussionNumber, commentNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v", teamID, discussionNumber, commentNumber)
|
||||
req, err := s.client.NewRequest("PATCH", u, comment)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeTeamDiscussionsPreview)
|
||||
|
||||
discussionComment := &DiscussionComment{}
|
||||
resp, err := s.client.Do(ctx, req, discussionComment)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return discussionComment, resp, nil
|
||||
}
|
||||
|
||||
// DeleteComment deletes a comment on a team discussion.
|
||||
// Authenticated user must grant write:discussion scope.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/discussion_comments/#delete-a-comment
|
||||
func (s *TeamsService) DeleteComment(ctx context.Context, teamID int64, discussionNumber, commentNumber int) (*Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v", teamID, discussionNumber, commentNumber)
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeTeamDiscussionsPreview)
|
||||
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
159
vendor/github.com/google/go-github/github/teams_discussions.go
generated
vendored
Normal file
159
vendor/github.com/google/go-github/github/teams_discussions.go
generated
vendored
Normal file
|
@ -0,0 +1,159 @@
|
|||
// Copyright 2018 The go-github AUTHORS. 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"
|
||||
)
|
||||
|
||||
// TeamDiscussion represents a GitHub dicussion in a team.
|
||||
type TeamDiscussion struct {
|
||||
Author *User `json:"author,omitempty"`
|
||||
Body *string `json:"body,omitempty"`
|
||||
BodyHTML *string `json:"body_html,omitempty"`
|
||||
BodyVersion *string `json:"body_version,omitempty"`
|
||||
CommentsCount *int `json:"comments_count,omitempty"`
|
||||
CommentsURL *string `json:"comments_url,omitempty"`
|
||||
CreatedAt *Timestamp `json:"created_at,omitempty"`
|
||||
LastEditedAt *Timestamp `json:"last_edited_at,omitempty"`
|
||||
HTMLURL *string `json:"html_url,omitempty"`
|
||||
NodeID *string `json:"node_id,omitempty"`
|
||||
Number *int `json:"number,omitempty"`
|
||||
Pinned *bool `json:"pinned,omitempty"`
|
||||
Private *bool `json:"private,omitempty"`
|
||||
TeamURL *string `json:"team_url,omitempty"`
|
||||
Title *string `json:"title,omitempty"`
|
||||
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
func (d TeamDiscussion) String() string {
|
||||
return Stringify(d)
|
||||
}
|
||||
|
||||
// DiscussionListOptions specifies optional parameters to the
|
||||
// TeamServices.ListDiscussions method.
|
||||
type DiscussionListOptions struct {
|
||||
// Sorts the discussion by the date they were created.
|
||||
// Accepted values are asc and desc. Default is desc.
|
||||
Direction string `url:"direction,omitempty"`
|
||||
}
|
||||
|
||||
// ListDiscussions lists all discussions on team's page.
|
||||
// Authenticated user must grant read:discussion scope.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/discussions/#list-discussions
|
||||
func (s *TeamsService) ListDiscussions(ctx context.Context, teamID int64, options *DiscussionListOptions) ([]*TeamDiscussion, *Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/discussions", teamID)
|
||||
u, err := addOptions(u, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeTeamDiscussionsPreview)
|
||||
|
||||
var teamDiscussions []*TeamDiscussion
|
||||
resp, err := s.client.Do(ctx, req, &teamDiscussions)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return teamDiscussions, resp, nil
|
||||
}
|
||||
|
||||
// GetDiscussion gets a specific discussion on a team's page.
|
||||
// Authenticated user must grant read:discussion scope.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/discussions/#get-a-single-discussion
|
||||
func (s *TeamsService) GetDiscussion(ctx context.Context, teamID int64, discussionNumber int) (*TeamDiscussion, *Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/discussions/%v", teamID, discussionNumber)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeTeamDiscussionsPreview)
|
||||
|
||||
teamDiscussion := &TeamDiscussion{}
|
||||
resp, err := s.client.Do(ctx, req, teamDiscussion)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return teamDiscussion, resp, nil
|
||||
}
|
||||
|
||||
// CreateDiscussion creates a new discussion post on a team's page.
|
||||
// Authenticated user must grant write:discussion scope.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/discussions/#create-a-discussion
|
||||
func (s *TeamsService) CreateDiscussion(ctx context.Context, teamID int64, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/discussions", teamID)
|
||||
req, err := s.client.NewRequest("POST", u, discussion)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeTeamDiscussionsPreview)
|
||||
|
||||
teamDiscussion := &TeamDiscussion{}
|
||||
resp, err := s.client.Do(ctx, req, teamDiscussion)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return teamDiscussion, resp, nil
|
||||
}
|
||||
|
||||
// EditDiscussion edits the title and body text of a discussion post.
|
||||
// Authenticated user must grant write:discussion scope.
|
||||
// User is allowed to change Title and Body of a discussion only.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/discussions/#edit-a-discussion
|
||||
func (s *TeamsService) EditDiscussion(ctx context.Context, teamID int64, discussionNumber int, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/discussions/%v", teamID, discussionNumber)
|
||||
req, err := s.client.NewRequest("PATCH", u, discussion)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeTeamDiscussionsPreview)
|
||||
|
||||
teamDiscussion := &TeamDiscussion{}
|
||||
resp, err := s.client.Do(ctx, req, teamDiscussion)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return teamDiscussion, resp, nil
|
||||
}
|
||||
|
||||
// DeleteDiscussion deletes a discussion from team's page.
|
||||
// Authenticated user must grant write:discussion scope.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/discussions/#delete-a-discussion
|
||||
func (s *TeamsService) DeleteDiscussion(ctx context.Context, teamID int64, discussionNumber int) (*Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/discussions/%v", teamID, discussionNumber)
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeTeamDiscussionsPreview)
|
||||
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
174
vendor/github.com/google/go-github/github/teams_members.go
generated
vendored
Normal file
174
vendor/github.com/google/go-github/github/teams_members.go
generated
vendored
Normal file
|
@ -0,0 +1,174 @@
|
|||
// Copyright 2018 The go-github AUTHORS. 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"
|
||||
)
|
||||
|
||||
// TeamListTeamMembersOptions specifies the optional parameters to the
|
||||
// TeamsService.ListTeamMembers method.
|
||||
type TeamListTeamMembersOptions struct {
|
||||
// Role filters members returned by their role in the team. Possible
|
||||
// values are "all", "member", "maintainer". Default is "all".
|
||||
Role string `url:"role,omitempty"`
|
||||
|
||||
ListOptions
|
||||
}
|
||||
|
||||
// ListTeamMembers lists all of the users who are members of the specified
|
||||
// team.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/members/#list-team-members
|
||||
func (s *TeamsService) ListTeamMembers(ctx context.Context, team int64, opt *TeamListTeamMembersOptions) ([]*User, *Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/members", team)
|
||||
u, err := addOptions(u, opt)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req.Header.Set("Accept", mediaTypeNestedTeamsPreview)
|
||||
|
||||
var members []*User
|
||||
resp, err := s.client.Do(ctx, req, &members)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return members, resp, nil
|
||||
}
|
||||
|
||||
// IsTeamMember checks if a user is a member of the specified team.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/members/#get-team-member
|
||||
//
|
||||
// Deprecated: This API has been marked as deprecated in the Github API docs,
|
||||
// TeamsService.GetTeamMembership method should be used instead.
|
||||
func (s *TeamsService) IsTeamMember(ctx context.Context, team int64, user string) (bool, *Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/members/%v", team, user)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return false, nil, err
|
||||
}
|
||||
|
||||
resp, err := s.client.Do(ctx, req, nil)
|
||||
member, err := parseBoolResponse(err)
|
||||
return member, resp, err
|
||||
}
|
||||
|
||||
// GetTeamMembership returns the membership status for a user in a team.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/members/#get-team-membership
|
||||
func (s *TeamsService) GetTeamMembership(ctx context.Context, team int64, user string) (*Membership, *Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/memberships/%v", team, user)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req.Header.Set("Accept", mediaTypeNestedTeamsPreview)
|
||||
|
||||
t := new(Membership)
|
||||
resp, err := s.client.Do(ctx, req, t)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return t, resp, nil
|
||||
}
|
||||
|
||||
// TeamAddTeamMembershipOptions specifies the optional
|
||||
// parameters to the TeamsService.AddTeamMembership method.
|
||||
type TeamAddTeamMembershipOptions struct {
|
||||
// Role specifies the role the user should have in the team. Possible
|
||||
// values are:
|
||||
// member - a normal member of the team
|
||||
// maintainer - a team maintainer. Able to add/remove other team
|
||||
// members, promote other team members to team
|
||||
// maintainer, and edit the team’s name and description
|
||||
//
|
||||
// Default value is "member".
|
||||
Role string `json:"role,omitempty"`
|
||||
}
|
||||
|
||||
// AddTeamMembership adds or invites a user to a team.
|
||||
//
|
||||
// In order to add a membership between a user and a team, the authenticated
|
||||
// user must have 'admin' permissions to the team or be an owner of the
|
||||
// organization that the team is associated with.
|
||||
//
|
||||
// If the user is already a part of the team's organization (meaning they're on
|
||||
// at least one other team in the organization), this endpoint will add the
|
||||
// user to the team.
|
||||
//
|
||||
// If the user is completely unaffiliated with the team's organization (meaning
|
||||
// they're on none of the organization's teams), this endpoint will send an
|
||||
// invitation to the user via email. This newly-created membership will be in
|
||||
// the "pending" state until the user accepts the invitation, at which point
|
||||
// the membership will transition to the "active" state and the user will be
|
||||
// added as a member of the team.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/members/#add-or-update-team-membership
|
||||
func (s *TeamsService) AddTeamMembership(ctx context.Context, team int64, user string, opt *TeamAddTeamMembershipOptions) (*Membership, *Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/memberships/%v", team, user)
|
||||
req, err := s.client.NewRequest("PUT", u, opt)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
t := new(Membership)
|
||||
resp, err := s.client.Do(ctx, req, t)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return t, resp, nil
|
||||
}
|
||||
|
||||
// RemoveTeamMembership removes a user from a team.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/members/#remove-team-membership
|
||||
func (s *TeamsService) RemoveTeamMembership(ctx context.Context, team int64, user string) (*Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/memberships/%v", team, user)
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
||||
// ListPendingTeamInvitations get pending invitaion list in team.
|
||||
// Warning: The API may change without advance notice during the preview period.
|
||||
// Preview features are not supported for production use.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/teams/members/#list-pending-team-invitations
|
||||
func (s *TeamsService) ListPendingTeamInvitations(ctx context.Context, team int64, opt *ListOptions) ([]*Invitation, *Response, error) {
|
||||
u := fmt.Sprintf("teams/%v/invitations", team)
|
||||
u, err := addOptions(u, opt)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var pendingInvitations []*Invitation
|
||||
resp, err := s.client.Do(ctx, req, &pendingInvitations)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return pendingInvitations, resp, nil
|
||||
}
|
4
vendor/github.com/google/go-github/github/timestamp.go
generated
vendored
4
vendor/github.com/google/go-github/github/timestamp.go
generated
vendored
|
@ -28,9 +28,9 @@ func (t *Timestamp) UnmarshalJSON(data []byte) (err error) {
|
|||
str := string(data)
|
||||
i, err := strconv.ParseInt(str, 10, 64)
|
||||
if err == nil {
|
||||
(*t).Time = time.Unix(i, 0)
|
||||
t.Time = time.Unix(i, 0)
|
||||
} else {
|
||||
(*t).Time, err = time.Parse(`"`+time.RFC3339+`"`, str)
|
||||
t.Time, err = time.Parse(`"`+time.RFC3339+`"`, str)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
54
vendor/github.com/google/go-github/github/users.go
generated
vendored
54
vendor/github.com/google/go-github/github/users.go
generated
vendored
|
@ -20,6 +20,7 @@ type UsersService service
|
|||
type User struct {
|
||||
Login *string `json:"login,omitempty"`
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
NodeID *string `json:"node_id,omitempty"`
|
||||
AvatarURL *string `json:"avatar_url,omitempty"`
|
||||
HTMLURL *string `json:"html_url,omitempty"`
|
||||
GravatarID *string `json:"gravatar_id,omitempty"`
|
||||
|
@ -134,12 +135,65 @@ func (s *UsersService) Edit(ctx context.Context, user *User) (*User, *Response,
|
|||
return uResp, resp, nil
|
||||
}
|
||||
|
||||
// HovercardOptions specifies optional parameters to the UsersService.GetHovercard
|
||||
// method.
|
||||
type HovercardOptions struct {
|
||||
// SubjectType specifies the additional information to be received about the hovercard.
|
||||
// Possible values are: organization, repository, issue, pull_request. (Required when using subject_id.)
|
||||
SubjectType string `url:"subject_type"`
|
||||
|
||||
// SubjectID specifies the ID for the SubjectType. (Required when using subject_type.)
|
||||
SubjectID string `url:"subject_id"`
|
||||
}
|
||||
|
||||
// Hovercard represents hovercard information about a user.
|
||||
type Hovercard struct {
|
||||
Contexts []*UserContext `json:"contexts,omitempty"`
|
||||
}
|
||||
|
||||
// UserContext represents the contextual information about user.
|
||||
type UserContext struct {
|
||||
Message *string `json:"message,omitempty"`
|
||||
Octicon *string `json:"octicon,omitempty"`
|
||||
}
|
||||
|
||||
// GetHovercard fetches contextual information about user. It requires authentication
|
||||
// via Basic Auth or via OAuth with the repo scope.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/users/#get-contextual-information-about-a-user
|
||||
func (s *UsersService) GetHovercard(ctx context.Context, user string, opt *HovercardOptions) (*Hovercard, *Response, error) {
|
||||
u := fmt.Sprintf("users/%v/hovercard", user)
|
||||
u, err := addOptions(u, opt)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeHovercardPreview)
|
||||
|
||||
hc := new(Hovercard)
|
||||
resp, err := s.client.Do(ctx, req, hc)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return hc, resp, nil
|
||||
}
|
||||
|
||||
// UserListOptions specifies optional parameters to the UsersService.ListAll
|
||||
// method.
|
||||
type UserListOptions struct {
|
||||
// ID of the last user seen
|
||||
Since int64 `url:"since,omitempty"`
|
||||
|
||||
// Note: Pagination is powered exclusively by the Since parameter,
|
||||
// ListOptions.Page has no effect.
|
||||
// ListOptions.PerPage controls an undocumented GitHub API parameter.
|
||||
ListOptions
|
||||
}
|
||||
|
||||
|
|
5
vendor/github.com/google/go-github/github/with_appengine.go
generated
vendored
5
vendor/github.com/google/go-github/github/with_appengine.go
generated
vendored
|
@ -6,11 +6,6 @@
|
|||
// +build appengine
|
||||
|
||||
// This file provides glue for making github work on App Engine.
|
||||
// In order to get the entire github package to compile with
|
||||
// Go 1.6, you will need to rewrite all the import "context" lines.
|
||||
// Fortunately, this is easy with "gofmt":
|
||||
//
|
||||
// gofmt -w -r '"context" -> "golang.org/x/net/context"' *.go
|
||||
|
||||
package github
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue