Skip to content

User

Endpoints

User

User endpoint

Source code in matrix_admin_sdk/endpoints/v1/user.py
class User(Endpoint):
    """
    User endpoint
    """

    def __int__(self, user_id: str, **kwargs):
        """
        Initialize User endpoint
        Args:
            user_id: fully-qualified user id: for example, @user:server.com
            **kwargs: keyword arguments to pass to Endpoint

        Returns: None

        """
        self.user_id = user_id
        super().__init__(**kwargs)

    async def query_current_sessions(self) -> CurrentSessionsModel:
        """
        This API returns information about the active sessions for a specific user
        Returns:

        """
        url = self.url(f"whois/{self.user_id}")
        result = await self.request(RequestMethods.GET, url)
        res: CurrentSessionsModel = CurrentSessionsModel.from_dict(result)
        return res

    async def deactivate_account(self) -> Dict[str, bool]:
        """
        This API deactivates an account. It removes active access tokens, resets
        the password, and deletes third-party IDs (to prevent the user requesting
        a password reset).

        It can also mark the user as GDPR-erased. This means messages sent by
        the user will still be visible by anyone that was in the room when these
        messages were sent, but hidden from users joining the room afterwards.

        Returns: {"erase": True}

        """
        url = self.url(f"deactivate/{self.user_id}")
        data: Dict[str, str] = {}
        result = await self.request(RequestMethods.POST, url, json=data)
        return result

    async def reset_password(
        self, new_password: str, logout_devices: bool = True
    ) -> None:
        """
        Changes the password of another user. This will automatically log the
        user out of all their devices
        Args:
            new_password: new user's password
            logout_devices: logout all devices, Default: True

        Returns: None

        """
        url = self.url(f"reset_password/{self.user_id}")
        data = {"new_password": new_password, "logout_devices": logout_devices}
        await self.request(RequestMethods.POST, url, json=data)

    async def is_admin(self) -> bool:
        """
        Get whether a user is a server administrator or not

        Returns: True if user is admin, False otherwise

        """
        url = self.url(f"users/{self.user_id}/admin")
        result = await self.request(RequestMethods.GET, url)
        res: bool = result["admin"]
        return res

    async def set_admin(self, admin: bool) -> None:
        """
        Change whether a user is a server administrator or not
        **NOTE**: you cannot demote yourself

        Args:
            admin: True to make user admin, False to remove admin

        Returns: None

        """
        url = self.url(f"users/{self.user_id}/admin")
        data = {"admin": admin}
        await self.request(RequestMethods.POST, url, data=data)

    async def get_rooms(self) -> RoomModel:
        """
        Gets a list of all room_id that a specific user_id is member.
        Returns: list of rooms

        """
        url = self.url(f"users/{self.user_id}/joined_rooms")
        result = await self.request(RequestMethods.GET, url)
        res: RoomModel = RoomModel.from_dict(result)
        return res

    async def get_data(self) -> Dict[str, Any]:
        """
        Gets information about account data for a specific user_id.

        Returns: See response example here https://matrix-org.github.io/synapse/latest/admin_api/user_admin_api.html#account-data
        """

        url = self.url(f"users/{self.user_id}/accountdata")
        result = await self.request(RequestMethods.GET, url)
        return result

    async def get_media(
        self,
        limit: int = 100,
        from_: int = 0,
        order_by: Optional[OrderByMedia] = None,
        dir_: str = "f",
    ) -> MediaListModel:
        """
        List media uploaded by a user

        Gets a list of all local media that a specific user_id has created.
        These are media that the user has uploaded themselves (local media),
        as well as URL preview images requested by the user if the feature is enabled.

        By default, the response is ordered by descending creation date and
        ascending media ID. The newest media is on top. You can change the order
        with parameters order_by and dir

        Args:
            limit: Is optional but is used for pagination, denoting the maximum
                number of items to return in this call. Defaults to 100
            from_: Is optional but used for pagination, denoting the offset in
                the returned results. This should be treated as an opaque value and
                not explicitly set to anything other than the return value of
                next_token from a previous call. Defaults to 0
            order_by: The method by which to sort the returned list of media.
                If the ordered field has duplicates, the second order
                is always by ascending OrderByMedia.MEDIA_ID, which guarantees a
                stable ordering
            dir_: Direction of media order. Either f for forwards or b for
                backwards. Setting this value to b will reverse the above sort order.
                Defaults to f

        Returns: MediaModel

        """
        url = self.url(f"users/{self.user_id}/media")
        if order_by is None:
            order_by = OrderByMedia.MEDIA_ID
        params = {
            "limit": limit,
            "from": from_,
            "order_by": order_by.value,
            "dir": dir_,
        }
        result = await self.request(RequestMethods.GET, url, params=params)
        res: MediaListModel = MediaListModel.from_dict(result)
        return res

    async def delete_media(self) -> DeletedMediaModel:
        """
        This API deletes the local media from the disk of your own server that
        a specific user_id has created. This includes any local thumbnails.

        This API will not affect media that has been uploaded to external media
        repositories (e.g https://github.com/turt2live/matrix-media-repo/).

        By default, the API deletes media ordered by descending creation date
        and ascending media ID. The newest media is deleted first. You
        can change the order with parameters order_by and dir. If no limit is
        set the API deletes 100 files per request.

        Returns:

        """
        url = self.url(f"users/{self.user_id}/media")
        result = await self.request(RequestMethods.DELETE, url)
        res: DeletedMediaModel = DeletedMediaModel.from_dict(result)
        return res

    async def login_as_user(
        self, valid_until_ms: Optional[int] = None
    ) -> Dict[str, str]:
        """
        Get an access token that can be used to authenticate as that user.

        Useful for when admins wish to do actions on behalf of a user.

        This API does not generate a new device for the user, and so will not appear their /devices list, and in general the target user should not be able to tell they have been logged in as.

        To expire the token call the standard /logout API with the token.

        **Note**: The token will expire if the admin user calls /logout/all from
        any of their devices, but the token will not expire if the target user
        does the same.


        Args:
            valid_until_ms: An optional valid_until_ms field can be specified
                in the request body as an integer timestamp that specifies when the
                token should expire. By default tokens do not expire.

        Returns: {"access_token": "<opaque_access_token_string>"}

        """
        url = self.url(f"users/{self.user_id}/login")
        data = {"valid_until_ms": valid_until_ms}
        result = await self.request(RequestMethods.POST, url, json=data)
        return result

    async def get_all_pushers(self) -> PushersModel:
        """
        Gets information about all pushers for a specific user_id.
        Returns: PushersModel

        """
        url = self.url(f"users/{self.user_id}/pushers")
        result = await self.request(RequestMethods.GET, url)
        res: PushersModel = PushersModel.from_dict(result)
        return res

    async def shadow_bann(self, bann_user: bool) -> None:
        """
        Shadow-banning is a useful tool for moderating malicious or egregiously
        abusive users. A shadow-banned users receives successful responses to
        their client-server API requests, but the events are not propagated
        into rooms. This can be an effective tool as it (hopefully) takes
        longer for the user to realise they are being moderated before pivoting
        to another account.

        Shadow-banning a user should be used as a tool of last resort and may
        lead to confusing or broken behaviour for the client. A shadow-banned
        user will not receive any notification and it is generally more
        appropriate to ban or kick abusive users. A shadow-banned user will be
        unable to contact anyone on the server.

        Args:
            bann_user: True to shadow-ban the user, False to un-shadow-ban the user.

        Returns: None

        """
        url = self.url(f"users/{self.user_id}/shadow_ban")
        if bann_user:
            method = RequestMethods.POST
        else:
            method = RequestMethods.DELETE

        await self.request(method, url)

__int__(self, user_id, **kwargs) special

Initialize User endpoint

Parameters:

Name Type Description Default
user_id str

fully-qualified user id: for example, @user:server.com

required
**kwargs

keyword arguments to pass to Endpoint

{}
Source code in matrix_admin_sdk/endpoints/v1/user.py
def __int__(self, user_id: str, **kwargs):
    """
    Initialize User endpoint
    Args:
        user_id: fully-qualified user id: for example, @user:server.com
        **kwargs: keyword arguments to pass to Endpoint

    Returns: None

    """
    self.user_id = user_id
    super().__init__(**kwargs)

deactivate_account(self) async

This API deactivates an account. It removes active access tokens, resets the password, and deletes third-party IDs (to prevent the user requesting a password reset).

It can also mark the user as GDPR-erased. This means messages sent by the user will still be visible by anyone that was in the room when these messages were sent, but hidden from users joining the room afterwards.

Returns: {"erase": True}

Source code in matrix_admin_sdk/endpoints/v1/user.py
async def deactivate_account(self) -> Dict[str, bool]:
    """
    This API deactivates an account. It removes active access tokens, resets
    the password, and deletes third-party IDs (to prevent the user requesting
    a password reset).

    It can also mark the user as GDPR-erased. This means messages sent by
    the user will still be visible by anyone that was in the room when these
    messages were sent, but hidden from users joining the room afterwards.

    Returns: {"erase": True}

    """
    url = self.url(f"deactivate/{self.user_id}")
    data: Dict[str, str] = {}
    result = await self.request(RequestMethods.POST, url, json=data)
    return result

delete_media(self) async

This API deletes the local media from the disk of your own server that a specific user_id has created. This includes any local thumbnails.

This API will not affect media that has been uploaded to external media repositories (e.g https://github.com/turt2live/matrix-media-repo/).

By default, the API deletes media ordered by descending creation date and ascending media ID. The newest media is deleted first. You can change the order with parameters order_by and dir. If no limit is set the API deletes 100 files per request.

Source code in matrix_admin_sdk/endpoints/v1/user.py
async def delete_media(self) -> DeletedMediaModel:
    """
    This API deletes the local media from the disk of your own server that
    a specific user_id has created. This includes any local thumbnails.

    This API will not affect media that has been uploaded to external media
    repositories (e.g https://github.com/turt2live/matrix-media-repo/).

    By default, the API deletes media ordered by descending creation date
    and ascending media ID. The newest media is deleted first. You
    can change the order with parameters order_by and dir. If no limit is
    set the API deletes 100 files per request.

    Returns:

    """
    url = self.url(f"users/{self.user_id}/media")
    result = await self.request(RequestMethods.DELETE, url)
    res: DeletedMediaModel = DeletedMediaModel.from_dict(result)
    return res

get_all_pushers(self) async

Gets information about all pushers for a specific user_id. Returns: PushersModel

Source code in matrix_admin_sdk/endpoints/v1/user.py
async def get_all_pushers(self) -> PushersModel:
    """
    Gets information about all pushers for a specific user_id.
    Returns: PushersModel

    """
    url = self.url(f"users/{self.user_id}/pushers")
    result = await self.request(RequestMethods.GET, url)
    res: PushersModel = PushersModel.from_dict(result)
    return res

get_data(self) async

Gets information about account data for a specific user_id.

Returns: See response example here https://matrix-org.github.io/synapse/latest/admin_api/user_admin_api.html#account-data

Source code in matrix_admin_sdk/endpoints/v1/user.py
async def get_data(self) -> Dict[str, Any]:
    """
    Gets information about account data for a specific user_id.

    Returns: See response example here https://matrix-org.github.io/synapse/latest/admin_api/user_admin_api.html#account-data
    """

    url = self.url(f"users/{self.user_id}/accountdata")
    result = await self.request(RequestMethods.GET, url)
    return result

get_media(self, limit=100, from_=0, order_by=None, dir_='f') async

List media uploaded by a user

Gets a list of all local media that a specific user_id has created. These are media that the user has uploaded themselves (local media), as well as URL preview images requested by the user if the feature is enabled.

By default, the response is ordered by descending creation date and ascending media ID. The newest media is on top. You can change the order with parameters order_by and dir

Parameters:

Name Type Description Default
limit int

Is optional but is used for pagination, denoting the maximum number of items to return in this call. Defaults to 100

100
from_ int

Is optional but used for pagination, denoting the offset in the returned results. This should be treated as an opaque value and not explicitly set to anything other than the return value of next_token from a previous call. Defaults to 0

0
order_by Optional[matrix_admin_sdk.endpoints.v1.user.OrderByMedia]

The method by which to sort the returned list of media. If the ordered field has duplicates, the second order is always by ascending OrderByMedia.MEDIA_ID, which guarantees a stable ordering

None
dir_ str

Direction of media order. Either f for forwards or b for backwards. Setting this value to b will reverse the above sort order. Defaults to f

'f'
Source code in matrix_admin_sdk/endpoints/v1/user.py
async def get_media(
    self,
    limit: int = 100,
    from_: int = 0,
    order_by: Optional[OrderByMedia] = None,
    dir_: str = "f",
) -> MediaListModel:
    """
    List media uploaded by a user

    Gets a list of all local media that a specific user_id has created.
    These are media that the user has uploaded themselves (local media),
    as well as URL preview images requested by the user if the feature is enabled.

    By default, the response is ordered by descending creation date and
    ascending media ID. The newest media is on top. You can change the order
    with parameters order_by and dir

    Args:
        limit: Is optional but is used for pagination, denoting the maximum
            number of items to return in this call. Defaults to 100
        from_: Is optional but used for pagination, denoting the offset in
            the returned results. This should be treated as an opaque value and
            not explicitly set to anything other than the return value of
            next_token from a previous call. Defaults to 0
        order_by: The method by which to sort the returned list of media.
            If the ordered field has duplicates, the second order
            is always by ascending OrderByMedia.MEDIA_ID, which guarantees a
            stable ordering
        dir_: Direction of media order. Either f for forwards or b for
            backwards. Setting this value to b will reverse the above sort order.
            Defaults to f

    Returns: MediaModel

    """
    url = self.url(f"users/{self.user_id}/media")
    if order_by is None:
        order_by = OrderByMedia.MEDIA_ID
    params = {
        "limit": limit,
        "from": from_,
        "order_by": order_by.value,
        "dir": dir_,
    }
    result = await self.request(RequestMethods.GET, url, params=params)
    res: MediaListModel = MediaListModel.from_dict(result)
    return res

get_rooms(self) async

Gets a list of all room_id that a specific user_id is member. Returns: list of rooms

Source code in matrix_admin_sdk/endpoints/v1/user.py
async def get_rooms(self) -> RoomModel:
    """
    Gets a list of all room_id that a specific user_id is member.
    Returns: list of rooms

    """
    url = self.url(f"users/{self.user_id}/joined_rooms")
    result = await self.request(RequestMethods.GET, url)
    res: RoomModel = RoomModel.from_dict(result)
    return res

is_admin(self) async

Get whether a user is a server administrator or not

Returns: True if user is admin, False otherwise

Source code in matrix_admin_sdk/endpoints/v1/user.py
async def is_admin(self) -> bool:
    """
    Get whether a user is a server administrator or not

    Returns: True if user is admin, False otherwise

    """
    url = self.url(f"users/{self.user_id}/admin")
    result = await self.request(RequestMethods.GET, url)
    res: bool = result["admin"]
    return res

login_as_user(self, valid_until_ms=None) async

Get an access token that can be used to authenticate as that user.

Useful for when admins wish to do actions on behalf of a user.

This API does not generate a new device for the user, and so will not appear their /devices list, and in general the target user should not be able to tell they have been logged in as.

To expire the token call the standard /logout API with the token.

Note: The token will expire if the admin user calls /logout/all from any of their devices, but the token will not expire if the target user does the same.

Parameters:

Name Type Description Default
valid_until_ms Optional[int]

An optional valid_until_ms field can be specified in the request body as an integer timestamp that specifies when the token should expire. By default tokens do not expire.

None
Source code in matrix_admin_sdk/endpoints/v1/user.py
async def login_as_user(
    self, valid_until_ms: Optional[int] = None
) -> Dict[str, str]:
    """
    Get an access token that can be used to authenticate as that user.

    Useful for when admins wish to do actions on behalf of a user.

    This API does not generate a new device for the user, and so will not appear their /devices list, and in general the target user should not be able to tell they have been logged in as.

    To expire the token call the standard /logout API with the token.

    **Note**: The token will expire if the admin user calls /logout/all from
    any of their devices, but the token will not expire if the target user
    does the same.


    Args:
        valid_until_ms: An optional valid_until_ms field can be specified
            in the request body as an integer timestamp that specifies when the
            token should expire. By default tokens do not expire.

    Returns: {"access_token": "<opaque_access_token_string>"}

    """
    url = self.url(f"users/{self.user_id}/login")
    data = {"valid_until_ms": valid_until_ms}
    result = await self.request(RequestMethods.POST, url, json=data)
    return result

query_current_sessions(self) async

This API returns information about the active sessions for a specific user

Source code in matrix_admin_sdk/endpoints/v1/user.py
async def query_current_sessions(self) -> CurrentSessionsModel:
    """
    This API returns information about the active sessions for a specific user
    Returns:

    """
    url = self.url(f"whois/{self.user_id}")
    result = await self.request(RequestMethods.GET, url)
    res: CurrentSessionsModel = CurrentSessionsModel.from_dict(result)
    return res

reset_password(self, new_password, logout_devices=True) async

Changes the password of another user. This will automatically log the user out of all their devices

Parameters:

Name Type Description Default
new_password str

new user's password

required
logout_devices bool

logout all devices, Default: True

True
Source code in matrix_admin_sdk/endpoints/v1/user.py
async def reset_password(
    self, new_password: str, logout_devices: bool = True
) -> None:
    """
    Changes the password of another user. This will automatically log the
    user out of all their devices
    Args:
        new_password: new user's password
        logout_devices: logout all devices, Default: True

    Returns: None

    """
    url = self.url(f"reset_password/{self.user_id}")
    data = {"new_password": new_password, "logout_devices": logout_devices}
    await self.request(RequestMethods.POST, url, json=data)

set_admin(self, admin) async

Change whether a user is a server administrator or not NOTE: you cannot demote yourself

Parameters:

Name Type Description Default
admin bool

True to make user admin, False to remove admin

required
Source code in matrix_admin_sdk/endpoints/v1/user.py
async def set_admin(self, admin: bool) -> None:
    """
    Change whether a user is a server administrator or not
    **NOTE**: you cannot demote yourself

    Args:
        admin: True to make user admin, False to remove admin

    Returns: None

    """
    url = self.url(f"users/{self.user_id}/admin")
    data = {"admin": admin}
    await self.request(RequestMethods.POST, url, data=data)

shadow_bann(self, bann_user) async

Shadow-banning is a useful tool for moderating malicious or egregiously abusive users. A shadow-banned users receives successful responses to their client-server API requests, but the events are not propagated into rooms. This can be an effective tool as it (hopefully) takes longer for the user to realise they are being moderated before pivoting to another account.

Shadow-banning a user should be used as a tool of last resort and may lead to confusing or broken behaviour for the client. A shadow-banned user will not receive any notification and it is generally more appropriate to ban or kick abusive users. A shadow-banned user will be unable to contact anyone on the server.

Parameters:

Name Type Description Default
bann_user bool

True to shadow-ban the user, False to un-shadow-ban the user.

required
Source code in matrix_admin_sdk/endpoints/v1/user.py
async def shadow_bann(self, bann_user: bool) -> None:
    """
    Shadow-banning is a useful tool for moderating malicious or egregiously
    abusive users. A shadow-banned users receives successful responses to
    their client-server API requests, but the events are not propagated
    into rooms. This can be an effective tool as it (hopefully) takes
    longer for the user to realise they are being moderated before pivoting
    to another account.

    Shadow-banning a user should be used as a tool of last resort and may
    lead to confusing or broken behaviour for the client. A shadow-banned
    user will not receive any notification and it is generally more
    appropriate to ban or kick abusive users. A shadow-banned user will be
    unable to contact anyone on the server.

    Args:
        bann_user: True to shadow-ban the user, False to un-shadow-ban the user.

    Returns: None

    """
    url = self.url(f"users/{self.user_id}/shadow_ban")
    if bann_user:
        method = RequestMethods.POST
    else:
        method = RequestMethods.DELETE

    await self.request(method, url)

Models

CurrentSessionsModel

CurrentSessionsModel(user_id: str, devices: Dict[str, List[matrix_admin_sdk.models.v1.user.ConnectionModel]])

Source code in matrix_admin_sdk/models/v1/user.py
class CurrentSessionsModel(BaseModel):
    user_id: str
    devices: Dict[str, List[ConnectionModel]]

    @classmethod
    def from_dict(cls, data: Dict[str, Any]) -> "CurrentSessionsModel":
        devices = {}
        for k, v in data["devices"].items():
            for session in v["sessions"]:
                devices[k] = [ConnectionModel(**i) for i in session["connections"]]
        return cls(
            user_id=data["user_id"],
            devices=devices,
        )

ConnectionModel

ConnectionModel(ip: str, last_seen: int, user_agent: str)

Source code in matrix_admin_sdk/models/v1/user.py
class ConnectionModel(BaseModel):
    ip: str
    last_seen: int
    user_agent: str

RoomModel

Room model

Attributes:

Name Type Description
joined_rooms list[str]

An array of room_id

total int

Number of rooms

Source code in matrix_admin_sdk/models/v1/user.py
class RoomModel(BaseModel):
    """
    Room model
    Attributes:
        joined_rooms (list[str]): An array of room_id
        total (int): Number of rooms
    """

    joined_rooms: List[str]
    total: int

MediaListModel

MediaListModel(media: List[matrix_admin_sdk.models.v1.user.MediaModel], next_token: Union[int, NoneType], total: int)

Source code in matrix_admin_sdk/models/v1/user.py
class MediaListModel(BaseModel):
    media: List[MediaModel]
    next_token: Optional[int]
    total: int

    @classmethod
    def from_dict(cls, data: Dict[str, Any]) -> "MediaListModel":
        media = [MediaModel.from_dict(i) for i in data["media"]]
        return cls(
            media=media,
            next_token=data.get("next_token"),
            total=data["total"],
        )

MediaModel

MediaModel(created_ts: int, media_id: str, media_length: int, media_type: str, safe_from_quarantine: bool, upload_name: str, last_access_ts: Union[int, NoneType] = None, quarantined_by: Union[str, NoneType] = None)

Source code in matrix_admin_sdk/models/v1/user.py
class MediaModel(BaseModel):
    created_ts: int
    media_id: str
    media_length: int
    media_type: str
    safe_from_quarantine: bool
    upload_name: str
    last_access_ts: Optional[int] = None
    quarantined_by: Optional[str] = None

DeletedMediaModel

Deleted media model

Attributes:

Name Type Description
deleted_media list[str]

List of deleted media_id

total int

Total number of deleted media

Source code in matrix_admin_sdk/models/v1/user.py
class DeletedMediaModel(BaseModel):
    """
    Deleted media model
    Attributes:
        deleted_media (list[str]): List of deleted media_id
        total (int): Total number of deleted media
    """

    deleted_media: List[str]
    total: int

PushersModel

Pushers model

Attributes:

Name Type Description
pushers list[PusherModel]

An array containing the current pushers for the user

total int

Total number of pushers

Source code in matrix_admin_sdk/models/v1/user.py
class PushersModel(BaseModel):
    """
    Pushers model
    Attributes:
        pushers (list[PusherModel]): An array containing the current pushers for
            the user
        total (int): Total number of pushers

    """

    pushers: List[PusherModel]
    total: int

    @classmethod
    def from_dict(cls, data: Dict[str, Any]) -> "PushersModel":
        pushers = [PusherModel.from_dict(i) for i in data["pushers"]]
        return cls(
            pushers=pushers,
            total=data["total"],
        )

PusherModel

Pusher model

Attributes:

Name Type Description
app_display_name str

A string that will allow the user to identify what application owns this pusher.

app_id str

This is a reverse-DNS style identifier for the application. Max length, 64 chars.

data PusherDataModel

information for the pusher implementation itself

device_display_name str

A string that will allow the user to identify what device owns this pusher.

profile_tag str

This string determines which set of device specific rules this pusher executes.

kind str

The kind of pusher. "http" is a pusher that sends HTTP pokes.

lang str

The preferred language for receiving notifications (e.g. 'en' or 'en-US')

pushkey str

This is a unique identifier for this pusher. Max length, 512 bytes.

Source code in matrix_admin_sdk/models/v1/user.py
class PusherModel(BaseModel):
    """
    Pusher model
    Attributes:
        app_display_name (str): A string that will allow the user to identify what
            application owns this pusher.
        app_id (str): This is a reverse-DNS style identifier for the application.
            Max length, 64 chars.
        data (PusherDataModel): information for the pusher implementation itself
        device_display_name (str): A string that will allow the user to identify
            what device owns this pusher.
        profile_tag (str): This string determines which set of device specific
            rules this pusher executes.
        kind (str): The kind of pusher. "http" is a pusher that sends HTTP pokes.
        lang (str): The preferred language for receiving notifications
            (e.g. 'en' or 'en-US')
        pushkey (str): This is a unique identifier for this pusher. Max length,
            512 bytes.

    """

    app_display_name: str
    app_id: str
    data: PusherDataModel
    device_display_name: str
    profile_tag: str
    kind: str
    lang: str
    pushkey: str

    @classmethod
    def from_dict(cls, data: Dict[str, Any]) -> "PusherModel":
        data = data.copy()
        data_field = PusherDataModel.from_dict(data.pop("data"))
        return cls(data=data_field, **data)

PusherDataModel

Pusher data model

Attributes:

Name Type Description
url str

Required if kind is http. The URL to use to send notifications to

format str

The format to use when sending notifications to the Push Gateway.

Source code in matrix_admin_sdk/models/v1/user.py
class PusherDataModel(BaseModel):
    """
    Pusher data model
    Attributes:
        url (str): Required if kind is http. The URL to use to send notifications to
        format (str): The format to use when sending notifications to the Push Gateway.
    """

    url: str
    format: Optional[str] = None