Skip to content

Commit d95c6d5

Browse files
committed
Update api reference and associated texts
1 parent 5b5eb76 commit d95c6d5

3 files changed

Lines changed: 104 additions & 59 deletions

File tree

src/.vitepress/sidebar/en.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ export default {
100100
collapsed: true,
101101
items: [
102102
{ text: 'Custom Mobile App', link: '/dev/customapp/' },
103-
{ text: 'Python Client Module Integration', link: '/dev/integration/' },
104-
{ text: 'C++ Standalone Client Integration', link: '/dev/integration-cpp/' },
103+
{ text: 'Python API Client', link: '/dev/integration/' },
104+
{ text: 'C++ API Client', link: '/dev/integration-cpp/' },
105105
{ text: 'PostgreSQL DB Sync', link: '/dev/dbsync/' },
106106
{ text: 'Media Sync', link: '/dev/media-sync/' },
107107
{ text: 'Work Packages', link: '/dev/work-packages/' },

src/dev/integration-cpp/index.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# C++ Standalone Client Integration
1+
# C++ API Client
22
[[toc]]
33

44
Do you want to integrate <MainPlatformNameLink />? <MainPlatformName /> is an open platform that aims to be developer friendly and it has been designed to allow easy integration with other software.
55

6-
## C++ client installation
7-
C++ client is completely without any dependencies. To install the C++ client, just download the binary for your platform from <GitHubRepo id="MerginMaps/cpp-api-client/releases"/> and use it from the command line.
6+
## Installation
7+
C++ API client is completely without any dependencies. To install the client, just download the binary for your platform from <GitHubRepo id="MerginMaps/cpp-api-client/releases"/> and use it from the command line.
88

9-
Go to <GitHubRepo id="MerginMaps/cpp-api-client" /> repository for more information on how to use it.
9+
The client uses Qt-based <GitHubRepo id="MerginMaps/mobile/tree/master/core" desc="Mergin Maps API core library" /> used by the <MainDomainNameLink desc="mobile app" /> to sync the projects in the mobile application. Go to <GitHubRepo id="MerginMaps/cpp-api-client" /> repository for more information on how to use it.
1010

11-
## Command line tool
11+
## Command line interface
1212
When the client is installed, it comes with `mergin` command line tool.
1313

1414
```bash
@@ -28,7 +28,3 @@ Commands:
2828
sync Pull&Push the changes
2929
remove Remove project from server.
3030
```
31-
32-
## Mergin Maps API core library
33-
34-
C++ Client is based on the Qt-based <GitHubRepo id="MerginMaps/mobile/tree/master/core" desc="Mergin Maps API core library" /> used by the <MainDomainNameLink desc="Mergin Maps mobile app" /> to sync the projects in the mobile application.

src/dev/integration/index.md

Lines changed: 97 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
1-
# Python Client Module Integration
1+
---
2+
outline: deep
3+
---
4+
5+
# Python API Client
26
[[toc]]
37

48
Do you want to integrate <MainPlatformNameLink />? <MainPlatformName /> is an open platform that aims to be developer friendly and it has been designed to allow easy integration with other software.
59

6-
## Python client module installation
7-
The Python client module is the easiest way to programmatically use <MainPlatformNameLink />. You can use Python API or a command-line tool to easily work with <MainPlatformName /> projects, such as to get project status, push and pull changes, or to download, create and delete projects.
8-
9-
The <GitHubRepo id="MerginMaps/python-api-client" /> repository contains the source code of the Python client module and more information on how to use it.
10+
## Installation
11+
The Python client module is the easiest way to programmatically use <MainPlatformNameLink />. You can use Python API or a command-line tool to easily work with your projects, such as to get project status, push and pull changes. You can also create user accounts and manage their roles.
1012

1113
Python client is available in the PyPI repository and can be installed with `pip`:
1214

1315
```
1416
pip3 install mergin-client
1517
```
1618

19+
## Command line interface
20+
For those who prefer using terminal, there is `mergin` command line tool shipped with the Python client. With several built-in commands, it is possible to download <MainPlatformName /> projects, push/pull changes, create or delete projects and more.
21+
22+
For example, to download a <MainPlatformName /> project to a local folder:
23+
```
24+
mergin download john/project1 ~/mergin/project1
25+
```
26+
For more details, visit <GitHubRepo id="MerginMaps/python-api-client" />.
27+
1728
## Python module
1829
To use <MainPlatformNameLink /> from Python, just create `MerginClient` object and then use it. Here, for instance, to download a project:
1930

@@ -30,132 +41,170 @@ import Mergin.mergin as mergin
3041
client = mergin.MerginClient(login='john', password='T0p_secret')
3142
```
3243

33-
## User and roles management in Python module
34-
You can create new users and manage their permissions using the following methods:
44+
## API reference - users
45+
46+
You can create new users and manage their roles using the following methods.
47+
48+
::: warning API availability
49+
The following methods are available for Python API Client versions `0.10.0` or higher, using server versions `2025.2.0` or higher.
50+
:::
3551

3652
### Create a user
3753

3854
```python
3955
client.create_user(<email>, <password>, <workspace_id>, <workspace_role>, [username], [notify_user])
4056
```
57+
58+
The caller must be a workspace admin, owner or server administrator.
59+
4160
Arguments:
4261

4362
`email` (string): Must be a unique email.
4463

4564
`password` (string): Must meet security requirements.
4665

47-
`workspace_id` (int): The workspace ID where the user will be added.
66+
`workspace_id` (int)⭐️ : The workspace ID where the user will be added.
4867

49-
`workspace_role`(string): The user’s role in the workspace. [See the roles options](../../manage/permissions.md).
68+
`workspace_role` (string)⭐️ : The user’s role in the workspace. [See the roles options](../../manage/permissions.md#workspace-member-roles-overview).
5069

51-
`username` (string, optional): Custom username; if not provided, it will be automatically generated.
70+
`username` (string, optional): If not provided, it will be automatically generated from the email address.
5271

53-
`notify_user` (Boolean, optional): Flag for email notifications (invitations, access requests etc.). Default is `False`.
72+
`notify_user` (Boolean, optional): If true, confirmation email and other email communication will be sent to the email address (invitations, access requests etc.). Default is `False`.
5473

5574
Example:
5675
```python
5776
client.create_user("jill@example.com", "T0p_secret", 1, "editor", notify_user=True)
5877
```
5978

60-
### Get a workspace member detail
79+
> ⭐️ `workspace_id` and `workspace_role` arguments are ignored on Community edition servers.
80+
81+
---
82+
83+
### Workspace members methods
84+
85+
These methods are available for Cloud and Enterperise edition servers.
86+
87+
::: warning API availability
88+
The following methods are available for Python API Client versions `0.10.0` or higher, using server versions `2025.2.0` or higher.
89+
:::
90+
91+
The caller of the following methods must be a workspace admin, owner or server administrator.
92+
93+
#### List members
6194

6295
```python
63-
client.get_workspace_member(<workspace_id>, <user_id>)
96+
client.list_workspace_members(<workspace_id>)
6497
```
6598
Arguments:
6699

67-
`workspace_id` (int): The workspace ID used to retrieve the user's roles for the workspace and its projects.
68-
69-
`user_id` (int): ID of the user.
100+
`workspace_id` (int): ID of the workspace.
70101

71-
### Get a list of workspace members
102+
#### Get member detail
72103

73104
```python
74-
client.list_workspace_members(<workspace_id>)
105+
client.get_workspace_member(<workspace_id>, <user_id>)
75106
```
76107
Arguments:
77108

78-
`workspace_id` (int): The workspace ID to list the members.
109+
`workspace_id` (int): ID of the workspace.
110+
111+
`user_id` (int): ID of the user.
79112

80-
### Update workspace role
113+
#### Update member role
81114

82115
```python
83116
client.update_workspace_member(<workspace_id>, <user_id>, <workspace_role>, [reset_projects_roles])
84117
```
85118
Arguments:
86119

87-
`workspace_id` (int): Workspace ID where to update user's role.
120+
`workspace_id` (int): ID of the workspace.
88121

89-
`user_id` (int): User to be updated.
122+
`user_id` (int): ID of the user.
90123

91-
`workspace_role` (string): New role.
124+
`workspace_role` (string): New role. [See the roles options](../../manage/permissions.md#workspace-member-roles-overview).
92125

93-
`reset_projects_roles` (Boolean, optional): Flag to remove all project specific roles.
126+
`reset_projects_roles` (Boolean, optional): If true, overriden project roles (explicitly shared projects access) will be reset. Default is `False`.
94127

95-
### Remove a user from a workspace
128+
#### Remove member
96129

97130
```python
98131
client.remove_workspace_member(<workspace_id>, <user_id>)
99132
```
100133
Arguments:
101134

102-
`workspace_id` (int): Workspace ID from which to remove the user.
135+
`workspace_id` (int): ID of the workspace.
136+
137+
`user_id` (int): ID of the user.
138+
139+
> Note: the user account is not removed. This method only removes their access to the workspace.
140+
141+
---
142+
143+
### Project collaborators methods
144+
145+
These methods are available for all server types.
146+
147+
::: warning API availability
148+
The following methods are available for Python API Client versions `0.10.0` or higher, using server versions `2025.2.0` or higher.
149+
:::
103150

104-
`user_id` (int): ID of the user to be removed.
151+
The caller of the following methods must be a workspace admin, owner, project owner or server administrator.
105152

106-
### Get a list of project collaborators
153+
The following methods accept project ids (of type `uuid`). You can find project id via [projects_list](https://github.com/MerginMaps/python-api-client/blob/634237890afd9f28f03953e5a01376b56f5abf5c/mergin/client.py#L572) and [project_info](https://github.com/MerginMaps/python-api-client/blob/634237890afd9f28f03953e5a01376b56f5abf5c/mergin/client.py#L642) methods.
154+
155+
#### List project collaborators
107156

108157
```python
109158
client.list_project_collaborators(<project_id>)
110159
```
111160
Arguments:
112161

113-
`project_id` (string): Project ID to list the users.
162+
`project_id` (string): ID of the project.
163+
164+
#### Add project collaborator
114165

115-
### Add a user to project
166+
Adds a user as project collaborator. This method is good for sharing projects with guests or upgrading roles of members for specific projects.
167+
On Cloud, the user must be a in the workspace where the project belongs.
116168

117169
```python
118170
client.add_project_collaborator(<project_id>, <user>, <project_role>)
119171
```
120172
Arguments:
121173

122-
`project_id` (string): Project ID to add the user.
174+
`project_id` (string): ID of the project.
123175

124-
`user` (string): Email or username of the user to be added to the project.
176+
`user` (string): Email or username of the user to be added to the project.
125177

126-
`project_role`: (string): Role of the user in the project.
178+
`project_role`: (string): Role of the user in the project. [See the roles options](../../manage/permissions.md##project-permissions-overview)
127179

128-
### Update project role
180+
#### Update project collaborator role
129181

130182
```python
131183
client.update_project_collaborator(<project_id>, <user_id>, <project_role>)
132184
```
133185
Arguments:
134186

135-
`project_id` (string): Project ID in which the role will be updated.
187+
`project_id` (string): ID of the project.
136188

137-
`user_id` (int): ID of the user to update.
189+
`user_id` (int): ID of the user.
138190

139-
`project_role`: (string): New role.
191+
`project_role`: (string): New role. [See the roles options](../../manage/permissions.md##project-permissions-overview)
140192

141-
Note that the user must have a project role to update it. You can create one using the previous method.
193+
> Note: the user must be first added to the project (via [Add project collaborator](./index.md#add-project-collaborator)) before calling this method, even if he/she is already a workspace member or guest.
142194
143-
### Update project role
195+
#### Remove project collaborator
144196

145197
```python
146198
client.remove_project_collaborator(<project_id>, <user_id>)
147199
```
148200
Arguments:
149201

150-
`project_id` (string): Project ID to remove the user.
202+
`project_id` (string): ID of the project.
151203

152-
`user_id` (int): ID of the user to remove from the project.
204+
`user_id` (int): ID of the user.
153205

154-
## Command line interface
155-
For those who prefer using terminal, there is `mergin` command line tool shipped with the Python client. With several built-in commands, it is possible to download <MainPlatformName /> projects, push/pull changes, create or delete projects and more.
206+
> Note: the user account is not removed, only the project access.
156207
157-
For example, to download a <MainPlatformName /> project to a local folder:
158-
```
159-
mergin download john/project1 ~/mergin/project1
160-
```
161-
For more details, visit <GitHubRepo id="MerginMaps/python-api-client" />.
208+
## Further details
209+
210+
The <GitHubRepo id="MerginMaps/python-api-client" /> repository contains the source code and more information on how to use it.

0 commit comments

Comments
 (0)