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
18namespace Google\Service\TagManager\Resource;
19
20use Google\Service\TagManager\CustomTemplate;
21use Google\Service\TagManager\ListTemplatesResponse;
22use Google\Service\TagManager\RevertTemplateResponse;
23
24/**
25 * The "templates" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $tagmanagerService = new Google\Service\TagManager(...);
29 *   $templates = $tagmanagerService->templates;
30 *  </code>
31 */
32class AccountsContainersWorkspacesTemplates extends \Google\Service\Resource
33{
34  /**
35   * Creates a GTM Custom Template. (templates.create)
36   *
37   * @param string $parent GTM Workspace's API relative path. Example:
38   * accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
39   * @param CustomTemplate $postBody
40   * @param array $optParams Optional parameters.
41   * @return CustomTemplate
42   */
43  public function create($parent, CustomTemplate $postBody, $optParams = [])
44  {
45    $params = ['parent' => $parent, 'postBody' => $postBody];
46    $params = array_merge($params, $optParams);
47    return $this->call('create', [$params], CustomTemplate::class);
48  }
49  /**
50   * Deletes a GTM Template. (templates.delete)
51   *
52   * @param string $path GTM Custom Template's API relative path. Example: account
53   * s/{account_id}/containers/{container_id}/workspaces/{workspace_id}/templates/
54   * {template_id}
55   * @param array $optParams Optional parameters.
56   */
57  public function delete($path, $optParams = [])
58  {
59    $params = ['path' => $path];
60    $params = array_merge($params, $optParams);
61    return $this->call('delete', [$params]);
62  }
63  /**
64   * Gets a GTM Template. (templates.get)
65   *
66   * @param string $path GTM Custom Template's API relative path. Example: account
67   * s/{account_id}/containers/{container_id}/workspaces/{workspace_id}/templates/
68   * {template_id}
69   * @param array $optParams Optional parameters.
70   * @return CustomTemplate
71   */
72  public function get($path, $optParams = [])
73  {
74    $params = ['path' => $path];
75    $params = array_merge($params, $optParams);
76    return $this->call('get', [$params], CustomTemplate::class);
77  }
78  /**
79   * Lists all GTM Templates of a GTM container workspace.
80   * (templates.listAccountsContainersWorkspacesTemplates)
81   *
82   * @param string $parent GTM Workspace's API relative path. Example:
83   * accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
84   * @param array $optParams Optional parameters.
85   *
86   * @opt_param string pageToken Continuation token for fetching the next page of
87   * results.
88   * @return ListTemplatesResponse
89   */
90  public function listAccountsContainersWorkspacesTemplates($parent, $optParams = [])
91  {
92    $params = ['parent' => $parent];
93    $params = array_merge($params, $optParams);
94    return $this->call('list', [$params], ListTemplatesResponse::class);
95  }
96  /**
97   * Reverts changes to a GTM Template in a GTM Workspace. (templates.revert)
98   *
99   * @param string $path GTM Custom Template's API relative path. Example: account
100   * s/{account_id}/containers/{container_id}/workspaces/{workspace_id}/templates/
101   * {template_id}
102   * @param array $optParams Optional parameters.
103   *
104   * @opt_param string fingerprint When provided, this fingerprint must match the
105   * fingerprint of the template in storage.
106   * @return RevertTemplateResponse
107   */
108  public function revert($path, $optParams = [])
109  {
110    $params = ['path' => $path];
111    $params = array_merge($params, $optParams);
112    return $this->call('revert', [$params], RevertTemplateResponse::class);
113  }
114  /**
115   * Updates a GTM Template. (templates.update)
116   *
117   * @param string $path GTM Custom Template's API relative path. Example: account
118   * s/{account_id}/containers/{container_id}/workspaces/{workspace_id}/templates/
119   * {template_id}
120   * @param CustomTemplate $postBody
121   * @param array $optParams Optional parameters.
122   *
123   * @opt_param string fingerprint When provided, this fingerprint must match the
124   * fingerprint of the templates in storage.
125   * @return CustomTemplate
126   */
127  public function update($path, CustomTemplate $postBody, $optParams = [])
128  {
129    $params = ['path' => $path, 'postBody' => $postBody];
130    $params = array_merge($params, $optParams);
131    return $this->call('update', [$params], CustomTemplate::class);
132  }
133}
134
135// Adding a class alias for backwards compatibility with the previous class name.
136class_alias(AccountsContainersWorkspacesTemplates::class, 'Google_Service_TagManager_Resource_AccountsContainersWorkspacesTemplates');
137