Skip to content

Commit

Permalink
Changing code example order for roles
Browse files Browse the repository at this point in the history
  • Loading branch information
cpluta committed Jan 31, 2020
1 parent 4ac354f commit 2a6d343
Show file tree
Hide file tree
Showing 5 changed files with 292 additions and 292 deletions.
98 changes: 49 additions & 49 deletions docs/roles/creating.rst
Expand Up @@ -22,32 +22,30 @@ Creating a role allows it to be assignable to a user.

.. tabs::

.. group-tab:: C#
.. group-tab:: REST

.. code-block:: c#
var client = MeshyClient.Initialize(accountName, publicKey);
var connection = await client.LoginAnonymouslyAsync(username);
var role = new Role();
.. code-block:: http
POST https://api.meshydb.com/{accountName}/roles HTTP/1.1
Authorization: Bearer {access_token}
Content-Type: application/json
await connection.Roles.CreateAsync(role);
{
"name":"test",
"description":"..."
}
|parameters|

accountName : :type:`string`, :required:`required`
Indicates which account you are connecting to.
publicKey : :type:`string`, :required:`required`
Public identifier of connecting service.
username : :type:`string`, :required:`required`
Unique user name for authentication.
name : :type:`string`, :required:`required`
Name of the role.
description : :type:`string`
Describes the purpose of the role.
numberOfUsers : :type:`string`
Read-only count of users assigned to the role.


.. group-tab:: NodeJS

.. code-block:: javascript
Expand All @@ -72,30 +70,32 @@ Creating a role allows it to be assignable to a user.
numberOfUsers : :type:`string`
Read-only count of users assigned to the role.

.. group-tab:: REST
.. group-tab:: C#

.. code-block:: http
POST https://api.meshydb.com/{accountName}/roles HTTP/1.1
Authorization: Bearer {access_token}
Content-Type: application/json
.. code-block:: c#
var client = MeshyClient.Initialize(accountName, publicKey);
var connection = await client.LoginAnonymouslyAsync(username);
{
"name":"test",
"description":"..."
}
var role = new Role();
await connection.Roles.CreateAsync(role);
|parameters|

accountName : :type:`string`, :required:`required`
Indicates which account you are connecting to.
publicKey : :type:`string`, :required:`required`
Public identifier of connecting service.
username : :type:`string`, :required:`required`
Unique user name for authentication.
name : :type:`string`, :required:`required`
Name of the role.
description : :type:`string`
Describes the purpose of the role.

numberOfUsers : :type:`string`
Read-only count of users assigned to the role.

.. rubric:: Responses

201 : Created
Expand Down Expand Up @@ -134,23 +134,28 @@ When creating a permission it is assigned to a role. When a user has the role th

.. tabs::

.. group-tab:: C#
.. group-tab:: REST

.. code-block:: c#
var client = MeshyClient.Initialize(accountName, publicKey);
var connection = await client.LoginAnonymouslyAsync(username);
var permission = new Permission();
.. code-block:: http
POST https://api.meshydb.com/{accountName}/roles/{roleId}/permissions HTTP/1.1
Authorization: Bearer {access_token}
Content-Type: application/json
await connection.Roles.CreatePermissionAsync(roleId, permission);
{
"permissibleName":"meshes",
"create":"true",
"update":"true",
"read":"true",
"delete":"true"
}
|parameters|

accountName : :type:`string`, :required:`required`
Indicates which account you are connecting to.
publicKey : :type:`string`, :required:`required`
Public identifier of connecting service.
access_token : :type:`string`, :required:`required`
Token identifying authorization with MeshyDB requested during `Generating Token <../authorization/generating_token.html#generating-token>`_.
roleId : :type:`string`, :required:`required`
Identifies id of role.
permissibleName : :type:`string`, :required:`required`
Expand Down Expand Up @@ -194,28 +199,23 @@ When creating a permission it is assigned to a role. When a user has the role th
delete : type:`boolean`
Identifies if role can delete data.

.. group-tab:: REST
.. group-tab:: C#

.. code-block:: http
POST https://api.meshydb.com/{accountName}/roles/{roleId}/permissions HTTP/1.1
Authorization: Bearer {access_token}
Content-Type: application/json
.. code-block:: c#
var client = MeshyClient.Initialize(accountName, publicKey);
var connection = await client.LoginAnonymouslyAsync(username);
{
"permissibleName":"meshes",
"create":"true",
"update":"true",
"read":"true",
"delete":"true"
}
var permission = new Permission();
await connection.Roles.CreatePermissionAsync(roleId, permission);
|parameters|

accountName : :type:`string`, :required:`required`
Indicates which account you are connecting to.
access_token : :type:`string`, :required:`required`
Token identifying authorization with MeshyDB requested during `Generating Token <../authorization/generating_token.html#generating-token>`_.
publicKey : :type:`string`, :required:`required`
Public identifier of connecting service.
roleId : :type:`string`, :required:`required`
Identifies id of role.
permissibleName : :type:`string`, :required:`required`
Expand Down
130 changes: 65 additions & 65 deletions docs/roles/deleting.rst
Expand Up @@ -20,26 +20,20 @@ Delete details about role by id.

.. tabs::

.. group-tab:: C#
.. group-tab:: REST

.. code-block:: c#
var client = MeshyClient.Initialize(accountName, publicKey);
var connection = await client.LoginAnonymouslyAsync(username);
await connection.Roles.DeleteAsync(roleId);
.. code-block:: http
DELETE https://api.meshydb.com/{accountName}/roles/{roleId} HTTP/1.1
Authorization: Bearer {access_token}
|parameters|

accountName : :type:`string`, :required:`required`
Indicates which account you are connecting to.
publicKey : :type:`string`, :required:`required`
Public identifier of connecting service.
username : :type:`string`, :required:`required`
Unique user name for authentication.
roleId : :type:`string`, :required:`required`
Identifies id of role.

access_token : :type:`string`, :required:`required`
Token identifying authorization with MeshyDB requested during `Generating Token <../authorization/generating_token.html#generating-token>`_.

.. group-tab:: NodeJS

.. code-block:: javascript
Expand All @@ -61,20 +55,26 @@ Delete details about role by id.
roleId : :type:`string`, :required:`required`
Identifies id of role.

.. group-tab:: REST
.. group-tab:: C#

.. code-block:: http
DELETE https://api.meshydb.com/{accountName}/roles/{roleId} HTTP/1.1
Authorization: Bearer {access_token}
.. code-block:: c#
var client = MeshyClient.Initialize(accountName, publicKey);
var connection = await client.LoginAnonymouslyAsync(username);
await connection.Roles.DeleteAsync(roleId);
|parameters|

accountName : :type:`string`, :required:`required`
Indicates which account you are connecting to.
access_token : :type:`string`, :required:`required`
Token identifying authorization with MeshyDB requested during `Generating Token <../authorization/generating_token.html#generating-token>`_.

publicKey : :type:`string`, :required:`required`
Public identifier of connecting service.
username : :type:`string`, :required:`required`
Unique user name for authentication.
roleId : :type:`string`, :required:`required`
Identifies id of role.

.. rubric:: Responses

204 : No Content
Expand Down Expand Up @@ -103,21 +103,19 @@ Delete specific permission from role by id.

.. tabs::

.. group-tab:: C#
.. group-tab:: REST

.. code-block:: c#
var client = MeshyClient.Initialize(accountName, publicKey);
var connection = await client.LoginAnonymouslyAsync(username);
await connection.Roles.DeletePermissionAsync(roleId, permissionId);
.. code-block:: http
DELETE https://api.meshydb.com/{accountName}/roles/{roleId}/permissions/{permissionId} HTTP/1.1
Authorization: Bearer {access_token}
|parameters|

accountName : :type:`string`, :required:`required`
Indicates which account you are connecting to.
publicKey : :type:`string`, :required:`required`
Public identifier of connecting service.
access_token : :type:`string`, :required:`required`
Token identifying authorization with MeshyDB requested during `Generating Token <../authorization/generating_token.html#generating-token>`_.
roleId : :type:`string`, :required:`required`
Identifies id of role.
permissionId : :type:`string`, :required:`required`
Expand Down Expand Up @@ -146,19 +144,21 @@ Delete specific permission from role by id.
permissionId : :type:`string`, :required:`required`
Identifies id of permission.

.. group-tab:: REST
.. group-tab:: C#

.. code-block:: http
DELETE https://api.meshydb.com/{accountName}/roles/{roleId}/permissions/{permissionId} HTTP/1.1
Authorization: Bearer {access_token}
.. code-block:: c#
var client = MeshyClient.Initialize(accountName, publicKey);
var connection = await client.LoginAnonymouslyAsync(username);
await connection.Roles.DeletePermissionAsync(roleId, permissionId);
|parameters|

accountName : :type:`string`, :required:`required`
Indicates which account you are connecting to.
access_token : :type:`string`, :required:`required`
Token identifying authorization with MeshyDB requested during `Generating Token <../authorization/generating_token.html#generating-token>`_.
publicKey : :type:`string`, :required:`required`
Public identifier of connecting service.
roleId : :type:`string`, :required:`required`
Identifies id of role.
permissionId : :type:`string`, :required:`required`
Expand Down Expand Up @@ -189,27 +189,30 @@ Remove users from specific role.

.. tabs::

.. group-tab:: C#
.. group-tab:: REST

.. code-block:: c#
var client = MeshyClient.Initialize(accountName, publicKey);
var connection = await client.LoginAnonymouslyAsync(username);
var batchRoleRemove = new BatchRoleRemove();
.. code-block:: http
DELETE https://api.meshydb.com/{accountName}/roles/{roleId}/users HTTP/1.1
Authorization: Bearer {access_token}
Content-Type: application/json
await connection.Roles.RemoveUsersAsync(roleId, batchRoleRemove);
{
"users": [
{
"id":"5db..."
}
]
}
|parameters|

accountName : :type:`string`, :required:`required`
Indicates which account you are connecting to.
publicKey : :type:`string`, :required:`required`
Public identifier of connecting service.
access_token : :type:`string`, :required:`required`
Token identifying authorization with MeshyDB requested during `Generating Token <../authorization/generating_token.html#generating-token>`_.
roleId : :type:`string`, :required:`required`
Identifies id of role.
batchRoleRemove : :type:`object`, :required:`required`
Batch object of user ids to be removed from role.

.. group-tab:: NodeJS

Expand All @@ -234,30 +237,27 @@ Remove users from specific role.
batchRoleRemove : :type:`object`, :required:`required`
Batch object of user ids to be removed from role.

.. group-tab:: REST
.. group-tab:: C#

.. code-block:: http
DELETE https://api.meshydb.com/{accountName}/roles/{roleId}/users HTTP/1.1
Authorization: Bearer {access_token}
Content-Type: application/json
.. code-block:: c#
var client = MeshyClient.Initialize(accountName, publicKey);
var connection = await client.LoginAnonymouslyAsync(username);
{
"users": [
{
"id":"5db..."
}
]
}
var batchRoleRemove = new BatchRoleRemove();
await connection.Roles.RemoveUsersAsync(roleId, batchRoleRemove);
|parameters|

accountName : :type:`string`, :required:`required`
Indicates which account you are connecting to.
access_token : :type:`string`, :required:`required`
Token identifying authorization with MeshyDB requested during `Generating Token <../authorization/generating_token.html#generating-token>`_.
publicKey : :type:`string`, :required:`required`
Public identifier of connecting service.
roleId : :type:`string`, :required:`required`
Identifies id of role.
batchRoleRemove : :type:`object`, :required:`required`
Batch object of user ids to be removed from role.

.. rubric:: Responses

Expand Down

0 comments on commit 2a6d343

Please sign in to comment.