CommunityTypesMixin

class squirro_client.topic.CommunityTypesMixin

Bases: object

Methods Summary

delete_community_type(project_id, …)

Deletes a community type

get_community_type(project_id, community_type_id)

Returns a community types for a project given the community_type_id

get_community_types(project_id)

Returns all community types for a particular project.

modify_community_type(project_id, …[, facet])

Modifies a community type

move_community_type(project_id, …)

Move a community type.

new_community_type(project_id, name[, facet])

Creates a new community type

Methods Documentation

delete_community_type(project_id, community_type_id)

Deletes a community type

Parameters
  • project_id – Project Identifier

  • community_type_id – Community type Identifier

Example:

>>> client.delete_community_type(
        'Xh9CeyQtTYe2cv5F11e6nQ',
        'LB5Q-GmBSbaNvJhUxXfUaA')
{}
get_community_type(project_id, community_type_id, include_communities=False, start=None, count=- 1, community_partial_name=None, include_count_of_items=False)

Returns a community types for a project given the community_type_id

Parameters
  • project_id – Project Identifier

  • community_type_id – Community type Identifier

  • include_communities – Boolean argument to include all the communities belonging to the community type with id community_type_id. Defaults to False.

  • start – Integer. Used for pagination of objects. If set, the objects starting with offset start are returned. Defaults to None.

  • count – Integer. Used for pagination of objects. If set, count number of communities are returned. To return all communities, set to -1. Defaults to -1.

  • community_partial_name – Argument to filter communities by name.

  • include_count_of_items – Boolean argument to include the count of items belonging to the communities of community type community_type_id. Defaults to False.

Example:

>>> client.get_community_type(
    'Xh9CeyQtTYe2cv5F11e6nQ',
    'LB5Q-GmBSbaNvJhUxXfUaA'
)
{
    "id": "LB5Q-GmBSbaNvJhUxXfUaA",
    "created_at": "2020-09-09T15:15:42",
    "modified_at": "2020-09-09T15:15:42",
    "project_id": "Xh9CeyQtTYe2cv5F11e6nQ",
    "name": "Community_type_1",
    "facet": "Company"
}
get_community_types(project_id)

Returns all community types for a particular project.

Parameters

project_id – Project Identifier

Example:

>>> client.get_community_types('Xh9CeyQtTYe2cv5F11e6nQ')
[
    {
    "id": "9WArQ7hhRUeEkg3_CLdfLA",
    "created_at": "2020-09-09T15:19:38",
    "modified_at": "2020-09-09T15:19:38",
    "project_id": "Xh9CeyQtTYe2cv5F11e6nQ",
    "name": "Community_type_2",
    "facet": "Country"
    },
    {
    "id": "LB5Q-GmBSbaNvJhUxXfUaA",
    "created_at": "2020-09-09T15:15:42",
    "modified_at": "2020-09-09T15:15:42",
    "project_id": "Xh9CeyQtTYe2cv5F11e6nQ",
    "name": "Community_type_1",
    "facet": "Company"
    }
]
modify_community_type(project_id, community_type_id, name, facet=None)

Modifies a community type

Parameters
  • project_id – Project Identifier

  • community_type_id – Community type Identifier

  • name – community type name

  • facet – facet name associated with the community

Example:

>>> client.modify_community_type(
        'Xh9CeyQtTYe2cv5F11e6nQ',
        'LB5Q-GmBSbaNvJhUxXfUaA',
        'Community_type_1',
        facet='Country',
    )
{
    "id": "LB5Q-GmBSbaNvJhUxXfUaA",
    "created_at": "2020-09-09T15:15:42",
    "modified_at": "2020-09-09T15:15:42",
    "project_id": "Xh9CeyQtTYe2cv5F11e6nQ",
    "name": "Community_type_1",
    "facet": "Country"
}
move_community_type(project_id, community_type_id, after)

Move a community type.

Parameters
  • project_id – Project identifier

  • community_type_id – Community type identifier

  • after – The community type identifier after which the community type should be moved. Can be None to move the community type to the beginning of the list.

Returns

No return value.

Example:

>>> client.move_community_type('Xh9CeyQtTYe2cv5F11e6nQ',
...                            'LB5Q-GmBSbaNvJhUxXfUaA',
...                            'AaUfXUhJvNabSBBmG-Q5LB')
new_community_type(project_id, name, facet=None)

Creates a new community type

Parameters
  • project_id – Project Identifier

  • name – community type name

  • facet – facet name associated with the community

Example:

>>> client.new_community_type(
        'Xh9CeyQtTYe2cv5F11e6nQ',
        'Community_type_1',
        facet='Company'
        )
{
    "id": "LB5Q-GmBSbaNvJhUxXfUaA",
    "created_at": "2020-09-09T15:15:42",
    "modified_at": "2020-09-09T15:15:42",
    "project_id": "Xh9CeyQtTYe2cv5F11e6nQ",
    "name": "Community_type_1",
    "facet": "Company"
}