moveEntitiesToFolder method

Future<void> moveEntitiesToFolder(
  1. Folder request,
  2. String path, {
  3. List<String>? tagId,
  4. List<String>? triggerId,
  5. List<String>? variableId,
  6. String? $fields,
})

Moves entities to a GTM Folder.

If {folder_id} in the request path equals 0, this will instead move entities out of the folder they currently belong to.

request - The metadata request object.

Request parameters:

path - GTM Folder's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/folders/{folder_id} Value must have pattern ^accounts/\[^/\]+/containers/\[^/\]+/workspaces/\[^/\]+/folders/\[^/\]+$.

tagId - The tags to be moved to the folder.

triggerId - The triggers to be moved to the folder.

variableId - The variables to be moved to the folder.

$fields - Selector specifying which fields to include in a partial response.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<void> moveEntitiesToFolder(
  Folder request,
  core.String path, {
  core.List<core.String>? tagId,
  core.List<core.String>? triggerId,
  core.List<core.String>? variableId,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (tagId != null) 'tagId': tagId,
    if (triggerId != null) 'triggerId': triggerId,
    if (variableId != null) 'variableId': variableId,
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'tagmanager/v2/' +
      core.Uri.encodeFull('$path') +
      ':move_entities_to_folder';

  await _requester.request(
    url_,
    'POST',
    body: body_,
    queryParams: queryParams_,
    downloadOptions: null,
  );
}