// NewRequestDatabaseArgs initializes RequestDatabaseArgs with the required arguments.
766430
func NewRequestDatabaseArgs(securityOrigin string, databaseName string) *RequestDatabaseArgs {
	args := new(RequestDatabaseArgs)
	args.SecurityOrigin = securityOrigin
	args.DatabaseName = databaseName
	return args
}
194750
func NewRequestDatabaseNamesArgs(securityOrigin string) *RequestDatabaseNamesArgs {
	args := new(RequestDatabaseNamesArgs)
	args.SecurityOrigin = securityOrigin
	return args
}
953464
func (d *domainClient) RequestDatabaseNames(ctx context.Context, args *RequestDatabaseNamesArgs) (reply *RequestDatabaseNamesReply, err error) {
	reply = new(RequestDatabaseNamesReply)
	if args != nil {
		err = rpcc.Invoke(ctx, "IndexedDB.requestDatabaseNames", args, reply, d.conn)
	} else {
		err = rpcc.Invoke(ctx, "IndexedDB.requestDatabaseNames", nil, reply, d.conn)
	}
	if err != nil {
		err = &internal.OpError{Domain: "IndexedDB", Op: "RequestDatabaseNames", Err: err}
	}
	return
}
843275
func (DefaultRequestFactory) NewRequest(
	method, urlStr string, body io.Reader) (*http.Request, error) {
	return http.NewRequest(method, urlStr, body)
}
1216909
func NewGetMetadataArgs(securityOrigin string, databaseName string, objectStoreName string) *GetMetadataArgs {
	args := new(GetMetadataArgs)
	args.SecurityOrigin = securityOrigin
	args.DatabaseName = databaseName
	args.ObjectStoreName = objectStoreName
	return args
}
1070778
func NewPaperDocCreateArgs(ImportFormat *ImportFormat) *PaperDocCreateArgs {
	s := new(PaperDocCreateArgs)
	s.ImportFormat = ImportFormat
	return s
}
782149
func (c *Client) NewRequest(method, path string) *Request {
	r := &Request{
		method: method,
		url:    c.Config.ApiAddress + path,
		params: make(map[string][]string),
	}
	return r
}
400699
func (fw *Framework) NewRequest(version string, agent string, senderid string, callerid string, ttl int, requestid string, collective string) (request protocol.Request, err error) {
	switch version {
	case protocol.RequestV1:
		request, err = v1.NewRequest(agent, senderid, callerid, ttl, requestid, collective)
	default:
		err = fmt.Errorf("Do not know how to create a Request version %s", version)
	}

	return
}
1071354
func NewRequestNodeArgs(objectID runtime.RemoteObjectID) *RequestNodeArgs {
	args := new(RequestNodeArgs)
	args.ObjectID = objectID
	return args
}
44917
func (c *Client) NewRequest(params map[string]string, method string, action string) (*http.Request, error) {
	p := url.Values{}
	u, err := url.Parse(c.URL)

	if err != nil {
		return nil, fmt.Errorf("Error parsing base URL: %s", err)
	}

	// Build up our request parameters
	for k, v := range params {
		p.Add(k, v)
	}

	// Add authentication details
	p.Add("tkn", c.Token)
	p.Add("email", c.Email)

	// The "action" to take against the API
	p.Add("a", action)

	// Add the params to our URL
	u.RawQuery = p.Encode()

	// Build the request
	req, err := http.NewRequest(method, u.String(), nil)

	if err != nil {
		return nil, fmt.Errorf("Error creating request: %s", err)
	}

	return req, nil

}
235311
func newRequest(server, method string, URI string, body io.Reader) (*http.Request, error) {
	URL := fmt.Sprintf("%s%s", server, URI)
	req, err := http.NewRequest(method, URL, body)
	if err != nil {
		return nil, err
	}

	req.Header.Set("Accept", "application/json")
	req.Header.Set("Content-Type", "application/json")

	return req, nil
}
100386
func (c *httpClient) CreateDatabase(ctx context.Context, database string) error {
	query := fmt.Sprintf(`CREATE DATABASE "%s"`,
		escapeIdentifier.Replace(database))

	req, err := c.makeQueryRequest(query)

	resp, err := c.client.Do(req.WithContext(ctx))
	if err != nil {
		return err
	}
	defer resp.Body.Close()

	queryResp := &QueryResponse{}
	dec := json.NewDecoder(resp.Body)
	err = dec.Decode(queryResp)

	if err != nil {
		if resp.StatusCode == 200 {
			c.createdDatabases[database] = true
			return nil
		}

		return &APIError{
			StatusCode: resp.StatusCode,
			Title:      resp.Status,
		}
	}

	// Even with a 200 response there can be an error
	if resp.StatusCode == http.StatusOK && queryResp.Error() == "" {
		c.createdDatabases[database] = true
		return nil
	}

	return &APIError{
		StatusCode:  resp.StatusCode,
		Title:       resp.Status,
		Description: queryResp.Error(),
	}
}
1336236
func NewBadRequestf(cause error, context interface{}, format string, args ...interface{}) Error {
	if format == "" {
		format = fmt.Sprintf("Bad Request: %s", context)
	}
	return makeErrorf(BadRequestError, cause, format, args...)
}
544957
func NewRequestCacheNamesArgs(securityOrigin string) *RequestCacheNamesArgs {
	args := new(RequestCacheNamesArgs)
	args.SecurityOrigin = securityOrigin
	return args
}
134236
func NewMonitorArgs(database string, value interface{}, requests map[string]MonitorRequest) []interface{} {
	return []interface{}{database, value, requests}
}
1194098
func NewQuerySelectorArgs(nodeID NodeID, selector string) *QuerySelectorArgs {
	args := new(QuerySelectorArgs)
	args.NodeID = nodeID
	args.Selector = selector
	return args
}
34221
func (c *IndexedDB) RequestDatabaseWithParams(v *IndexedDBRequestDatabaseParams) (*IndexedDBDatabaseWithObjectStores, error) {
	resp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "IndexedDB.requestDatabase", Params: v})
	if err != nil {
		return nil, err
	}

	var chromeData struct {
		Result struct {
			DatabaseWithObjectStores *IndexedDBDatabaseWithObjectStores
		}
	}

	if resp == nil {
		return nil, &gcdmessage.ChromeEmptyResponseErr{}
	}

	// test if error first
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return nil, &gcdmessage.ChromeRequestErr{Resp: cerr}
	}

	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return nil, err
	}

	return chromeData.Result.DatabaseWithObjectStores, nil
}