Documentation ¶
Overview ¶
Package searchconsole provides access to the Google Search Console URL Testing Tools API.
For product documentation, see: https://developers.google.com/webmaster-tools/search-console-api/
Creating a client ¶
Usage example:
import "google.golang.org/api/searchconsole/v1" ... ctx := context.Background() searchconsoleService, err := searchconsole.NewService(ctx)
In this example, Google Application Default Credentials are used for authentication.
For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
Other authentication options ¶
To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
searchconsoleService, err := searchconsole.NewService(ctx, option.WithAPIKey("AIza..."))
To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
config := &oauth2.Config{...} // ... token, err := config.Exchange(ctx, ...) searchconsoleService, err := searchconsole.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
See https://godoc.org/google.golang.org/api/option/ for details on options.
Index ¶
- type BlockedResource
- type Image
- type MobileFriendlyIssue
- type ResourceIssue
- type RunMobileFriendlyTestRequest
- type RunMobileFriendlyTestResponse
- type Service
- type TestStatus
- type UrlTestingToolsMobileFriendlyTestRunCall
- func (c *UrlTestingToolsMobileFriendlyTestRunCall) Context(ctx context.Context) *UrlTestingToolsMobileFriendlyTestRunCall
- func (c *UrlTestingToolsMobileFriendlyTestRunCall) Do(opts ...googleapi.CallOption) (*RunMobileFriendlyTestResponse, error)
- func (c *UrlTestingToolsMobileFriendlyTestRunCall) Fields(s ...googleapi.Field) *UrlTestingToolsMobileFriendlyTestRunCall
- func (c *UrlTestingToolsMobileFriendlyTestRunCall) Header() http.Header
- type UrlTestingToolsMobileFriendlyTestService
- type UrlTestingToolsService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockedResource ¶
type BlockedResource struct { // Url: URL of the blocked resource. Url string `json:"url,omitempty"` // ForceSendFields is a list of field names (e.g. "Url") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Url") to include in API // requests with the JSON null value. By default, fields with empty // values are omitted from API requests. However, any field with an // empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` }
BlockedResource: Blocked resource.
func (*BlockedResource) MarshalJSON ¶
func (s *BlockedResource) MarshalJSON() ([]byte, error)
type Image ¶
type Image struct { // Data: Image data in format determined by the mime type. Currently, // the format // will always be "image/png", but this might change in the future. Data string `json:"data,omitempty"` // MimeType: The mime-type of the image data. MimeType string `json:"mimeType,omitempty"` // ForceSendFields is a list of field names (e.g. "Data") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Data") to include in API // requests with the JSON null value. By default, fields with empty // values are omitted from API requests. However, any field with an // empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` }
Image: Describe image data.
func (*Image) MarshalJSON ¶
type MobileFriendlyIssue ¶
type MobileFriendlyIssue struct { // Rule: Rule violated. // // Possible values: // "MOBILE_FRIENDLY_RULE_UNSPECIFIED" - Unknown rule. Sorry, we don't // have any description for the rule that was // broken. // "USES_INCOMPATIBLE_PLUGINS" - Plugins incompatible with mobile // devices are being used. [Learn // more] // (https://support.google.com/webmasters/answer/6352293#flash_usag // e). // "CONFIGURE_VIEWPORT" - Viewsport is not specified using the meta // viewport tag. [Learn // more] // (https://support.google.com/webmasters/answer/6352293#viewport_n // ot_configured). // "FIXED_WIDTH_VIEWPORT" - Viewport defined to a fixed width. [Learn // more] // (https://support.google.com/webmasters/answer/6352293#fixed-widt // h_viewport). // "SIZE_CONTENT_TO_VIEWPORT" - Content not sized to viewport. [Learn // more] // (https://support.google.com/webmasters/answer/6352293#content_no // t_sized_to_viewport). // "USE_LEGIBLE_FONT_SIZES" - Font size is too small for easy reading // on a small screen. [Learn // More] // (https://support.google.com/webmasters/answer/6352293#small_font // _size). // "TAP_TARGETS_TOO_CLOSE" - Touch elements are too close to each // other. [Learn // more] // (https://support.google.com/webmasters/answer/6352293#touch_elem // ents_too_close). Rule string `json:"rule,omitempty"` // ForceSendFields is a list of field names (e.g. "Rule") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Rule") to include in API // requests with the JSON null value. By default, fields with empty // values are omitted from API requests. However, any field with an // empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` }
MobileFriendlyIssue: Mobile-friendly issue.
func (*MobileFriendlyIssue) MarshalJSON ¶
func (s *MobileFriendlyIssue) MarshalJSON() ([]byte, error)
type ResourceIssue ¶
type ResourceIssue struct { // BlockedResource: Describes a blocked resource issue. BlockedResource *BlockedResource `json:"blockedResource,omitempty"` // ForceSendFields is a list of field names (e.g. "BlockedResource") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "BlockedResource") to // include in API requests with the JSON null value. By default, fields // with empty values are omitted from API requests. However, any field // with an empty value appearing in NullFields will be sent to the // server as null. It is an error if a field in this list has a // non-empty value. This may be used to include null fields in Patch // requests. NullFields []string `json:"-"` }
ResourceIssue: Information about a resource with issue.
func (*ResourceIssue) MarshalJSON ¶
func (s *ResourceIssue) MarshalJSON() ([]byte, error)
type RunMobileFriendlyTestRequest ¶
type RunMobileFriendlyTestRequest struct { // RequestScreenshot: Whether or not screenshot is requested. Default is // false. RequestScreenshot bool `json:"requestScreenshot,omitempty"` // Url: URL for inspection. Url string `json:"url,omitempty"` // ForceSendFields is a list of field names (e.g. "RequestScreenshot") // to unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "RequestScreenshot") to // include in API requests with the JSON null value. By default, fields // with empty values are omitted from API requests. However, any field // with an empty value appearing in NullFields will be sent to the // server as null. It is an error if a field in this list has a // non-empty value. This may be used to include null fields in Patch // requests. NullFields []string `json:"-"` }
RunMobileFriendlyTestRequest: Mobile-friendly test request.
func (*RunMobileFriendlyTestRequest) MarshalJSON ¶
func (s *RunMobileFriendlyTestRequest) MarshalJSON() ([]byte, error)
type RunMobileFriendlyTestResponse ¶
type RunMobileFriendlyTestResponse struct { // MobileFriendliness: Test verdict, whether the page is mobile friendly // or not. // // Possible values: // "MOBILE_FRIENDLY_TEST_RESULT_UNSPECIFIED" - Internal error when // running this test. Please try running the test again. // "MOBILE_FRIENDLY" - The page is mobile friendly. // "NOT_MOBILE_FRIENDLY" - The page is not mobile friendly. MobileFriendliness string `json:"mobileFriendliness,omitempty"` // MobileFriendlyIssues: List of mobile-usability issues. MobileFriendlyIssues []*MobileFriendlyIssue `json:"mobileFriendlyIssues,omitempty"` // ResourceIssues: Information about embedded resources issues. ResourceIssues []*ResourceIssue `json:"resourceIssues,omitempty"` // Screenshot: Screenshot of the requested URL. Screenshot *Image `json:"screenshot,omitempty"` // TestStatus: Final state of the test, can be either complete or an // error. TestStatus *TestStatus `json:"testStatus,omitempty"` // ServerResponse contains the HTTP response code and headers from the // server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "MobileFriendliness") // to unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "MobileFriendliness") to // include in API requests with the JSON null value. By default, fields // with empty values are omitted from API requests. However, any field // with an empty value appearing in NullFields will be sent to the // server as null. It is an error if a field in this list has a // non-empty value. This may be used to include null fields in Patch // requests. NullFields []string `json:"-"` }
RunMobileFriendlyTestResponse: Mobile-friendly test response, including mobile-friendly issues and resource issues.
func (*RunMobileFriendlyTestResponse) MarshalJSON ¶
func (s *RunMobileFriendlyTestResponse) MarshalJSON() ([]byte, error)
type Service ¶
type Service struct { BasePath string // API endpoint base URL UserAgent string // optional additional User-Agent fragment UrlTestingTools *UrlTestingToolsService // contains filtered or unexported fields }
func New
deprecated
New creates a new Service. It uses the provided http.Client for requests.
Deprecated: please use NewService instead. To provide a custom HTTP client, use option.WithHTTPClient. If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
func NewService ¶
NewService creates a new Service.
type TestStatus ¶
type TestStatus struct { // Details: Error details if applicable. Details string `json:"details,omitempty"` // Status: Status of the test. // // Possible values: // "TEST_STATUS_UNSPECIFIED" - Internal error when running this test. // Please try running the test again. // "COMPLETE" - Inspection has completed without errors. // "INTERNAL_ERROR" - Inspection terminated in an error state. This // indicates a problem in // Google's infrastructure, not a user error. Please try again later. // "PAGE_UNREACHABLE" - Google can not access the URL because of a // user error such as a robots.txt // blockage, a 403 or 500 code etc. Please make sure that the URL // provided is // accessible by Googlebot and is not password protected. Status string `json:"status,omitempty"` // ForceSendFields is a list of field names (e.g. "Details") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Details") to include in // API requests with the JSON null value. By default, fields with empty // values are omitted from API requests. However, any field with an // empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` }
TestStatus: Final state of the test, including error details if necessary.
func (*TestStatus) MarshalJSON ¶
func (s *TestStatus) MarshalJSON() ([]byte, error)
type UrlTestingToolsMobileFriendlyTestRunCall ¶
type UrlTestingToolsMobileFriendlyTestRunCall struct {
// contains filtered or unexported fields
}
func (*UrlTestingToolsMobileFriendlyTestRunCall) Context ¶
func (c *UrlTestingToolsMobileFriendlyTestRunCall) Context(ctx context.Context) *UrlTestingToolsMobileFriendlyTestRunCall
Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.
func (*UrlTestingToolsMobileFriendlyTestRunCall) Do ¶
func (c *UrlTestingToolsMobileFriendlyTestRunCall) Do(opts ...googleapi.CallOption) (*RunMobileFriendlyTestResponse, error)
Do executes the "searchconsole.urlTestingTools.mobileFriendlyTest.run" call. Exactly one of *RunMobileFriendlyTestResponse or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *RunMobileFriendlyTestResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*UrlTestingToolsMobileFriendlyTestRunCall) Fields ¶
func (c *UrlTestingToolsMobileFriendlyTestRunCall) Fields(s ...googleapi.Field) *UrlTestingToolsMobileFriendlyTestRunCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.
func (*UrlTestingToolsMobileFriendlyTestRunCall) Header ¶
func (c *UrlTestingToolsMobileFriendlyTestRunCall) Header() http.Header
Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.
type UrlTestingToolsMobileFriendlyTestService ¶
type UrlTestingToolsMobileFriendlyTestService struct {
// contains filtered or unexported fields
}
func NewUrlTestingToolsMobileFriendlyTestService ¶
func NewUrlTestingToolsMobileFriendlyTestService(s *Service) *UrlTestingToolsMobileFriendlyTestService
func (*UrlTestingToolsMobileFriendlyTestService) Run ¶
func (r *UrlTestingToolsMobileFriendlyTestService) Run(runmobilefriendlytestrequest *RunMobileFriendlyTestRequest) *UrlTestingToolsMobileFriendlyTestRunCall
Run: Runs Mobile-Friendly Test for a given URL.
type UrlTestingToolsService ¶
type UrlTestingToolsService struct { MobileFriendlyTest *UrlTestingToolsMobileFriendlyTestService // contains filtered or unexported fields }
func NewUrlTestingToolsService ¶
func NewUrlTestingToolsService(s *Service) *UrlTestingToolsService