Current section

Files

Jump to
docusign lib docusign api groups.ex
Raw

lib/docusign/api/groups.ex

# NOTE: This file is auto generated by OpenAPI Generator 6.4.0 (https://openapi-generator.tech).
# Do not edit this file manually.
defmodule DocuSign.Api.Groups do
@moduledoc """
API calls for all endpoints tagged `Groups`.
"""
alias DocuSign.Connection
import DocuSign.RequestBuilder
@doc """
Deletes an existing user group.
Deletes an existing user group. When you delete a group, you include only the `groupId` in the request body. Example: ``` { \"groups\": [ { \"groupId\": \"12345\" } } ```
### Parameters
- `connection` (DocuSign.Connection): Connection to server
- `account_id` (String.t): The external account number (int) or account ID GUID.
- `opts` (keyword): Optional parameters
- `:body` (GroupInformation):
### Returns
- `{:ok, DocuSign.Model.GroupInformation.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec groups_delete_groups(Tesla.Env.client(), String.t(), keyword()) ::
{:ok, DocuSign.Model.ErrorDetails.t()}
| {:ok, DocuSign.Model.GroupInformation.t()}
| {:error, Tesla.Env.t()}
def groups_delete_groups(connection, account_id, opts \\ []) do
optional_params = %{
:body => :body
}
request =
%{}
|> method(:delete)
|> url("/v2.1/accounts/#{account_id}/groups")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %DocuSign.Model.GroupInformation{}},
{400, %DocuSign.Model.ErrorDetails{}}
])
end
@doc """
Gets information about groups associated with the account.
Retrieves information about groups associated with the account. **Note:** To retrieve a group's users, use this endpoint to get the group ID and then call the [listGroupUsers](/docs/esign-rest-api/reference/usergroups/groupusers/list/) endpoint. ### Related topics - [How to set a permission profile](/docs/esign-rest-api/how-to/permission-profile-setting/)
### Parameters
- `connection` (DocuSign.Connection): Connection to server
- `account_id` (String.t): The external account number (int) or account ID GUID.
- `opts` (keyword): Optional parameters
- `:count` (String.t): The maximum number of results to return. Use `start_position` to specify the number of results to skip. Valid values: `1` to `100`
- `:group_type` (String.t): The type of group to return. Valid values: * `AdminGroup` * `CustomGroup` * `EveryoneGroup`
- `:include_usercount` (String.t): When **true,** every group returned in the response includes a `userCount` property that contains the total number of users in the group. The default is **true.**
- `:search_text` (String.t): Filters the results of a GET request based on the text that you specify.
- `:start_position` (String.t): The zero-based index of the result from which to start returning results. Use with `count` to limit the number of results. The default value is `0`.
### Returns
- `{:ok, DocuSign.Model.GroupInformation.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec groups_get_groups(Tesla.Env.client(), String.t(), keyword()) ::
{:ok, DocuSign.Model.ErrorDetails.t()}
| {:ok, DocuSign.Model.GroupInformation.t()}
| {:error, Tesla.Env.t()}
def groups_get_groups(connection, account_id, opts \\ []) do
optional_params = %{
:count => :query,
:group_type => :query,
:include_usercount => :query,
:search_text => :query,
:start_position => :query
}
request =
%{}
|> method(:get)
|> url("/v2.1/accounts/#{account_id}/groups")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %DocuSign.Model.GroupInformation{}},
{400, %DocuSign.Model.ErrorDetails{}}
])
end
@doc """
Creates one or more groups for the account.
Creates one or more groups for the account. Groups can be used to help manage users by associating users with a group. You can associate a group with a Permission Profile, which sets the user permissions for users in that group without having to set the `userSettings` property for each user. You are not required to set Permission Profiles for a group, but it makes it easier to manage user permissions for a large number of users. You can also use groups with template sharing to limit user access to templates.
### Parameters
- `connection` (DocuSign.Connection): Connection to server
- `account_id` (String.t): The external account number (int) or account ID GUID.
- `opts` (keyword): Optional parameters
- `:body` (GroupInformation):
### Returns
- `{:ok, DocuSign.Model.GroupInformation.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec groups_post_groups(Tesla.Env.client(), String.t(), keyword()) ::
{:ok, DocuSign.Model.ErrorDetails.t()}
| {:ok, DocuSign.Model.GroupInformation.t()}
| {:error, Tesla.Env.t()}
def groups_post_groups(connection, account_id, opts \\ []) do
optional_params = %{
:body => :body
}
request =
%{}
|> method(:post)
|> url("/v2.1/accounts/#{account_id}/groups")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{201, %DocuSign.Model.GroupInformation{}},
{400, %DocuSign.Model.ErrorDetails{}}
])
end
@doc """
Updates the group information for a group.
Updates the group name and modifies, or sets, the permission profile for the group. ### Related topics - [How-To Set Up a Permission Profile](/docs/esign-rest-api/how-to/permission-profile-setting/)
### Parameters
- `connection` (DocuSign.Connection): Connection to server
- `account_id` (String.t): The external account number (int) or account ID GUID.
- `opts` (keyword): Optional parameters
- `:body` (GroupInformation):
### Returns
- `{:ok, DocuSign.Model.GroupInformation.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec groups_put_groups(Tesla.Env.client(), String.t(), keyword()) ::
{:ok, DocuSign.Model.ErrorDetails.t()}
| {:ok, DocuSign.Model.GroupInformation.t()}
| {:error, Tesla.Env.t()}
def groups_put_groups(connection, account_id, opts \\ []) do
optional_params = %{
:body => :body
}
request =
%{}
|> method(:put)
|> url("/v2.1/accounts/#{account_id}/groups")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %DocuSign.Model.GroupInformation{}},
{400, %DocuSign.Model.ErrorDetails{}}
])
end
end