google-api-ruby-client/generated/google/apis/people_v1/service.rb

203 lines
11 KiB
Ruby
Raw Normal View History

2016-02-10 21:57:13 +00:00
# Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
require 'google/apis/core/base_service'
require 'google/apis/core/json_representation'
require 'google/apis/core/hashable'
require 'google/apis/errors'
module Google
module Apis
module PeopleV1
# Google People API
#
2017-02-13 23:28:52 +00:00
# Provides access to information about profiles and contacts.
2016-02-10 21:57:13 +00:00
#
# @example
# require 'google/apis/people_v1'
#
# People = Google::Apis::PeopleV1 # Alias the module
# service = People::PeopleService.new
#
# @see https://developers.google.com/people/
class PeopleService < Google::Apis::Core::BaseService
# @return [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.
attr_accessor :key
# @return [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.
attr_accessor :quota_user
def initialize
super('https://people.googleapis.com/', '')
end
2017-03-10 21:11:09 +00:00
# Provides information about a list of specific people by specifying a list
# of requested resource names. Use `people/me` to indicate the authenticated
# user.
2016-02-10 21:57:13 +00:00
# @param [String] request_mask_include_field
2017-02-13 23:28:52 +00:00
# Comma-separated list of fields to be included in the response. Omitting
# this field will include all fields except for connections.list requests,
# which have a default mask that includes common fields like metadata, name,
# photo, and profile url.
# Each path should start with `person.`: for example, `person.names` or
# `person.photos`.
2017-03-10 21:11:09 +00:00
# @param [Array<String>, String] resource_names
# The resource name, such as one returned by
# [`people.connections.list`](/people/api/rest/v1/people.connections/list),
# of one of the people to provide information about. You can include this
# parameter up to 50 times in one request.
2016-02-10 21:57:13 +00:00
# @param [String] quota_user
# 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.
2017-03-27 22:14:47 +00:00
# @param [String] fields
# Selector specifying which fields to include in a partial response.
2016-02-10 21:57:13 +00:00
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
2017-03-10 21:11:09 +00:00
# @yieldparam result [Google::Apis::PeopleV1::GetPeopleResponse] parsed result object
2016-02-10 21:57:13 +00:00
# @yieldparam err [StandardError] error object if request failed
#
2017-03-10 21:11:09 +00:00
# @return [Google::Apis::PeopleV1::GetPeopleResponse]
2016-02-10 21:57:13 +00:00
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
2017-03-27 22:14:47 +00:00
def get_people(request_mask_include_field: nil, resource_names: nil, quota_user: nil, fields: nil, options: nil, &block)
2017-03-10 21:11:09 +00:00
command = make_simple_command(:get, 'v1/people:batchGet', options)
command.response_representation = Google::Apis::PeopleV1::GetPeopleResponse::Representation
command.response_class = Google::Apis::PeopleV1::GetPeopleResponse
2016-02-10 21:57:13 +00:00
command.query['requestMask.includeField'] = request_mask_include_field unless request_mask_include_field.nil?
2017-03-10 21:11:09 +00:00
command.query['resourceNames'] = resource_names unless resource_names.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
2017-03-27 22:14:47 +00:00
command.query['fields'] = fields unless fields.nil?
2016-02-10 21:57:13 +00:00
execute_or_queue_command(command, &block)
end
2017-03-10 21:11:09 +00:00
# Provides information about a person resource for a resource name. Use
# `people/me` to indicate the authenticated user.
# @param [String] resource_name
# The resource name of the person to provide information about.
# - To get information about the authenticated user, specify `people/me`.
# - To get information about any user, specify the resource name that
# identifies the user, such as the resource names returned by
# [`people.connections.list`](/people/api/rest/v1/people.connections/list).
2016-02-10 21:57:13 +00:00
# @param [String] request_mask_include_field
2017-02-13 23:28:52 +00:00
# Comma-separated list of fields to be included in the response. Omitting
# this field will include all fields except for connections.list requests,
# which have a default mask that includes common fields like metadata, name,
# photo, and profile url.
# Each path should start with `person.`: for example, `person.names` or
# `person.photos`.
2016-02-10 21:57:13 +00:00
# @param [String] quota_user
# 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.
2017-03-27 22:14:47 +00:00
# @param [String] fields
# Selector specifying which fields to include in a partial response.
2016-02-10 21:57:13 +00:00
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
2017-03-10 21:11:09 +00:00
# @yieldparam result [Google::Apis::PeopleV1::Person] parsed result object
2016-02-10 21:57:13 +00:00
# @yieldparam err [StandardError] error object if request failed
#
2017-03-10 21:11:09 +00:00
# @return [Google::Apis::PeopleV1::Person]
2016-02-10 21:57:13 +00:00
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
2017-03-27 22:14:47 +00:00
def get_person(resource_name, request_mask_include_field: nil, quota_user: nil, fields: nil, options: nil, &block)
2017-03-10 21:11:09 +00:00
command = make_simple_command(:get, 'v1/{+resourceName}', options)
command.response_representation = Google::Apis::PeopleV1::Person::Representation
command.response_class = Google::Apis::PeopleV1::Person
command.params['resourceName'] = resource_name unless resource_name.nil?
2016-02-10 21:57:13 +00:00
command.query['requestMask.includeField'] = request_mask_include_field unless request_mask_include_field.nil?
2017-03-10 21:11:09 +00:00
command.query['quotaUser'] = quota_user unless quota_user.nil?
2017-03-27 22:14:47 +00:00
command.query['fields'] = fields unless fields.nil?
2016-02-10 21:57:13 +00:00
execute_or_queue_command(command, &block)
end
2017-02-13 23:28:52 +00:00
# Provides a list of the authenticated user's contacts merged with any
# linked profiles.
2017-03-10 21:11:09 +00:00
# @param [String] resource_name
# The resource name to return connections for. Only `people/me` is valid.
2017-03-27 22:14:47 +00:00
# @param [String] sync_token
# A sync token, returned by a previous call to `people.connections.list`.
# Only resources changed since the sync token was created will be returned.
2017-03-10 21:11:09 +00:00
# @param [String] sort_order
# The order in which the connections should be sorted. Defaults to
# `LAST_MODIFIED_ASCENDING`.
# @param [Boolean] request_sync_token
# Whether the response should include a sync token, which can be used to get
# all changes since the last request.
2016-02-25 23:16:53 +00:00
# @param [String] page_token
# The token of the page to be returned.
2017-03-27 22:14:47 +00:00
# @param [Fixnum] page_size
# The number of connections to include in the response. Valid values are
# between 1 and 500, inclusive. Defaults to 100.
2017-02-13 23:28:52 +00:00
# @param [String] request_mask_include_field
# Comma-separated list of fields to be included in the response. Omitting
# this field will include all fields except for connections.list requests,
# which have a default mask that includes common fields like metadata, name,
# photo, and profile url.
# Each path should start with `person.`: for example, `person.names` or
# `person.photos`.
2016-02-10 21:57:13 +00:00
# @param [String] quota_user
# 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.
2017-03-27 22:14:47 +00:00
# @param [String] fields
# Selector specifying which fields to include in a partial response.
2016-02-10 21:57:13 +00:00
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::PeopleV1::ListConnectionsResponse] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::PeopleV1::ListConnectionsResponse]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
2017-03-27 22:14:47 +00:00
def list_person_connections(resource_name, sync_token: nil, sort_order: nil, request_sync_token: nil, page_token: nil, page_size: nil, request_mask_include_field: nil, quota_user: nil, fields: nil, options: nil, &block)
2017-03-10 21:11:09 +00:00
command = make_simple_command(:get, 'v1/{+resourceName}/connections', options)
2016-02-10 21:57:13 +00:00
command.response_representation = Google::Apis::PeopleV1::ListConnectionsResponse::Representation
command.response_class = Google::Apis::PeopleV1::ListConnectionsResponse
2017-03-10 21:11:09 +00:00
command.params['resourceName'] = resource_name unless resource_name.nil?
2017-03-27 22:14:47 +00:00
command.query['syncToken'] = sync_token unless sync_token.nil?
2017-03-10 21:11:09 +00:00
command.query['sortOrder'] = sort_order unless sort_order.nil?
command.query['requestSyncToken'] = request_sync_token unless request_sync_token.nil?
2016-02-25 23:16:53 +00:00
command.query['pageToken'] = page_token unless page_token.nil?
2017-03-10 21:11:09 +00:00
command.query['pageSize'] = page_size unless page_size.nil?
2017-03-27 22:14:47 +00:00
command.query['requestMask.includeField'] = request_mask_include_field unless request_mask_include_field.nil?
2017-03-10 21:11:09 +00:00
command.query['quotaUser'] = quota_user unless quota_user.nil?
2017-03-27 22:14:47 +00:00
command.query['fields'] = fields unless fields.nil?
2016-02-10 21:57:13 +00:00
execute_or_queue_command(command, &block)
end
protected
def apply_command_defaults(command)
command.query['key'] = key unless key.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
end
end
end
end
end