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\CreateContainerVersionRequestVersionOptions;
21use Google\Service\TagManager\CreateContainerVersionResponse;
22use Google\Service\TagManager\Entity;
23use Google\Service\TagManager\GetWorkspaceStatusResponse;
24use Google\Service\TagManager\ListWorkspacesResponse;
25use Google\Service\TagManager\QuickPreviewResponse;
26use Google\Service\TagManager\SyncWorkspaceResponse;
27use Google\Service\TagManager\Workspace;
28
29/**
30 * The "workspaces" collection of methods.
31 * Typical usage is:
32 *  <code>
33 *   $tagmanagerService = new Google\Service\TagManager(...);
34 *   $workspaces = $tagmanagerService->workspaces;
35 *  </code>
36 */
37class AccountsContainersWorkspaces extends \Google\Service\Resource
38{
39  /**
40   * Creates a Workspace. (workspaces.create)
41   *
42   * @param string $parent GTM parent Container's API relative path. Example:
43   * accounts/{account_id}/containers/{container_id}
44   * @param Workspace $postBody
45   * @param array $optParams Optional parameters.
46   * @return Workspace
47   */
48  public function create($parent, Workspace $postBody, $optParams = [])
49  {
50    $params = ['parent' => $parent, 'postBody' => $postBody];
51    $params = array_merge($params, $optParams);
52    return $this->call('create', [$params], Workspace::class);
53  }
54  /**
55   * Creates a Container Version from the entities present in the workspace,
56   * deletes the workspace, and sets the base container version to the newly
57   * created version. (workspaces.create_version)
58   *
59   * @param string $path GTM Workspace's API relative path. Example:
60   * accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
61   * @param CreateContainerVersionRequestVersionOptions $postBody
62   * @param array $optParams Optional parameters.
63   * @return CreateContainerVersionResponse
64   */
65  public function create_version($path, CreateContainerVersionRequestVersionOptions $postBody, $optParams = [])
66  {
67    $params = ['path' => $path, 'postBody' => $postBody];
68    $params = array_merge($params, $optParams);
69    return $this->call('create_version', [$params], CreateContainerVersionResponse::class);
70  }
71  /**
72   * Deletes a Workspace. (workspaces.delete)
73   *
74   * @param string $path GTM Workspace's API relative path. Example:
75   * accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
76   * @param array $optParams Optional parameters.
77   */
78  public function delete($path, $optParams = [])
79  {
80    $params = ['path' => $path];
81    $params = array_merge($params, $optParams);
82    return $this->call('delete', [$params]);
83  }
84  /**
85   * Gets a Workspace. (workspaces.get)
86   *
87   * @param string $path GTM Workspace's API relative path. Example:
88   * accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
89   * @param array $optParams Optional parameters.
90   * @return Workspace
91   */
92  public function get($path, $optParams = [])
93  {
94    $params = ['path' => $path];
95    $params = array_merge($params, $optParams);
96    return $this->call('get', [$params], Workspace::class);
97  }
98  /**
99   * Finds conflicting and modified entities in the workspace.
100   * (workspaces.getStatus)
101   *
102   * @param string $path GTM Workspace's API relative path. Example:
103   * accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
104   * @param array $optParams Optional parameters.
105   * @return GetWorkspaceStatusResponse
106   */
107  public function getStatus($path, $optParams = [])
108  {
109    $params = ['path' => $path];
110    $params = array_merge($params, $optParams);
111    return $this->call('getStatus', [$params], GetWorkspaceStatusResponse::class);
112  }
113  /**
114   * Lists all Workspaces that belong to a GTM Container.
115   * (workspaces.listAccountsContainersWorkspaces)
116   *
117   * @param string $parent GTM parent Container's API relative path. Example:
118   * accounts/{account_id}/containers/{container_id}
119   * @param array $optParams Optional parameters.
120   *
121   * @opt_param string pageToken Continuation token for fetching the next page of
122   * results.
123   * @return ListWorkspacesResponse
124   */
125  public function listAccountsContainersWorkspaces($parent, $optParams = [])
126  {
127    $params = ['parent' => $parent];
128    $params = array_merge($params, $optParams);
129    return $this->call('list', [$params], ListWorkspacesResponse::class);
130  }
131  /**
132   * Quick previews a workspace by creating a fake container version from all
133   * entities in the provided workspace. (workspaces.quick_preview)
134   *
135   * @param string $path GTM Workspace's API relative path. Example:
136   * accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
137   * @param array $optParams Optional parameters.
138   * @return QuickPreviewResponse
139   */
140  public function quick_preview($path, $optParams = [])
141  {
142    $params = ['path' => $path];
143    $params = array_merge($params, $optParams);
144    return $this->call('quick_preview', [$params], QuickPreviewResponse::class);
145  }
146  /**
147   * Resolves a merge conflict for a workspace entity by updating it to the
148   * resolved entity passed in the request. (workspaces.resolve_conflict)
149   *
150   * @param string $path GTM Workspace's API relative path. Example:
151   * accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
152   * @param Entity $postBody
153   * @param array $optParams Optional parameters.
154   *
155   * @opt_param string fingerprint When provided, this fingerprint must match the
156   * fingerprint of the entity_in_workspace in the merge conflict.
157   */
158  public function resolve_conflict($path, Entity $postBody, $optParams = [])
159  {
160    $params = ['path' => $path, 'postBody' => $postBody];
161    $params = array_merge($params, $optParams);
162    return $this->call('resolve_conflict', [$params]);
163  }
164  /**
165   * Syncs a workspace to the latest container version by updating all unmodified
166   * workspace entities and displaying conflicts for modified entities.
167   * (workspaces.sync)
168   *
169   * @param string $path GTM Workspace's API relative path. Example:
170   * accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
171   * @param array $optParams Optional parameters.
172   * @return SyncWorkspaceResponse
173   */
174  public function sync($path, $optParams = [])
175  {
176    $params = ['path' => $path];
177    $params = array_merge($params, $optParams);
178    return $this->call('sync', [$params], SyncWorkspaceResponse::class);
179  }
180  /**
181   * Updates a Workspace. (workspaces.update)
182   *
183   * @param string $path GTM Workspace's API relative path. Example:
184   * accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}
185   * @param Workspace $postBody
186   * @param array $optParams Optional parameters.
187   *
188   * @opt_param string fingerprint When provided, this fingerprint must match the
189   * fingerprint of the workspace in storage.
190   * @return Workspace
191   */
192  public function update($path, Workspace $postBody, $optParams = [])
193  {
194    $params = ['path' => $path, 'postBody' => $postBody];
195    $params = array_merge($params, $optParams);
196    return $this->call('update', [$params], Workspace::class);
197  }
198}
199
200// Adding a class alias for backwards compatibility with the previous class name.
201class_alias(AccountsContainersWorkspaces::class, 'Google_Service_TagManager_Resource_AccountsContainersWorkspaces');
202