func (r *CreateContentAttachmentResponse) 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
}
ReadResponse reads an *http.Response. Non-nil errors will have the type octo.ResponseError.
package apps
import (
	"context"
	"fmt"
	components "github.com/willabides/octo-go/components"
	requests "github.com/willabides/octo-go/requests"
	"net/http"
	"net/url"
	"strconv"
)
func AddRepoToInstallation(ctx context.Context, req *AddRepoToInstallationReq, opt ...requests.Option) (*AddRepoToInstallationResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(AddRepoToInstallationReq)
	}
	resp := &AddRepoToInstallationResponse{}
	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) AddRepoToInstallation(ctx context.Context, req *AddRepoToInstallationReq, opt ...requests.Option) (*AddRepoToInstallationResponse, error) {
	return AddRepoToInstallation(ctx, req, append(c, opt...)...)
}
type AddRepoToInstallationReq struct {
	_url string
	InstallationId int64
	RepositoryId int64
	MachineManPreview bool
}
func (r *AddRepoToInstallationReq) HTTPRequest(ctx context.Context, opt ...requests.Option) (*http.Request, error) {
	return buildHTTPRequest(ctx, buildHTTPRequestOptions{
		AllPreviews:      []string{"machine-man"},
		ExplicitURL:      r._url,
		Method:           "PUT",
		Options:          opt,
		Previews:         map[string]bool{"machine-man": r.MachineManPreview},
		RequiredPreviews: []string{"machine-man"},
		URLPath:          fmt.Sprintf("/user/installations/%v/repositories/%v", r.InstallationId, r.RepositoryId),
	})
}
func (r *AddRepoToInstallationReq) Rel(link string, resp *AddRepoToInstallationResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type AddRepoToInstallationResponse struct {
	httpResponse *http.Response
}
func (r *AddRepoToInstallationResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}
func (r *AddRepoToInstallationResponse) ReadResponse(resp *http.Response) error {
	r.httpResponse = resp
	err := responseErrorCheck(resp, []int{204, 304})
	if err != nil {
		return err
	}
	return nil
}
func CheckAuthorization(ctx context.Context, req *CheckAuthorizationReq, opt ...requests.Option) (*CheckAuthorizationResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(CheckAuthorizationReq)
	}
	resp := &CheckAuthorizationResponse{}
	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) CheckAuthorization(ctx context.Context, req *CheckAuthorizationReq, opt ...requests.Option) (*CheckAuthorizationResponse, error) {
	return CheckAuthorization(ctx, req, append(c, opt...)...)
}
type CheckAuthorizationReq struct {
	_url        string
	ClientId    string
	AccessToken string
}
func (r *CheckAuthorizationReq) 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/%v/tokens/%v", r.ClientId, r.AccessToken),
	})
}
func (r *CheckAuthorizationReq) Rel(link string, resp *CheckAuthorizationResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type CheckAuthorizationResponse struct {
	httpResponse *http.Response
	Data         components.Authorization
}
func (r *CheckAuthorizationResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}
func (r *CheckAuthorizationResponse) 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 CheckToken(ctx context.Context, req *CheckTokenReq, opt ...requests.Option) (*CheckTokenResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(CheckTokenReq)
	}
	resp := &CheckTokenResponse{}
	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) CheckToken(ctx context.Context, req *CheckTokenReq, opt ...requests.Option) (*CheckTokenResponse, error) {
	return CheckToken(ctx, req, append(c, opt...)...)
}
type CheckTokenReq struct {
	_url        string
	ClientId    string
	RequestBody CheckTokenReqBody
}
func (r *CheckTokenReq) 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("/applications/%v/token", r.ClientId),
	})
}
func (r *CheckTokenReq) Rel(link string, resp *CheckTokenResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type CheckTokenReqBody struct {
	AccessToken *string `json:"access_token"`
}
type CheckTokenResponse struct {
	httpResponse *http.Response
	Data         components.Authorization
}
func (r *CheckTokenResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}
func (r *CheckTokenResponse) 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 CreateContentAttachment(ctx context.Context, req *CreateContentAttachmentReq, opt ...requests.Option) (*CreateContentAttachmentResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(CreateContentAttachmentReq)
	}
	resp := &CreateContentAttachmentResponse{}
	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) CreateContentAttachment(ctx context.Context, req *CreateContentAttachmentReq, opt ...requests.Option) (*CreateContentAttachmentResponse, error) {
	return CreateContentAttachment(ctx, req, append(c, opt...)...)
}
type CreateContentAttachmentReq struct {
	_url string
	ContentReferenceId int64
	RequestBody        CreateContentAttachmentReqBody
	CorsairPreview bool
}
func (r *CreateContentAttachmentReq) HTTPRequest(ctx context.Context, opt ...requests.Option) (*http.Request, error) {
	return buildHTTPRequest(ctx, buildHTTPRequestOptions{
		AllPreviews: []string{"corsair"},
		Body:        r.RequestBody,
		ExplicitURL: r._url,
		HeaderVals: map[string]*string{
			"accept":       strPtr("application/json"),
			"content-type": strPtr("application/json"),
		},
		Method:           "POST",
		Options:          opt,
		Previews:         map[string]bool{"corsair": r.CorsairPreview},
		RequiredPreviews: []string{"corsair"},
		URLPath:          fmt.Sprintf("/content_references/%v/attachments", r.ContentReferenceId),
	})
}
func (r *CreateContentAttachmentReq) Rel(link string, resp *CreateContentAttachmentResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type CreateContentAttachmentReqBody struct {
	Body *string `json:"body"`
	Title *string `json:"title"`
}
type CreateContentAttachmentResponse struct {
	httpResponse *http.Response
	Data         components.ContentReferenceAttachment
}
func (r *CreateContentAttachmentResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}