[e3d4e0a] | 1 | <?php
|
---|
| 2 | /*
|
---|
| 3 | * Copyright 2014 Google Inc.
|
---|
| 4 | *
|
---|
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
---|
| 6 | * use this file except in compliance with the License. You may obtain a copy of
|
---|
| 7 | * the License at
|
---|
| 8 | *
|
---|
| 9 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
| 10 | *
|
---|
| 11 | * Unless required by applicable law or agreed to in writing, software
|
---|
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
---|
| 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
---|
| 14 | * License for the specific language governing permissions and limitations under
|
---|
| 15 | * the License.
|
---|
| 16 | */
|
---|
| 17 |
|
---|
| 18 | namespace Google\Service\SubscriptionLinking\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\SubscriptionLinking\DeleteReaderResponse;
|
---|
| 21 | use Google\Service\SubscriptionLinking\Reader;
|
---|
| 22 | use Google\Service\SubscriptionLinking\ReaderEntitlements;
|
---|
| 23 |
|
---|
| 24 | /**
|
---|
| 25 | * The "readers" collection of methods.
|
---|
| 26 | * Typical usage is:
|
---|
| 27 | * <code>
|
---|
| 28 | * $readerrevenuesubscriptionlinkingService = new Google\Service\SubscriptionLinking(...);
|
---|
| 29 | * $readers = $readerrevenuesubscriptionlinkingService->publications_readers;
|
---|
| 30 | * </code>
|
---|
| 31 | */
|
---|
| 32 | class PublicationsReaders extends \Google\Service\Resource
|
---|
| 33 | {
|
---|
| 34 | /**
|
---|
| 35 | * Removes a publication reader, effectively severing the association with a
|
---|
| 36 | * Google user. If `force` is set to true, any entitlements for this reader will
|
---|
| 37 | * also be deleted. (Otherwise, the request will only work if the reader has no
|
---|
| 38 | * entitlements.) - If the reader does not exist, return NOT_FOUND. - Return
|
---|
| 39 | * FAILED_PRECONDITION if the force field is false (or unset) and entitlements
|
---|
| 40 | * are present. (readers.delete)
|
---|
| 41 | *
|
---|
| 42 | * @param string $name Required. The resource name of the reader. Format:
|
---|
| 43 | * publications/{publication_id}/readers/{ppid}
|
---|
| 44 | * @param array $optParams Optional parameters.
|
---|
| 45 | *
|
---|
| 46 | * @opt_param bool force If set to true, any entitlements under the reader will
|
---|
| 47 | * also be purged.
|
---|
| 48 | * @return DeleteReaderResponse
|
---|
| 49 | * @throws \Google\Service\Exception
|
---|
| 50 | */
|
---|
| 51 | public function delete($name, $optParams = [])
|
---|
| 52 | {
|
---|
| 53 | $params = ['name' => $name];
|
---|
| 54 | $params = array_merge($params, $optParams);
|
---|
| 55 | return $this->call('delete', [$params], DeleteReaderResponse::class);
|
---|
| 56 | }
|
---|
| 57 | /**
|
---|
| 58 | * Gets a reader of a publication. Returns NOT_FOUND if the reader does not
|
---|
| 59 | * exist. (readers.get)
|
---|
| 60 | *
|
---|
| 61 | * @param string $name Required. The resource name of the reader. Format:
|
---|
| 62 | * publications/{publication_id}/readers/{ppid}
|
---|
| 63 | * @param array $optParams Optional parameters.
|
---|
| 64 | * @return Reader
|
---|
| 65 | * @throws \Google\Service\Exception
|
---|
| 66 | */
|
---|
| 67 | public function get($name, $optParams = [])
|
---|
| 68 | {
|
---|
| 69 | $params = ['name' => $name];
|
---|
| 70 | $params = array_merge($params, $optParams);
|
---|
| 71 | return $this->call('get', [$params], Reader::class);
|
---|
| 72 | }
|
---|
| 73 | /**
|
---|
| 74 | * Gets the reader entitlements for a publication reader. - Returns
|
---|
| 75 | * PERMISSION_DENIED if the caller does not have access. - Returns NOT_FOUND if
|
---|
| 76 | * the reader does not exist. (readers.getEntitlements)
|
---|
| 77 | *
|
---|
| 78 | * @param string $name Required. The name of the reader entitlements to
|
---|
| 79 | * retrieve. Format:
|
---|
| 80 | * publications/{publication_id}/readers/{reader_id}/entitlements
|
---|
| 81 | * @param array $optParams Optional parameters.
|
---|
| 82 | * @return ReaderEntitlements
|
---|
| 83 | * @throws \Google\Service\Exception
|
---|
| 84 | */
|
---|
| 85 | public function getEntitlements($name, $optParams = [])
|
---|
| 86 | {
|
---|
| 87 | $params = ['name' => $name];
|
---|
| 88 | $params = array_merge($params, $optParams);
|
---|
| 89 | return $this->call('getEntitlements', [$params], ReaderEntitlements::class);
|
---|
| 90 | }
|
---|
| 91 | /**
|
---|
| 92 | * Updates the reader entitlements for a publication reader. The entire reader
|
---|
| 93 | * entitlements will be overwritten by the new reader entitlements in the
|
---|
| 94 | * payload, like a PUT. - Returns PERMISSION_DENIED if the caller does not have
|
---|
| 95 | * access. - Returns NOT_FOUND if the reader does not exist.
|
---|
| 96 | * (readers.updateEntitlements)
|
---|
| 97 | *
|
---|
| 98 | * @param string $name Output only. The resource name of the singleton.
|
---|
| 99 | * @param ReaderEntitlements $postBody
|
---|
| 100 | * @param array $optParams Optional parameters.
|
---|
| 101 | *
|
---|
| 102 | * @opt_param string updateMask Optional. The list of fields to update. Defaults
|
---|
| 103 | * to all fields.
|
---|
| 104 | * @return ReaderEntitlements
|
---|
| 105 | * @throws \Google\Service\Exception
|
---|
| 106 | */
|
---|
| 107 | public function updateEntitlements($name, ReaderEntitlements $postBody, $optParams = [])
|
---|
| 108 | {
|
---|
| 109 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 110 | $params = array_merge($params, $optParams);
|
---|
| 111 | return $this->call('updateEntitlements', [$params], ReaderEntitlements::class);
|
---|
| 112 | }
|
---|
| 113 | }
|
---|
| 114 |
|
---|
| 115 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 116 | class_alias(PublicationsReaders::class, 'Google_Service_SubscriptionLinking_Resource_PublicationsReaders');
|
---|