func (r *CheckCollaboratorResponse) ReadResponse(resp *http.Response) error {
	r.httpResponse = resp
	err := responseErrorCheck(resp, []int{204, 404})
	if err != nil {
		return err
	}
	err = setBoolResult(resp, &r.Data)
	if err != nil {
		return err
	}
	return nil
}
ReadResponse reads an *http.Response. Non-nil errors will have the type octo.ResponseError.
package repos
import (
	"context"
	"encoding/json"
	"fmt"
	components "github.com/willabides/octo-go/components"
	requests "github.com/willabides/octo-go/requests"
	"io"
	"net/http"
	"net/url"
	"strconv"
)
func AcceptInvitation(ctx context.Context, req *AcceptInvitationReq, opt ...requests.Option) (*AcceptInvitationResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(AcceptInvitationReq)
	}
	resp := &AcceptInvitationResponse{}
	httpReq, err := req.HTTPRequest(ctx, opt...)
	if err != nil {
		return nil, err
	}
	r, err := opts.HttpClient().Do(httpReq)
	if err != nil {
		return nil, err
	}
	err = resp.ReadResponse(r)
	if err != nil {
		return nil, err
	}
	return resp, nil
}
func (c Client) AcceptInvitation(ctx context.Context, req *AcceptInvitationReq, opt ...requests.Option) (*AcceptInvitationResponse, error) {
	return AcceptInvitation(ctx, req, append(c, opt...)...)
}
type AcceptInvitationReq struct {
	_url string
	InvitationId int64
}
func (r *AcceptInvitationReq) HTTPRequest(ctx context.Context, opt ...requests.Option) (*http.Request, error) {
	return buildHTTPRequest(ctx, buildHTTPRequestOptions{
		ExplicitURL: r._url,
		Method:      "PATCH",
		Options:     opt,
		URLPath:     fmt.Sprintf("/user/repository_invitations/%v", r.InvitationId),
	})
}
func (r *AcceptInvitationReq) Rel(link string, resp *AcceptInvitationResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type AcceptInvitationResponse struct {
	httpResponse *http.Response
}
func (r *AcceptInvitationResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}
func (r *AcceptInvitationResponse) ReadResponse(resp *http.Response) error {
	r.httpResponse = resp
	err := responseErrorCheck(resp, []int{204, 304})
	if err != nil {
		return err
	}
	return nil
}
func AddAppAccessRestrictions(ctx context.Context, req *AddAppAccessRestrictionsReq, opt ...requests.Option) (*AddAppAccessRestrictionsResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(AddAppAccessRestrictionsReq)
	}
	resp := &AddAppAccessRestrictionsResponse{}
	httpReq, err := req.HTTPRequest(ctx, opt...)
	if err != nil {
		return nil, err
	}
	r, err := opts.HttpClient().Do(httpReq)
	if err != nil {
		return nil, err
	}
	err = resp.ReadResponse(r)
	if err != nil {
		return nil, err
	}
	return resp, nil
}
func (c Client) AddAppAccessRestrictions(ctx context.Context, req *AddAppAccessRestrictionsReq, opt ...requests.Option) (*AddAppAccessRestrictionsResponse, error) {
	return AddAppAccessRestrictions(ctx, req, append(c, opt...)...)
}
type AddAppAccessRestrictionsReq struct {
	_url  string
	Owner string
	Repo  string
	Branch      string
	RequestBody AddAppAccessRestrictionsReqBody
}
func (r *AddAppAccessRestrictionsReq) HTTPRequest(ctx context.Context, opt ...requests.Option) (*http.Request, error) {
	return buildHTTPRequest(ctx, buildHTTPRequestOptions{
		Body:        r.RequestBody,
		ExplicitURL: r._url,
		HeaderVals: map[string]*string{
			"accept":       strPtr("application/json"),
			"content-type": strPtr("application/json"),
		},
		Method:  "POST",
		Options: opt,
		URLPath: fmt.Sprintf("/repos/%v/%v/branches/%v/protection/restrictions/apps", r.Owner, r.Repo, r.Branch),
	})
}
func (r *AddAppAccessRestrictionsReq) Rel(link string, resp *AddAppAccessRestrictionsResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type AddAppAccessRestrictionsReqBody []string
type AddAppAccessRestrictionsResponse struct {
	httpResponse *http.Response
	Data         []components.Integration
}
func (r *AddAppAccessRestrictionsResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}
func (r *AddAppAccessRestrictionsResponse) ReadResponse(resp *http.Response) error {
	r.httpResponse = resp
	err := responseErrorCheck(resp, []int{200})
	if err != nil {
		return err
	}
	if intInSlice(resp.StatusCode, []int{200}) {
		err = unmarshalResponseBody(resp, &r.Data)
		if err != nil {
			return err
		}
	}
	return nil
}
func AddCollaborator(ctx context.Context, req *AddCollaboratorReq, opt ...requests.Option) (*AddCollaboratorResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(AddCollaboratorReq)
	}
	resp := &AddCollaboratorResponse{}
	httpReq, err := req.HTTPRequest(ctx, opt...)
	if err != nil {
		return nil, err
	}
	r, err := opts.HttpClient().Do(httpReq)
	if err != nil {
		return nil, err
	}
	err = resp.ReadResponse(r)
	if err != nil {
		return nil, err
	}
	return resp, nil
}
func (c Client) AddCollaborator(ctx context.Context, req *AddCollaboratorReq, opt ...requests.Option) (*AddCollaboratorResponse, error) {
	return AddCollaborator(ctx, req, append(c, opt...)...)
}
type AddCollaboratorReq struct {
	_url        string
	Owner       string
	Repo        string
	Username    string
	RequestBody AddCollaboratorReqBody
}
func (r *AddCollaboratorReq) HTTPRequest(ctx context.Context, opt ...requests.Option) (*http.Request, error) {
	return buildHTTPRequest(ctx, buildHTTPRequestOptions{
		Body:        r.RequestBody,
		ExplicitURL: r._url,
		HeaderVals: map[string]*string{
			"accept":       strPtr("application/json"),
			"content-type": strPtr("application/json"),
		},
		Method:  "PUT",
		Options: opt,
		URLPath: fmt.Sprintf("/repos/%v/%v/collaborators/%v", r.Owner, r.Repo, r.Username),
	})
}
func (r *AddCollaboratorReq) Rel(link string, resp *AddCollaboratorResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type AddCollaboratorReqBody struct {
	Permission  *string `json:"permission,omitempty"`
	Permissions *string `json:"permissions,omitempty"`
}
type AddCollaboratorResponse struct {
	httpResponse *http.Response
	Data         components.RepositoryInvitation
}
func (r *AddCollaboratorResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}
func (r *AddCollaboratorResponse) ReadResponse(resp *http.Response) error {
	r.httpResponse = resp
	err := responseErrorCheck(resp, []int{201, 204})
	if err != nil {
		return err
	}
	if intInSlice(resp.StatusCode, []int{201}) {
		err = unmarshalResponseBody(resp, &r.Data)
		if err != nil {
			return err
		}
	}
	return nil
}
func AddStatusCheckContexts(ctx context.Context, req *AddStatusCheckContextsReq, opt ...requests.Option) (*AddStatusCheckContextsResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(AddStatusCheckContextsReq)
	}
	resp := &AddStatusCheckContextsResponse{}
	httpReq, err := req.HTTPRequest(ctx, opt...)
	if err != nil {
		return nil, err
	}
	r, err := opts.HttpClient().Do(httpReq)
	if err != nil {
		return nil, err
	}
	err = resp.ReadResponse(r)
	if err != nil {
		return nil, err
	}
	return resp, nil
}
func (c Client) AddStatusCheckContexts(ctx context.Context, req *AddStatusCheckContextsReq, opt ...requests.Option) (*AddStatusCheckContextsResponse, error) {
	return AddStatusCheckContexts(ctx, req, append(c, opt...)...)
}
type AddStatusCheckContextsReq struct {
	_url  string
	Owner string
	Repo  string
	Branch      string
	RequestBody AddStatusCheckContextsReqBody
}
func (r *AddStatusCheckContextsReq) HTTPRequest(ctx context.Context, opt ...requests.Option) (*http.Request, error) {
	return buildHTTPRequest(ctx, buildHTTPRequestOptions{
		Body:        r.RequestBody,
		ExplicitURL: r._url,
		HeaderVals: map[string]*string{
			"accept":       strPtr("application/json"),
			"content-type": strPtr("application/json"),
		},
		Method:  "POST",
		Options: opt,
		URLPath: fmt.Sprintf("/repos/%v/%v/branches/%v/protection/required_status_checks/contexts", r.Owner, r.Repo, r.Branch),
	})
}
func (r *AddStatusCheckContextsReq) Rel(link string, resp *AddStatusCheckContextsResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type AddStatusCheckContextsReqBody []string
type AddStatusCheckContextsResponseBody []string
type AddStatusCheckContextsResponse struct {
	httpResponse *http.Response
	Data         AddStatusCheckContextsResponseBody
}
func (r *AddStatusCheckContextsResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}
func (r *AddStatusCheckContextsResponse) ReadResponse(resp *http.Response) error {
	r.httpResponse = resp
	err := responseErrorCheck(resp, []int{200})
	if err != nil {
		return err
	}
	if intInSlice(resp.StatusCode, []int{200}) {
		err = unmarshalResponseBody(resp, &r.Data)
		if err != nil {
			return err
		}
	}
	return nil
}
func AddTeamAccessRestrictions(ctx context.Context, req *AddTeamAccessRestrictionsReq, opt ...requests.Option) (*AddTeamAccessRestrictionsResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(AddTeamAccessRestrictionsReq)
	}
	resp := &AddTeamAccessRestrictionsResponse{}
	httpReq, err := req.HTTPRequest(ctx, opt...)
	if err != nil {
		return nil, err
	}
	r, err := opts.HttpClient().Do(httpReq)
	if err != nil {
		return nil, err
	}
	err = resp.ReadResponse(r)
	if err != nil {
		return nil, err
	}
	return resp, nil
}
func (c Client) AddTeamAccessRestrictions(ctx context.Context, req *AddTeamAccessRestrictionsReq, opt ...requests.Option) (*AddTeamAccessRestrictionsResponse, error) {
	return AddTeamAccessRestrictions(ctx, req, append(c, opt...)...)
}
type AddTeamAccessRestrictionsReq struct {
	_url  string
	Owner string
	Repo  string
	Branch      string
	RequestBody AddTeamAccessRestrictionsReqBody
}
func (r *AddTeamAccessRestrictionsReq) HTTPRequest(ctx context.Context, opt ...requests.Option) (*http.Request, error) {
	return buildHTTPRequest(ctx, buildHTTPRequestOptions{
		Body:        r.RequestBody,
		ExplicitURL: r._url,
		HeaderVals: map[string]*string{
			"accept":       strPtr("application/json"),
			"content-type": strPtr("application/json"),
		},
		Method:  "POST",
		Options: opt,
		URLPath: fmt.Sprintf("/repos/%v/%v/branches/%v/protection/restrictions/teams", r.Owner, r.Repo, r.Branch),
	})
}
func (r *AddTeamAccessRestrictionsReq) Rel(link string, resp *AddTeamAccessRestrictionsResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type AddTeamAccessRestrictionsReqBody []string
type AddTeamAccessRestrictionsResponse struct {
	httpResponse *http.Response
	Data         []components.Team
}
func (r *AddTeamAccessRestrictionsResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}
func (r *AddTeamAccessRestrictionsResponse) ReadResponse(resp *http.Response) error {
	r.httpResponse = resp
	err := responseErrorCheck(resp, []int{200})
	if err != nil {
		return err
	}
	if intInSlice(resp.StatusCode, []int{200}) {
		err = unmarshalResponseBody(resp, &r.Data)
		if err != nil {
			return err
		}
	}
	return nil
}
func AddUserAccessRestrictions(ctx context.Context, req *AddUserAccessRestrictionsReq, opt ...requests.Option) (*AddUserAccessRestrictionsResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(AddUserAccessRestrictionsReq)
	}
	resp := &AddUserAccessRestrictionsResponse{}
	httpReq, err := req.HTTPRequest(ctx, opt...)
	if err != nil {
		return nil, err
	}
	r, err := opts.HttpClient().Do(httpReq)
	if err != nil {
		return nil, err
	}
	err = resp.ReadResponse(r)
	if err != nil {
		return nil, err
	}
	return resp, nil
}
func (c Client) AddUserAccessRestrictions(ctx context.Context, req *AddUserAccessRestrictionsReq, opt ...requests.Option) (*AddUserAccessRestrictionsResponse, error) {
	return AddUserAccessRestrictions(ctx, req, append(c, opt...)...)
}
type AddUserAccessRestrictionsReq struct {
	_url  string
	Owner string
	Repo  string
	Branch      string
	RequestBody AddUserAccessRestrictionsReqBody
}
func (r *AddUserAccessRestrictionsReq) HTTPRequest(ctx context.Context, opt ...requests.Option) (*http.Request, error) {
	return buildHTTPRequest(ctx, buildHTTPRequestOptions{
		Body:        r.RequestBody,
		ExplicitURL: r._url,
		HeaderVals: map[string]*string{
			"accept":       strPtr("application/json"),
			"content-type": strPtr("application/json"),
		},
		Method:  "POST",
		Options: opt,
		URLPath: fmt.Sprintf("/repos/%v/%v/branches/%v/protection/restrictions/users", r.Owner, r.Repo, r.Branch),
	})
}
func (r *AddUserAccessRestrictionsReq) Rel(link string, resp *AddUserAccessRestrictionsResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type AddUserAccessRestrictionsReqBody []string
type AddUserAccessRestrictionsResponse struct {
	httpResponse *http.Response
	Data         []components.SimpleUser
}
func (r *AddUserAccessRestrictionsResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}
func (r *AddUserAccessRestrictionsResponse) ReadResponse(resp *http.Response) error {
	r.httpResponse = resp
	err := responseErrorCheck(resp, []int{200})
	if err != nil {
		return err
	}
	if intInSlice(resp.StatusCode, []int{200}) {
		err = unmarshalResponseBody(resp, &r.Data)
		if err != nil {
			return err
		}
	}
	return nil
}
func CheckCollaborator(ctx context.Context, req *CheckCollaboratorReq, opt ...requests.Option) (*CheckCollaboratorResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(CheckCollaboratorReq)
	}
	resp := &CheckCollaboratorResponse{}
	httpReq, err := req.HTTPRequest(ctx, opt...)
	if err != nil {
		return nil, err
	}
	r, err := opts.HttpClient().Do(httpReq)
	if err != nil {
		return nil, err
	}
	err = resp.ReadResponse(r)
	if err != nil {
		return nil, err
	}
	return resp, nil
}
func (c Client) CheckCollaborator(ctx context.Context, req *CheckCollaboratorReq, opt ...requests.Option) (*CheckCollaboratorResponse, error) {
	return CheckCollaborator(ctx, req, append(c, opt...)...)
}
type CheckCollaboratorReq struct {
	_url     string
	Owner    string
	Repo     string
	Username string
}
func (r *CheckCollaboratorReq) HTTPRequest(ctx context.Context, opt ...requests.Option) (*http.Request, error) {
	return buildHTTPRequest(ctx, buildHTTPRequestOptions{
		ExplicitURL: r._url,
		Method:      "GET",
		Options:     opt,
		URLPath:     fmt.Sprintf("/repos/%v/%v/collaborators/%v", r.Owner, r.Repo, r.Username),
	})
}
func (r *CheckCollaboratorReq) Rel(link string, resp *CheckCollaboratorResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type CheckCollaboratorResponse struct {
	httpResponse *http.Response
	Data         bool
}
func (r *CheckCollaboratorResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}