@verdocs/js-sdk 5.0.2 → 5.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +378 -30
- package/dist/index.d.ts +378 -30
- package/dist/index.js +374 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +374 -26
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +1 -3
- package/package.json +1 -3
package/dist/index.mjs
CHANGED
|
@@ -888,7 +888,13 @@ var globalThis$1 = /*@__PURE__*/getDefaultExportFromCjs(globalThis_1);
|
|
|
888
888
|
*
|
|
889
889
|
* @group Authentication
|
|
890
890
|
* @api POST /v2/oauth2/token Authenticate
|
|
891
|
-
* @apiBody string(
|
|
891
|
+
* @apiBody string(enum: 'client_credentials'|'refresh_token'|'password') grant_type The type of grant to request. API callers should nearly always use 'client_credentials'.
|
|
892
|
+
* @apiBody string(format: 'uuid') client_id? If grant_type is client_credentials or refresh_token, the client ID of the API key to use.
|
|
893
|
+
* @apiBody string(format: 'uuid') client_secret? If grant_type is client_credentials, the secret key of the API key to use.
|
|
894
|
+
* @apiBody string username? If grant_type is password, the username to authenticate with.
|
|
895
|
+
* @apiBody string password? If grant_type is password, the password to authenticate with.
|
|
896
|
+
* @apiBody string password? If grant_type is password, the password to authenticate with.
|
|
897
|
+
* @apiBody string scope? Optional scope to limit the auth token to. Do not specify this unless you are instructed to by a Verdocs Support rep.
|
|
892
898
|
* @apiSuccess IAuthenticateResponse . The detailed metadata for the envelope requested
|
|
893
899
|
*/
|
|
894
900
|
const authenticate = (endpoint, params) => endpoint.api //
|
|
@@ -916,6 +922,12 @@ const refreshToken = (endpoint, refreshToken) => authenticate(endpoint, { grant_
|
|
|
916
922
|
* window.alert(`Password reset error: ${message}`);
|
|
917
923
|
* }
|
|
918
924
|
* ```
|
|
925
|
+
*
|
|
926
|
+
* @group Authentication
|
|
927
|
+
* @api POST /v2/users/change-password Change the caller's password
|
|
928
|
+
* @apiBody string old_password Current password for the caller
|
|
929
|
+
* @apiBody string new_password New password to set for the caller. Must meet strength requirements.
|
|
930
|
+
* @apiSuccess string . Success
|
|
919
931
|
*/
|
|
920
932
|
const changePassword = (endpoint, params) => endpoint.api //
|
|
921
933
|
.post('/v2/users/change-password', params)
|
|
@@ -938,42 +950,59 @@ const changePassword = (endpoint, params) => endpoint.api //
|
|
|
938
950
|
* window.alert(`Please check your verification code and try again.`);
|
|
939
951
|
* }
|
|
940
952
|
* ```
|
|
953
|
+
*
|
|
954
|
+
* @group Authentication
|
|
955
|
+
* @api POST /v2/users/reset-password Reset a password for a user
|
|
956
|
+
* @apiBody string email Email address for the user account
|
|
957
|
+
* @apiBody string code? To initiate a reset request, omit this field. To complete it, provide the emailed code received by the user.
|
|
958
|
+
* @apiBody string new_password? To initiate a reset request, omit this field. To complete it, provide the new password the user wishes to use.
|
|
959
|
+
* @apiSuccess string . Success
|
|
941
960
|
*/
|
|
942
961
|
const resetPassword = (endpoint, params) => endpoint.api //
|
|
943
962
|
.post('/v2/users/reset-password', params)
|
|
944
963
|
.then((r) => r.data);
|
|
945
964
|
/**
|
|
946
|
-
* Resend the email verification request
|
|
947
|
-
*
|
|
948
|
-
*
|
|
949
|
-
* active token on an endpoint, which may be inconvenient in workflows where it is preferable to keep the user in
|
|
950
|
-
* "anonymous" mode while verification is being performed.
|
|
965
|
+
* Resend the email verification request if the email or token are unknown. Instead, an accessToken
|
|
966
|
+
* may be supplied through which the user will be identified. This is intended to be used in post-signup
|
|
967
|
+
* cases where the user is "partially" authenticated (has a session, but is not yet verified).
|
|
951
968
|
*
|
|
952
969
|
* ```typescript
|
|
953
970
|
* import {resendVerification} from '@verdocs/js-sdk';
|
|
954
971
|
*
|
|
955
972
|
* const result = await resendVerification();
|
|
956
973
|
* ```
|
|
974
|
+
*
|
|
975
|
+
* @group Authentication
|
|
976
|
+
* @api POST /v2/users/verify Resend an email verification request for a "partially" authenticated user (authenticated, but not yet verified)
|
|
977
|
+
* @apiSuccess string . Success
|
|
957
978
|
*/
|
|
958
979
|
const resendVerification = (endpoint, accessToken) => endpoint.api //
|
|
959
980
|
.post('/v2/users/resend-verification', {}, accessToken ? { headers: { Authorization: `Bearer ${accessToken}` } } : {})
|
|
960
981
|
.then((r) => r.data);
|
|
961
982
|
/**
|
|
962
|
-
* Resend the email verification request
|
|
963
|
-
*
|
|
964
|
-
* the access token to be used may be passed directly as a parameter here. This avoids the need to set it as the
|
|
965
|
-
* active token on an endpoint, which may be inconvenient in workflows where it is preferable to keep the user in
|
|
966
|
-
* "anonymous" mode while verification is being performed.
|
|
983
|
+
* Resend the email verification request if the user is unauthenticated, but the email and token are known.
|
|
984
|
+
* Used if the token is valid but has expired.
|
|
967
985
|
*
|
|
968
986
|
* ```typescript
|
|
969
987
|
* import {resendVerification} from '@verdocs/js-sdk';
|
|
970
988
|
*
|
|
971
989
|
* const result = await resendVerification();
|
|
972
990
|
* ```
|
|
991
|
+
*
|
|
992
|
+
* @group Authentication
|
|
993
|
+
* @api POST /v2/users/verify Resend the email verification request if both the email and token are known. Used if the token is valid but has expired.
|
|
994
|
+
* @apiSuccess IAuthenticateResponse . Updated authentication details
|
|
973
995
|
*/
|
|
974
996
|
const verifyEmail = (endpoint, params) => endpoint.api //
|
|
975
997
|
.post('/v2/users/verify', params)
|
|
976
998
|
.then((r) => r.data);
|
|
999
|
+
/**
|
|
1000
|
+
* Get the caller's current user record.
|
|
1001
|
+
*
|
|
1002
|
+
* @group Authentication
|
|
1003
|
+
* @api GET /v2/users/me Get the caller's user record.
|
|
1004
|
+
* @apiSuccess IUser . User record
|
|
1005
|
+
*/
|
|
977
1006
|
const getMyUser = (endpoint) => endpoint.api //
|
|
978
1007
|
.get('/v2/users/me')
|
|
979
1008
|
.then((r) => r.data);
|
|
@@ -983,19 +1012,24 @@ const getNotifications = async (endpoint) => endpoint.api //
|
|
|
983
1012
|
.then((r) => r.data);
|
|
984
1013
|
|
|
985
1014
|
/**
|
|
986
|
-
* Get the
|
|
1015
|
+
* Get the caller's available profiles. The current profile will be marked with `current: true`.
|
|
987
1016
|
*
|
|
988
1017
|
* ```typescript
|
|
989
1018
|
* import {getProfiles} from '@verdocs/js-sdk';
|
|
990
1019
|
*
|
|
991
1020
|
* const profiles = await getProfiles();
|
|
992
1021
|
* ```
|
|
1022
|
+
*
|
|
1023
|
+
* @group Profiles
|
|
1024
|
+
* @api GET /v2/profiles Get the caller's profiles
|
|
1025
|
+
* @apiDescription A user may have multiple profiles, one for each organization of which they are a member. Only one profile may be "current" at a time.
|
|
1026
|
+
* @apiSuccess array(items: IProfile) . The caller's profiles
|
|
993
1027
|
*/
|
|
994
1028
|
const getProfiles = (endpoint) => endpoint.api //
|
|
995
1029
|
.get('/v2/profiles')
|
|
996
1030
|
.then((r) => r.data);
|
|
997
1031
|
/**
|
|
998
|
-
* Get the
|
|
1032
|
+
* Get the caller's current profile. This is just a convenience accessor that calls `getProfiles()`
|
|
999
1033
|
* and returns the first `current: true` entry.
|
|
1000
1034
|
*
|
|
1001
1035
|
* ```typescript
|
|
@@ -1017,6 +1051,10 @@ const getCurrentProfile = (endpoint) => endpoint.api //
|
|
|
1017
1051
|
*
|
|
1018
1052
|
* const newProfile = await switchProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
|
|
1019
1053
|
* ```
|
|
1054
|
+
*
|
|
1055
|
+
* @group Profiles
|
|
1056
|
+
* @api POST /v2/profiles/:profile_id/switch Change the "current" profile for the caller
|
|
1057
|
+
* @apiSuccess IAuthenticateResponse . New authentication credentials
|
|
1020
1058
|
*/
|
|
1021
1059
|
const switchProfile = (endpoint, profileId) => endpoint.api //
|
|
1022
1060
|
.post(`/v2/profiles/${profileId}/switch`)
|
|
@@ -1030,6 +1068,15 @@ const switchProfile = (endpoint, profileId) => endpoint.api //
|
|
|
1030
1068
|
*
|
|
1031
1069
|
* const newProfile = await updateProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
|
|
1032
1070
|
* ```
|
|
1071
|
+
*
|
|
1072
|
+
* @group Profiles
|
|
1073
|
+
* @api PATCH /v2/profiles/:profile_id Update a profile
|
|
1074
|
+
* @apiBody string first_name? First name
|
|
1075
|
+
* @apiBody string last_name? Last name
|
|
1076
|
+
* @apiBody string phone? Phone number
|
|
1077
|
+
* @apiBody array(items:TPermission) permissions? New permissions to directly apply to the profile
|
|
1078
|
+
* @apiBody array(items:TRole) roles? New roles to assign to the profile
|
|
1079
|
+
* @apiSuccess IProfile . The updated profile
|
|
1033
1080
|
*/
|
|
1034
1081
|
const updateProfile = (endpoint, profileId, params) => endpoint.api //
|
|
1035
1082
|
.patch(`/v2/profiles/${profileId}`, params)
|
|
@@ -1043,12 +1090,16 @@ const updateProfile = (endpoint, profileId, params) => endpoint.api //
|
|
|
1043
1090
|
*
|
|
1044
1091
|
* await deleteProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
|
|
1045
1092
|
* ```
|
|
1093
|
+
*
|
|
1094
|
+
* @group Profiles
|
|
1095
|
+
* @api DELETE /v2/profiles/:profile_id Delete a profile
|
|
1096
|
+
* @apiSuccess IAuthenticateResponse . New session tokens for the next available profile for the caller, or null if none.
|
|
1046
1097
|
*/
|
|
1047
1098
|
const deleteProfile = (endpoint, profileId) => endpoint.api //
|
|
1048
1099
|
.delete(`/v2/profiles/${profileId}`)
|
|
1049
1100
|
.then((r) => r.data);
|
|
1050
1101
|
/**
|
|
1051
|
-
* Create a new
|
|
1102
|
+
* Create a new profile. Note that there are two registration paths for creation:
|
|
1052
1103
|
* - Get invited to an organization, by an admin or owner of that org.
|
|
1053
1104
|
* - Created a new organization. The caller will become the first owner of the new org.
|
|
1054
1105
|
*
|
|
@@ -1081,6 +1132,11 @@ const createProfile = (endpoint, params) => endpoint.api //
|
|
|
1081
1132
|
*
|
|
1082
1133
|
* await uploadProfilePhoto((VerdocsEndpoint.getDefault(), profileId, file);
|
|
1083
1134
|
* ```
|
|
1135
|
+
*
|
|
1136
|
+
* @group Profiles
|
|
1137
|
+
* @api PATCH /v2/templates/:template_id Change a profile's photo
|
|
1138
|
+
* @apiBody string(format:binary) file File to upload
|
|
1139
|
+
* @apiSuccess IProfile . The updated profile
|
|
1084
1140
|
*/
|
|
1085
1141
|
const updateProfilePhoto = (endpoint, profileId, file, onUploadProgress) => {
|
|
1086
1142
|
const formData = new FormData();
|
|
@@ -1509,8 +1565,8 @@ class VerdocsEndpoint {
|
|
|
1509
1565
|
* ```
|
|
1510
1566
|
*
|
|
1511
1567
|
* @group Envelopes
|
|
1512
|
-
* @api POST /v2/envelopes Create Envelope
|
|
1513
|
-
* @apiBody string(format:uuid) template_id The
|
|
1568
|
+
* @api POST /v2/envelopes Create Envelope From Template
|
|
1569
|
+
* @apiBody string(format:uuid) template_id The ID of the template to copy
|
|
1514
1570
|
* @apiBody array(items:ICreateEnvelopeRecipient) recipients A list of recipients to include in the workflow. Must specify one recipient to match each template Role.
|
|
1515
1571
|
* @apiBody string name? Override the name of the envelope (defaults to the template name).
|
|
1516
1572
|
* @apiBody string description? Override the description of the envelope (defaults to the template description).
|
|
@@ -1528,7 +1584,7 @@ const createEnvelope = async (endpoint, request) => endpoint.api //
|
|
|
1528
1584
|
* this will return only the **metadata** the caller is allowed to view.
|
|
1529
1585
|
*
|
|
1530
1586
|
* @group Envelopes
|
|
1531
|
-
* @api GET /v2/envelopes/:id Get
|
|
1587
|
+
* @api GET /v2/envelopes/:id Get envelope details
|
|
1532
1588
|
* @apiParam string(format: 'uuid') id The ID of the envelope to retrieve.
|
|
1533
1589
|
* @apiSuccess IEnvelope . The detailed metadata for the envelope requested
|
|
1534
1590
|
*/
|
|
@@ -1539,8 +1595,8 @@ const getEnvelope = async (endpoint, envelopeId) => endpoint.api //
|
|
|
1539
1595
|
* Get all metadata for an envelope document. Note that when called by non-creators (e.g. Recipients)
|
|
1540
1596
|
* this will return only the **metadata** the caller is allowed to view.
|
|
1541
1597
|
*
|
|
1542
|
-
* @group
|
|
1543
|
-
* @api GET /envelopes/:id Get
|
|
1598
|
+
* @group Envelope Documents
|
|
1599
|
+
* @api GET /envelopes/:id Get envelope document
|
|
1544
1600
|
* @apiParam string(format: 'uuid') id The ID of the document to retrieve.
|
|
1545
1601
|
* @apiSuccess IEnvelopeDocument . The detailed metadata for the document requested
|
|
1546
1602
|
*/
|
|
@@ -1551,7 +1607,7 @@ const getEnvelopeDocument = async (endpoint, envelopeId, documentId) => endpoint
|
|
|
1551
1607
|
* Get a pre-signed download link for an Envelope Document. This link expires quickly, so it should
|
|
1552
1608
|
* be accessed immediately and never shared. Content-Disposition will be set to "download".
|
|
1553
1609
|
*
|
|
1554
|
-
* @group
|
|
1610
|
+
* @group Envelope Documents
|
|
1555
1611
|
* @api GET /envelopes/:envelope_id/envelope_documents/:document_id Preview, Download, or Link to a Document
|
|
1556
1612
|
* @apiParam string(format: 'uuid') envelope_id The ID of the envelope to retrieve.
|
|
1557
1613
|
* @apiParam string(format: 'uuid') document_id The ID of the document to retrieve.
|
|
@@ -1699,7 +1755,7 @@ const getFieldAttachment = async (endpoint, envelopeId, fieldName) => endpoint.a
|
|
|
1699
1755
|
* for DISPLAY ONLY, are not legally binding documents, and do not contain any encoded metadata from participants.
|
|
1700
1756
|
*
|
|
1701
1757
|
* @group Envelopes
|
|
1702
|
-
* @api GET /v2/envelope-documnets/page-image/:document_id/:variant/:page Get
|
|
1758
|
+
* @api GET /v2/envelope-documnets/page-image/:document_id/:variant/:page Get envelope document page display URI
|
|
1703
1759
|
* @apiParam string(format: 'uuid') document_id The ID of the document to retrieve.
|
|
1704
1760
|
* @apiParam string(enum: 'original'|'filled') variant The variant of the document to retrieve.
|
|
1705
1761
|
* @apiParam integer page The page number to retrieve
|
|
@@ -1716,7 +1772,7 @@ const getEnvelopeDocumentPageDisplayUri = async (endpoint, documentId, page, var
|
|
|
1716
1772
|
* ```
|
|
1717
1773
|
*
|
|
1718
1774
|
* @group Envelopes
|
|
1719
|
-
* @api GET /v2/envelopes List
|
|
1775
|
+
* @api GET /v2/envelopes List envelopes
|
|
1720
1776
|
* @apiQuery string q? Match envelopes whose name contains this string
|
|
1721
1777
|
* @apiQuery string(enum: 'inbox' | 'sent' | 'action' | 'waiting' | 'completed') view? Request pre-defined view. `inbox` returns envelopes where action is required by the caller. `sent` returns envelopes created by the caller. `action` returns envelopes where action is required by the caller. `waiting` returns envelopes where action is required by anyone. `completed` returns envelopes where all actions are complete.
|
|
1722
1778
|
* @apiQuery array(items: 'complete' | 'pending' | 'in progress' | 'declined' | 'canceled') status? Match envelopes in one of the specified states.
|
|
@@ -2036,6 +2092,10 @@ const deleteSignature = (endpoint, signatureId) => endpoint.api //
|
|
|
2036
2092
|
*
|
|
2037
2093
|
* const keys = await getApiKeys(ORGID);
|
|
2038
2094
|
* ```
|
|
2095
|
+
*
|
|
2096
|
+
* @group API Keys
|
|
2097
|
+
* @api GET /v2/api-keys Get API keys
|
|
2098
|
+
* @apiSuccess array(items: IApiKey) . A list of the API keys for the caller's organization. Secrets will not be included.
|
|
2039
2099
|
*/
|
|
2040
2100
|
const getApiKeys = (endpoint) => endpoint.api //
|
|
2041
2101
|
.get(`/v2/api-keys`)
|
|
@@ -2048,6 +2108,13 @@ const getApiKeys = (endpoint) => endpoint.api //
|
|
|
2048
2108
|
*
|
|
2049
2109
|
* await createApiKey(ORGID, {name: NEWNAME});
|
|
2050
2110
|
* ```
|
|
2111
|
+
*
|
|
2112
|
+
* @group API Keys
|
|
2113
|
+
* @api POST /v2/api-keys Create API key
|
|
2114
|
+
* @apiBody string name A name used to identify the key in the Verdocs Web App
|
|
2115
|
+
* @apiBody string(format:uuid) profile_id The profile ID that calls made using the key will act as
|
|
2116
|
+
* @apiBody array(items:string) permission An array of permissions to assign to the new key. Extends (but does not override) the API key's profile permissions.
|
|
2117
|
+
* @apiSuccess IApiKey . The newly-created API key, including its secret.
|
|
2051
2118
|
*/
|
|
2052
2119
|
const createApiKey = (endpoint, params) => endpoint.api //
|
|
2053
2120
|
.post('/v2/api-keys', params)
|
|
@@ -2060,6 +2127,11 @@ const createApiKey = (endpoint, params) => endpoint.api //
|
|
|
2060
2127
|
*
|
|
2061
2128
|
* const {client_secret: newSecret} = await rotateApiKey(ORGID, CLIENTID);
|
|
2062
2129
|
* ```
|
|
2130
|
+
*
|
|
2131
|
+
* @group API Keys
|
|
2132
|
+
* @api POST /v2/api-keys/:client_id/rotate Rotate API key
|
|
2133
|
+
* @apiParam string(format:uuid) client_id The client ID of the key to rotate
|
|
2134
|
+
* @apiSuccess IApiKey . The updated API key with its new secret.
|
|
2063
2135
|
*/
|
|
2064
2136
|
const rotateApiKey = (endpoint, clientId) => endpoint.api //
|
|
2065
2137
|
.post(`/v2/api-keys/${clientId}/rotate`)
|
|
@@ -2072,6 +2144,12 @@ const rotateApiKey = (endpoint, clientId) => endpoint.api //
|
|
|
2072
2144
|
*
|
|
2073
2145
|
* await updateApiKey(ORGID, CLIENTID, {name: NEWNAME});
|
|
2074
2146
|
* ```
|
|
2147
|
+
*
|
|
2148
|
+
* @group API Keys
|
|
2149
|
+
* @api PATCH /v2/api-keys/:client_id Update API key
|
|
2150
|
+
* @apiBody string name? New name for the API key
|
|
2151
|
+
* @apiBody array(items:string) permission New array of permissions to assign to the new key. Extends (but does not override) the API key's profile permissions.
|
|
2152
|
+
* @apiSuccess IApiKey . The updated API key. The secret will not be included.
|
|
2075
2153
|
*/
|
|
2076
2154
|
const updateApiKey = (endpoint, clientId, params) => endpoint.api //
|
|
2077
2155
|
.patch(`/v2/api-keys/${clientId}`, params)
|
|
@@ -2084,6 +2162,10 @@ const updateApiKey = (endpoint, clientId, params) => endpoint.api //
|
|
|
2084
2162
|
*
|
|
2085
2163
|
* await deleteApiKey(ORGID, CLIENTID);
|
|
2086
2164
|
* ```
|
|
2165
|
+
*
|
|
2166
|
+
* @group API Keys
|
|
2167
|
+
* @api DELETE /v2/api-keys/:client_id Delete API key
|
|
2168
|
+
* @apiSuccess string . Success.
|
|
2087
2169
|
*/
|
|
2088
2170
|
const deleteApiKey = (endpoint, clientId) => endpoint.api //
|
|
2089
2171
|
.delete(`/v2/api-keys/${clientId}`)
|
|
@@ -2103,19 +2185,30 @@ const deleteApiKey = (endpoint, clientId) => endpoint.api //
|
|
|
2103
2185
|
*
|
|
2104
2186
|
* const members = await getOrganizationContacts(VerdocsEndpoint.getDefault()});
|
|
2105
2187
|
* ```
|
|
2188
|
+
*
|
|
2189
|
+
* @group Organization Contacts
|
|
2190
|
+
* @api GET /v2/organization-contacts Get a list of organization contacts
|
|
2191
|
+
* @apiBody string email Email address for the invitee
|
|
2192
|
+
* @apiBody string token Invite token for the invitee
|
|
2193
|
+
* @apiSuccess string . Success. The invitation will be marked declined and the token will be invalidated.
|
|
2106
2194
|
*/
|
|
2107
2195
|
const getOrganizationContacts = (endpoint) => endpoint.api //
|
|
2108
2196
|
.get(`/v2/organization-contacts`)
|
|
2109
2197
|
.then((r) => r.data);
|
|
2110
2198
|
/**
|
|
2111
|
-
* Delete a contact from the caller's organization. Note that the caller must be an admin or owner
|
|
2112
|
-
* may not delete him/herself.
|
|
2199
|
+
* Delete a contact from the caller's organization. Note that the caller must be an admin or owner.
|
|
2113
2200
|
*
|
|
2114
2201
|
* ```typescript
|
|
2115
2202
|
* import {deleteOrganizationContact} from '@verdocs/js-sdk';
|
|
2116
2203
|
*
|
|
2117
2204
|
* await deleteOrganizationContact(VerdocsEndpoint.getDefault(), 'PROFILEID'});
|
|
2118
2205
|
* ```
|
|
2206
|
+
*
|
|
2207
|
+
* @group Organization Contacts
|
|
2208
|
+
* @api POST /v2/organization-invitations/decline GET a list of pending invitations
|
|
2209
|
+
* @apiBody string email Email address for the invitee
|
|
2210
|
+
* @apiBody string token Invite token for the invitee
|
|
2211
|
+
* @apiSuccess string . Success. The invitation will be marked declined and the token will be invalidated.
|
|
2119
2212
|
*/
|
|
2120
2213
|
const deleteOrganizationContact = (endpoint, profileId) => endpoint.api //
|
|
2121
2214
|
.delete(`/v2/organization-contacts/${profileId}`)
|
|
@@ -2247,12 +2340,27 @@ const deleteGroupMember = (endpoint, groupId, profile_id) => endpoint.api //
|
|
|
2247
2340
|
*/
|
|
2248
2341
|
/**
|
|
2249
2342
|
* Get a list of invitations pending for the caller's organization. The caller must be an admin or owner.
|
|
2343
|
+
*
|
|
2344
|
+
* @group Organization Invitations
|
|
2345
|
+
* @api GET /v2/organization-invitations Get a list of pending invitations
|
|
2346
|
+
* @apiBody array(items:TRole) roles URL to send Webhook events to. An empty or invalid URL will disable Webhook calls.
|
|
2347
|
+
* @apiBody string first_name First name. The user may override this after accepting the invitation.
|
|
2348
|
+
* @apiBody string last_name Last name. The user may override this after accepting the invitation.
|
|
2349
|
+
* @apiSuccess array(items:IProfile) . List of caller's current organization's members
|
|
2250
2350
|
*/
|
|
2251
2351
|
const getOrganizationInvitations = (endpoint) => endpoint.api //
|
|
2252
2352
|
.get(`/v2/organization-invitations`)
|
|
2253
2353
|
.then((r) => r.data);
|
|
2254
2354
|
/**
|
|
2255
2355
|
* Invite a new user to join the organization.
|
|
2356
|
+
*
|
|
2357
|
+
* @group Organization Invitations
|
|
2358
|
+
* @api POST /v2/organization-invitations Invite a new user to join the organization
|
|
2359
|
+
* @apiBody string email Email address to send the invitation to
|
|
2360
|
+
* @apiBody string first_name First name. The user may override this after accepting the invitation.
|
|
2361
|
+
* @apiBody string last_name Last name. The user may override this after accepting the invitation.
|
|
2362
|
+
* @apiBody TRole role Initial role to assign to the user once they accept.
|
|
2363
|
+
* @apiSuccess IOrganizationInvitation . The newly-created invitation.
|
|
2256
2364
|
*/
|
|
2257
2365
|
const createOrganizationInvitation = (endpoint, params) => endpoint.api //
|
|
2258
2366
|
.post(`/v2/organization-invitations`, params)
|
|
@@ -2261,6 +2369,10 @@ const createOrganizationInvitation = (endpoint, params) => endpoint.api //
|
|
|
2261
2369
|
* Delete an invitation. Note that no cancellation message will be sent. Invitations are also one-time-use.
|
|
2262
2370
|
* If the invitee attempts to join after the invitation is deleted, accepted, or decline, they will be
|
|
2263
2371
|
* shown an error.
|
|
2372
|
+
*
|
|
2373
|
+
* @group Organization Invitations
|
|
2374
|
+
* @api DELETE /v2/organization-invitations/:email Delete a pending invitation
|
|
2375
|
+
* @apiSuccess string . Success
|
|
2264
2376
|
*/
|
|
2265
2377
|
const deleteOrganizationInvitation = (endpoint, email) => endpoint.api //
|
|
2266
2378
|
.delete(`/v2/organization-invitations/${email}`)
|
|
@@ -2268,12 +2380,24 @@ const deleteOrganizationInvitation = (endpoint, email) => endpoint.api //
|
|
|
2268
2380
|
/**
|
|
2269
2381
|
* Update an invitation. Note that email may not be changed after the invite is sent. To change
|
|
2270
2382
|
* an invitee's email, delete the incorrect entry and create one with the correct value.
|
|
2383
|
+
*
|
|
2384
|
+
* @group Organization Invitations
|
|
2385
|
+
* @api PATCH /v2/organization-invitations/:email Update a pending invitation
|
|
2386
|
+
* @apiBody string first_name First name. The user may override this after accepting the invitation.
|
|
2387
|
+
* @apiBody string last_name Last name. The user may override this after accepting the invitation.
|
|
2388
|
+
* @apiBody TRole role Initial role to assign to the user once they accept.
|
|
2389
|
+
* @apiSuccess IOrganizationInvitation . The updated invitation.
|
|
2271
2390
|
*/
|
|
2272
2391
|
const updateOrganizationInvitation = (endpoint, email, params) => endpoint.api //
|
|
2273
2392
|
.patch(`/v2/organization-invitations/${email}`, params)
|
|
2274
2393
|
.then((r) => r.data);
|
|
2275
2394
|
/**
|
|
2276
2395
|
* Send a reminder to the invitee to join the organization.
|
|
2396
|
+
*
|
|
2397
|
+
* @group Organization Invitations
|
|
2398
|
+
* @api POST /v2/organization-invitations/resend Send a reminder to a pending invitee
|
|
2399
|
+
* @apiBody string email The recipient to send the reminder to
|
|
2400
|
+
* @apiSuccess IOrganizationInvitation . The updated invitation
|
|
2277
2401
|
*/
|
|
2278
2402
|
const resendOrganizationInvitation = (endpoint, email) => endpoint.api //
|
|
2279
2403
|
.post('/v2/organization-invitations/resend', { email })
|
|
@@ -2282,15 +2406,28 @@ const resendOrganizationInvitation = (endpoint, email) => endpoint.api //
|
|
|
2282
2406
|
* Get an invitation's details. This is generally used as the first step of accepting the invite.
|
|
2283
2407
|
* A successful response will indicate that the invite token is still valid, and include some
|
|
2284
2408
|
* metadata for the organization to style the acceptance screen.
|
|
2409
|
+
*
|
|
2410
|
+
* @group Organization Invitations
|
|
2411
|
+
* @api GET /v2/organization-invitations/:email/:token Get a pending invitation (_Authenticated via invite token, not an active session._). Intended to be called by the invitee to get details about the invitation they are about to accept.
|
|
2412
|
+
* @apiSuccess IOrganizationInvitation . Requested invitation's details. Will always include summary details for the organization, to be used for branding the accept-invite view.
|
|
2285
2413
|
*/
|
|
2286
2414
|
const getOrganizationInvitation = (endpoint, email, token) => endpoint.api //
|
|
2287
2415
|
.get(`/v2/organization-invitations/${email}/${token}`)
|
|
2288
2416
|
.then((r) => r.data);
|
|
2289
2417
|
/**
|
|
2290
|
-
* Accept an invitation. This will automatically create
|
|
2418
|
+
* Accept an invitation. This will automatically create a user record for the caller as well as a profile
|
|
2291
2419
|
* with the appropriate role as specified in the invite. The profile will be set as "current" for the caller,
|
|
2292
2420
|
* and session tokens will be returned to access the new profile. The profile's email_verified flag will
|
|
2293
2421
|
* also be set to true.
|
|
2422
|
+
*
|
|
2423
|
+
* @group Organization Invitations
|
|
2424
|
+
* @api POST /v2/organization-invitations/accept Accept an invitation
|
|
2425
|
+
* @apiBody string email Email address for the invitee
|
|
2426
|
+
* @apiBody string token Invite token for the invitee
|
|
2427
|
+
* @apiBody string first_name First name
|
|
2428
|
+
* @apiBody string last_name Last name
|
|
2429
|
+
* @apiBody string password Password
|
|
2430
|
+
* @apiSuccess IAuthenticateResponse . Session credentials for the newly-created user's profile. If the user already had a profile for another organization, the new profile will be made "current" automatically.
|
|
2294
2431
|
*/
|
|
2295
2432
|
const acceptOrganizationInvitation = (endpoint, params) => endpoint.api //
|
|
2296
2433
|
.post('/v2/organization-invitations/accept', params)
|
|
@@ -2299,6 +2436,13 @@ const acceptOrganizationInvitation = (endpoint, params) => endpoint.api //
|
|
|
2299
2436
|
* Decline an invitation. This will mark the status "declined," providing a visual indication to the
|
|
2300
2437
|
* organization's admins that the invite was declined, preventing further invites from being created
|
|
2301
2438
|
* to the same email address, and also preventing the invitee from receiving reminders to join.
|
|
2439
|
+
*
|
|
2440
|
+
* @group Organization Invitations
|
|
2441
|
+
* @api POST /v2/organization-invitations/decline Decline an invitation
|
|
2442
|
+
* @apiDescription Mark the status "declined," providing a visual indication to the organization's admins that the invite was declined, preventing further invites from being created to the same email address, and also preventing the invitee from receiving reminders to join.
|
|
2443
|
+
* @apiBody string email Email address for the invitee
|
|
2444
|
+
* @apiBody string token Invite token for the invitee
|
|
2445
|
+
* @apiSuccess string . Success. The invitation will be marked declined and the token will be invalidated.
|
|
2302
2446
|
*/
|
|
2303
2447
|
const declineOrganizationInvitation = (endpoint, email, token) => endpoint.api //
|
|
2304
2448
|
.post('/v2/organization-invitations/decline', { email, token })
|
|
@@ -2317,6 +2461,10 @@ const declineOrganizationInvitation = (endpoint, email, token) => endpoint.api /
|
|
|
2317
2461
|
*
|
|
2318
2462
|
* const members = await getOrganizationMembers(VerdocsEndpoint.getDefault()});
|
|
2319
2463
|
* ```
|
|
2464
|
+
*
|
|
2465
|
+
* @group Organization Members
|
|
2466
|
+
* @api GET /v2/organization-members List current organization's members
|
|
2467
|
+
* @apiSuccess array(items:IProfile) . List of caller's current organization's members
|
|
2320
2468
|
*/
|
|
2321
2469
|
const getOrganizationMembers = (endpoint) => endpoint.api //
|
|
2322
2470
|
.get(`/v2/organization-members`)
|
|
@@ -2330,6 +2478,10 @@ const getOrganizationMembers = (endpoint) => endpoint.api //
|
|
|
2330
2478
|
*
|
|
2331
2479
|
* await deleteOrganizationMember(VerdocsEndpoint.getDefault(), 'PROFILEID'});
|
|
2332
2480
|
* ```
|
|
2481
|
+
*
|
|
2482
|
+
* @group Organization Members
|
|
2483
|
+
* @api DELETE /v2/organization-members/:profile_id Delete a member from the organization
|
|
2484
|
+
* @apiSuccess string . Success
|
|
2333
2485
|
*/
|
|
2334
2486
|
const deleteOrganizationMember = (endpoint, profileId) => endpoint.api //
|
|
2335
2487
|
.delete(`/v2/organization-members/${profileId}`)
|
|
@@ -2342,6 +2494,13 @@ const deleteOrganizationMember = (endpoint, profileId) => endpoint.api //
|
|
|
2342
2494
|
*
|
|
2343
2495
|
* const result = await updateOrganizationMember(VerdocsEndpoint.getDefault(), 'PROFILEID', {roles:['member']});
|
|
2344
2496
|
* ```
|
|
2497
|
+
*
|
|
2498
|
+
* @group Organization Members
|
|
2499
|
+
* @api PATCH /v2/organization-members/:profile_id Update an organization member.
|
|
2500
|
+
* @apiBody array(items:TRole) roles URL to send Webhook events to. An empty or invalid URL will disable Webhook calls.
|
|
2501
|
+
* @apiBody string first_name Set to true to enable Webhooks calls.
|
|
2502
|
+
* @apiBody string last_name Record<TWebhookEvent, boolean> map of events to enable/disable.
|
|
2503
|
+
* @apiSuccess array(items:IProfile) . List of caller's current organization's members
|
|
2345
2504
|
*/
|
|
2346
2505
|
const updateOrganizationMember = (endpoint, profileId, params) => endpoint.api //
|
|
2347
2506
|
.patch(`/v2/organization-members/${profileId}`, params)
|
|
@@ -2369,6 +2528,10 @@ const updateOrganizationMember = (endpoint, profileId, params) => endpoint.api /
|
|
|
2369
2528
|
*
|
|
2370
2529
|
* const organizations = await getOrganization(VerdocsEndpoint.getDefault(), 'ORGID');
|
|
2371
2530
|
* ```
|
|
2531
|
+
*
|
|
2532
|
+
* @group Organizations
|
|
2533
|
+
* @api GET /v2/organizations/:organization_id Get organization
|
|
2534
|
+
* @apiSuccess IOrganization . The requested organization. The caller must be a member.
|
|
2372
2535
|
*/
|
|
2373
2536
|
const getOrganization = (endpoint, organizationId) => endpoint.api //
|
|
2374
2537
|
.get(`/v2/organizations/${organizationId}`)
|
|
@@ -2383,6 +2546,18 @@ const getOrganization = (endpoint, organizationId) => endpoint.api //
|
|
|
2383
2546
|
*
|
|
2384
2547
|
* const organization = await createOrganization(VerdocsEndpoint.getDefault(), {name: 'NewOrg'});
|
|
2385
2548
|
* ```
|
|
2549
|
+
*
|
|
2550
|
+
* @group Organizations
|
|
2551
|
+
* @api POST /v2/organizations Create organization
|
|
2552
|
+
* @apiDescription The caller will be assigned an "Owner" profile in the new organization, and it will be set to "current" automatically. A new set of session tokens will be issued to the caller, and the caller should update their endpoint to use the new tokens.
|
|
2553
|
+
* @apiBody string name The name of the new organization
|
|
2554
|
+
* @apiBody string contact_email? Contact email for the new organization
|
|
2555
|
+
* @apiBody string url? URL for the new organization
|
|
2556
|
+
* @apiBody string full_logo_url? URL of a large-format PNG logo
|
|
2557
|
+
* @apiBody string thumbnail_url? URL of a small-format (square is recommended) PNG logo
|
|
2558
|
+
* @apiBody string primary_color? URL of a small-format (square is recommended) PNG logo
|
|
2559
|
+
* @apiBody string secondary_color? URL of a small-format (square is recommended) PNG logo
|
|
2560
|
+
* @apiSuccess IAuthenticateResponse . Authentication credentials for user in the new organization. The user will be made an Owner automatically.
|
|
2386
2561
|
*/
|
|
2387
2562
|
const createOrganization = (endpoint, params) => endpoint.api //
|
|
2388
2563
|
.post(`/v2/organizations`, params)
|
|
@@ -2395,6 +2570,17 @@ const createOrganization = (endpoint, params) => endpoint.api //
|
|
|
2395
2570
|
*
|
|
2396
2571
|
* const organizations = await updateOrganization(VerdocsEndpoint.getDefault(), organizationId, {name:'ORGNAME'});
|
|
2397
2572
|
* ```
|
|
2573
|
+
*
|
|
2574
|
+
* @group Organizations
|
|
2575
|
+
* @api PATCH /v2/organizations/:organization_id Update organization
|
|
2576
|
+
* @apiBody string name The name of the new organization
|
|
2577
|
+
* @apiBody string contact_email? Contact email for the new organization
|
|
2578
|
+
* @apiBody string url? URL for the new organization
|
|
2579
|
+
* @apiBody string full_logo_url? URL of a large-format PNG logo
|
|
2580
|
+
* @apiBody string thumbnail_url? URL of a small-format (square is recommended) PNG logo
|
|
2581
|
+
* @apiBody string primary_color? URL of a small-format (square is recommended) PNG logo
|
|
2582
|
+
* @apiBody string secondary_color? URL of a small-format (square is recommended) PNG logo
|
|
2583
|
+
* @apiSuccess IOrganization . The details for the updated organization
|
|
2398
2584
|
*/
|
|
2399
2585
|
const updateOrganization = (endpoint, organizationId, params) => endpoint.api //
|
|
2400
2586
|
.patch(`/v2/organizations/${organizationId}`, params)
|
|
@@ -2408,18 +2594,28 @@ const updateOrganization = (endpoint, organizationId, params) => endpoint.api //
|
|
|
2408
2594
|
*
|
|
2409
2595
|
* const newSession = await deleteOrganization(VerdocsEndpoint.getDefault(), organizationId);
|
|
2410
2596
|
* ```
|
|
2597
|
+
*
|
|
2598
|
+
* @group Organizations
|
|
2599
|
+
* @api DELETE /v2/organizations/:organization_id Delete organization
|
|
2600
|
+
* @apiSuccess IAuthenticateResponse . If the caller is a member of another organization, authentication credentials for the next organization available. If not, this will be null and the caller will be logged out.
|
|
2411
2601
|
*/
|
|
2412
2602
|
const deleteOrganization = (endpoint, organizationId) => endpoint.api //
|
|
2413
2603
|
.delete(`/v2/organizations/${organizationId}`)
|
|
2414
2604
|
.then((r) => r.data);
|
|
2415
2605
|
/**
|
|
2416
|
-
* Update the organization's logo. This can only be called by an admin or owner.
|
|
2606
|
+
* Update the organization's full or thumbnail logo. This can only be called by an admin or owner.
|
|
2417
2607
|
*
|
|
2418
2608
|
* ```typescript
|
|
2419
2609
|
* import {updateOrganizationLogo} from '@verdocs/js-sdk';
|
|
2420
2610
|
*
|
|
2421
2611
|
* await updateOrganizationLogo((VerdocsEndpoint.getDefault(), organizationId, file);
|
|
2422
2612
|
* ```
|
|
2613
|
+
*
|
|
2614
|
+
* @group Organizations
|
|
2615
|
+
* @api PATCH /v2/organizations/:organization_id Update organization full or thumbnail logo.
|
|
2616
|
+
* @apiBody image/png logo? Form-url-encoded file to upload
|
|
2617
|
+
* @apiBody image/png thumbnail? Form-url-encoded file to upload
|
|
2618
|
+
* @apiSuccess IOrganization . The updated organization.
|
|
2423
2619
|
*/
|
|
2424
2620
|
const updateOrganizationLogo = (endpoint, organizationId, file, onUploadProgress) => {
|
|
2425
2621
|
const formData = new FormData();
|
|
@@ -2473,6 +2669,10 @@ const updateOrganizationThumbnail = (endpoint, organizationId, file, onUploadPro
|
|
|
2473
2669
|
*
|
|
2474
2670
|
* await getWebhooks(ORGID, params);
|
|
2475
2671
|
* ```
|
|
2672
|
+
*
|
|
2673
|
+
* @group Webhooks
|
|
2674
|
+
* @api GET /v2/webhooks Get organization Webhooks config
|
|
2675
|
+
* @apiSuccess IWebhook . The current Webhooks config for the caller's organization.
|
|
2476
2676
|
*/
|
|
2477
2677
|
const getWebhooks = (endpoint) => endpoint.api //
|
|
2478
2678
|
.get(`/v2/webhooks`)
|
|
@@ -2487,6 +2687,14 @@ const getWebhooks = (endpoint) => endpoint.api //
|
|
|
2487
2687
|
*
|
|
2488
2688
|
* await setWebhooks(ORGID, params);
|
|
2489
2689
|
* ```
|
|
2690
|
+
*
|
|
2691
|
+
* @group Webhooks
|
|
2692
|
+
* @api PATCH /v2/webhooks Update organization Webhooks config
|
|
2693
|
+
* @apiDescription Note that Webhooks cannot currently be deleted, but may be easily disabled by setting `active` to `false` and/or setting the `url` to an empty string.
|
|
2694
|
+
* @apiBody string url URL to send Webhook events to. An empty or invalid URL will disable Webhook calls.
|
|
2695
|
+
* @apiBody boolean active Set to true to enable Webhooks calls.
|
|
2696
|
+
* @apiBody object events Record<TWebhookEvent, boolean> map of events to enable/disable.
|
|
2697
|
+
* @apiSuccess IWebhook . The updated Webhooks config for the caller's organization.
|
|
2490
2698
|
*/
|
|
2491
2699
|
const setWebhooks = (endpoint, params) => endpoint.api //
|
|
2492
2700
|
.patch(`/v2/webhooks`, params)
|
|
@@ -2671,6 +2879,25 @@ const hasRequiredPermissions = (profile, permissions) => permissions.every((perm
|
|
|
2671
2879
|
*
|
|
2672
2880
|
* await createField((VerdocsEndpoint.getDefault(), template_id, { ... });
|
|
2673
2881
|
* ```
|
|
2882
|
+
*
|
|
2883
|
+
* @group Fields
|
|
2884
|
+
* @api POST /v2/fields/:template_id Add a field to a template
|
|
2885
|
+
* @apiBody string name Name for the new field. Field names must be unique within a template. Although special characters are allowed, they must be URL-encoded in subsequent requests, so it is recommended to use only alphanumeric characters and hyphens if possible.
|
|
2886
|
+
* @apiBody string role_name Role to assign to the field. Role names must be valid, so it is recommended to create roles before fields.
|
|
2887
|
+
* @apiBody string document_id ID of the document upon which to place the field.
|
|
2888
|
+
* @apiBody string(enum: 'signature' | 'initial' | 'checkbox' | 'radio' | 'textbox' | 'timestamp' | 'date' | 'dropdown' | 'textarea' | 'attachment' | 'payment') type Type of field to create
|
|
2889
|
+
* @apiBody boolean(default: false) required Whether the field is required
|
|
2890
|
+
* @apiBody integer(min: 0) page 0-based page number upon which to place the field
|
|
2891
|
+
* @apiBody integer(min: 0) x X position for the field (left to right)
|
|
2892
|
+
* @apiBody integer(min: 0) y Y position for the field (_bottom to top!_)
|
|
2893
|
+
* @apiBody string label? Optional label to display above the field
|
|
2894
|
+
* @apiBody integer(min: 50) width? Width of the field. Note that all fields have built-in defaults, and it is recommended that this only be set on text fields.
|
|
2895
|
+
* @apiBody integer(min: 15) height? Height of the field. Note that all fields have built-in defaults, and it is recommended that this only be set on text fields.
|
|
2896
|
+
* @apiBody string placeholder? Optional placeholder to display in text fields
|
|
2897
|
+
* @apiBody string group? For fields that support grouping (radio buttons and check boxes) the value selected will be stored under this name
|
|
2898
|
+
* @apiBody array(items:IDropdownOption) options? For dropdown fields, the options to display
|
|
2899
|
+
* @apiBody string value? Optional default value to set on the field
|
|
2900
|
+
* @apiSuccess ITemplateField . Template field
|
|
2674
2901
|
*/
|
|
2675
2902
|
const createField = (endpoint, templateId, params) => endpoint.api //
|
|
2676
2903
|
.post(`/v2/fields/${templateId}`, params)
|
|
@@ -2683,6 +2910,25 @@ const createField = (endpoint, templateId, params) => endpoint.api //
|
|
|
2683
2910
|
*
|
|
2684
2911
|
* await updateField((VerdocsEndpoint.getDefault(), template_id, field_name, { ... });
|
|
2685
2912
|
* ```
|
|
2913
|
+
*
|
|
2914
|
+
* @group Fields
|
|
2915
|
+
* @api PATCH /v2/fields/:template_id/:field_name Update a field. See createField for additional details on the supported parameters.
|
|
2916
|
+
* @apiBody string name? Rename the field. Note that template field names must be unique within a template.
|
|
2917
|
+
* @apiBody string role_name Role to assign to the field.
|
|
2918
|
+
* @apiBody string document_id ID of the document upon which to place the field.
|
|
2919
|
+
* @apiBody string(enum: 'signature' | 'initial' | 'checkbox' | 'radio' | 'textbox' | 'timestamp' | 'date' | 'dropdown' | 'textarea' | 'attachment' | 'payment') type? Change the field type. Note that while this is technically allowed, fields have different behaviors, validators, default sizes, etc. It is usually easier to add a new field and delete the old one.
|
|
2920
|
+
* @apiBody boolean(default: false) required? Whether the field is required
|
|
2921
|
+
* @apiBody integer(min: 0) page? 0-based page number upon which to place the field
|
|
2922
|
+
* @apiBody integer(min: 0) x? X position for the field (left to right)
|
|
2923
|
+
* @apiBody integer(min: 0) y? Y position for the field (_bottom to top!_)
|
|
2924
|
+
* @apiBody string label? Optional label to display above the field
|
|
2925
|
+
* @apiBody integer(min: 50) width? Width of the field. Note that all fields have built-in defaults, and it is recommended that this only be set on text fields.
|
|
2926
|
+
* @apiBody integer(min: 15) height? Height of the field. Note that all fields have built-in defaults, and it is recommended that this only be set on text fields.
|
|
2927
|
+
* @apiBody string placeholder? Optional placeholder to display in text fields
|
|
2928
|
+
* @apiBody string group? For fields that support grouping (radio buttons and check boxes) the value selected will be stored under this name
|
|
2929
|
+
* @apiBody array(items:IDropdownOption) options? For dropdown fields, the options to display
|
|
2930
|
+
* @apiBody string value? Optional default value to set on the field
|
|
2931
|
+
* @apiSuccess ITemplateField . Updated template field
|
|
2686
2932
|
*/
|
|
2687
2933
|
const updateField = (endpoint, templateId, name, params) => endpoint.api //
|
|
2688
2934
|
.patch(`/v2/fields/${templateId}/${encodeURIComponent(name)}`, params)
|
|
@@ -2695,6 +2941,10 @@ const updateField = (endpoint, templateId, name, params) => endpoint.api //
|
|
|
2695
2941
|
*
|
|
2696
2942
|
* await deleteField((VerdocsEndpoint.getDefault(), template_id, field_name);
|
|
2697
2943
|
* ```
|
|
2944
|
+
*
|
|
2945
|
+
* @group Fields
|
|
2946
|
+
* @api DELETE /v2/fields/:template_id/:field_name Delete a field
|
|
2947
|
+
* @apiSuccess string . Success
|
|
2698
2948
|
*/
|
|
2699
2949
|
const deleteField = (endpoint, templateId, name) => endpoint.api //
|
|
2700
2950
|
.delete(`/v2/fields/${templateId}/${encodeURIComponent(name)}`)
|
|
@@ -2820,6 +3070,20 @@ const userCanPreviewTemplate = (profile, template) => {
|
|
|
2820
3070
|
*
|
|
2821
3071
|
* const role = await createTemplateRole(VerdocsEndpoint.getDefault(), template_id, params...);
|
|
2822
3072
|
* ```
|
|
3073
|
+
*
|
|
3074
|
+
* @group Roles
|
|
3075
|
+
* @api POST /v2/roles/:template_id Add a role to a template
|
|
3076
|
+
* @apiBody string name Name for the new role. Must be unique within the template. May include spaces, but later calls must URL-encode any references to this role, so it is recomended that special characters be avoided.
|
|
3077
|
+
* @apiBody string(enum:'signer' | 'cc' | 'approver') type Type of role to create. Signers act on documents by filling and signing fields. CC recipients receive a copy but do not act on the document. Approvers control the final submission of a document, but do not have fields of their own to fill out.
|
|
3078
|
+
* @apiBody string full_name? Default full name for the role. May be completed/overridden later, when envelopes are made from the template.
|
|
3079
|
+
* @apiBody string email? Default email address for the role. May be completed/overridden later, when envelopes are made from the template.
|
|
3080
|
+
* @apiBody string phone? Default (SMS-capable) phone number for the role. May be completed/overridden later, when envelopes are made from the template.
|
|
3081
|
+
* @apiBody string message? Optional message to include in email and SMS signing invitations.
|
|
3082
|
+
* @apiBody integer(min: 1, default: 1) sequence? Optional 1-based sequence number for the role. Roles that share the same sequence number act in parallel, and will receive invitations at the same time.
|
|
3083
|
+
* @apiBody integer(min: 1, default: 1) order? Optional 1-based order number for the role. Controls the left-to-right display order of roles at the same sequence number in the UI components e.g. `<verdocs-template-roles />`.
|
|
3084
|
+
* @apiBody boolean delegator? If true, the role may delegate their signing responsibility to another party.
|
|
3085
|
+
* @apiBody string(enum:'pin'|'identity'|'') kba_method? Active PIN- or Identity-based KBA for the role. NOTE: Some KBA operations may incur additional fees.
|
|
3086
|
+
* @apiSuccess IRole . The newly-created role
|
|
2823
3087
|
*/
|
|
2824
3088
|
const createTemplateRole = (endpoint, template_id, params) => endpoint.api //
|
|
2825
3089
|
.post(`/v2/roles/${template_id}`, params)
|
|
@@ -2832,6 +3096,20 @@ const createTemplateRole = (endpoint, template_id, params) => endpoint.api //
|
|
|
2832
3096
|
*
|
|
2833
3097
|
* const role = await updateTemplateRole(VerdocsEndpoint.getDefault(), template_id, name, params...);
|
|
2834
3098
|
* ```
|
|
3099
|
+
*
|
|
3100
|
+
* @group Roles
|
|
3101
|
+
* @api PATCH /v2/roles/:template_id/:role_id Update a role. See createRole for additional details on the parameters available.
|
|
3102
|
+
* @apiBody string name? Rename the role. Note that role names must be unique within a template, so this may fail if the new name is already in use.
|
|
3103
|
+
* @apiBody string(enum:'signer' | 'cc' | 'approver') type? Type of role.
|
|
3104
|
+
* @apiBody string full_name? Default full name for the role.
|
|
3105
|
+
* @apiBody string email? Default email address for the role.
|
|
3106
|
+
* @apiBody string phone? Default (SMS-capable) phone number for the role.
|
|
3107
|
+
* @apiBody string message? Optional message to include in email and SMS signing invitations.
|
|
3108
|
+
* @apiBody integer(min: 1, default: 1) sequence? Optional 1-based sequence number for the role.
|
|
3109
|
+
* @apiBody integer(min: 1, default: 1) order? Optional 1-based order number for the role.
|
|
3110
|
+
* @apiBody boolean delegator? If true, the role may delegate their signing responsibility to another party.
|
|
3111
|
+
* @apiBody string(enum:'pin'|'identity'|'') kba_method? Active PIN- or Identity-based KBA for the role.
|
|
3112
|
+
* @apiSuccess IRole . The newly-created role
|
|
2835
3113
|
*/
|
|
2836
3114
|
const updateTemplateRole = (endpoint, template_id, name, params) => endpoint.api //
|
|
2837
3115
|
.patch(`/v2/roles/${template_id}/${encodeURIComponent(name)}`, params)
|
|
@@ -2844,6 +3122,10 @@ const updateTemplateRole = (endpoint, template_id, name, params) => endpoint.api
|
|
|
2844
3122
|
*
|
|
2845
3123
|
* const profiles = await deleteTemplateRole(VerdocsEndpoint.getDefault(), template_id, name);
|
|
2846
3124
|
* ```
|
|
3125
|
+
*
|
|
3126
|
+
* @group Roles
|
|
3127
|
+
* @api DELETE /v2/roles/:template_id/:role_id Delete a role.
|
|
3128
|
+
* @apiSuccess string . Success
|
|
2847
3129
|
*/
|
|
2848
3130
|
const deleteTemplateRole = (endpoint, template_id, name) => endpoint.api //
|
|
2849
3131
|
.delete(`/v2/roles/${template_id}/${encodeURIComponent(name)}`)
|
|
@@ -2950,6 +3232,10 @@ const getTemplates = (endpoint, params) => endpoint.api //
|
|
|
2950
3232
|
*
|
|
2951
3233
|
* const template = await getTemplate((VerdocsEndpoint.getDefault(), '83da3d70-7857-4392-b876-c4592a304bc9');
|
|
2952
3234
|
* ```
|
|
3235
|
+
*
|
|
3236
|
+
* @group Templates
|
|
3237
|
+
* @api GET /v2/templates/:template_id Get a template. Note that the caller must have at least View access to the template.
|
|
3238
|
+
* @apiSuccess ITemplate . The requested template
|
|
2953
3239
|
*/
|
|
2954
3240
|
const getTemplate = (endpoint, templateId) => {
|
|
2955
3241
|
window?.console?.log('[JS_SDK] Loading template', templateId);
|
|
@@ -2996,6 +3282,21 @@ const ALLOWED_CREATE_FIELDS = [
|
|
|
2996
3282
|
*
|
|
2997
3283
|
* const newTemplate = await createTemplate((VerdocsEndpoint.getDefault(), {...});
|
|
2998
3284
|
* ```
|
|
3285
|
+
*
|
|
3286
|
+
* @group Templates
|
|
3287
|
+
* @api POST /v2/templates Create a template
|
|
3288
|
+
* @apiBody string name Template name
|
|
3289
|
+
* @apiBody string description? Optional description
|
|
3290
|
+
* @apiBody TTemplateVisibility visibility? Visibility setting
|
|
3291
|
+
* @apiBody boolean is_personal? Deprecated. If true, the template is personal and can only be seen by the caller. (Use "visibility" for new calls.)
|
|
3292
|
+
* @apiBody boolean is_public? Deprecated. If true, the template is public and can be seen by anybody. (Use "visibility" for new calls.)
|
|
3293
|
+
* @apiBody TTemplateSender sender? Who may send envelopes using this template
|
|
3294
|
+
* @apiBody number initial_reminder? Delay (in seconds) before the first reminder is sent (min: 4hrs). Set to 0 or null to disable.
|
|
3295
|
+
* @apiBody number followup_reminders? Delay (in seconds) before the subsequent reminders are sent (min: 12hrs). Set to 0 or null to disable.
|
|
3296
|
+
* @apiBody array(items:object) documents? Optional list of documents to attach to the template
|
|
3297
|
+
* @apiBody array(items:IRole) roles? Optional list of roles to create. Note that if roles are not included in the request, fields will be ignored.
|
|
3298
|
+
* @apiBody array(fields:ITemplateField) fields? Optional list of fields to create. Note that if fields that do not match a role will be ignored.
|
|
3299
|
+
* @apiSuccess ITemplate . The newly-created template
|
|
2999
3300
|
*/
|
|
3000
3301
|
const createTemplate = (endpoint, params, onUploadProgress) => {
|
|
3001
3302
|
const options = {
|
|
@@ -3031,6 +3332,12 @@ const createTemplate = (endpoint, params, onUploadProgress) => {
|
|
|
3031
3332
|
*
|
|
3032
3333
|
* const newTemplate = await duplicateTemplate((VerdocsEndpoint.getDefault(), originalTemplateId, 'My Template Copy');
|
|
3033
3334
|
* ```
|
|
3335
|
+
*
|
|
3336
|
+
* @group Templates
|
|
3337
|
+
* @api PUT /v2/templates/:template_id Perform an operation on a template
|
|
3338
|
+
* @apiBody string(enum:'duplicate') action Action to perform
|
|
3339
|
+
* @apiBody string name? If duplicating the template, a name for the new copy
|
|
3340
|
+
* @apiSuccess ITemplate . The newly-copied template
|
|
3034
3341
|
*/
|
|
3035
3342
|
const duplicateTemplate = (endpoint, templateId, name) => endpoint.api //
|
|
3036
3343
|
.put(`/v2/templates/${templateId}`, { action: 'duplicate', name })
|
|
@@ -3043,6 +3350,14 @@ const duplicateTemplate = (endpoint, templateId, name) => endpoint.api //
|
|
|
3043
3350
|
*
|
|
3044
3351
|
* const newTemplate = await createTemplateFromSharepoint((VerdocsEndpoint.getDefault(), {...});
|
|
3045
3352
|
* ```
|
|
3353
|
+
*
|
|
3354
|
+
* @group Templates
|
|
3355
|
+
* @api POST /v2/templates/from-sharepoint Create a template from an asset in Sharepoint
|
|
3356
|
+
* @apiBody string name Name for the new template
|
|
3357
|
+
* @apiBody string siteId Name for the new template
|
|
3358
|
+
* @apiBody string itemId Name for the new template
|
|
3359
|
+
* @apiBody string oboToken On-Behalf-Of token for calls to Sharepoint. Should be generated as a short-expiration token with at least Read privileges to the siteId/itemId. This token will be discarded after being used.
|
|
3360
|
+
* @apiSuccess ITemplate . The newly-created template
|
|
3046
3361
|
*/
|
|
3047
3362
|
const createTemplateFromSharepoint = (endpoint, params) => {
|
|
3048
3363
|
const options = {
|
|
@@ -3058,6 +3373,18 @@ const createTemplateFromSharepoint = (endpoint, params) => {
|
|
|
3058
3373
|
*
|
|
3059
3374
|
* const updatedTemplate = await updateTemplate((VerdocsEndpoint.getDefault(), '83da3d70-7857-4392-b876-c4592a304bc9', { name: 'New Name' });
|
|
3060
3375
|
* ```
|
|
3376
|
+
*
|
|
3377
|
+
* @group Templates
|
|
3378
|
+
* @api PATCH /v2/templates/:template_id Update a template
|
|
3379
|
+
* @apiBody string name? Template name
|
|
3380
|
+
* @apiBody string description? Optional description
|
|
3381
|
+
* @apiBody TTemplateVisibility visibility? Visibility setting
|
|
3382
|
+
* @apiBody boolean is_personal? Deprecated. If true, the template is personal and can only be seen by the caller. (Use "visibility" for new calls.)
|
|
3383
|
+
* @apiBody boolean is_public? Deprecated. If true, the template is public and can be seen by anybody. (Use "visibility" for new calls.)
|
|
3384
|
+
* @apiBody TTemplateSender sender? Who may send envelopes using this template
|
|
3385
|
+
* @apiBody number initial_reminder? Delay (in seconds) before the first reminder is sent (min: 4hrs). Set to 0 or null to disable.
|
|
3386
|
+
* @apiBody number followup_reminders? Delay (in seconds) before the subsequent reminders are sent (min: 12hrs). Set to 0 or null to disable.
|
|
3387
|
+
* @apiSuccess ITemplate . The updated template
|
|
3061
3388
|
*/
|
|
3062
3389
|
const updateTemplate = (endpoint, templateId, params) => endpoint.api //
|
|
3063
3390
|
.patch(`/v2/templates/${templateId}`, params)
|
|
@@ -3070,6 +3397,10 @@ const updateTemplate = (endpoint, templateId, params) => endpoint.api //
|
|
|
3070
3397
|
*
|
|
3071
3398
|
* await deleteTemplate((VerdocsEndpoint.getDefault(), '83da3d70-7857-4392-b876-c4592a304bc9');
|
|
3072
3399
|
* ```
|
|
3400
|
+
*
|
|
3401
|
+
* @group Templates
|
|
3402
|
+
* @api DELETE /v2/templates/:template_id Delete a template
|
|
3403
|
+
* @apiSuccess string . Success
|
|
3073
3404
|
*/
|
|
3074
3405
|
const deleteTemplate = (endpoint, templateId) => endpoint.api //
|
|
3075
3406
|
.delete(`/v2/templates/${templateId}`)
|
|
@@ -3088,6 +3419,10 @@ const deleteTemplate = (endpoint, templateId) => endpoint.api //
|
|
|
3088
3419
|
*
|
|
3089
3420
|
* await TemplateDocument.geTemplateDocuments((VerdocsEndpoint.getDefault(), templateId);
|
|
3090
3421
|
* ```
|
|
3422
|
+
*
|
|
3423
|
+
* @group Template Documents
|
|
3424
|
+
* @api GET /v2/templates/:template_id/documents List the documents assigned to a template
|
|
3425
|
+
* @apiSuccess array(items: ITemplateDocument) . Template documents
|
|
3091
3426
|
*/
|
|
3092
3427
|
const getTemplateDocuments = (endpoint, templateId) => endpoint.api //
|
|
3093
3428
|
.get(`/templates/${templateId}/documents/`)
|
|
@@ -3100,6 +3435,10 @@ const getTemplateDocuments = (endpoint, templateId) => endpoint.api //
|
|
|
3100
3435
|
*
|
|
3101
3436
|
* await TemplateDocument.geTemplateDocument((VerdocsEndpoint.getDefault(), templateId,documentId);
|
|
3102
3437
|
* ```
|
|
3438
|
+
*
|
|
3439
|
+
* @group Template Documents
|
|
3440
|
+
* @api GET /v2/templates/:template_id/documents/:document_id Get an individual template document
|
|
3441
|
+
* @apiSuccess ITemplateDocument . Template document
|
|
3103
3442
|
*/
|
|
3104
3443
|
const getTemplateDocument = (endpoint, templateId, documentId) => endpoint.api //
|
|
3105
3444
|
.get(`/templates/${templateId}/documents/${documentId}`)
|
|
@@ -3112,6 +3451,11 @@ const getTemplateDocument = (endpoint, templateId, documentId) => endpoint.api /
|
|
|
3112
3451
|
*
|
|
3113
3452
|
* await TemplateDocument.createDocument((VerdocsEndpoint.getDefault(), templateID, params);
|
|
3114
3453
|
* ```
|
|
3454
|
+
*
|
|
3455
|
+
* @group Template Documents
|
|
3456
|
+
* @api POST /v2/templates/:template_id/documents Attach a document to a template
|
|
3457
|
+
* @apiBody string(format:binary) file Document file to attach. The file name will automatically be used as the document name.
|
|
3458
|
+
* @apiSuccess ITemplateDocument . Template document
|
|
3115
3459
|
*/
|
|
3116
3460
|
const createTemplateDocument = (endpoint, templateId, file, onUploadProgress) => {
|
|
3117
3461
|
const formData = new FormData();
|
|
@@ -3135,6 +3479,10 @@ const createTemplateDocument = (endpoint, templateId, file, onUploadProgress) =>
|
|
|
3135
3479
|
*
|
|
3136
3480
|
* await TemplateDocument.deleteDocument((VerdocsEndpoint.getDefault(), templateID, documentID);
|
|
3137
3481
|
* ```
|
|
3482
|
+
*
|
|
3483
|
+
* @group Template Documents
|
|
3484
|
+
* @api DELETE /v2/templates/:temlate_id/documents/:document_id Delete a template document
|
|
3485
|
+
* @apiSuccess string . Success
|
|
3138
3486
|
*/
|
|
3139
3487
|
const deleteTemplateDocument = (endpoint, templateId, documentId) => endpoint.api //
|
|
3140
3488
|
.delete(`/templates/${templateId}/documents/${documentId}`)
|