blob: d679cf3ac007890f1ad286a742798aeb9b9aac41 [file] [log] [blame] [edit]
// Code generated by cdpgen. DO NOT EDIT.
package fetch
import (
"github.com/mafredri/cdp/protocol/io"
"github.com/mafredri/cdp/protocol/network"
)
// EnableArgs represents the arguments for Enable in the Fetch domain.
type EnableArgs struct {
Patterns []RequestPattern `json:"patterns,omitempty"` // If specified, only requests matching any of these patterns will produce fetchRequested event and will be paused until clients response. If not set, all requests will be affected.
HandleAuthRequests *bool `json:"handleAuthRequests,omitempty"` // If true, authRequired events will be issued and requests will be paused expecting a call to continueWithAuth.
}
// NewEnableArgs initializes EnableArgs with the required arguments.
func NewEnableArgs() *EnableArgs {
args := new(EnableArgs)
return args
}
// SetPatterns sets the Patterns optional argument. If specified, only
// requests matching any of these patterns will produce fetchRequested
// event and will be paused until clients response. If not set, all
// requests will be affected.
func (a *EnableArgs) SetPatterns(patterns []RequestPattern) *EnableArgs {
a.Patterns = patterns
return a
}
// SetHandleAuthRequests sets the HandleAuthRequests optional argument.
// If true, authRequired events will be issued and requests will be
// paused expecting a call to continueWithAuth.
func (a *EnableArgs) SetHandleAuthRequests(handleAuthRequests bool) *EnableArgs {
a.HandleAuthRequests = &handleAuthRequests
return a
}
// FailRequestArgs represents the arguments for FailRequest in the Fetch domain.
type FailRequestArgs struct {
RequestID RequestID `json:"requestId"` // An id the client received in requestPaused event.
ErrorReason network.ErrorReason `json:"errorReason"` // Causes the request to fail with the given reason.
}
// NewFailRequestArgs initializes FailRequestArgs with the required arguments.
func NewFailRequestArgs(requestID RequestID, errorReason network.ErrorReason) *FailRequestArgs {
args := new(FailRequestArgs)
args.RequestID = requestID
args.ErrorReason = errorReason
return args
}
// FulfillRequestArgs represents the arguments for FulfillRequest in the Fetch domain.
type FulfillRequestArgs struct {
RequestID RequestID `json:"requestId"` // An id the client received in requestPaused event.
ResponseCode int `json:"responseCode"` // An HTTP response code.
ResponseHeaders []HeaderEntry `json:"responseHeaders"` // Response headers.
Body *string `json:"body,omitempty"` // A response body.
ResponsePhrase *string `json:"responsePhrase,omitempty"` // A textual representation of responseCode. If absent, a standard phrase mathcing responseCode is used.
}
// NewFulfillRequestArgs initializes FulfillRequestArgs with the required arguments.
func NewFulfillRequestArgs(requestID RequestID, responseCode int, responseHeaders []HeaderEntry) *FulfillRequestArgs {
args := new(FulfillRequestArgs)
args.RequestID = requestID
args.ResponseCode = responseCode
args.ResponseHeaders = responseHeaders
return args
}
// SetBody sets the Body optional argument. A response body.
func (a *FulfillRequestArgs) SetBody(body string) *FulfillRequestArgs {
a.Body = &body
return a
}
// SetResponsePhrase sets the ResponsePhrase optional argument. A
// textual representation of responseCode. If absent, a standard phrase
// mathcing responseCode is used.
func (a *FulfillRequestArgs) SetResponsePhrase(responsePhrase string) *FulfillRequestArgs {
a.ResponsePhrase = &responsePhrase
return a
}
// ContinueRequestArgs represents the arguments for ContinueRequest in the Fetch domain.
type ContinueRequestArgs struct {
RequestID RequestID `json:"requestId"` // An id the client received in requestPaused event.
URL *string `json:"url,omitempty"` // If set, the request url will be modified in a way that's not observable by page.
Method *string `json:"method,omitempty"` // If set, the request method is overridden.
PostData *string `json:"postData,omitempty"` // If set, overrides the post data in the request.
Headers []HeaderEntry `json:"headers,omitempty"` // If set, overrides the request headrts.
}
// NewContinueRequestArgs initializes ContinueRequestArgs with the required arguments.
func NewContinueRequestArgs(requestID RequestID) *ContinueRequestArgs {
args := new(ContinueRequestArgs)
args.RequestID = requestID
return args
}
// SetURL sets the URL optional argument. If set, the request url will
// be modified in a way that's not observable by page.
func (a *ContinueRequestArgs) SetURL(url string) *ContinueRequestArgs {
a.URL = &url
return a
}
// SetMethod sets the Method optional argument. If set, the request
// method is overridden.
func (a *ContinueRequestArgs) SetMethod(method string) *ContinueRequestArgs {
a.Method = &method
return a
}
// SetPostData sets the PostData optional argument. If set, overrides
// the post data in the request.
func (a *ContinueRequestArgs) SetPostData(postData string) *ContinueRequestArgs {
a.PostData = &postData
return a
}
// SetHeaders sets the Headers optional argument. If set, overrides
// the request headrts.
func (a *ContinueRequestArgs) SetHeaders(headers []HeaderEntry) *ContinueRequestArgs {
a.Headers = headers
return a
}
// ContinueWithAuthArgs represents the arguments for ContinueWithAuth in the Fetch domain.
type ContinueWithAuthArgs struct {
RequestID RequestID `json:"requestId"` // An id the client received in authRequired event.
AuthChallengeResponse AuthChallengeResponse `json:"authChallengeResponse"` // Response to with an authChallenge.
}
// NewContinueWithAuthArgs initializes ContinueWithAuthArgs with the required arguments.
func NewContinueWithAuthArgs(requestID RequestID, authChallengeResponse AuthChallengeResponse) *ContinueWithAuthArgs {
args := new(ContinueWithAuthArgs)
args.RequestID = requestID
args.AuthChallengeResponse = authChallengeResponse
return args
}
// GetResponseBodyArgs represents the arguments for GetResponseBody in the Fetch domain.
type GetResponseBodyArgs struct {
RequestID RequestID `json:"requestId"` // Identifier for the intercepted request to get body for.
}
// NewGetResponseBodyArgs initializes GetResponseBodyArgs with the required arguments.
func NewGetResponseBodyArgs(requestID RequestID) *GetResponseBodyArgs {
args := new(GetResponseBodyArgs)
args.RequestID = requestID
return args
}
// GetResponseBodyReply represents the return values for GetResponseBody in the Fetch domain.
type GetResponseBodyReply struct {
Body string `json:"body"` // Response body.
Base64Encoded bool `json:"base64Encoded"` // True, if content was sent as base64.
}
// TakeResponseBodyAsStreamArgs represents the arguments for TakeResponseBodyAsStream in the Fetch domain.
type TakeResponseBodyAsStreamArgs struct {
RequestID RequestID `json:"requestId"` // No description.
}
// NewTakeResponseBodyAsStreamArgs initializes TakeResponseBodyAsStreamArgs with the required arguments.
func NewTakeResponseBodyAsStreamArgs(requestID RequestID) *TakeResponseBodyAsStreamArgs {
args := new(TakeResponseBodyAsStreamArgs)
args.RequestID = requestID
return args
}
// TakeResponseBodyAsStreamReply represents the return values for TakeResponseBodyAsStream in the Fetch domain.
type TakeResponseBodyAsStreamReply struct {
Stream io.StreamHandle `json:"stream"` // No description.
}