Documentation
¶
Overview ¶
Package client provides a wrapper for interacting with the DocuSign API.
API Endpoints Used ¶
This client interacts with the following DocuSign eSignature REST API v2.1 endpoints:
Users: DOCUMENTATION: https://developers.docusign.com/docs/esign-rest-api/reference/users/users/
- GET /restapi/v2.1/accounts/{accountId}/users - List account users (supports pagination)
- GET /restapi/v2.1/accounts/{accountId}/users/{userId} - Get user details
- POST /restapi/v2.1/accounts/{accountId}/users - Create new users
- PUT /restapi/v2.1/accounts/{accountId}/users/{userId}/profile - Update user profile
- DELETE /restapi/v2.1/accounts/{accountId}/users - Delete users
Groups: DOCUMENTATION: https://developers.docusign.com/docs/esign-rest-api/reference/usergroups/groups/ DOCUMENTATION: https://developers.docusign.com/docs/esign-rest-api/reference/usergroups/groupusers/
- GET /restapi/v2.1/accounts/{accountId}/groups - List account groups (supports pagination)
- GET /restapi/v2.1/accounts/{accountId}/groups/{groupId}/users - List users in a group (supports pagination)
- PUT /restapi/v2.1/accounts/{accountId}/groups/{groupId}/users - Add users to a group
- DELETE /restapi/v2.1/accounts/{accountId}/groups/{groupId}/users - Remove users from a group
Signing Groups: DOCUMENTATION: https://developers.docusign.com/docs/esign-rest-api/reference/signinggroups/
- GET /restapi/v2.1/accounts/{accountId}/signing_groups - List signing groups (supports pagination)
- GET /restapi/v2.1/accounts/{accountId}/signing_groups/{groupId}/users - List signing group users (supports pagination)
- PUT /restapi/v2.1/accounts/{accountId}/signing_groups/{groupId} - Update signing group membership
- DELETE /restapi/v2.1/accounts/{accountId}/signing_groups/{groupId}/users - Remove users from signing group
Permission Profiles: DOCUMENTATION: https://developers.docusign.com/docs/esign-rest-api/reference/accounts/accountpermissionprofiles/ DOCUMENTATION: https://developers.docusign.com/docs/esign-rest-api/reference/users/userprofiles/
- GET /restapi/v2.1/accounts/{accountId}/permission_profiles - List permission profiles (no pagination)
- PUT /restapi/v2.1/accounts/{accountId}/users/{userId}/profile - Update user profile
OAuth:
- GET https://account-d.docusign.com/oauth/userinfo - Get OAuth user info (demo environment)
- GET https://account.docusign.com/oauth/userinfo - Get OAuth user info (production environment)
API Documentation ¶
Complete API documentation: https://developers.docusign.com/docs/esign-rest-api/reference/
Pagination Strategy ¶
DocuSign API uses cursor-based pagination with the following parameters:
- count: Number of results per page (1-100, default: 100)
- start_position: Starting position (0-based index)
The API returns:
- endPosition: Last item position in current page
- totalSetSize: Total number of items available
Rate Limiting:
- API rate limits are enforced by DocuSign
- The SDK automatically handles rate limit errors via uhttp
Package client — DocuSign CLM (Contract Lifecycle Management) support.
CLM is a separate DocuSign product from eSignature, on a different host, with its own OAuth scopes ("spring_read"/"spring_write", see oauth.go) and a different Object API surface. Endpoints below are derived from DocuSign's CLM API reference (method tables and request/response schemas). Validate against cmd/test-server during development; a production CLM tenant was not available to exercise this integration directly.
API Endpoints Used ¶
Folders:
- POST /v2/{accountId}/folders/search - Discover folders (no flat list-all exists)
- GET /v2/{accountId}/folders/{id}?expand=Security - Get a folder with its explicit security entries. Security is three separate collections by principal type (Groups/Roles/Users), confirmed via DocuSign's own Folders.Patch reference page - see ClmFolderSecurity's doc in clm_models.go.
- PATCH /v2/{accountId}/folders/{id} - Update folder security (grant: set an AccessType on the relevant Groups/Roles/Users entry; revoke: set that entry's AccessType to "NoAccess")
Groups:
- GET /v2/{accountId}/groups - List CLM groups (GetAllGroups)
- GET /v2/{accountId}/groups/{id}/groupmembers - List a group's members (GetUsers)
Members (CLM's principal object):
- GET /v2/{accountId}/members - List members (GetMembers)
- GET /v2/{accountId}/members/{id}/groups - Groups a member belongs to
- PATCH /v2/{accountId}/members/{id} - Add member to new groups (additive/merge)
- PUT /v2/{accountId}/members/{id} - Replace member's groups (adds new, removes unspecified)
PermissionSets:
- GET /v2/{accountId}/permissionsets - List permission sets (GetAll). Confirmed read-only: no assignment/grant endpoint exists anywhere in the CLM API.
Base URL resolution ¶
CLM's Object API base URL (a distinct host from eSignature's per-account base_uri, e.g. api.{site}.{region}.clm.docusign.net) is resolved via a separate account discovery call, confirmed via DocuSign's "CLM API 101" documentation:
GET https://auth.springcm.com/api/v2/{accountId}/account (production)
GET https://authuat.springcm.com/api/v2/{accountId}/account (demo/UAT)
authenticated with the same Bearer access token this connector already obtains via the unified eSignature OAuth flow (account.docusign.com/account-d.docusign.com) — no separate SpringCM-specific authentication is required to call it, per that same documentation. This is a different, legacy-hosted mechanism from both the token response and /oauth/userinfo: neither of those was confirmed to carry the CLM base URL (the token response's documented fields are access_token/token_type/ refresh_token/expires_in/scope; /oauth/userinfo's are sub/name/accounts[] with no CLM-specific field), and an earlier version of this code incorrectly read it from the token's Extra data as a result.
This endpoint's exact response schema was not available when this was written — only the endpoint, its auth requirement, and its stated purpose ("account related URLs including the base CLM API URLs") were confirmed. ensureClmInitialized below checks a short list of the most likely field names and fails with the actual response's field names listed if none match, rather than guessing wrong silently.
Pagination ¶
Offset-based: pageSortParams.offset / pageSortParams.limit / pageSortParams.sortProperty / pageSortParams.sortDirection / pageSortParams.filter query params; responses wrap results as {First, Href, Items, Last, Limit, Next, Offset, Previous, Total}.
Index ¶
- Constants
- Variables
- func ApplyQueryParam(reqURL *url.URL, key string, value string)
- type AccountInfo
- type AccountManagement
- type Client
- func (c *Client) CreateUsers(ctx context.Context, request CreateUsersRequest) (*UserCreationResponse, annotations.Annotations, error)
- func (c *Client) DeleteGroupUsers(ctx context.Context, groupID string, request GroupUsersRequest) (*GroupUsersResponse, annotations.Annotations, error)
- func (c *Client) DeleteSigningGroupUsers(ctx context.Context, signingGroupID string, request SigningGroupUsersRequest) (*SigningGroupUsersResponse, annotations.Annotations, error)
- func (c *Client) DeleteUsers(ctx context.Context, request DeleteUsersRequest) (*DeleteUsersResponse, annotations.Annotations, error)
- func (c *Client) GetFolder(ctx context.Context, folderID string, expand ...string) (*ClmFolder, annotations.Annotations, error)
- func (c *Client) GetFolderFresh(ctx context.Context, folderID string, expand ...string) (*ClmFolder, annotations.Annotations, error)
- func (c *Client) GetGroupMembers(ctx context.Context, groupID string, options PageOptions) ([]ClmMember, string, annotations.Annotations, error)
- func (c *Client) GetGroupUsers(ctx context.Context, groupId string, options PageOptions) ([]User, string, annotations.Annotations, error)
- func (c *Client) GetGroups(ctx context.Context, options PageOptions) ([]Group, string, annotations.Annotations, error)
- func (c *Client) GetMemberGroups(ctx context.Context, memberID string) ([]ClmGroup, annotations.Annotations, error)
- func (c *Client) GetPermissionProfiles(ctx context.Context) ([]PermissionProfile, annotations.Annotations, error)
- func (c *Client) GetSigningGroupUsers(ctx context.Context, groupId string, options PageOptions) ([]User, string, annotations.Annotations, error)
- func (c *Client) GetSigningGroups(ctx context.Context, options PageOptions) ([]SigningGroup, string, annotations.Annotations, error)
- func (c *Client) GetUserByEmail(ctx context.Context, userEmail string) (*User, annotations.Annotations, error)
- func (c *Client) GetUserDetails(ctx context.Context, userID string) (*UserDetail, annotations.Annotations, error)
- func (c *Client) GetUsers(ctx context.Context, options PageOptions) ([]User, string, annotations.Annotations, error)
- func (c *Client) ListGroups(ctx context.Context, options PageOptions) ([]ClmGroup, string, annotations.Annotations, error)
- func (c *Client) ListMembers(ctx context.Context, options PageOptions) ([]ClmMember, string, annotations.Annotations, error)
- func (c *Client) ListPermissionSets(ctx context.Context, options PageOptions) ([]ClmPermissionSet, string, annotations.Annotations, error)
- func (c *Client) PatchFolderSecurity(ctx context.Context, folderID string, write ClmFolderSecurityWrite) (annotations.Annotations, error)
- func (c *Client) PatchMemberGroups(ctx context.Context, memberID string, newGroups []ClmGroup) (annotations.Annotations, error)
- func (c *Client) PutMemberGroups(ctx context.Context, memberID string, fullGroups []ClmGroup) (annotations.Annotations, error)
- func (c *Client) RequestRefreshToken(ctx context.Context, clientID, clientSecret, redirectURI, code string) (string, error)
- func (c *Client) SearchFolders(ctx context.Context, options PageOptions) ([]ClmFolder, string, annotations.Annotations, error)
- func (c *Client) UpdateGroupUsers(ctx context.Context, groupID string, request GroupUsersRequest) (*GroupUsersResponse, annotations.Annotations, error)
- func (c *Client) UpdateSigningGroup(ctx context.Context, signingGroupID string, request SigningGroupUsersRequest) (*SigningGroupUsersResponse, annotations.Annotations, error)
- func (c *Client) UpdateUserProfile(ctx context.Context, userID string, request UpdateUserProfileRequest) (annotations.Annotations, error)
- type ClmErrorResponse
- type ClmFolder
- type ClmFolderPage
- type ClmFolderRef
- type ClmFolderSecurity
- type ClmFolderSecurityPatch
- type ClmFolderSecurityWrite
- type ClmGroup
- type ClmGroupList
- type ClmGroupPage
- type ClmGroupSecurityEntry
- type ClmGroupSecurityPage
- type ClmMember
- type ClmMemberGroupsPatch
- type ClmMemberPage
- type ClmPage
- type ClmPermissionSet
- type ClmPermissionSetPage
- type ClmRole
- type ClmRoleSecurityEntry
- type ClmRoleSecurityPage
- type ClmUserSecurityEntry
- type ClmUserSecurityPage
- type CreateUsersRequest
- type DeleteUsersRequest
- type DeleteUsersResponse
- type EmailNotifications
- type ErrorResponse
- type Group
- type GroupUserIdentifier
- type GroupUsersRequest
- type GroupUsersResponse
- type GroupsResponse
- type NewUser
- type OAuth2Docusign
- type Page
- type PageOptions
- type PermissionProfile
- type PermissionProfilesResponse
- type SigningGroup
- type SigningGroupResponse
- type SigningGroupUser
- type SigningGroupUserIdentifier
- type SigningGroupUsersRequest
- type SigningGroupUsersResponse
- type TokenResponse
- type UpdateUserProfileRequest
- type User
- type UserCreationResponse
- type UserDetail
- type UserIdentifier
- type UserInfoResponse
- type UserSettings
- type UsersResponse
Constants ¶
const ( ClmAccessTypeInherit = "InheritFromParentFolder" ClmAccessTypeNoAccess = "NoAccess" ClmAccessTypeView = "View" ClmAccessTypeViewCreate = "ViewCreate" ClmAccessTypeViewEdit = "ViewEdit" ClmAccessTypeViewEditDelete = "ViewEditDelete" ClmAccessTypeViewEditDeleteSetAccess = "ViewEditDeleteSetAccess" ClmAccessTypeCustom = "Custom" )
ClmAccessType enumerates the confirmed folder-security write values. Custom and InheritFromParentFolder are deliberately not exposed as grantable entitlements — see pkg/connector/clm_folders.go.
const ClmDiscoveryFieldAPIBaseURL = "ApiBaseUrl"
clmBaseURLCandidateFields lists the response field names most likely to carry the CLM Object API base URL, in priority order. ClmDiscoveryFieldAPIBaseURL mirrors the field name CLM's legacy token-exchange response uses for the same concept, per the CLM.CM OAuth 2.0 Web Server Flow documentation — exported so clmtest's mock can use the identical constant rather than a duplicated literal. Deliberately excludes generic names like "BaseUrl"/"base_url": the discovery response's exact schema isn't confirmed, and a bare "BaseUrl" is plausible enough as a name for an unrelated field (e.g. a web/UI URL) that matching it could silently misroute every CLM API call at the wrong host instead of failing loudly the way an absent field does.
const DefaultPageSize = 100
Variables ¶
var ClmRoles = []ClmRole{
{Name: "Guest"},
{Name: "LimitedSubscriber"},
{Name: "FullSubscriber"},
{Name: "UserAdministrator"},
{Name: "SuperAdministrator"},
}
ClmRoles are the confirmed, fixed set of CLM account-level roles.
Functions ¶
Types ¶
type AccountInfo ¶ added in v0.0.6
type AccountInfo struct {
AccountId string `json:"account_id"`
IsDefault bool `json:"is_default"`
AccountName string `json:"account_name"`
BaseURI string `json:"base_uri"`
OrganizationId string `json:"organization_id"`
}
AccountInfo represents account information from the User Info response.
type AccountManagement ¶
type AccountManagement struct {
CanManageUsers string `json:"canManageUsers"`
CanManageAdmins string `json:"canManageAdmins"`
CanManageAccountSettings string `json:"canManageAccountSettings"`
CanManageReporting string `json:"canManageReporting"`
CanManageAccountSecuritySettings string `json:"canManageAccountSecuritySettings"`
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps HTTP interactions with the DocuSign API.
func New ¶
func New( ctx context.Context, isDemo bool, clientID, clientSecret, redirectURI, refreshToken, configAccountId string, includeClm bool, clmBaseURLOverride, baseURLOverride string, ) (*Client, error)
New constructs a Client with OAuth2 flow, now using dynamic base URI resolution. If configAccountId is non-empty, the client will select that specific account instead of the default. includeClm requests the additional OAuth scopes required for the DocuSign CLM API. clmBaseURLOverride and baseURLOverride are testing-only; see their Client field docs. When baseURLOverride is set, the real OAuth refresh flow is skipped entirely and refreshToken is used verbatim as a static bearer token — there's no real account to refresh a token against once eSignature calls are redirected to a local mock.
func NewClient ¶
func NewClient(ctx context.Context, isDemo bool, tokenSource oauth2.TokenSource, configAccountId, clmBaseURLOverride string, httpClient ...*uhttp.BaseHttpClient) *Client
NewClient initializes a Client with a fixed token and optional HTTP wrapper. If configAccountId is non-empty, the client will select that specific account instead of the default. clmBaseURLOverride is testing-only; see the Client.clmBaseURLOverride field doc — used by the service-mode path (NewWithTokenSource), where DocuSign auth is handled by ConductorOne's managed OAuth app rather than a local refresh token.
func (*Client) CreateUsers ¶
func (c *Client) CreateUsers(ctx context.Context, request CreateUsersRequest) (*UserCreationResponse, annotations.Annotations, error)
CreateUsers sends a bulk create request for new users in the account.
func (*Client) DeleteGroupUsers ¶ added in v0.1.1
func (c *Client) DeleteGroupUsers(ctx context.Context, groupID string, request GroupUsersRequest) (*GroupUsersResponse, annotations.Annotations, error)
DeleteGroupUsers removes users from a group using the DocuSign API. Based on API: DELETE /restapi/v2.1/accounts/{accountId}/groups/{groupId}/users.
func (*Client) DeleteSigningGroupUsers ¶ added in v0.1.1
func (c *Client) DeleteSigningGroupUsers(ctx context.Context, signingGroupID string, request SigningGroupUsersRequest) (*SigningGroupUsersResponse, annotations.Annotations, error)
DeleteSigningGroupUsers removes users from a signing group using the DocuSign API. Based on API: DELETE /restapi/v2.1/accounts/{accountId}/signing_groups/{signingGroupId}/users.
func (*Client) DeleteUsers ¶ added in v0.1.1
func (c *Client) DeleteUsers(ctx context.Context, request DeleteUsersRequest) (*DeleteUsersResponse, annotations.Annotations, error)
DeleteUsers sends a bulk delete request to remove users from the account.
func (*Client) GetFolder ¶ added in v0.1.8
func (c *Client) GetFolder(ctx context.Context, folderID string, expand ...string) (*ClmFolder, annotations.Annotations, error)
GetFolder fetches a single folder, optionally expanding Security to get its explicit (non-inherited) folder security entries. The response may be served from the shared HTTP GET cache.
func (*Client) GetFolderFresh ¶ added in v0.1.8
func (c *Client) GetFolderFresh(ctx context.Context, folderID string, expand ...string) (*ClmFolder, annotations.Annotations, error)
GetFolderFresh is identical to GetFolder but bypasses the shared HTTP GET cache. Use this for the read-before-write check in Grant/Revoke: PatchFolderSecurity doesn't invalidate the cache entry a prior GetFolder call may have left behind, so a cached read there would see security entries as they stood before the most recent write rather than the current state.
func (*Client) GetGroupMembers ¶ added in v0.1.8
func (c *Client) GetGroupMembers(ctx context.Context, groupID string, options PageOptions) ([]ClmMember, string, annotations.Annotations, error)
GetGroupMembers lists the members of a CLM group.
Pagination: offset/limit, see package doc.
func (*Client) GetGroupUsers ¶
func (c *Client) GetGroupUsers(ctx context.Context, groupId string, options PageOptions) ([]User, string, annotations.Annotations, error)
GetGroupUsers fetches a page of users that belong to a specific group.
Pagination: This endpoint supports cursor-based pagination using start_position and count parameters. The API returns up to 100 users per page (controlled by PageOptions.PageSize). To fetch the next page, use the returned nextToken as PageOptions.PageToken.
Returns: users list, next page token (empty if last page), annotations, error.
func (*Client) GetGroups ¶
func (c *Client) GetGroups(ctx context.Context, options PageOptions) ([]Group, string, annotations.Annotations, error)
GetGroups fetches a page of groups from the DocuSign account.
Pagination: This endpoint supports cursor-based pagination using start_position and count parameters. The API returns up to 100 groups per page (controlled by PageOptions.PageSize). To fetch the next page, use the returned nextToken as PageOptions.PageToken.
Returns: groups list, next page token (empty if last page), annotations, error.
func (*Client) GetMemberGroups ¶ added in v0.1.8
func (c *Client) GetMemberGroups(ctx context.Context, memberID string) ([]ClmGroup, annotations.Annotations, error)
GetMemberGroups gets the FULL current list of groups a member belongs to — required before Grant/Revoke, since both are read-modify-write against this list (Patch is additive/merge, Put is full-replace). This method pages to completion internally: callers need the complete list, not one page of it — Revoke in particular does a full-replace Put using this result, so a truncated list here would silently drop the member's memberships in every group beyond the first page.
Intentional carve-out from the usual client-layer rule against looping through pages internally (that's normally the connector layer's job, driving one page per call): this isn't a sync List — it's a read-before-write for provisioning, where the caller fundamentally needs the complete set to safely do a full-replace Put, not a page at a time. The loop is bounded (maxMemberGroupPages) and guards against a non-advancing token, so it can't hang even if the underlying assumption about the API is wrong.
func (*Client) GetPermissionProfiles ¶ added in v0.0.3
func (c *Client) GetPermissionProfiles(ctx context.Context) ([]PermissionProfile, annotations.Annotations, error)
GetPermissionProfiles fetches all permission profiles from the DocuSign account.
Pagination: This endpoint does NOT support pagination. It returns all permission profiles in a single request. Typically, DocuSign accounts have a limited number of permission profiles (< 50), so this is acceptable.
Returns: all permission profiles, annotations, error.
func (*Client) GetSigningGroupUsers ¶ added in v0.0.3
func (c *Client) GetSigningGroupUsers(ctx context.Context, groupId string, options PageOptions) ([]User, string, annotations.Annotations, error)
GetSigningGroupUsers fetches a page of users that belong to a specific signing group.
Pagination: This endpoint supports cursor-based pagination using start_position and count parameters. The API returns up to 100 users per page (controlled by PageOptions.PageSize). To fetch the next page, use the returned nextToken as PageOptions.PageToken.
Returns: users list, next page token (empty if last page), annotations, error.
func (*Client) GetSigningGroups ¶ added in v0.0.3
func (c *Client) GetSigningGroups(ctx context.Context, options PageOptions) ([]SigningGroup, string, annotations.Annotations, error)
GetSigningGroups fetches a page of signing groups from the DocuSign account.
Pagination: This endpoint supports cursor-based pagination using start_position and count parameters. The API returns up to 100 signing groups per page (controlled by PageOptions.PageSize). To fetch the next page, use the returned nextToken as PageOptions.PageToken.
Returns: signing groups list, next page token (empty if last page), annotations, error.
func (*Client) GetUserByEmail ¶ added in v0.0.3
func (c *Client) GetUserByEmail(ctx context.Context, userEmail string) (*User, annotations.Annotations, error)
GetUserByEmail retrieves a user filtering by the email and the user status 'Active' or 'Activation Sent'.
func (*Client) GetUserDetails ¶
func (c *Client) GetUserDetails(ctx context.Context, userID string) (*UserDetail, annotations.Annotations, error)
GetUserDetails fetches detailed information for a specific user, including permissions.
func (*Client) GetUsers ¶
func (c *Client) GetUsers(ctx context.Context, options PageOptions) ([]User, string, annotations.Annotations, error)
GetUsers fetches a page of users from the DocuSign account.
Pagination: This endpoint supports cursor-based pagination using start_position and count parameters. The API returns up to 100 users per page (controlled by PageOptions.PageSize). To fetch the next page, use the returned nextToken as PageOptions.PageToken.
Returns: users list, next page token (empty if last page), annotations, error.
func (*Client) ListGroups ¶ added in v0.1.8
func (c *Client) ListGroups(ctx context.Context, options PageOptions) ([]ClmGroup, string, annotations.Annotations, error)
ListGroups lists CLM groups (a distinct object from eSignature groups).
Pagination: offset/limit, see package doc.
func (*Client) ListMembers ¶ added in v0.1.8
func (c *Client) ListMembers(ctx context.Context, options PageOptions) ([]ClmMember, string, annotations.Annotations, error)
ListMembers lists CLM members (the CLM API's principal object). Synced as its own resource type rather than reused as the existing `user` resource, since identity between the two could not be confirmed 1:1.
Pagination: offset/limit, see package doc.
func (*Client) ListPermissionSets ¶ added in v0.1.8
func (c *Client) ListPermissionSets(ctx context.Context, options PageOptions) ([]ClmPermissionSet, string, annotations.Annotations, error)
ListPermissionSets lists CLM permission sets. Confirmed read-only — no grant/revoke/assignment endpoint exists anywhere in the CLM API for this object.
Pagination: offset/limit, see package doc.
func (*Client) PatchFolderSecurity ¶ added in v0.1.8
func (c *Client) PatchFolderSecurity(ctx context.Context, folderID string, write ClmFolderSecurityWrite) (annotations.Annotations, error)
PatchFolderSecurity grants or revokes folder security. write must be the folder's complete security state across all three principal-type collections (see the connector-layer caller — clmFolderSecurityToWrite builds this from a fresh read, with one entry changed/added in whichever of Groups/Roles/Users the grant/revoke targets), not just the one entry being changed: Folders.Patch's merge-vs-replace semantics for the Security field are undocumented, and sending the complete state is correct under either interpretation, whereas sending only the one changed entry would wipe every other principal's access to the folder if the real API replaces rather than merges.
UNVERIFIED against a real CLM tenant, and higher-risk than the merge-semantics question above: DocuSign's docs also reference a separate `ChangeSecurityTasks` resource (POST /v2/{accountId}/changesecuritytasks), which may be the documented way to mutate folder security asynchronously rather than a direct PATCH on the folder itself. If that's the actual contract, this method - the entire mechanism Grant/Revoke on clm_folder relies on - could silently no-op or 404 against a real tenant. Verify which endpoint the real API expects before treating folder provisioning here as more than best-effort.
func (*Client) PatchMemberGroups ¶ added in v0.1.8
func (c *Client) PatchMemberGroups(ctx context.Context, memberID string, newGroups []ClmGroup) (annotations.Annotations, error)
PatchMemberGroups grants group membership: the CLM API adds the member to any group in newGroups they don't already belong to and leaves the rest of their membership untouched (additive/merge — confirmed via the CLM API's own Patch description: "the member will be added to any new groups provided"). Since the merge happens API-side, callers may pass either just the group(s) being added or their full current list plus the addition — both are safe. This connector's only caller passes the full list.
func (*Client) PutMemberGroups ¶ added in v0.1.8
func (c *Client) PutMemberGroups(ctx context.Context, memberID string, fullGroups []ClmGroup) (annotations.Annotations, error)
PutMemberGroups revokes group membership: replaces the member's full group list with fullGroups (any group omitted from this list is removed — confirmed via the CLM API's own Put description: "added to any new groups provided and removed from unspecified groups"). Callers must pass the member's CURRENT groups minus the one(s) being revoked, not just the groups to add — this is a full-replace, not a diff.
func (*Client) RequestRefreshToken ¶ added in v0.1.2
func (c *Client) RequestRefreshToken(ctx context.Context, clientID, clientSecret, redirectURI, code string) (string, error)
RequestRefreshToken exchanges an authorization code for a refresh token. DocuSign requires Basic Auth (base64(clientID:clientSecret)) and redirect_uri in the request.
func (*Client) SearchFolders ¶ added in v0.1.8
func (c *Client) SearchFolders(ctx context.Context, options PageOptions) ([]ClmFolder, string, annotations.Annotations, error)
SearchFolders discovers folders via the CLM Folders search endpoint (there is no flat list-all endpoint for folders, unlike Groups/Members/PermissionSets).
Pagination: offset/limit, see package doc.
func (*Client) UpdateGroupUsers ¶ added in v0.1.1
func (c *Client) UpdateGroupUsers(ctx context.Context, groupID string, request GroupUsersRequest) (*GroupUsersResponse, annotations.Annotations, error)
UpdateGroupUsers adds users to a group using the DocuSign API. Based on API: PUT /restapi/v2.1/accounts/{accountId}/groups/{groupId}/users.
func (*Client) UpdateSigningGroup ¶ added in v0.1.1
func (c *Client) UpdateSigningGroup(ctx context.Context, signingGroupID string, request SigningGroupUsersRequest) (*SigningGroupUsersResponse, annotations.Annotations, error)
UpdateSigningGroup updates a signing group by adding users to it. Based on API: PUT /restapi/v2.1/accounts/{accountId}/signing_groups/{signingGroupId}.
func (*Client) UpdateUserProfile ¶ added in v0.1.1
func (c *Client) UpdateUserProfile(ctx context.Context, userID string, request UpdateUserProfileRequest) (annotations.Annotations, error)
UpdateUserProfile updates a user's permission profile. Based on API: PUT /restapi/v2.1/accounts/{accountId}/users/{userId}/profile.
type ClmErrorResponse ¶ added in v0.1.8
type ClmErrorResponse struct {
Msg string `json:"Message"`
}
ClmErrorResponse is CLM's error envelope. DocuSign's API reference does not document an error response shape, so this is intentionally loose; callers should log the raw body if fields don't populate as expected.
func (*ClmErrorResponse) Message ¶ added in v0.1.8
func (e *ClmErrorResponse) Message() string
type ClmFolder ¶ added in v0.1.8
type ClmFolder struct {
Href string `json:"Href"`
Name string `json:"Name"`
Description string `json:"Description"`
Path string `json:"Path"`
CreatedBy string `json:"CreatedBy"`
CreatedDate string `json:"CreatedDate"`
UpdatedBy string `json:"UpdatedBy"`
UpdatedDate string `json:"UpdatedDate"`
ParentFolder *ClmFolderRef `json:"ParentFolder,omitempty"`
PropagateAttributeGroupsToChildren bool `json:"PropagateAttributeGroupsToChildren,omitempty"`
// Security is only populated when the request used ?expand=Security, and only
// reflects explicit assignments — not permissions inherited from a parent folder.
Security ClmFolderSecurity `json:"Security,omitempty"`
}
ClmFolder represents a CLM Folder object.
type ClmFolderPage ¶ added in v0.1.8
ClmFolderPage is the paginated collection of ClmFolder (e.g. from Search).
type ClmFolderRef ¶ added in v0.1.8
ClmFolderRef is a lightweight folder reference (e.g. ParentFolder).
type ClmFolderSecurity ¶ added in v0.1.8
type ClmFolderSecurity struct {
Groups ClmGroupSecurityPage `json:"Groups,omitempty"`
Roles ClmRoleSecurityPage `json:"Roles,omitempty"`
Users ClmUserSecurityPage `json:"Users,omitempty"`
}
ClmFolderSecurity is a folder's explicit (non-inherited) security assignments, confirmed via DocuSign's own Folders.Patch reference page (pasted live, since the site is JS-rendered and unreachable by automated tools) to be three SEPARATE collections by principal type — not a single flat list, and not the AccessType-vs-boolean-flags dual representation an earlier version of this file assumed. No boolean flags (Create/Move/Read/See/SetAccess/Write) appear anywhere in the confirmed schema; every entry across all three collections carries AccessType directly.
type ClmFolderSecurityPatch ¶ added in v0.1.8
type ClmFolderSecurityPatch struct {
Security ClmFolderSecurityWrite `json:"Security"`
}
ClmFolderSecurityPatch is the request body for PATCH .../folders/{id} when updating folder security.
type ClmFolderSecurityWrite ¶ added in v0.1.8
type ClmFolderSecurityWrite struct {
Groups []ClmGroupSecurityEntry `json:"Groups,omitempty"`
Roles []ClmRoleSecurityEntry `json:"Roles,omitempty"`
Users []ClmUserSecurityEntry `json:"Users,omitempty"`
}
ClmFolderSecurityWrite is the plain-list (non-paginated) shape of ClmFolderSecurity used on writes — a write payload has no First/Href/Last/Limit/Next/Offset/Previous/ Total metadata to send, mirroring ClmGroupList's precedent for the same reason on member-groups writes. Grant/Revoke always populate all three fields with the folder's complete current security (see clm_folders.go's clmFolderSecurityToWrite), not just the one changed entry: Folders.Patch's merge-vs-replace semantics for Security are undocumented, and sending the complete state is correct either way.
type ClmGroup ¶ added in v0.1.8
type ClmGroup struct {
Href string `json:"Href"`
Name string `json:"Name"`
Description string `json:"Description,omitempty"`
// GroupType is "security" or "distribution" per the confirmed schema.
GroupType string `json:"GroupType,omitempty"`
CreatedDate string `json:"CreatedDate,omitempty"`
UpdatedDate string `json:"UpdatedDate,omitempty"`
}
ClmGroup represents a CLM Group object — distinct from eSignature's Group.
type ClmGroupList ¶ added in v0.1.8
type ClmGroupList struct {
Items []ClmGroup `json:"Items"`
}
ClmGroupList is a bare list of groups, used for write payloads (see ClmMemberGroupsPatch).
type ClmGroupPage ¶ added in v0.1.8
ClmGroupPage is the paginated collection of ClmGroup, returned by read endpoints (GetAllGroups, a member's current groups, etc.). See ClmGroupList for the separate, leaner type used on write payloads.
type ClmGroupSecurityEntry ¶ added in v0.1.8
type ClmGroupSecurityEntry struct {
AccessType string `json:"AccessType,omitempty"`
Href string `json:"Href"`
Name string `json:"Name,omitempty"`
GroupType string `json:"GroupType,omitempty"`
Description string `json:"Description,omitempty"`
CreatedDate string `json:"CreatedDate,omitempty"`
UpdatedDate string `json:"UpdatedDate,omitempty"`
}
ClmGroupSecurityEntry is one folder-security grant to a CLM Group. Confirmed shape: the full Group object's own fields (Href/Name/GroupType/Description/CreatedDate/ UpdatedDate) plus AccessType — not a lean {Item, AccessType} pair.
type ClmGroupSecurityPage ¶ added in v0.1.8
type ClmGroupSecurityPage struct {
ClmPage
Items []ClmGroupSecurityEntry `json:"Items"`
}
ClmGroupSecurityPage is the paginated collection of ClmGroupSecurityEntry returned on a read (GetFolder?expand=Security). See ClmFolderSecurityWrite for the plain-list shape used on writes.
type ClmMember ¶ added in v0.1.8
type ClmMember struct {
Href string `json:"Href"`
Email string `json:"Email"`
UserName string `json:"UserName"`
FirstName string `json:"FirstName"`
LastName string `json:"LastName"`
MiddleName string `json:"MiddleName,omitempty"`
// Role is an account-level enum: Guest/LimitedSubscriber/FullSubscriber/
// UserAdministrator/SuperAdministrator. This is the "Role" grantee type
// referenced in folder Security's "by role, group, and user".
Role string `json:"Role"`
Company string `json:"Company,omitempty"`
Department string `json:"Department,omitempty"`
Title string `json:"Title,omitempty"`
CreatedDate string `json:"CreatedDate,omitempty"`
UpdatedDate string `json:"UpdatedDate,omitempty"`
ExemptFromUserSync bool `json:"ExemptFromUserSync,omitempty"`
PortalOnly bool `json:"PortalOnly,omitempty"`
}
ClmMember represents a CLM Member object — CLM's principal. Confirmed schema (richer than what the Patch/Put body alone shows, per Groups.GetUsers).
type ClmMemberGroupsPatch ¶ added in v0.1.8
type ClmMemberGroupsPatch struct {
Groups ClmGroupList `json:"Groups"`
}
ClmMemberGroupsPatch is the request body for PATCH/PUT .../members/{id} when granting (Patch, additive) or revoking (Put, full-replace) group membership. Deliberately a plain Items list, not the paginated ClmGroupPage used for reads — a write payload has no First/Href/Last/Limit/Next/Offset/Previous/Total metadata to send, and including response-only fields risks rejection if CLM's model binding is strict.
type ClmMemberPage ¶ added in v0.1.8
ClmMemberPage is the paginated collection of ClmMember.
type ClmPage ¶ added in v0.1.8
type ClmPage struct {
First string `json:"First"`
Href string `json:"Href"`
Last string `json:"Last"`
Limit int `json:"Limit"`
Next string `json:"Next"`
Offset int `json:"Offset"`
Previous string `json:"Previous"`
Total int `json:"Total"`
}
ClmPage is the pagination metadata CLM's Object API embeds in every list response — distinct from eSignature's Page (see models.go). Each *Page wrapper type below embeds this plus its own Items field, matching the confirmed response shape: {First, Href, Items, Last, Limit, Next, Offset, Previous, Total}.
type ClmPermissionSet ¶ added in v0.1.8
type ClmPermissionSet struct {
Href string `json:"Href"`
Name string `json:"Name"`
Permissions []string `json:"Permissions"`
}
ClmPermissionSet represents a CLM PermissionSet object. Confirmed schema: Name + Permissions (a list of PrivilegeType strings) — an account/feature-privilege bundle, NOT the same thing as a folder's AccessType/boolean-flag access levels. Confirmed read-only: no assignment/grant endpoint exists anywhere in the CLM API.
type ClmPermissionSetPage ¶ added in v0.1.8
type ClmPermissionSetPage struct {
ClmPage
Items []ClmPermissionSet `json:"Items"`
}
ClmPermissionSetPage is the paginated collection of ClmPermissionSet.
type ClmRole ¶ added in v0.1.8
type ClmRole struct {
Name string
}
ClmRole is a static, hardcoded representation of one of the 5 fixed account-level Member.Role values. Not backed by an API call — needed so folder-security entries granted "by role" (Item referencing a Role rather than a Group/User) have a real synced resource to attach the grant to. See pkg/connector/clm_roles.go.
type ClmRoleSecurityEntry ¶ added in v0.1.8
type ClmRoleSecurityEntry struct {
AccessType string `json:"AccessType,omitempty"`
Item string `json:"Item"`
}
ClmRoleSecurityEntry is one folder-security grant to a CLM Role. Confirmed shape: flat {AccessType, Item} — unlike Groups/Users, a Role has no separate object to expand, so Item is just the role name string.
type ClmRoleSecurityPage ¶ added in v0.1.8
type ClmRoleSecurityPage struct {
ClmPage
Items []ClmRoleSecurityEntry `json:"Items"`
}
ClmRoleSecurityPage is the paginated collection of ClmRoleSecurityEntry.
type ClmUserSecurityEntry ¶ added in v0.1.8
type ClmUserSecurityEntry struct {
AccessType string `json:"AccessType,omitempty"`
Href string `json:"Href"`
Email string `json:"Email,omitempty"`
UserName string `json:"UserName,omitempty"`
FirstName string `json:"FirstName,omitempty"`
LastName string `json:"LastName,omitempty"`
Role string `json:"Role,omitempty"`
}
ClmUserSecurityEntry is one folder-security grant to a CLM Member (user). Confirmed shape: the Member object's own identifying fields plus AccessType — mirrors ClmGroupSecurityEntry's pattern. Deliberately doesn't repeat every field ClmMember has (Address*, City, Company, etc.): Grant/Revoke only ever need Href to identify the member, never reconstruct a full member profile from a security entry.
type ClmUserSecurityPage ¶ added in v0.1.8
type ClmUserSecurityPage struct {
ClmPage
Items []ClmUserSecurityEntry `json:"Items"`
}
ClmUserSecurityPage is the paginated collection of ClmUserSecurityEntry.
type CreateUsersRequest ¶
type CreateUsersRequest struct {
NewUsers []NewUser `json:"newUsers"`
}
type DeleteUsersRequest ¶ added in v0.1.1
type DeleteUsersRequest struct {
Users []UserIdentifier `json:"users"`
}
DeleteUsersRequest represents a request to delete users from an account.
type DeleteUsersResponse ¶ added in v0.1.1
type DeleteUsersResponse struct {
Users []struct {
UserId string `json:"userId"`
UserName string `json:"userName"`
Email string `json:"email"`
UserStatus string `json:"userStatus"`
Success string `json:"success"`
ErrorDetails *struct {
ErrorCode string `json:"errorCode"`
Message string `json:"message"`
} `json:"errorDetails,omitempty"`
} `json:"users"`
}
DeleteUsersResponse represents the response from a user deletion request.
type EmailNotifications ¶
type ErrorResponse ¶ added in v0.0.5
type ErrorResponse struct {
ErrorCode string `json:"errorCode"`
ErrorMessage string `json:"message"`
}
func (*ErrorResponse) Message ¶ added in v0.0.5
func (e *ErrorResponse) Message() string
type GroupUserIdentifier ¶ added in v0.1.1
type GroupUserIdentifier struct {
UserId string `json:"userId"`
}
GroupUserIdentifier represents a user identifier for group operations.
type GroupUsersRequest ¶ added in v0.1.1
type GroupUsersRequest struct {
Users []GroupUserIdentifier `json:"users"`
}
GroupUsersRequest represents a request to modify group membership (add or remove users).
type GroupUsersResponse ¶ added in v0.1.1
type GroupUsersResponse struct {
Users []struct {
UserName string `json:"userName"`
UserId string `json:"userId"`
UserType string `json:"userType"`
UserStatus string `json:"userStatus"`
URI string `json:"uri"`
} `json:"users"`
}
GroupUsersResponse represents the response from modifying group membership.
type GroupsResponse ¶
type NewUser ¶
type NewUser struct {
UserName string `json:"userName"`
Email string `json:"email"`
UserSettings *UserSettings `json:"userSettings,omitempty"`
}
type OAuth2Docusign ¶
type OAuth2Docusign struct {
// contains filtered or unexported fields
}
OAuth2Docusign manages the OAuth2 configuration and token lifecycle for DocuSign.
func NewOAuth2Docusign ¶
func NewOAuth2Docusign(isDemo bool, clientID, clientSecret, redirectURI string, includeClm bool) *OAuth2Docusign
NewOAuth2Docusign initializes a new OAuth2Docusign helper with client credentials.
func (*OAuth2Docusign) Authorize ¶ added in v0.1.2
func (o *OAuth2Docusign) Authorize(ctx context.Context) (string, error)
Authorize initiates the OAuth2 authorization code flow and prompts the user to enter the authorization code.
func (*OAuth2Docusign) ExchangeCodeForToken ¶ added in v0.1.2
func (o *OAuth2Docusign) ExchangeCodeForToken(ctx context.Context, code string) (*oauth2.Token, error)
ExchangeCodeForToken exchanges an authorization code for an access token and refresh token.
type PageOptions ¶
type PermissionProfile ¶ added in v0.0.3
type PermissionProfilesResponse ¶ added in v0.0.3
type PermissionProfilesResponse struct {
Page
PermissionProfiles []PermissionProfile `json:"permissionProfiles"`
}
type SigningGroup ¶ added in v0.0.3
type SigningGroup struct {
SigningGroupId string `json:"signingGroupId"`
GroupName string `json:"groupName"`
GroupType string `json:"groupType"`
GroupEmail string `json:"groupEmail"`
Created string `json:"created"`
CreatedBy string `json:"createdBy"`
Modified string `json:"modified"`
ModifiedBy string `json:"modifiedBy"`
Users []SigningGroupUser `json:"users"`
}
type SigningGroupResponse ¶ added in v0.0.3
type SigningGroupResponse struct {
Page
SigningGroups []SigningGroup `json:"groups"`
}
type SigningGroupUser ¶ added in v0.0.3
type SigningGroupUser struct {
UserID string `json:"userId,omitempty"`
UserName string `json:"userName,omitempty"`
Email string `json:"email,omitempty"`
}
SigningGroupUser represents a user member of a SigningGroup.
type SigningGroupUserIdentifier ¶ added in v0.1.1
type SigningGroupUserIdentifier struct {
UserName string `json:"userName"`
Email string `json:"email"`
}
SigningGroupUserIdentifier represents a user identifier for signing group operations.
type SigningGroupUsersRequest ¶ added in v0.1.1
type SigningGroupUsersRequest struct {
Users []SigningGroupUserIdentifier `json:"users"`
}
SigningGroupUsersRequest represents a request to modify signing group membership (add or remove users).
type SigningGroupUsersResponse ¶ added in v0.1.1
type SigningGroupUsersResponse struct {
SigningGroupId string `json:"signingGroupId"`
GroupName string `json:"groupName"`
GroupType string `json:"groupType"`
Created string `json:"created"`
CreatedBy string `json:"createdBy"`
Modified string `json:"modified"`
ModifiedBy string `json:"modifiedBy"`
Users []struct {
UserName string `json:"userName"`
Email string `json:"email"`
} `json:"users"`
}
SigningGroupUsersResponse represents the response from modifying signing group membership.
type TokenResponse ¶
type UpdateUserProfileRequest ¶ added in v0.1.1
type UpdateUserProfileRequest struct {
UserDetails struct {
PermissionProfileId string `json:"permissionProfileId"`
} `json:"userDetails"`
}
UpdateUserProfileRequest represents a request to update a user's permission profile.
type UserCreationResponse ¶
type UserCreationResponse struct {
NewUsers []struct {
UserId string `json:"userId"`
URI string `json:"uri"`
Email string `json:"email"`
UserName string `json:"userName"`
UserStatus string `json:"userStatus"`
CreatedDateTime string `json:"createdDateTime"`
MembershipId string `json:"membershipId"`
ErrorDetails *struct {
ErrorCode string `json:"errorCode"`
Message string `json:"message"`
} `json:"errorDetails,omitempty"`
} `json:"newUsers"`
}
type UserDetail ¶
type UserDetail struct {
UserID string `json:"userId"`
UserName string `json:"userName"`
Email string `json:"email"`
IsAdmin string `json:"isAdmin"`
UserStatus string `json:"userStatus"`
PermissionProfileName string `json:"permissionProfileName"`
PermissionProfileID string `json:"permissionProfileId"`
UserSettings UserSettings `json:"userSettings"`
GroupList []Group `json:"groupList"`
}
type UserIdentifier ¶ added in v0.1.1
type UserIdentifier struct {
UserId string `json:"userId"`
}
UserIdentifier represents a user identifier for deletion operations.
type UserInfoResponse ¶ added in v0.0.6
type UserInfoResponse struct {
Sub string `json:"sub"`
Name string `json:"name"`
Email string `json:"email"`
Accounts []AccountInfo `json:"accounts"`
}
UserInfoResponse represents the response from DocuSign's OAuth User Info endpoint.
type UserSettings ¶
type UserSettings struct {
CanManageAccount string `json:"canManageAccount"`
AccountManagementGranular AccountManagement `json:"accountManagementGranular"`
CanSendEnvelope string `json:"canSendEnvelope"`
CanSignEnvelope string `json:"canSignEnvelope"`
AllowSendOnBehalfOf string `json:"allowSendOnBehalfOf"`
BulkSend string `json:"bulkSend"`
CanSendAPIRequests string `json:"canSendAPIRequests"`
EnableSequentialSigningUI string `json:"enableSequentialSigningUI"`
EnableDSPro string `json:"enableDSPro"`
CanUseScratchpad string `json:"canUseScratchpad"`
CanCreateWorkspaces string `json:"canCreateWorkspaces"`
EnableTransactionPoint string `json:"enableTransactionPoint"`
PowerFormMode string `json:"powerFormMode"`
APICanExportAC string `json:"apiCanExportAC"`
EnableVaulting string `json:"enableVaulting"`
CanManageTemplates string `json:"canManageTemplates"`
AdminOnly string `json:"adminOnly"`
CanManageDistributor string `json:"canManageDistributor"`
CanManageOrganization string `json:"canManageOrganization"`
CanUseSmartContracts string `json:"canUseSmartContracts"`
SignerEmailNotifications EmailNotifications `json:"signerEmailNotifications"`
SenderEmailNotifications EmailNotifications `json:"senderEmailNotifications"`
}
type UsersResponse ¶
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package clmtest provides an in-memory mock of the DocuSign eSignature /oauth/userinfo endpoint, CLM's account discovery endpoint, and the DocuSign CLM Object API, for use by tests in pkg/client and pkg/connector.
|
Package clmtest provides an in-memory mock of the DocuSign eSignature /oauth/userinfo endpoint, CLM's account discovery endpoint, and the DocuSign CLM Object API, for use by tests in pkg/client and pkg/connector. |