📄 Source: UsersSections.php
<?php
/*
* Copyright 2014 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.
*/
namespace Google\Service\HangoutsChat\Resource;
use Google\Service\HangoutsChat\ChatEmpty;
use Google\Service\HangoutsChat\GoogleChatV1Section;
use Google\Service\HangoutsChat\ListSectionsResponse;
use Google\Service\HangoutsChat\PositionSectionRequest;
use Google\Service\HangoutsChat\PositionSectionResponse;
/**
* The "sections" collection of methods.
* Typical usage is:
* <code>
* $chatService = new Google\Service\HangoutsChat(...);
* $sections = $chatService->users_sections;
* </code>
*/
class UsersSections extends \Google\Service\Resource
{
/**
* Creates a section in Google Chat. Sections help users group conversations and
* customize the list of spaces displayed in Chat navigation panel. Only
* sections of type `CUSTOM_SECTION` can be created. For details, see [Create
* and organize sections in Google
* Chat](https://support.google.com/chat/answer/16059854). Requires [user
* authentication](https://developers.google.com/workspace/chat/authenticate-
* authorize-chat-user) with the [authorization
* scope](https://developers.google.com/workspace/chat/authenticate-
* authorize#chat-api-scopes): -
* `https://www.googleapis.com/auth/chat.users.sections` (sections.create)
*
* @param string $parent Required. The parent resource name where the section is
* created. Format: `users/{user}`
* @param GoogleChatV1Section $postBody
* @param array $optParams Optional parameters.
* @return GoogleChatV1Section
* @throws \Google\Service\Exception
*/
public function create($parent, GoogleChatV1Section $postBody, $optParams = [])
{
$params = ['parent' => $parent, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('create', [$params], GoogleChatV1Section::class);
}
/**
* Deletes a section of type `CUSTOM_SECTION`. If the section contains items,
* such as spaces, the items are moved to Google Chat's default sections and are
* not deleted. For details, see [Create and organize sections in Google
* Chat](https://support.google.com/chat/answer/16059854). Requires [user
* authentication](https://developers.google.com/workspace/chat/authenticate-
* authorize-chat-user) with the [authorization
* scope](https://developers.google.com/workspace/chat/authenticate-
* authorize#chat-api-scopes): -
* `https://www.googleapis.com/auth/chat.users.sections` (sections.delete)
*
* @param string $name Required. The name of the section to delete. Format:
* `users/{user}/sections/{section}`
* @param array $optParams Optional parameters.
* @return ChatEmpty
* @throws \Google\Service\Exception
*/
public function delete($name, $optParams = [])
{
$params = ['name' => $name];
$params = array_merge($params, $optParams);
return $this->call('delete', [$params], ChatEmpty::class);
}
/**
* Lists sections available to the Chat user. Sections help users group their
* conversations and customize the list of spaces displayed in Chat navigation
* panel. For details, see [Create and organize sections in Google
* Chat](https://support.google.com/chat/answer/16059854). Requires [user
* authentication](https://developers.google.com/workspace/chat/authenticate-
* authorize-chat-user) with the [authorization
* scope](https://developers.google.com/workspace/chat/authenticate-
* authorize#chat-api-scopes): -
* `https://www.googleapis.com/auth/chat.users.sections` -
* `https://www.googleapis.com/auth/chat.users.sections.readonly`
* (sections.listUsersSections)
*
* @param string $parent Required. The parent, which is the user resource name
* that owns this collection of sections. Only supports listing sections for the
* calling user. To refer to the calling user, set one of the following: - The
* `me` alias. For example, `users/me`. - Their Workspace email address. For
* example, `users/user@example.com`. - Their user id. For example,
* `users/123456789`. Format: `users/{user}`
* @param array $optParams Optional parameters.
*
* @opt_param int pageSize Optional. The maximum number of sections to return.
* The service may return fewer than this value. If unspecified, at most 10
* sections will be returned. The maximum value is 100. If you use a value more
* than 100, it's automatically changed to 100. Negative values return an
* `INVALID_ARGUMENT` error.
* @opt_param string pageToken Optional. A page token, received from a previous
* list sections call. Provide this to retrieve the subsequent page. When
* paginating, all other parameters provided should match the call that provided
* the page token. Passing different values to the other parameters might lead
* to unexpected results.
* @return ListSectionsResponse
* @throws \Google\Service\Exception
*/
public function listUsersSections($parent, $optParams = [])
{
$params = ['parent' => $parent];
$params = array_merge($params, $optParams);
return $this->call('list', [$params], ListSectionsResponse::class);
}
/**
* Updates a section. Only sections of type `CUSTOM_SECTION` can be updated. For
* details, see [Create and organize sections in Google
* Chat](https://support.google.com/chat/answer/16059854). Requires [user
* authentication](https://developers.google.com/workspace/chat/authenticate-
* authorize-chat-user) with the [authorization
* scope](https://developers.google.com/workspace/chat/authenticate-
* authorize#chat-api-scopes): -
* `https://www.googleapis.com/auth/chat.users.sections` (sections.patch)
*
* @param string $name Identifier. Resource name of the section. For system
* sections, the section ID is a constant string: - DEFAULT_DIRECT_MESSAGES:
* `users/{user}/sections/default-direct-messages` - DEFAULT_SPACES:
* `users/{user}/sections/default-spaces` - DEFAULT_APPS:
* `users/{user}/sections/default-apps` Format:
* `users/{user}/sections/{section}`
* @param GoogleChatV1Section $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string updateMask Required. The mask to specify which fields to
* update. Currently supported field paths: - `display_name`
* @return GoogleChatV1Section
* @throws \Google\Service\Exception
*/
public function patch($name, GoogleChatV1Section $postBody, $optParams = [])
{
$params = ['name' => $name, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('patch', [$params], GoogleChatV1Section::class);
}
/**
* Changes the sort order of a section. For details, see [Create and organize
* sections in Google Chat](https://support.google.com/chat/answer/16059854).
* Requires [user
* authentication](https://developers.google.com/workspace/chat/authenticate-
* authorize-chat-user) with the [authorization
* scope](https://developers.google.com/workspace/chat/authenticate-
* authorize#chat-api-scopes): -
* `https://www.googleapis.com/auth/chat.users.sections` (sections.position)
*
* @param string $name Required. The resource name of the section to position.
* Format: `users/{user}/sections/{section}`
* @param PositionSectionRequest $postBody
* @param array $optParams Optional parameters.
* @return PositionSectionResponse
* @throws \Google\Service\Exception
*/
public function position($name, PositionSectionRequest $postBody, $optParams = [])
{
$params = ['name' => $name, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('position', [$params], PositionSectionResponse::class);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(UsersSections::class, 'Google_Service_HangoutsChat_Resource_UsersSections');
← Back