Class: Google::Apis::DeveloperknowledgeV1::DeveloperKnowledgeService

Inherits:
Core::BaseService
  • Object
show all
Defined in:
lib/google/apis/developerknowledge_v1/service.rb

Overview

Developer Knowledge API

The Developer Knowledge API provides access to Google's developer knowledge.

Examples:

require 'google/apis/developerknowledge_v1'

Developerknowledge = Google::Apis::DeveloperknowledgeV1 # Alias the module
service = Developerknowledge::DeveloperKnowledgeService.new

See Also:

Constant Summary collapse

DEFAULT_ENDPOINT_TEMPLATE =
"https://developerknowledge.$UNIVERSE_DOMAIN$/"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDeveloperKnowledgeService

Returns a new instance of DeveloperKnowledgeService.



47
48
49
50
51
52
# File 'lib/google/apis/developerknowledge_v1/service.rb', line 47

def initialize
  super(DEFAULT_ENDPOINT_TEMPLATE, '',
        client_name: 'google-apis-developerknowledge_v1',
        client_version: Google::Apis::DeveloperknowledgeV1::GEM_VERSION)
  @batch_path = 'batch'
end

Instance Attribute Details

#keyString

Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

Returns:

  • (String)

    API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.



40
41
42
# File 'lib/google/apis/developerknowledge_v1/service.rb', line 40

def key
  @key
end

#quota_userString

Returns Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

Returns:

  • (String)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.



45
46
47
# File 'lib/google/apis/developerknowledge_v1/service.rb', line 45

def quota_user
  @quota_user
end

Instance Method Details

#batch_document_get(names: nil, view: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::DeveloperknowledgeV1::BatchGetDocumentsResponse

Retrieves multiple documents, each with its full Markdown content.

Parameters:

  • names (Array<String>, String) (defaults to: nil)

    Required. Specifies the names of the documents to retrieve. A maximum of 20 documents can be retrieved in a batch. The documents are returned in the same order as the names in the request. Format: documents/uri_without_scheme` Example:documents/docs.cloud.google.com/storage/docs/creating-buckets`

  • view (String) (defaults to: nil)

    Optional. Specifies the DocumentView of the document. If unspecified, DeveloperKnowledge.BatchGetDocuments defaults to DOCUMENT_VIEW_CONTENT.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



80
81
82
83
84
85
86
87
88
89
# File 'lib/google/apis/developerknowledge_v1/service.rb', line 80

def batch_document_get(names: nil, view: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/documents:batchGet', options)
  command.response_representation = Google::Apis::DeveloperknowledgeV1::BatchGetDocumentsResponse::Representation
  command.response_class = Google::Apis::DeveloperknowledgeV1::BatchGetDocumentsResponse
  command.query['names'] = names unless names.nil?
  command.query['view'] = view unless view.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_document(name, view: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::DeveloperknowledgeV1::Document

Retrieves a single document with its full Markdown content.

Parameters:

  • name (String)

    Required. Specifies the name of the document to retrieve. Format: documents/ uri_without_scheme`Example:documents/docs.cloud.google.com/storage/docs/ creating-buckets`

  • view (String) (defaults to: nil)

    Optional. Specifies the DocumentView of the document. If unspecified, DeveloperKnowledge.GetDocument defaults to DOCUMENT_VIEW_CONTENT.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



116
117
118
119
120
121
122
123
124
125
# File 'lib/google/apis/developerknowledge_v1/service.rb', line 116

def get_document(name, view: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+name}', options)
  command.response_representation = Google::Apis::DeveloperknowledgeV1::Document::Representation
  command.response_class = Google::Apis::DeveloperknowledgeV1::Document
  command.params['name'] = name unless name.nil?
  command.query['view'] = view unless view.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#search_document_document_chunks(filter: nil, page_size: nil, page_token: nil, query: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::DeveloperknowledgeV1::SearchDocumentChunksResponse

Searches for developer knowledge across Google's developer documentation. Returns DocumentChunks based on the user's query. There may be many chunks from the same Document. To retrieve full documents, use DeveloperKnowledge. GetDocument or DeveloperKnowledge.BatchGetDocuments with the DocumentChunk. parent returned in the SearchDocumentChunksResponse.results.

Parameters:

  • filter (String) (defaults to: nil)

    Optional. Applies a strict filter to the search results. The expression supports a subset of the syntax described at https://google.aip.dev/160. While SearchDocumentChunks returns DocumentChunks, the filter is applied to DocumentChunk.document fields. Supported fields for filtering: * data_source (STRING): The source of the document, e.g. docs.cloud.google.com. See https: //developers.google.com/knowledge/reference/corpus-reference for the complete list of data sources in the corpus. * update_time (TIMESTAMP): The timestamp of when the document was last meaningfully updated. A meaningful update is one that changes document's markdown content or metadata. * uri (STRING): The document URI, e.g. https://docs.cloud.google.com/bigquery/docs/tables. STRING fields support = (equals) and != (not equals) operators for exact match on the whole string. Partial match, prefix match, and regexp match are not supported. TIMESTAMP fields support =, <, <=, >, and >= operators. Timestamps must be in RFC-3339 format, e.g., "2025-01-01T00:00:00Z" . You can combine expressions using AND, OR, and NOT (or -) logical operators. OR has higher precedence than AND. Use parentheses for explicit precedence grouping. Examples: * data_source = "docs.cloud.google.com" OR data_source = "firebase.google.com" * data_source != "firebase.google.com" * update_time < "2024-01-01T00:00:00Z" * update_time >= "2025-01-22T00:00: 00Z" AND (data_source = "developer.chrome.com" OR data_source = "web.dev") * uri = "https://docs.cloud.google.com/release-notes" The filter string must not exceed 500 characters; values longer than 500 characters will result in an INVALID_ARGUMENT error.

  • page_size (Fixnum) (defaults to: nil)

    Optional. Specifies the maximum number of results to return. The service may return fewer than this value. If unspecified, at most 5 results will be returned. The maximum value is 20; values above 20 will result in an INVALID_ARGUMENT error.

  • page_token (String) (defaults to: nil)

    Optional. Contains a page token, received from a previous SearchDocumentChunks call. Provide this to retrieve the subsequent page.

  • query (String) (defaults to: nil)

    Required. Provides the raw query string provided by the user, such as "How to create a Cloud Storage bucket?".

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/google/apis/developerknowledge_v1/service.rb', line 184

def search_document_document_chunks(filter: nil, page_size: nil, page_token: nil, query: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/documents:searchDocumentChunks', options)
  command.response_representation = Google::Apis::DeveloperknowledgeV1::SearchDocumentChunksResponse::Representation
  command.response_class = Google::Apis::DeveloperknowledgeV1::SearchDocumentChunksResponse
  command.query['filter'] = filter unless filter.nil?
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['query'] = query unless query.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end