2017-01-24 15:09:23 +00:00
|
|
|
// Package schema provides the Chrome Debugging Protocol
|
|
|
|
// commands, types, and events for the Chrome Schema domain.
|
|
|
|
//
|
|
|
|
// Provides information about the protocol schema.
|
|
|
|
//
|
|
|
|
// Generated by the chromedp-gen command.
|
|
|
|
package schema
|
|
|
|
|
|
|
|
// AUTOGENERATED. DO NOT EDIT.
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2017-01-26 07:28:34 +00:00
|
|
|
cdp "github.com/knq/chromedp/cdp"
|
2017-01-24 15:09:23 +00:00
|
|
|
"github.com/mailru/easyjson"
|
|
|
|
)
|
|
|
|
|
|
|
|
// GetDomainsParams returns supported domains.
|
|
|
|
type GetDomainsParams struct{}
|
|
|
|
|
|
|
|
// GetDomains returns supported domains.
|
|
|
|
func GetDomains() *GetDomainsParams {
|
|
|
|
return &GetDomainsParams{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetDomainsReturns return values.
|
|
|
|
type GetDomainsReturns struct {
|
|
|
|
Domains []*Domain `json:"domains,omitempty"` // List of supported domains.
|
|
|
|
}
|
|
|
|
|
|
|
|
// Do executes Schema.getDomains.
|
|
|
|
//
|
|
|
|
// returns:
|
|
|
|
// domains - List of supported domains.
|
2017-01-26 07:28:34 +00:00
|
|
|
func (p *GetDomainsParams) Do(ctxt context.Context, h cdp.FrameHandler) (domains []*Domain, err error) {
|
2017-01-24 15:09:23 +00:00
|
|
|
if ctxt == nil {
|
|
|
|
ctxt = context.Background()
|
|
|
|
}
|
|
|
|
|
|
|
|
// execute
|
2017-01-26 07:28:34 +00:00
|
|
|
ch := h.Execute(ctxt, cdp.CommandSchemaGetDomains, cdp.Empty)
|
2017-01-24 15:09:23 +00:00
|
|
|
|
|
|
|
// read response
|
|
|
|
select {
|
|
|
|
case res := <-ch:
|
|
|
|
if res == nil {
|
2017-01-26 07:28:34 +00:00
|
|
|
return nil, cdp.ErrChannelClosed
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch v := res.(type) {
|
|
|
|
case easyjson.RawMessage:
|
|
|
|
// unmarshal
|
|
|
|
var r GetDomainsReturns
|
|
|
|
err = easyjson.Unmarshal(v, &r)
|
|
|
|
if err != nil {
|
2017-01-26 07:28:34 +00:00
|
|
|
return nil, cdp.ErrInvalidResult
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return r.Domains, nil
|
|
|
|
|
|
|
|
case error:
|
|
|
|
return nil, v
|
|
|
|
}
|
|
|
|
|
|
|
|
case <-ctxt.Done():
|
2017-01-26 07:28:34 +00:00
|
|
|
return nil, cdp.ErrContextDone
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 07:28:34 +00:00
|
|
|
return nil, cdp.ErrUnknownResult
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|