func (c Client) IssuesAndPullRequests(ctx context.Context, req *IssuesAndPullRequestsReq, opt ...requests.Option) (*IssuesAndPullRequestsResponse, error) {
	return IssuesAndPullRequests(ctx, req, append(c, opt...)...)
}
/*
IssuesAndPullRequests performs requests for "search/issues-and-pull-requests"

Search issues and pull requests.

GET /search/issues

https://developer.github.com/v3/search/#search-issues-and-pull-requests

Non-nil errors will have the type *requests.RequestError, octo.ResponseError or url.Error.
package search
import (
	"context"
	"fmt"
	components "github.com/willabides/octo-go/components"
	requests "github.com/willabides/octo-go/requests"
	"net/http"
	"net/url"
	"strconv"
)
func Code(ctx context.Context, req *CodeReq, opt ...requests.Option) (*CodeResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(CodeReq)
	}
	resp := &CodeResponse{}
	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) Code(ctx context.Context, req *CodeReq, opt ...requests.Option) (*CodeResponse, error) {
	return Code(ctx, req, append(c, opt...)...)
}
type CodeReq struct {
	_url string
	Q *string
	Sort *string
	Order *string
	PerPage *int64
	Page *int64
}
func (r *CodeReq) HTTPRequest(ctx context.Context, opt ...requests.Option) (*http.Request, error) {
	query := url.Values{}
	if r.Q != nil {
		query.Set("q", *r.Q)
	}
	if r.Sort != nil {
		query.Set("sort", *r.Sort)
	}
	if r.Order != nil {
		query.Set("order", *r.Order)
	}
	if r.PerPage != nil {
		query.Set("per_page", strconv.FormatInt(*r.PerPage, 10))
	}
	if r.Page != nil {
		query.Set("page", strconv.FormatInt(*r.Page, 10))
	}
	return buildHTTPRequest(ctx, buildHTTPRequestOptions{
		ExplicitURL: r._url,
		HeaderVals:  map[string]*string{"accept": strPtr("application/json")},
		Method:      "GET",
		Options:     opt,
		URLPath:     fmt.Sprintf("/search/code"),
		URLQuery:    query,
	})
}
func (r *CodeReq) Rel(link string, resp *CodeResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type CodeResponseBody struct {
	IncompleteResults bool                              `json:"incomplete_results,omitempty"`
	Items             []components.CodeSearchResultItem `json:"items,omitempty"`
	TotalCount        int64                             `json:"total_count,omitempty"`
}
type CodeResponse struct {
	httpResponse *http.Response
	Data         CodeResponseBody
}
func (r *CodeResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}
func (r *CodeResponse) 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 Commits(ctx context.Context, req *CommitsReq, opt ...requests.Option) (*CommitsResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(CommitsReq)
	}
	resp := &CommitsResponse{}
	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) Commits(ctx context.Context, req *CommitsReq, opt ...requests.Option) (*CommitsResponse, error) {
	return Commits(ctx, req, append(c, opt...)...)
}
type CommitsReq struct {
	_url string
	Q *string
	Sort *string
	Order *string
	PerPage *int64
	Page *int64
	CloakPreview bool
}
func (r *CommitsReq) HTTPRequest(ctx context.Context, opt ...requests.Option) (*http.Request, error) {
	query := url.Values{}
	if r.Q != nil {
		query.Set("q", *r.Q)
	}
	if r.Sort != nil {
		query.Set("sort", *r.Sort)
	}
	if r.Order != nil {
		query.Set("order", *r.Order)
	}
	if r.PerPage != nil {
		query.Set("per_page", strconv.FormatInt(*r.PerPage, 10))
	}
	if r.Page != nil {
		query.Set("page", strconv.FormatInt(*r.Page, 10))
	}
	return buildHTTPRequest(ctx, buildHTTPRequestOptions{
		AllPreviews:      []string{"cloak"},
		ExplicitURL:      r._url,
		HeaderVals:       map[string]*string{"accept": strPtr("application/json")},
		Method:           "GET",
		Options:          opt,
		Previews:         map[string]bool{"cloak": r.CloakPreview},
		RequiredPreviews: []string{"cloak"},
		URLPath:          fmt.Sprintf("/search/commits"),
		URLQuery:         query,
	})
}
func (r *CommitsReq) Rel(link string, resp *CommitsResponse) bool {
	u := getRelLink(resp.HTTPResponse(), link)
	if u == "" {
		return false
	}
	r._url = u
	return true
}
type CommitsResponseBody struct {
	IncompleteResults bool                                `json:"incomplete_results,omitempty"`
	Items             []components.CommitSearchResultItem `json:"items,omitempty"`
	TotalCount        int64                               `json:"total_count,omitempty"`
}
type CommitsResponse struct {
	httpResponse *http.Response
	Data         CommitsResponseBody
}
func (r *CommitsResponse) HTTPResponse() *http.Response {
	return r.httpResponse
}
func (r *CommitsResponse) 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 IssuesAndPullRequests(ctx context.Context, req *IssuesAndPullRequestsReq, opt ...requests.Option) (*IssuesAndPullRequestsResponse, error) {
	opts := requests.BuildOptions(opt...)
	if req == nil {
		req = new(IssuesAndPullRequestsReq)
	}
	resp := &IssuesAndPullRequestsResponse{}
	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
}