func (r *AddOrUpdateRepoPermissionsInOrgReq) Rel(link string, resp *AddOrUpdateRepoPermissionsInOrgResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
/*
Rel updates this request to point to a relative link from resp. Returns false if
the link does not exist. Handy for paging.
package teams
import (
	"context"
	"fmt"
	components "github.com/willabides/octo-go/components"
	requests "github.com/willabides/octo-go/requests"
	"net/http"
	"net/url"
	"strconv"
)
func AddMemberLegacy(ctx context.Context, req *AddMemberLegacyReq, opt ...requests.Option) (*AddMemberLegacyResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(AddMemberLegacyReq)
	}
	resp := &AddMemberLegacyResponse{}
	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) AddMemberLegacy(ctx context.Context, req *AddMemberLegacyReq, opt ...requests.Option) (*AddMemberLegacyResponse, error) {
	return AddMemberLegacy(ctx, req, append(c, opt...)...)
}
type AddMemberLegacyReq struct {
	_url     string
	TeamId   int64
	Username string
}
func (r *AddMemberLegacyReq) HTTPRequest(ctx context.Context, opt ...requests.Option) (*http.Request, error) {
	return buildHTTPRequest(ctx, buildHTTPRequestOptions{
		ExplicitURL: r._url,
		Method:      "PUT",
		Options:     opt,
		URLPath:     fmt.Sprintf("/teams/%v/members/%v", r.TeamId, r.Username),
	})
}
func (r *AddMemberLegacyReq) Rel(link string, resp *AddMemberLegacyResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type AddMemberLegacyResponse struct {
	httpResponse *http.Response
}
func (r *AddMemberLegacyResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}
func (r *AddMemberLegacyResponse) ReadResponse(resp *http.Response) error {
	r.httpResponse = resp
	err := responseErrorCheck(resp, []int{204})
	if err != nil {
		return err
	}
	return nil
}
func AddOrUpdateMembershipForUserInOrg(ctx context.Context, req *AddOrUpdateMembershipForUserInOrgReq, opt ...requests.Option) (*AddOrUpdateMembershipForUserInOrgResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(AddOrUpdateMembershipForUserInOrgReq)
	}
	resp := &AddOrUpdateMembershipForUserInOrgResponse{}
	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) AddOrUpdateMembershipForUserInOrg(ctx context.Context, req *AddOrUpdateMembershipForUserInOrgReq, opt ...requests.Option) (*AddOrUpdateMembershipForUserInOrgResponse, error) {
	return AddOrUpdateMembershipForUserInOrg(ctx, req, append(c, opt...)...)
}
type AddOrUpdateMembershipForUserInOrgReq struct {
	_url string
	Org  string
	TeamSlug    string
	Username    string
	RequestBody AddOrUpdateMembershipForUserInOrgReqBody
}
func (r *AddOrUpdateMembershipForUserInOrgReq) 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("/orgs/%v/teams/%v/memberships/%v", r.Org, r.TeamSlug, r.Username),
	})
}
func (r *AddOrUpdateMembershipForUserInOrgReq) Rel(link string, resp *AddOrUpdateMembershipForUserInOrgResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type AddOrUpdateMembershipForUserInOrgReqBody struct {
	Role *string `json:"role,omitempty"`
}
type AddOrUpdateMembershipForUserInOrgResponse struct {
	httpResponse *http.Response
	Data         components.TeamMembership
}
func (r *AddOrUpdateMembershipForUserInOrgResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}
func (r *AddOrUpdateMembershipForUserInOrgResponse) 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 AddOrUpdateMembershipForUserLegacy(ctx context.Context, req *AddOrUpdateMembershipForUserLegacyReq, opt ...requests.Option) (*AddOrUpdateMembershipForUserLegacyResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(AddOrUpdateMembershipForUserLegacyReq)
	}
	resp := &AddOrUpdateMembershipForUserLegacyResponse{}
	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) AddOrUpdateMembershipForUserLegacy(ctx context.Context, req *AddOrUpdateMembershipForUserLegacyReq, opt ...requests.Option) (*AddOrUpdateMembershipForUserLegacyResponse, error) {
	return AddOrUpdateMembershipForUserLegacy(ctx, req, append(c, opt...)...)
}
type AddOrUpdateMembershipForUserLegacyReq struct {
	_url        string
	TeamId      int64
	Username    string
	RequestBody AddOrUpdateMembershipForUserLegacyReqBody
}
func (r *AddOrUpdateMembershipForUserLegacyReq) 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("/teams/%v/memberships/%v", r.TeamId, r.Username),
	})
}
func (r *AddOrUpdateMembershipForUserLegacyReq) Rel(link string, resp *AddOrUpdateMembershipForUserLegacyResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type AddOrUpdateMembershipForUserLegacyReqBody struct {
	Role *string `json:"role,omitempty"`
}
type AddOrUpdateMembershipForUserLegacyResponse struct {
	httpResponse *http.Response
	Data         components.TeamMembership
}
func (r *AddOrUpdateMembershipForUserLegacyResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}
func (r *AddOrUpdateMembershipForUserLegacyResponse) 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 AddOrUpdateProjectPermissionsInOrg(ctx context.Context, req *AddOrUpdateProjectPermissionsInOrgReq, opt ...requests.Option) (*AddOrUpdateProjectPermissionsInOrgResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(AddOrUpdateProjectPermissionsInOrgReq)
	}
	resp := &AddOrUpdateProjectPermissionsInOrgResponse{}
	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) AddOrUpdateProjectPermissionsInOrg(ctx context.Context, req *AddOrUpdateProjectPermissionsInOrgReq, opt ...requests.Option) (*AddOrUpdateProjectPermissionsInOrgResponse, error) {
	return AddOrUpdateProjectPermissionsInOrg(ctx, req, append(c, opt...)...)
}
type AddOrUpdateProjectPermissionsInOrgReq struct {
	_url string
	Org  string
	TeamSlug    string
	ProjectId   int64
	RequestBody AddOrUpdateProjectPermissionsInOrgReqBody
	InertiaPreview bool
}
func (r *AddOrUpdateProjectPermissionsInOrgReq) HTTPRequest(ctx context.Context, opt ...requests.Option) (*http.Request, error) {
	return buildHTTPRequest(ctx, buildHTTPRequestOptions{
		AllPreviews:      []string{"inertia"},
		Body:             r.RequestBody,
		ExplicitURL:      r._url,
		HeaderVals:       map[string]*string{"content-type": strPtr("application/json")},
		Method:           "PUT",
		Options:          opt,
		Previews:         map[string]bool{"inertia": r.InertiaPreview},
		RequiredPreviews: []string{"inertia"},
		URLPath:          fmt.Sprintf("/orgs/%v/teams/%v/projects/%v", r.Org, r.TeamSlug, r.ProjectId),
	})
}
func (r *AddOrUpdateProjectPermissionsInOrgReq) Rel(link string, resp *AddOrUpdateProjectPermissionsInOrgResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type AddOrUpdateProjectPermissionsInOrgReqBody struct {
	Permission *string `json:"permission,omitempty"`
}
type AddOrUpdateProjectPermissionsInOrgResponse struct {
	httpResponse *http.Response
}
func (r *AddOrUpdateProjectPermissionsInOrgResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}
func (r *AddOrUpdateProjectPermissionsInOrgResponse) ReadResponse(resp *http.Response) error {
	r.httpResponse = resp
	err := responseErrorCheck(resp, []int{204})
	if err != nil {
		return err
	}
	return nil
}
func AddOrUpdateProjectPermissionsLegacy(ctx context.Context, req *AddOrUpdateProjectPermissionsLegacyReq, opt ...requests.Option) (*AddOrUpdateProjectPermissionsLegacyResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(AddOrUpdateProjectPermissionsLegacyReq)
	}
	resp := &AddOrUpdateProjectPermissionsLegacyResponse{}
	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) AddOrUpdateProjectPermissionsLegacy(ctx context.Context, req *AddOrUpdateProjectPermissionsLegacyReq, opt ...requests.Option) (*AddOrUpdateProjectPermissionsLegacyResponse, error) {
	return AddOrUpdateProjectPermissionsLegacy(ctx, req, append(c, opt...)...)
}
type AddOrUpdateProjectPermissionsLegacyReq struct {
	_url        string
	TeamId      int64
	ProjectId   int64
	RequestBody AddOrUpdateProjectPermissionsLegacyReqBody
	InertiaPreview bool
}
func (r *AddOrUpdateProjectPermissionsLegacyReq) HTTPRequest(ctx context.Context, opt ...requests.Option) (*http.Request, error) {
	return buildHTTPRequest(ctx, buildHTTPRequestOptions{
		AllPreviews:      []string{"inertia"},
		Body:             r.RequestBody,
		ExplicitURL:      r._url,
		HeaderVals:       map[string]*string{"content-type": strPtr("application/json")},
		Method:           "PUT",
		Options:          opt,
		Previews:         map[string]bool{"inertia": r.InertiaPreview},
		RequiredPreviews: []string{"inertia"},
		URLPath:          fmt.Sprintf("/teams/%v/projects/%v", r.TeamId, r.ProjectId),
	})
}
func (r *AddOrUpdateProjectPermissionsLegacyReq) Rel(link string, resp *AddOrUpdateProjectPermissionsLegacyResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type AddOrUpdateProjectPermissionsLegacyReqBody struct {
	Permission *string `json:"permission,omitempty"`
}
type AddOrUpdateProjectPermissionsLegacyResponse struct {
	httpResponse *http.Response
}
func (r *AddOrUpdateProjectPermissionsLegacyResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}
func (r *AddOrUpdateProjectPermissionsLegacyResponse) ReadResponse(resp *http.Response) error {
	r.httpResponse = resp
	err := responseErrorCheck(resp, []int{204})
	if err != nil {
		return err
	}
	return nil
}
func AddOrUpdateRepoPermissionsInOrg(ctx context.Context, req *AddOrUpdateRepoPermissionsInOrgReq, opt ...requests.Option) (*AddOrUpdateRepoPermissionsInOrgResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(AddOrUpdateRepoPermissionsInOrgReq)
	}
	resp := &AddOrUpdateRepoPermissionsInOrgResponse{}
	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) AddOrUpdateRepoPermissionsInOrg(ctx context.Context, req *AddOrUpdateRepoPermissionsInOrgReq, opt ...requests.Option) (*AddOrUpdateRepoPermissionsInOrgResponse, error) {
	return AddOrUpdateRepoPermissionsInOrg(ctx, req, append(c, opt...)...)
}
type AddOrUpdateRepoPermissionsInOrgReq struct {
	_url string
	Org  string
	TeamSlug    string
	Owner       string
	Repo        string
	RequestBody AddOrUpdateRepoPermissionsInOrgReqBody
}
func (r *AddOrUpdateRepoPermissionsInOrgReq) HTTPRequest(ctx context.Context, opt ...requests.Option) (*http.Request, error) {
	return buildHTTPRequest(ctx, buildHTTPRequestOptions{
		Body:        r.RequestBody,
		ExplicitURL: r._url,
		HeaderVals:  map[string]*string{"content-type": strPtr("application/json")},
		Method:      "PUT",
		Options:     opt,
		URLPath:     fmt.Sprintf("/orgs/%v/teams/%v/repos/%v/%v", r.Org, r.TeamSlug, r.Owner, r.Repo),
	})
}