func (c *Runtime) GetProperties(objectId string, ownProperties bool, accessorPropertiesOnly bool, generatePreview bool) ([]*RuntimePropertyDescriptor, []*RuntimeInternalPropertyDescriptor, []*RuntimePrivatePropertyDescriptor, *RuntimeExceptionDetails, error) {
	var v RuntimeGetPropertiesParams
	v.ObjectId = objectId
	v.OwnProperties = ownProperties
	v.AccessorPropertiesOnly = accessorPropertiesOnly
	v.GeneratePreview = generatePreview
	return c.GetPropertiesWithParams(&v)
}
GetProperties - Returns properties of a given object. Object group of the result is inherited from the target object.
objectId - Identifier of the object to return properties for.
ownProperties - If true, returns properties belonging only to the element itself, not to its prototype chain.
accessorPropertiesOnly - If true, returns accessor properties (with getter/setter) only; internal properties are not returned either.
generatePreview - Whether preview should be generated for the results.
Returns -  result - Object properties. internalProperties - Internal object properties (only of the element itself). privateProperties - Object private properties. exceptionDetails - Exception details.
package gcdapi
import (
	"github.com/wirepair/gcd/gcdmessage"
)
type RuntimeRemoteObject struct {
	Type                string                `json:"type"`                           
	Subtype             string                `json:"subtype,omitempty"`              
	ClassName           string                `json:"className,omitempty"`            
	Value               interface{}           `json:"value,omitempty"`                
	UnserializableValue string                `json:"unserializableValue,omitempty"`  
	Description         string                `json:"description,omitempty"`          
	ObjectId            string                `json:"objectId,omitempty"`             
	Preview             *RuntimeObjectPreview `json:"preview,omitempty"`              
	CustomPreview       *RuntimeCustomPreview `json:"customPreview,omitempty"`        
}
type RuntimeCustomPreview struct {
	Header       string `json:"header"`                  
	BodyGetterId string `json:"bodyGetterId,omitempty"`  
}
type RuntimeObjectPreview struct {
	Type        string                    `json:"type"`                   
	Subtype     string                    `json:"subtype,omitempty"`      
	Description string                    `json:"description,omitempty"`  
	Overflow    bool                      `json:"overflow"`               
	Properties  []*RuntimePropertyPreview `json:"properties"`             
	Entries     []*RuntimeEntryPreview    `json:"entries,omitempty"`      
}
type RuntimePropertyPreview struct {
	Name         string                `json:"name"`                    
	Type         string                `json:"type"`                    
	Value        string                `json:"value,omitempty"`         
	ValuePreview *RuntimeObjectPreview `json:"valuePreview,omitempty"`  
	Subtype      string                `json:"subtype,omitempty"`       
}
type RuntimeEntryPreview struct {
	Key   *RuntimeObjectPreview `json:"key,omitempty"`  
	Value *RuntimeObjectPreview `json:"value"`          
}
type RuntimePropertyDescriptor struct {
	Name         string               `json:"name"`                 
	Value        *RuntimeRemoteObject `json:"value,omitempty"`      
	Writable     bool                 `json:"writable,omitempty"`   
	Get          *RuntimeRemoteObject `json:"get,omitempty"`        
	Set          *RuntimeRemoteObject `json:"set,omitempty"`        
	Configurable bool                 `json:"configurable"`         
	Enumerable   bool                 `json:"enumerable"`           
	WasThrown    bool                 `json:"wasThrown,omitempty"`  
	IsOwn        bool                 `json:"isOwn,omitempty"`      
	Symbol       *RuntimeRemoteObject `json:"symbol,omitempty"`     
}
type RuntimeInternalPropertyDescriptor struct {
	Name  string               `json:"name"`             
	Value *RuntimeRemoteObject `json:"value,omitempty"`  
}
type RuntimePrivatePropertyDescriptor struct {
	Name  string               `json:"name"`             
	Value *RuntimeRemoteObject `json:"value,omitempty"`  
	Get   *RuntimeRemoteObject `json:"get,omitempty"`    
	Set   *RuntimeRemoteObject `json:"set,omitempty"`    
}
type RuntimeCallArgument struct {
	Value               interface{} `json:"value,omitempty"`                
	UnserializableValue string      `json:"unserializableValue,omitempty"`  
	ObjectId            string      `json:"objectId,omitempty"`             
}
type RuntimeExecutionContextDescription struct {
	Id      int                    `json:"id"`                 
	Origin  string                 `json:"origin"`             
	Name    string                 `json:"name"`               
	AuxData map[string]interface{} `json:"auxData,omitempty"`  
}
type RuntimeExceptionDetails struct {
	ExceptionId        int                  `json:"exceptionId"`                   
	Text               string               `json:"text"`                          
	LineNumber         int                  `json:"lineNumber"`                    
	ColumnNumber       int                  `json:"columnNumber"`                  
	ScriptId           string               `json:"scriptId,omitempty"`            
	Url                string               `json:"url,omitempty"`                 
	StackTrace         *RuntimeStackTrace   `json:"stackTrace,omitempty"`          
	Exception          *RuntimeRemoteObject `json:"exception,omitempty"`           
	ExecutionContextId int                  `json:"executionContextId,omitempty"`  
}
type RuntimeCallFrame struct {
	FunctionName string `json:"functionName"`  
	ScriptId     string `json:"scriptId"`      
	Url          string `json:"url"`           
	LineNumber   int    `json:"lineNumber"`    
	ColumnNumber int    `json:"columnNumber"`  
}
type RuntimeStackTrace struct {
	Description string               `json:"description,omitempty"`  
	CallFrames  []*RuntimeCallFrame  `json:"callFrames"`             
	Parent      *RuntimeStackTrace   `json:"parent,omitempty"`       
	ParentId    *RuntimeStackTraceId `json:"parentId,omitempty"`     
}
type RuntimeStackTraceId struct {
	Id         string `json:"id"`                    
	DebuggerId string `json:"debuggerId,omitempty"`  
}
type RuntimeBindingCalledEvent struct {
	Method string `json:"method"`
	Params struct {
		Name               string `json:"name"`                
		Payload            string `json:"payload"`             
		ExecutionContextId int    `json:"executionContextId"`  
	} `json:"Params,omitempty"`
}
type RuntimeConsoleAPICalledEvent struct {
	Method string `json:"method"`
	Params struct {
		Type               string                 `json:"type"`                  
		Args               []*RuntimeRemoteObject `json:"args"`                  
		ExecutionContextId int                    `json:"executionContextId"`    
		Timestamp          float64                `json:"timestamp"`             
		StackTrace         *RuntimeStackTrace     `json:"stackTrace,omitempty"`  
		Context            string                 `json:"context,omitempty"`     
	} `json:"Params,omitempty"`
}
type RuntimeExceptionRevokedEvent struct {
	Method string `json:"method"`
	Params struct {
		Reason      string `json:"reason"`       
		ExceptionId int    `json:"exceptionId"`  
	} `json:"Params,omitempty"`
}
type RuntimeExceptionThrownEvent struct {
	Method string `json:"method"`
	Params struct {
		Timestamp        float64                  `json:"timestamp"`         
		ExceptionDetails *RuntimeExceptionDetails `json:"exceptionDetails"`  
	} `json:"Params,omitempty"`
}
type RuntimeExecutionContextCreatedEvent struct {
	Method string `json:"method"`
	Params struct {
		Context *RuntimeExecutionContextDescription `json:"context"`  
	} `json:"Params,omitempty"`
}
type RuntimeExecutionContextDestroyedEvent struct {
	Method string `json:"method"`
	Params struct {
		ExecutionContextId int `json:"executionContextId"`  
	} `json:"Params,omitempty"`
}
type RuntimeInspectRequestedEvent struct {
	Method string `json:"method"`
	Params struct {
		Object *RuntimeRemoteObject   `json:"object"`  
		Hints  map[string]interface{} `json:"hints"`   
	} `json:"Params,omitempty"`
}
type Runtime struct {
	target gcdmessage.ChromeTargeter
}
func NewRuntime(target gcdmessage.ChromeTargeter) *Runtime {
	c := &Runtime{target: target}
	return c
}
type RuntimeAwaitPromiseParams struct {
	PromiseObjectId string `json:"promiseObjectId"`
	ReturnByValue bool `json:"returnByValue,omitempty"`
	GeneratePreview bool `json:"generatePreview,omitempty"`
}
func (c *Runtime) AwaitPromiseWithParams(v *RuntimeAwaitPromiseParams) (*RuntimeRemoteObject, *RuntimeExceptionDetails, error) {
	resp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Runtime.awaitPromise", Params: v})
	if err != nil {
		return nil, nil, err
	}
	var chromeData struct {
		Result struct {
			Result           *RuntimeRemoteObject
			ExceptionDetails *RuntimeExceptionDetails
		}
	}
	if resp == nil {
		return nil, nil, &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return nil, nil, &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return nil, nil, err
	}
	return chromeData.Result.Result, chromeData.Result.ExceptionDetails, nil
}
func (c *Runtime) AwaitPromise(promiseObjectId string, returnByValue bool, generatePreview bool) (*RuntimeRemoteObject, *RuntimeExceptionDetails, error) {
	var v RuntimeAwaitPromiseParams
	v.PromiseObjectId = promiseObjectId
	v.ReturnByValue = returnByValue
	v.GeneratePreview = generatePreview
	return c.AwaitPromiseWithParams(&v)
}
type RuntimeCallFunctionOnParams struct {
	FunctionDeclaration string `json:"functionDeclaration"`
	ObjectId string `json:"objectId,omitempty"`
	Arguments []*RuntimeCallArgument `json:"arguments,omitempty"`
	Silent bool `json:"silent,omitempty"`
	ReturnByValue bool `json:"returnByValue,omitempty"`
	GeneratePreview bool `json:"generatePreview,omitempty"`
	UserGesture bool `json:"userGesture,omitempty"`
	AwaitPromise bool `json:"awaitPromise,omitempty"`
	ExecutionContextId int `json:"executionContextId,omitempty"`
	ObjectGroup string `json:"objectGroup,omitempty"`
}
func (c *Runtime) CallFunctionOnWithParams(v *RuntimeCallFunctionOnParams) (*RuntimeRemoteObject, *RuntimeExceptionDetails, error) {
	resp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Runtime.callFunctionOn", Params: v})
	if err != nil {
		return nil, nil, err
	}
	var chromeData struct {
		Result struct {
			Result           *RuntimeRemoteObject
			ExceptionDetails *RuntimeExceptionDetails
		}
	}
	if resp == nil {
		return nil, nil, &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return nil, nil, &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return nil, nil, err
	}
	return chromeData.Result.Result, chromeData.Result.ExceptionDetails, nil
}
func (c *Runtime) CallFunctionOn(functionDeclaration string, objectId string, arguments []*RuntimeCallArgument, silent bool, returnByValue bool, generatePreview bool, userGesture bool, awaitPromise bool, executionContextId int, objectGroup string) (*RuntimeRemoteObject, *RuntimeExceptionDetails, error) {
	var v RuntimeCallFunctionOnParams
	v.FunctionDeclaration = functionDeclaration
	v.ObjectId = objectId
	v.Arguments = arguments
	v.Silent = silent
	v.ReturnByValue = returnByValue
	v.GeneratePreview = generatePreview
	v.UserGesture = userGesture
	v.AwaitPromise = awaitPromise
	v.ExecutionContextId = executionContextId
	v.ObjectGroup = objectGroup
	return c.CallFunctionOnWithParams(&v)
}
type RuntimeCompileScriptParams struct {
	Expression string `json:"expression"`
	SourceURL string `json:"sourceURL"`
	PersistScript bool `json:"persistScript"`
	ExecutionContextId int `json:"executionContextId,omitempty"`
}
func (c *Runtime) CompileScriptWithParams(v *RuntimeCompileScriptParams) (string, *RuntimeExceptionDetails, error) {
	resp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Runtime.compileScript", Params: v})
	if err != nil {
		return "", nil, err
	}
	var chromeData struct {
		Result struct {
			ScriptId         string
			ExceptionDetails *RuntimeExceptionDetails
		}
	}
	if resp == nil {
		return "", nil, &gcdmessage.ChromeEmptyResponseErr{}
	}
	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.ScriptId, chromeData.Result.ExceptionDetails, nil
}
func (c *Runtime) CompileScript(expression string, sourceURL string, persistScript bool, executionContextId int) (string, *RuntimeExceptionDetails, error) {
	var v RuntimeCompileScriptParams
	v.Expression = expression
	v.SourceURL = sourceURL
	v.PersistScript = persistScript
	v.ExecutionContextId = executionContextId
	return c.CompileScriptWithParams(&v)
}
func (c *Runtime) Disable() (*gcdmessage.ChromeResponse, error) {
	return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Runtime.disable"})
}
func (c *Runtime) DiscardConsoleEntries() (*gcdmessage.ChromeResponse, error) {
	return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Runtime.discardConsoleEntries"})
}
func (c *Runtime) Enable() (*gcdmessage.ChromeResponse, error) {
	return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Runtime.enable"})
}
type RuntimeEvaluateParams struct {
	Expression string `json:"expression"`
	ObjectGroup string `json:"objectGroup,omitempty"`
	IncludeCommandLineAPI bool `json:"includeCommandLineAPI,omitempty"`
	Silent bool `json:"silent,omitempty"`
	ContextId int `json:"contextId,omitempty"`
	ReturnByValue bool `json:"returnByValue,omitempty"`
	GeneratePreview bool `json:"generatePreview,omitempty"`
	UserGesture bool `json:"userGesture,omitempty"`
	AwaitPromise bool `json:"awaitPromise,omitempty"`
	ThrowOnSideEffect bool `json:"throwOnSideEffect,omitempty"`
	Timeout float64 `json:"timeout,omitempty"`
	DisableBreaks bool `json:"disableBreaks,omitempty"`
	ReplMode bool `json:"replMode,omitempty"`
	AllowUnsafeEvalBlockedByCSP bool `json:"allowUnsafeEvalBlockedByCSP,omitempty"`
}
func (c *Runtime) EvaluateWithParams(v *RuntimeEvaluateParams) (*RuntimeRemoteObject, *RuntimeExceptionDetails, error) {
	resp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Runtime.evaluate", Params: v})
	if err != nil {
		return nil, nil, err
	}
	var chromeData struct {
		Result struct {
			Result           *RuntimeRemoteObject
			ExceptionDetails *RuntimeExceptionDetails
		}
	}
	if resp == nil {
		return nil, nil, &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return nil, nil, &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return nil, nil, err
	}
	return chromeData.Result.Result, chromeData.Result.ExceptionDetails, nil
}
func (c *Runtime) Evaluate(expression string, objectGroup string, includeCommandLineAPI bool, silent bool, contextId int, returnByValue bool, generatePreview bool, userGesture bool, awaitPromise bool, throwOnSideEffect bool, timeout float64, disableBreaks bool, replMode bool, allowUnsafeEvalBlockedByCSP bool) (*RuntimeRemoteObject, *RuntimeExceptionDetails, error) {
	var v RuntimeEvaluateParams
	v.Expression = expression
	v.ObjectGroup = objectGroup
	v.IncludeCommandLineAPI = includeCommandLineAPI
	v.Silent = silent
	v.ContextId = contextId
	v.ReturnByValue = returnByValue
	v.GeneratePreview = generatePreview
	v.UserGesture = userGesture
	v.AwaitPromise = awaitPromise
	v.ThrowOnSideEffect = throwOnSideEffect
	v.Timeout = timeout
	v.DisableBreaks = disableBreaks
	v.ReplMode = replMode
	v.AllowUnsafeEvalBlockedByCSP = allowUnsafeEvalBlockedByCSP
	return c.EvaluateWithParams(&v)
}
func (c *Runtime) GetIsolateId() (string, error) {
	resp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Runtime.getIsolateId"})
	if err != nil {
		return "", err
	}
	var chromeData struct {
		Result struct {
			Id string
		}
	}
	if resp == nil {
		return "", &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return "", &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return "", err
	}
	return chromeData.Result.Id, nil
}
func (c *Runtime) GetHeapUsage() (float64, float64, error) {
	resp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Runtime.getHeapUsage"})
	if err != nil {
		return 0, 0, err
	}
	var chromeData struct {
		Result struct {
			UsedSize  float64
			TotalSize float64
		}
	}
	if resp == nil {
		return 0, 0, &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return 0, 0, &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return 0, 0, err
	}
	return chromeData.Result.UsedSize, chromeData.Result.TotalSize, nil
}
type RuntimeGetPropertiesParams struct {
	ObjectId string `json:"objectId"`
	OwnProperties bool `json:"ownProperties,omitempty"`
	AccessorPropertiesOnly bool `json:"accessorPropertiesOnly,omitempty"`
	GeneratePreview bool `json:"generatePreview,omitempty"`
}
func (c *Runtime) GetPropertiesWithParams(v *RuntimeGetPropertiesParams) ([]*RuntimePropertyDescriptor, []*RuntimeInternalPropertyDescriptor, []*RuntimePrivatePropertyDescriptor, *RuntimeExceptionDetails, error) {
	resp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Runtime.getProperties", Params: v})
	if err != nil {
		return nil, nil, nil, nil, err
	}
	var chromeData struct {
		Result struct {
			Result             []*RuntimePropertyDescriptor
			InternalProperties []*RuntimeInternalPropertyDescriptor
			PrivateProperties  []*RuntimePrivatePropertyDescriptor
			ExceptionDetails   *RuntimeExceptionDetails
		}
	}
	if resp == nil {
		return nil, nil, nil, nil, &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return nil, nil, nil, nil, &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return nil, nil, nil, nil, err
	}
	return chromeData.Result.Result, chromeData.Result.InternalProperties, chromeData.Result.PrivateProperties, chromeData.Result.ExceptionDetails, nil
}