CommunityTypesMixin#

class 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[, ...])

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, query_context=None)#

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.

  • query_context (Optional[Dict[str, Any]]) –

    Dictionary with more context of the user’s input / intent: - searchbar_query : Terms that user typed in a searchbar. - dashboard_filters : Additional filter-queries provided via dashboard or widget configuration. - community_query : Selected community in the Community 360 dashboard. - like : Additional input to perform approximate search on.

    For now like is considered to be a long string (e.g. paragraphs)

    • parsed : The parsed, analysed and enriched representation of the searchbar_query (response of the configured query-processing workflow)

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, photo=None)#

Creates a new community type

Parameters:
  • project_id – Project Identifier

  • name – community type name

  • facet – facet name associated with the community

  • photo – Address to the photo of the community

Example:

>>> client.new_community_type(
        'Xh9CeyQtTYe2cv5F11e6nQ',
        'Community_type_1',
        facet='Company',
        photo='https://twitter.com/MarcusRashford/photo',
        )
{
    "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",
    "photo": "https://twitter.com/MarcusRashford/photo",
}