func (r *GetOrCreateAuthorizationForAppResponse) ReadResponse(resp *http.Response) error {
	r.httpResponse = resp
	err := responseErrorCheck(resp, []int{200, 201, 304})
	if err != nil {
		return err
	}
	if intInSlice(resp.StatusCode, []int{200, 201}) {
		err = unmarshalResponseBody(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 oauthauthorizations
import (
	"context"
	"fmt"
	components "github.com/willabides/octo-go/components"
	requests "github.com/willabides/octo-go/requests"
	"net/http"
	"net/url"
	"strconv"
)
func CreateAuthorization(ctx context.Context, req *CreateAuthorizationReq, opt ...requests.Option) (*CreateAuthorizationResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(CreateAuthorizationReq)
	}
	resp := &CreateAuthorizationResponse{}
	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) CreateAuthorization(ctx context.Context, req *CreateAuthorizationReq, opt ...requests.Option) (*CreateAuthorizationResponse, error) {
	return CreateAuthorization(ctx, req, append(c, opt...)...)
}
type CreateAuthorizationReq struct {
	_url        string
	RequestBody CreateAuthorizationReqBody
}
func (r *CreateAuthorizationReq) 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("/authorizations"),
	})
}
func (r *CreateAuthorizationReq) Rel(link string, resp *CreateAuthorizationResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type CreateAuthorizationReqBody struct {
	ClientId *string `json:"client_id,omitempty"`
	ClientSecret *string `json:"client_secret,omitempty"`
	Fingerprint *string `json:"fingerprint,omitempty"`
	Note *string `json:"note,omitempty"`
	NoteUrl *string `json:"note_url,omitempty"`
	Scopes []string `json:"scopes,omitempty"`
}
type CreateAuthorizationResponse struct {
	httpResponse *http.Response
	Data         components.Authorization
}
func (r *CreateAuthorizationResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}
func (r *CreateAuthorizationResponse) ReadResponse(resp *http.Response) error {
	r.httpResponse = resp
	err := responseErrorCheck(resp, []int{201, 304})
	if err != nil {
		return err
	}
	if intInSlice(resp.StatusCode, []int{201}) {
		err = unmarshalResponseBody(resp, &r.Data)
		if err != nil {
			return err
		}
	}
	return nil
}
func DeleteAuthorization(ctx context.Context, req *DeleteAuthorizationReq, opt ...requests.Option) (*DeleteAuthorizationResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(DeleteAuthorizationReq)
	}
	resp := &DeleteAuthorizationResponse{}
	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) DeleteAuthorization(ctx context.Context, req *DeleteAuthorizationReq, opt ...requests.Option) (*DeleteAuthorizationResponse, error) {
	return DeleteAuthorization(ctx, req, append(c, opt...)...)
}
type DeleteAuthorizationReq struct {
	_url string
	AuthorizationId int64
}
func (r *DeleteAuthorizationReq) HTTPRequest(ctx context.Context, opt ...requests.Option) (*http.Request, error) {
	return buildHTTPRequest(ctx, buildHTTPRequestOptions{
		ExplicitURL: r._url,
		Method:      "DELETE",
		Options:     opt,
		URLPath:     fmt.Sprintf("/authorizations/%v", r.AuthorizationId),
	})
}
func (r *DeleteAuthorizationReq) Rel(link string, resp *DeleteAuthorizationResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type DeleteAuthorizationResponse struct {
	httpResponse *http.Response
}
func (r *DeleteAuthorizationResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}
func (r *DeleteAuthorizationResponse) ReadResponse(resp *http.Response) error {
	r.httpResponse = resp
	err := responseErrorCheck(resp, []int{204, 304})
	if err != nil {
		return err
	}
	return nil
}
func DeleteGrant(ctx context.Context, req *DeleteGrantReq, opt ...requests.Option) (*DeleteGrantResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(DeleteGrantReq)
	}
	resp := &DeleteGrantResponse{}
	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) DeleteGrant(ctx context.Context, req *DeleteGrantReq, opt ...requests.Option) (*DeleteGrantResponse, error) {
	return DeleteGrant(ctx, req, append(c, opt...)...)
}
type DeleteGrantReq struct {
	_url string
	GrantId int64
}
func (r *DeleteGrantReq) HTTPRequest(ctx context.Context, opt ...requests.Option) (*http.Request, error) {
	return buildHTTPRequest(ctx, buildHTTPRequestOptions{
		ExplicitURL: r._url,
		Method:      "DELETE",
		Options:     opt,
		URLPath:     fmt.Sprintf("/applications/grants/%v", r.GrantId),
	})
}
func (r *DeleteGrantReq) Rel(link string, resp *DeleteGrantResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type DeleteGrantResponse struct {
	httpResponse *http.Response
}
func (r *DeleteGrantResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}
func (r *DeleteGrantResponse) ReadResponse(resp *http.Response) error {
	r.httpResponse = resp
	err := responseErrorCheck(resp, []int{204, 304})
	if err != nil {
		return err
	}
	return nil
}
func GetAuthorization(ctx context.Context, req *GetAuthorizationReq, opt ...requests.Option) (*GetAuthorizationResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(GetAuthorizationReq)
	}
	resp := &GetAuthorizationResponse{}
	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) GetAuthorization(ctx context.Context, req *GetAuthorizationReq, opt ...requests.Option) (*GetAuthorizationResponse, error) {
	return GetAuthorization(ctx, req, append(c, opt...)...)
}
type GetAuthorizationReq struct {
	_url string
	AuthorizationId int64
}
func (r *GetAuthorizationReq) HTTPRequest(ctx context.Context, opt ...requests.Option) (*http.Request, error) {
	return buildHTTPRequest(ctx, buildHTTPRequestOptions{
		ExplicitURL: r._url,
		HeaderVals:  map[string]*string{"accept": strPtr("application/json")},
		Method:      "GET",
		Options:     opt,
		URLPath:     fmt.Sprintf("/authorizations/%v", r.AuthorizationId),
	})
}
func (r *GetAuthorizationReq) Rel(link string, resp *GetAuthorizationResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type GetAuthorizationResponse struct {
	httpResponse *http.Response
	Data         components.Authorization
}
func (r *GetAuthorizationResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}
func (r *GetAuthorizationResponse) ReadResponse(resp *http.Response) error {
	r.httpResponse = resp
	err := responseErrorCheck(resp, []int{200, 304})
	if err != nil {
		return err
	}
	if intInSlice(resp.StatusCode, []int{200}) {
		err = unmarshalResponseBody(resp, &r.Data)
		if err != nil {
			return err
		}
	}
	return nil
}
func GetGrant(ctx context.Context, req *GetGrantReq, opt ...requests.Option) (*GetGrantResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(GetGrantReq)
	}
	resp := &GetGrantResponse{}
	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) GetGrant(ctx context.Context, req *GetGrantReq, opt ...requests.Option) (*GetGrantResponse, error) {
	return GetGrant(ctx, req, append(c, opt...)...)
}
type GetGrantReq struct {
	_url string
	GrantId int64
}
func (r *GetGrantReq) HTTPRequest(ctx context.Context, opt ...requests.Option) (*http.Request, error) {
	return buildHTTPRequest(ctx, buildHTTPRequestOptions{
		ExplicitURL: r._url,
		HeaderVals:  map[string]*string{"accept": strPtr("application/json")},
		Method:      "GET",
		Options:     opt,
		URLPath:     fmt.Sprintf("/applications/grants/%v", r.GrantId),
	})
}
func (r *GetGrantReq) Rel(link string, resp *GetGrantResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type GetGrantResponse struct {
	httpResponse *http.Response
	Data         components.ApplicationGrant
}
func (r *GetGrantResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}
func (r *GetGrantResponse) ReadResponse(resp *http.Response) error {
	r.httpResponse = resp
	err := responseErrorCheck(resp, []int{200, 304})
	if err != nil {
		return err
	}
	if intInSlice(resp.StatusCode, []int{200}) {
		err = unmarshalResponseBody(resp, &r.Data)
		if err != nil {
			return err
		}
	}
	return nil
}
func GetOrCreateAuthorizationForApp(ctx context.Context, req *GetOrCreateAuthorizationForAppReq, opt ...requests.Option) (*GetOrCreateAuthorizationForAppResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(GetOrCreateAuthorizationForAppReq)
	}
	resp := &GetOrCreateAuthorizationForAppResponse{}
	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) GetOrCreateAuthorizationForApp(ctx context.Context, req *GetOrCreateAuthorizationForAppReq, opt ...requests.Option) (*GetOrCreateAuthorizationForAppResponse, error) {
	return GetOrCreateAuthorizationForApp(ctx, req, append(c, opt...)...)
}
type GetOrCreateAuthorizationForAppReq struct {
	_url        string
	ClientId    string
	RequestBody GetOrCreateAuthorizationForAppReqBody
}
func (r *GetOrCreateAuthorizationForAppReq) 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("/authorizations/clients/%v", r.ClientId),
	})
}
func (r *GetOrCreateAuthorizationForAppReq) Rel(link string, resp *GetOrCreateAuthorizationForAppResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type GetOrCreateAuthorizationForAppReqBody struct {
	ClientSecret *string `json:"client_secret"`
	Fingerprint *string `json:"fingerprint,omitempty"`
	Note *string `json:"note,omitempty"`
	NoteUrl *string `json:"note_url,omitempty"`
	Scopes []string `json:"scopes,omitempty"`
}
type GetOrCreateAuthorizationForAppResponse struct {
	httpResponse *http.Response
	Data         components.Authorization
}
func (r *GetOrCreateAuthorizationForAppResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}