Zum Inhalt

TemplateVariablesCollectionsResource

TemplateVariablesCollectionsResource

TemplateVariablesCollectionsResource(client: Client)

Bases: BaseResource

create

create(name: str, description: str = '', variables: List[Dict[str, str]] | None = None) -> TemplateVariablesCollectionWithEntries

Creates a new collection.

Parameters:

Name Type Description Default
name str

The name for the new collection.

required
description str

Optional description for the collection.

''
variables list[dict[str, str]]

Optional list of variables to add to the collection.

None

Returns:

Type Description
TemplateVariablesCollection

The newly created collection object.

Raises:

Type Description
HTTPStatusError

If collection with same name already exists (400 BAD REQUEST)

get

get(*, name: str) -> TemplateVariablesCollectionWithEntries

Get a collection by name.

Parameters:

Name Type Description Default
name str

The name of the collection to get.

required

Returns:

Name Type Description
TemplateVariablesCollectionWithEntries TemplateVariablesCollectionWithEntries

The collection object.

Raises:

Type Description
ValueError

If no collection is found with the given name.

get_or_create

get_or_create(name: str, description: str = '', variables: List[Dict[str, str]] | None = None) -> tuple[TemplateVariablesCollectionWithEntries, bool]

Gets an existing collection by name or creates a new one if it doesn't exist. The existence check is only based on the name parameter - if a collection with the given name exists, it will be returned regardless of the other parameters.

Parameters:

Name Type Description Default
name str

The name of the collection to get or create.

required
description str

Optional description for the collection if created.

''
variables List[Dict[str, str]] | None

Optional list of variables to add to the collection if created.

None

Returns:

Type Description
tuple[TemplateVariablesCollectionWithEntries, bool]

tuple[TemplateVariablesCollectionWithEntries, bool]: A tuple containing: - Collection: The retrieved or created collection object - bool: True if a new collection was created, False if existing was found

list

list() -> list[TemplateVariablesCollection]

Get a list of template variables collections.

Returns:

Type Description
list[TemplateVariablesCollection]

list[TemplateVariablesCollection]: A list of template variables collections.