Skip to content

Team Members Asynchronous Endpoints

This Team Members endpoint provides asynchronous methods to interact with the team members of the authenticated user.

Example usage of the Team Members endpoint object:

import asyncio
from pyrevolut.client import AsyncClient

CREDS_JSON_LOC = "path/to/creds.json"

client = AsyncClient(
    creds_loc=CREDS_JSON_LOC,
    sandbox=True,
)

async def run():
    async with client:
        members = await client.TeamMembers.get_team_members()
        print(members)

asyncio.run(run())

EndpointTeamMembersAsync

Bases: BaseEndpointAsync

The async Team Members API

Retrieve information on existing team members of your organisation and invite new members.

This feature is available in the UK, US and the EEA.

This feature is not available in Sandbox.

Source code in pyrevolut/api/team_members/endpoint/asynchronous.py
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
class EndpointTeamMembersAsync(BaseEndpointAsync):
    """The async Team Members API

    Retrieve information on existing team members of your organisation and invite new members.

    This feature is available in the UK, US and the EEA.

    This feature is not available in Sandbox.
    """

    async def get_team_members(
        self,
        created_before: datetime | DateTime | str | int | float | None = None,
        limit: int | None = None,
        **kwargs,
    ) -> list[dict] | list[RetrieveListOfTeamMembers.Response]:
        """
        Get information about all the team members of your business.

        The results are paginated and sorted by the created_at date in reverse chronological order.

        Note
        ----
        This feature is available in the UK, US and the EEA.

        This feature is not available in Sandbox.

        Parameters
        ----------
        created_before : datetime | DateTime | str | int | float | None
            Retrieves team members with created_at < created_before.
            The default value is the current date and time at which you are calling the endpoint.
            Provided in ISO 8601 format.
        limit : int | None
            The maximum number of team members returned per page.
            To get to the next page, make a new request and use the
            created_at date of the last team member returned in the previous
            response as the value for created_before.

            If not provided, the default value is 100.

        Returns
        -------
        list[dict] | list[RetrieveListOfTeamMembers.Response]
            The list of all team members in your organisation.
        """
        self.__check_sandbox()
        endpoint = RetrieveListOfTeamMembers
        path = endpoint.ROUTE
        params = endpoint.Params(
            created_before=created_before,
            limit=limit,
        )

        return await self.client.get(
            path=path,
            response_model=endpoint.Response,
            params=params,
            **kwargs,
        )

    async def get_team_roles(
        self,
        created_before: datetime | DateTime | str | int | float | None = None,
        limit: int | None = None,
        **kwargs,
    ) -> list[dict] | list[RetrieveTeamRoles.Response]:
        """
        Get the list of roles for your business.

        The results are paginated and sorted by the created_at date in reverse chronological order.

        This feature is available in the UK, US and the EEA.

        This feature is not available in Sandbox.

        Parameters
        ----------
        created_before : datetime | DateTime | str | int | float | None
            Retrieves team roles with created_at < created_before.
            The default value is the current date and time at which you are calling the endpoint.
            Provided in ISO 8601 format.
        limit : int | None
            The maximum number of team roles returned per page.
            To get to the next page, make a new request and use the
            created_at date of the last role returned in the previous
            response as the value for created_before.

            If not provided, the default value is 100.

        Returns
        -------
        list[dict] | list[RetrieveTeamRoles.Response]
            The list of all team roles in your organisation.
        """
        self.__check_sandbox()
        endpoint = RetrieveTeamRoles
        path = endpoint.ROUTE
        params = endpoint.Params(
            created_before=created_before,
            limit=limit,
        )

        return await self.client.get(
            path=path,
            response_model=endpoint.Response,
            params=params,
            **kwargs,
        )

    async def invite_team_member(
        self,
        email: str,
        role_id: UUID | str,
        **kwargs,
    ) -> dict | InviteTeamMember.Response:
        """
        Invite a new member to your business account.

        When you invite a new team member to your business account,
        an invitation is sent to their email address that you provided in this request.
        To join your business account, the new team member has to accept this invitation.

        Note
        ----
        This feature is available in the UK, US and the EEA.

        This feature is not available in Sandbox.

        Parameters
        ----------
        email : str
            The email address of the invited member.
        role_id : UUID | str
            The ID of the role to assign to the new member.

        Returns
        -------
        dict | InviteTeamMember.Response
            The response model.
        """
        self.__check_sandbox()
        endpoint = InviteTeamMember
        path = endpoint.ROUTE
        body = endpoint.Body(
            email=email,
            role_id=role_id,
        )

        return await self.client.post(
            path=path,
            response_model=endpoint.Response,
            body=body,
            **kwargs,
        )

    def __check_sandbox(self):
        """
        Check if the sandbox is enabled.

        Raises
        ------
        PyRevolutInvalidEnvironment
            If the sandbox is enabled.
        """
        if self.client.sandbox:
            raise PyRevolutInvalidEnvironment(
                "This feature is not available in Sandbox."
            )

__check_sandbox()

Check if the sandbox is enabled.

Raises:

Type Description
PyRevolutInvalidEnvironment

If the sandbox is enabled.

Source code in pyrevolut/api/team_members/endpoint/asynchronous.py
167
168
169
170
171
172
173
174
175
176
177
178
179
def __check_sandbox(self):
    """
    Check if the sandbox is enabled.

    Raises
    ------
    PyRevolutInvalidEnvironment
        If the sandbox is enabled.
    """
    if self.client.sandbox:
        raise PyRevolutInvalidEnvironment(
            "This feature is not available in Sandbox."
        )

get_team_members(created_before=None, limit=None, **kwargs) async

Get information about all the team members of your business.

The results are paginated and sorted by the created_at date in reverse chronological order.

Note

This feature is available in the UK, US and the EEA.

This feature is not available in Sandbox.

Parameters:

Name Type Description Default
created_before datetime | DateTime | str | int | float | None

Retrieves team members with created_at < created_before. The default value is the current date and time at which you are calling the endpoint. Provided in ISO 8601 format.

None
limit int | None

The maximum number of team members returned per page. To get to the next page, make a new request and use the created_at date of the last team member returned in the previous response as the value for created_before.

If not provided, the default value is 100.

None

Returns:

Type Description
list[dict] | list[Response]

The list of all team members in your organisation.

Source code in pyrevolut/api/team_members/endpoint/asynchronous.py
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
async def get_team_members(
    self,
    created_before: datetime | DateTime | str | int | float | None = None,
    limit: int | None = None,
    **kwargs,
) -> list[dict] | list[RetrieveListOfTeamMembers.Response]:
    """
    Get information about all the team members of your business.

    The results are paginated and sorted by the created_at date in reverse chronological order.

    Note
    ----
    This feature is available in the UK, US and the EEA.

    This feature is not available in Sandbox.

    Parameters
    ----------
    created_before : datetime | DateTime | str | int | float | None
        Retrieves team members with created_at < created_before.
        The default value is the current date and time at which you are calling the endpoint.
        Provided in ISO 8601 format.
    limit : int | None
        The maximum number of team members returned per page.
        To get to the next page, make a new request and use the
        created_at date of the last team member returned in the previous
        response as the value for created_before.

        If not provided, the default value is 100.

    Returns
    -------
    list[dict] | list[RetrieveListOfTeamMembers.Response]
        The list of all team members in your organisation.
    """
    self.__check_sandbox()
    endpoint = RetrieveListOfTeamMembers
    path = endpoint.ROUTE
    params = endpoint.Params(
        created_before=created_before,
        limit=limit,
    )

    return await self.client.get(
        path=path,
        response_model=endpoint.Response,
        params=params,
        **kwargs,
    )

get_team_roles(created_before=None, limit=None, **kwargs) async

Get the list of roles for your business.

The results are paginated and sorted by the created_at date in reverse chronological order.

This feature is available in the UK, US and the EEA.

This feature is not available in Sandbox.

Parameters:

Name Type Description Default
created_before datetime | DateTime | str | int | float | None

Retrieves team roles with created_at < created_before. The default value is the current date and time at which you are calling the endpoint. Provided in ISO 8601 format.

None
limit int | None

The maximum number of team roles returned per page. To get to the next page, make a new request and use the created_at date of the last role returned in the previous response as the value for created_before.

If not provided, the default value is 100.

None

Returns:

Type Description
list[dict] | list[Response]

The list of all team roles in your organisation.

Source code in pyrevolut/api/team_members/endpoint/asynchronous.py
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
async def get_team_roles(
    self,
    created_before: datetime | DateTime | str | int | float | None = None,
    limit: int | None = None,
    **kwargs,
) -> list[dict] | list[RetrieveTeamRoles.Response]:
    """
    Get the list of roles for your business.

    The results are paginated and sorted by the created_at date in reverse chronological order.

    This feature is available in the UK, US and the EEA.

    This feature is not available in Sandbox.

    Parameters
    ----------
    created_before : datetime | DateTime | str | int | float | None
        Retrieves team roles with created_at < created_before.
        The default value is the current date and time at which you are calling the endpoint.
        Provided in ISO 8601 format.
    limit : int | None
        The maximum number of team roles returned per page.
        To get to the next page, make a new request and use the
        created_at date of the last role returned in the previous
        response as the value for created_before.

        If not provided, the default value is 100.

    Returns
    -------
    list[dict] | list[RetrieveTeamRoles.Response]
        The list of all team roles in your organisation.
    """
    self.__check_sandbox()
    endpoint = RetrieveTeamRoles
    path = endpoint.ROUTE
    params = endpoint.Params(
        created_before=created_before,
        limit=limit,
    )

    return await self.client.get(
        path=path,
        response_model=endpoint.Response,
        params=params,
        **kwargs,
    )

invite_team_member(email, role_id, **kwargs) async

Invite a new member to your business account.

When you invite a new team member to your business account, an invitation is sent to their email address that you provided in this request. To join your business account, the new team member has to accept this invitation.

Note

This feature is available in the UK, US and the EEA.

This feature is not available in Sandbox.

Parameters:

Name Type Description Default
email str

The email address of the invited member.

required
role_id UUID | str

The ID of the role to assign to the new member.

required

Returns:

Type Description
dict | Response

The response model.

Source code in pyrevolut/api/team_members/endpoint/asynchronous.py
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
async def invite_team_member(
    self,
    email: str,
    role_id: UUID | str,
    **kwargs,
) -> dict | InviteTeamMember.Response:
    """
    Invite a new member to your business account.

    When you invite a new team member to your business account,
    an invitation is sent to their email address that you provided in this request.
    To join your business account, the new team member has to accept this invitation.

    Note
    ----
    This feature is available in the UK, US and the EEA.

    This feature is not available in Sandbox.

    Parameters
    ----------
    email : str
        The email address of the invited member.
    role_id : UUID | str
        The ID of the role to assign to the new member.

    Returns
    -------
    dict | InviteTeamMember.Response
        The response model.
    """
    self.__check_sandbox()
    endpoint = InviteTeamMember
    path = endpoint.ROUTE
    body = endpoint.Body(
        email=email,
        role_id=role_id,
    )

    return await self.client.post(
        path=path,
        response_model=endpoint.Response,
        body=body,
        **kwargs,
    )