@verdocs/js-sdk 5.0.2 → 5.0.5

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.js CHANGED
@@ -890,7 +890,13 @@ var globalThis$1 = /*@__PURE__*/getDefaultExportFromCjs(globalThis_1);
890
890
  *
891
891
  * @group Authentication
892
892
  * @api POST /v2/oauth2/token Authenticate
893
- * @apiBody string(format: 'uuid') id The ID of the envelope to retrieve.
893
+ * @apiBody string(enum: 'client_credentials'|'refresh_token'|'password') grant_type The type of grant to request. API callers should nearly always use 'client_credentials'.
894
+ * @apiBody string(format: 'uuid') client_id? If grant_type is client_credentials or refresh_token, the client ID of the API key to use.
895
+ * @apiBody string(format: 'uuid') client_secret? If grant_type is client_credentials, the secret key of the API key to use.
896
+ * @apiBody string username? If grant_type is password, the username to authenticate with.
897
+ * @apiBody string password? If grant_type is password, the password to authenticate with.
898
+ * @apiBody string password? If grant_type is password, the password to authenticate with.
899
+ * @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.
894
900
  * @apiSuccess IAuthenticateResponse . The detailed metadata for the envelope requested
895
901
  */
896
902
  const authenticate = (endpoint, params) => endpoint.api //
@@ -918,6 +924,12 @@ const refreshToken = (endpoint, refreshToken) => authenticate(endpoint, { grant_
918
924
  * window.alert(`Password reset error: ${message}`);
919
925
  * }
920
926
  * ```
927
+ *
928
+ * @group Authentication
929
+ * @api POST /v2/users/change-password Change the caller's password
930
+ * @apiBody string old_password Current password for the caller
931
+ * @apiBody string new_password New password to set for the caller. Must meet strength requirements.
932
+ * @apiSuccess string . Success
921
933
  */
922
934
  const changePassword = (endpoint, params) => endpoint.api //
923
935
  .post('/v2/users/change-password', params)
@@ -940,42 +952,59 @@ const changePassword = (endpoint, params) => endpoint.api //
940
952
  * window.alert(`Please check your verification code and try again.`);
941
953
  * }
942
954
  * ```
955
+ *
956
+ * @group Authentication
957
+ * @api POST /v2/users/reset-password Reset a password for a user
958
+ * @apiBody string email Email address for the user account
959
+ * @apiBody string code? To initiate a reset request, omit this field. To complete it, provide the emailed code received by the user.
960
+ * @apiBody string new_password? To initiate a reset request, omit this field. To complete it, provide the new password the user wishes to use.
961
+ * @apiSuccess string . Success
943
962
  */
944
963
  const resetPassword = (endpoint, params) => endpoint.api //
945
964
  .post('/v2/users/reset-password', params)
946
965
  .then((r) => r.data);
947
966
  /**
948
- * Resend the email verification request. Note that to prevent certain forms of abuse, the email address is not
949
- * a parameter here. Instead, the caller must be authenticated as the (unverified) user. To simplify this process,
950
- * the access token to be used may be passed directly as a parameter here. This avoids the need to set it as the
951
- * active token on an endpoint, which may be inconvenient in workflows where it is preferable to keep the user in
952
- * "anonymous" mode while verification is being performed.
967
+ * Resend the email verification request if the email or token are unknown. Instead, an accessToken
968
+ * may be supplied through which the user will be identified. This is intended to be used in post-signup
969
+ * cases where the user is "partially" authenticated (has a session, but is not yet verified).
953
970
  *
954
971
  * ```typescript
955
972
  * import {resendVerification} from '@verdocs/js-sdk';
956
973
  *
957
974
  * const result = await resendVerification();
958
975
  * ```
976
+ *
977
+ * @group Authentication
978
+ * @api POST /v2/users/verify Resend an email verification request for a "partially" authenticated user (authenticated, but not yet verified)
979
+ * @apiSuccess string . Success
959
980
  */
960
981
  const resendVerification = (endpoint, accessToken) => endpoint.api //
961
982
  .post('/v2/users/resend-verification', {}, accessToken ? { headers: { Authorization: `Bearer ${accessToken}` } } : {})
962
983
  .then((r) => r.data);
963
984
  /**
964
- * Resend the email verification request. Note that to prevent certain forms of abuse, the email address is not
965
- * a parameter here. Instead, the caller must be authenticated as the (unverified) user. To simplify this process,
966
- * the access token to be used may be passed directly as a parameter here. This avoids the need to set it as the
967
- * active token on an endpoint, which may be inconvenient in workflows where it is preferable to keep the user in
968
- * "anonymous" mode while verification is being performed.
985
+ * Resend the email verification request if the user is unauthenticated, but the email and token are known.
986
+ * Used if the token is valid but has expired.
969
987
  *
970
988
  * ```typescript
971
989
  * import {resendVerification} from '@verdocs/js-sdk';
972
990
  *
973
991
  * const result = await resendVerification();
974
992
  * ```
993
+ *
994
+ * @group Authentication
995
+ * @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.
996
+ * @apiSuccess IAuthenticateResponse . Updated authentication details
975
997
  */
976
998
  const verifyEmail = (endpoint, params) => endpoint.api //
977
999
  .post('/v2/users/verify', params)
978
1000
  .then((r) => r.data);
1001
+ /**
1002
+ * Get the caller's current user record.
1003
+ *
1004
+ * @group Authentication
1005
+ * @api GET /v2/users/me Get the caller's user record.
1006
+ * @apiSuccess IUser . User record
1007
+ */
979
1008
  const getMyUser = (endpoint) => endpoint.api //
980
1009
  .get('/v2/users/me')
981
1010
  .then((r) => r.data);
@@ -985,19 +1014,24 @@ const getNotifications = async (endpoint) => endpoint.api //
985
1014
  .then((r) => r.data);
986
1015
 
987
1016
  /**
988
- * Get the user's available profiles. The current profile will be marked with `current: true`.
1017
+ * Get the caller's available profiles. The current profile will be marked with `current: true`.
989
1018
  *
990
1019
  * ```typescript
991
1020
  * import {getProfiles} from '@verdocs/js-sdk';
992
1021
  *
993
1022
  * const profiles = await getProfiles();
994
1023
  * ```
1024
+ *
1025
+ * @group Profiles
1026
+ * @api GET /v2/profiles Get the caller's profiles
1027
+ * @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.
1028
+ * @apiSuccess array(items: IProfile) . The caller's profiles
995
1029
  */
996
1030
  const getProfiles = (endpoint) => endpoint.api //
997
1031
  .get('/v2/profiles')
998
1032
  .then((r) => r.data);
999
1033
  /**
1000
- * Get the user's current profile. This is just a convenience accessor that calls `getProfiles()`
1034
+ * Get the caller's current profile. This is just a convenience accessor that calls `getProfiles()`
1001
1035
  * and returns the first `current: true` entry.
1002
1036
  *
1003
1037
  * ```typescript
@@ -1019,6 +1053,10 @@ const getCurrentProfile = (endpoint) => endpoint.api //
1019
1053
  *
1020
1054
  * const newProfile = await switchProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
1021
1055
  * ```
1056
+ *
1057
+ * @group Profiles
1058
+ * @api POST /v2/profiles/:profile_id/switch Change the "current" profile for the caller
1059
+ * @apiSuccess IAuthenticateResponse . New authentication credentials
1022
1060
  */
1023
1061
  const switchProfile = (endpoint, profileId) => endpoint.api //
1024
1062
  .post(`/v2/profiles/${profileId}/switch`)
@@ -1032,6 +1070,15 @@ const switchProfile = (endpoint, profileId) => endpoint.api //
1032
1070
  *
1033
1071
  * const newProfile = await updateProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
1034
1072
  * ```
1073
+ *
1074
+ * @group Profiles
1075
+ * @api PATCH /v2/profiles/:profile_id Update a profile
1076
+ * @apiBody string first_name? First name
1077
+ * @apiBody string last_name? Last name
1078
+ * @apiBody string phone? Phone number
1079
+ * @apiBody array(items:TPermission) permissions? New permissions to directly apply to the profile
1080
+ * @apiBody array(items:TRole) roles? New roles to assign to the profile
1081
+ * @apiSuccess IProfile . The updated profile
1035
1082
  */
1036
1083
  const updateProfile = (endpoint, profileId, params) => endpoint.api //
1037
1084
  .patch(`/v2/profiles/${profileId}`, params)
@@ -1045,12 +1092,16 @@ const updateProfile = (endpoint, profileId, params) => endpoint.api //
1045
1092
  *
1046
1093
  * await deleteProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
1047
1094
  * ```
1095
+ *
1096
+ * @group Profiles
1097
+ * @api DELETE /v2/profiles/:profile_id Delete a profile
1098
+ * @apiSuccess IAuthenticateResponse . New session tokens for the next available profile for the caller, or null if none.
1048
1099
  */
1049
1100
  const deleteProfile = (endpoint, profileId) => endpoint.api //
1050
1101
  .delete(`/v2/profiles/${profileId}`)
1051
1102
  .then((r) => r.data);
1052
1103
  /**
1053
- * Create a new user account. Note that there are two registration paths for creation:
1104
+ * Create a new profile. Note that there are two registration paths for creation:
1054
1105
  * - Get invited to an organization, by an admin or owner of that org.
1055
1106
  * - Created a new organization. The caller will become the first owner of the new org.
1056
1107
  *
@@ -1083,6 +1134,11 @@ const createProfile = (endpoint, params) => endpoint.api //
1083
1134
  *
1084
1135
  * await uploadProfilePhoto((VerdocsEndpoint.getDefault(), profileId, file);
1085
1136
  * ```
1137
+ *
1138
+ * @group Profiles
1139
+ * @api PATCH /v2/templates/:template_id Change a profile's photo
1140
+ * @apiBody string(format:binary) file File to upload
1141
+ * @apiSuccess IProfile . The updated profile
1086
1142
  */
1087
1143
  const updateProfilePhoto = (endpoint, profileId, file, onUploadProgress) => {
1088
1144
  const formData = new FormData();
@@ -1511,8 +1567,8 @@ class VerdocsEndpoint {
1511
1567
  * ```
1512
1568
  *
1513
1569
  * @group Envelopes
1514
- * @api POST /v2/envelopes Create Envelope
1515
- * @apiBody string(format:uuid) template_id The template to base the new Envelope from
1570
+ * @api POST /v2/envelopes Create Envelope From Template
1571
+ * @apiBody string(format:uuid) template_id The ID of the template to copy
1516
1572
  * @apiBody array(items:ICreateEnvelopeRecipient) recipients A list of recipients to include in the workflow. Must specify one recipient to match each template Role.
1517
1573
  * @apiBody string name? Override the name of the envelope (defaults to the template name).
1518
1574
  * @apiBody string description? Override the description of the envelope (defaults to the template description).
@@ -1530,7 +1586,7 @@ const createEnvelope = async (endpoint, request) => endpoint.api //
1530
1586
  * this will return only the **metadata** the caller is allowed to view.
1531
1587
  *
1532
1588
  * @group Envelopes
1533
- * @api GET /v2/envelopes/:id Get Envelope Details
1589
+ * @api GET /v2/envelopes/:id Get envelope details
1534
1590
  * @apiParam string(format: 'uuid') id The ID of the envelope to retrieve.
1535
1591
  * @apiSuccess IEnvelope . The detailed metadata for the envelope requested
1536
1592
  */
@@ -1541,8 +1597,8 @@ const getEnvelope = async (endpoint, envelopeId) => endpoint.api //
1541
1597
  * Get all metadata for an envelope document. Note that when called by non-creators (e.g. Recipients)
1542
1598
  * this will return only the **metadata** the caller is allowed to view.
1543
1599
  *
1544
- * @group Envelopes
1545
- * @api GET /envelopes/:id Get Envelope Details
1600
+ * @group Envelope Documents
1601
+ * @api GET /envelopes/:id Get envelope document
1546
1602
  * @apiParam string(format: 'uuid') id The ID of the document to retrieve.
1547
1603
  * @apiSuccess IEnvelopeDocument . The detailed metadata for the document requested
1548
1604
  */
@@ -1553,7 +1609,7 @@ const getEnvelopeDocument = async (endpoint, envelopeId, documentId) => endpoint
1553
1609
  * Get a pre-signed download link for an Envelope Document. This link expires quickly, so it should
1554
1610
  * be accessed immediately and never shared. Content-Disposition will be set to "download".
1555
1611
  *
1556
- * @group Envelopes
1612
+ * @group Envelope Documents
1557
1613
  * @api GET /envelopes/:envelope_id/envelope_documents/:document_id Preview, Download, or Link to a Document
1558
1614
  * @apiParam string(format: 'uuid') envelope_id The ID of the envelope to retrieve.
1559
1615
  * @apiParam string(format: 'uuid') document_id The ID of the document to retrieve.
@@ -1701,7 +1757,7 @@ const getFieldAttachment = async (endpoint, envelopeId, fieldName) => endpoint.a
1701
1757
  * for DISPLAY ONLY, are not legally binding documents, and do not contain any encoded metadata from participants.
1702
1758
  *
1703
1759
  * @group Envelopes
1704
- * @api GET /v2/envelope-documnets/page-image/:document_id/:variant/:page Get Document Page Display URI
1760
+ * @api GET /v2/envelope-documnets/page-image/:document_id/:variant/:page Get envelope document page display URI
1705
1761
  * @apiParam string(format: 'uuid') document_id The ID of the document to retrieve.
1706
1762
  * @apiParam string(enum: 'original'|'filled') variant The variant of the document to retrieve.
1707
1763
  * @apiParam integer page The page number to retrieve
@@ -1718,7 +1774,7 @@ const getEnvelopeDocumentPageDisplayUri = async (endpoint, documentId, page, var
1718
1774
  * ```
1719
1775
  *
1720
1776
  * @group Envelopes
1721
- * @api GET /v2/envelopes List Envelopes
1777
+ * @api GET /v2/envelopes List envelopes
1722
1778
  * @apiQuery string q? Match envelopes whose name contains this string
1723
1779
  * @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.
1724
1780
  * @apiQuery array(items: 'complete' | 'pending' | 'in progress' | 'declined' | 'canceled') status? Match envelopes in one of the specified states.
@@ -2038,6 +2094,10 @@ const deleteSignature = (endpoint, signatureId) => endpoint.api //
2038
2094
  *
2039
2095
  * const keys = await getApiKeys(ORGID);
2040
2096
  * ```
2097
+ *
2098
+ * @group API Keys
2099
+ * @api GET /v2/api-keys Get API keys
2100
+ * @apiSuccess array(items: IApiKey) . A list of the API keys for the caller's organization. Secrets will not be included.
2041
2101
  */
2042
2102
  const getApiKeys = (endpoint) => endpoint.api //
2043
2103
  .get(`/v2/api-keys`)
@@ -2050,6 +2110,13 @@ const getApiKeys = (endpoint) => endpoint.api //
2050
2110
  *
2051
2111
  * await createApiKey(ORGID, {name: NEWNAME});
2052
2112
  * ```
2113
+ *
2114
+ * @group API Keys
2115
+ * @api POST /v2/api-keys Create API key
2116
+ * @apiBody string name A name used to identify the key in the Verdocs Web App
2117
+ * @apiBody string(format:uuid) profile_id The profile ID that calls made using the key will act as
2118
+ * @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.
2119
+ * @apiSuccess IApiKey . The newly-created API key, including its secret.
2053
2120
  */
2054
2121
  const createApiKey = (endpoint, params) => endpoint.api //
2055
2122
  .post('/v2/api-keys', params)
@@ -2062,6 +2129,11 @@ const createApiKey = (endpoint, params) => endpoint.api //
2062
2129
  *
2063
2130
  * const {client_secret: newSecret} = await rotateApiKey(ORGID, CLIENTID);
2064
2131
  * ```
2132
+ *
2133
+ * @group API Keys
2134
+ * @api POST /v2/api-keys/:client_id/rotate Rotate API key
2135
+ * @apiParam string(format:uuid) client_id The client ID of the key to rotate
2136
+ * @apiSuccess IApiKey . The updated API key with its new secret.
2065
2137
  */
2066
2138
  const rotateApiKey = (endpoint, clientId) => endpoint.api //
2067
2139
  .post(`/v2/api-keys/${clientId}/rotate`)
@@ -2074,6 +2146,12 @@ const rotateApiKey = (endpoint, clientId) => endpoint.api //
2074
2146
  *
2075
2147
  * await updateApiKey(ORGID, CLIENTID, {name: NEWNAME});
2076
2148
  * ```
2149
+ *
2150
+ * @group API Keys
2151
+ * @api PATCH /v2/api-keys/:client_id Update API key
2152
+ * @apiBody string name? New name for the API key
2153
+ * @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.
2154
+ * @apiSuccess IApiKey . The updated API key. The secret will not be included.
2077
2155
  */
2078
2156
  const updateApiKey = (endpoint, clientId, params) => endpoint.api //
2079
2157
  .patch(`/v2/api-keys/${clientId}`, params)
@@ -2086,6 +2164,10 @@ const updateApiKey = (endpoint, clientId, params) => endpoint.api //
2086
2164
  *
2087
2165
  * await deleteApiKey(ORGID, CLIENTID);
2088
2166
  * ```
2167
+ *
2168
+ * @group API Keys
2169
+ * @api DELETE /v2/api-keys/:client_id Delete API key
2170
+ * @apiSuccess string . Success.
2089
2171
  */
2090
2172
  const deleteApiKey = (endpoint, clientId) => endpoint.api //
2091
2173
  .delete(`/v2/api-keys/${clientId}`)
@@ -2105,19 +2187,30 @@ const deleteApiKey = (endpoint, clientId) => endpoint.api //
2105
2187
  *
2106
2188
  * const members = await getOrganizationContacts(VerdocsEndpoint.getDefault()});
2107
2189
  * ```
2190
+ *
2191
+ * @group Organization Contacts
2192
+ * @api GET /v2/organization-contacts Get a list of organization contacts
2193
+ * @apiBody string email Email address for the invitee
2194
+ * @apiBody string token Invite token for the invitee
2195
+ * @apiSuccess string . Success. The invitation will be marked declined and the token will be invalidated.
2108
2196
  */
2109
2197
  const getOrganizationContacts = (endpoint) => endpoint.api //
2110
2198
  .get(`/v2/organization-contacts`)
2111
2199
  .then((r) => r.data);
2112
2200
  /**
2113
- * Delete a contact from the caller's organization. Note that the caller must be an admin or owner,
2114
- * may not delete him/herself.
2201
+ * Delete a contact from the caller's organization. Note that the caller must be an admin or owner.
2115
2202
  *
2116
2203
  * ```typescript
2117
2204
  * import {deleteOrganizationContact} from '@verdocs/js-sdk';
2118
2205
  *
2119
2206
  * await deleteOrganizationContact(VerdocsEndpoint.getDefault(), 'PROFILEID'});
2120
2207
  * ```
2208
+ *
2209
+ * @group Organization Contacts
2210
+ * @api POST /v2/organization-invitations/decline GET a list of pending invitations
2211
+ * @apiBody string email Email address for the invitee
2212
+ * @apiBody string token Invite token for the invitee
2213
+ * @apiSuccess string . Success. The invitation will be marked declined and the token will be invalidated.
2121
2214
  */
2122
2215
  const deleteOrganizationContact = (endpoint, profileId) => endpoint.api //
2123
2216
  .delete(`/v2/organization-contacts/${profileId}`)
@@ -2249,12 +2342,27 @@ const deleteGroupMember = (endpoint, groupId, profile_id) => endpoint.api //
2249
2342
  */
2250
2343
  /**
2251
2344
  * Get a list of invitations pending for the caller's organization. The caller must be an admin or owner.
2345
+ *
2346
+ * @group Organization Invitations
2347
+ * @api GET /v2/organization-invitations Get a list of pending invitations
2348
+ * @apiBody array(items:TRole) roles URL to send Webhook events to. An empty or invalid URL will disable Webhook calls.
2349
+ * @apiBody string first_name First name. The user may override this after accepting the invitation.
2350
+ * @apiBody string last_name Last name. The user may override this after accepting the invitation.
2351
+ * @apiSuccess array(items:IProfile) . List of caller's current organization's members
2252
2352
  */
2253
2353
  const getOrganizationInvitations = (endpoint) => endpoint.api //
2254
2354
  .get(`/v2/organization-invitations`)
2255
2355
  .then((r) => r.data);
2256
2356
  /**
2257
2357
  * Invite a new user to join the organization.
2358
+ *
2359
+ * @group Organization Invitations
2360
+ * @api POST /v2/organization-invitations Invite a new user to join the organization
2361
+ * @apiBody string email Email address to send the invitation to
2362
+ * @apiBody string first_name First name. The user may override this after accepting the invitation.
2363
+ * @apiBody string last_name Last name. The user may override this after accepting the invitation.
2364
+ * @apiBody TRole role Initial role to assign to the user once they accept.
2365
+ * @apiSuccess IOrganizationInvitation . The newly-created invitation.
2258
2366
  */
2259
2367
  const createOrganizationInvitation = (endpoint, params) => endpoint.api //
2260
2368
  .post(`/v2/organization-invitations`, params)
@@ -2263,6 +2371,10 @@ const createOrganizationInvitation = (endpoint, params) => endpoint.api //
2263
2371
  * Delete an invitation. Note that no cancellation message will be sent. Invitations are also one-time-use.
2264
2372
  * If the invitee attempts to join after the invitation is deleted, accepted, or decline, they will be
2265
2373
  * shown an error.
2374
+ *
2375
+ * @group Organization Invitations
2376
+ * @api DELETE /v2/organization-invitations/:email Delete a pending invitation
2377
+ * @apiSuccess string . Success
2266
2378
  */
2267
2379
  const deleteOrganizationInvitation = (endpoint, email) => endpoint.api //
2268
2380
  .delete(`/v2/organization-invitations/${email}`)
@@ -2270,12 +2382,24 @@ const deleteOrganizationInvitation = (endpoint, email) => endpoint.api //
2270
2382
  /**
2271
2383
  * Update an invitation. Note that email may not be changed after the invite is sent. To change
2272
2384
  * an invitee's email, delete the incorrect entry and create one with the correct value.
2385
+ *
2386
+ * @group Organization Invitations
2387
+ * @api PATCH /v2/organization-invitations/:email Update a pending invitation
2388
+ * @apiBody string first_name First name. The user may override this after accepting the invitation.
2389
+ * @apiBody string last_name Last name. The user may override this after accepting the invitation.
2390
+ * @apiBody TRole role Initial role to assign to the user once they accept.
2391
+ * @apiSuccess IOrganizationInvitation . The updated invitation.
2273
2392
  */
2274
2393
  const updateOrganizationInvitation = (endpoint, email, params) => endpoint.api //
2275
2394
  .patch(`/v2/organization-invitations/${email}`, params)
2276
2395
  .then((r) => r.data);
2277
2396
  /**
2278
2397
  * Send a reminder to the invitee to join the organization.
2398
+ *
2399
+ * @group Organization Invitations
2400
+ * @api POST /v2/organization-invitations/resend Send a reminder to a pending invitee
2401
+ * @apiBody string email The recipient to send the reminder to
2402
+ * @apiSuccess IOrganizationInvitation . The updated invitation
2279
2403
  */
2280
2404
  const resendOrganizationInvitation = (endpoint, email) => endpoint.api //
2281
2405
  .post('/v2/organization-invitations/resend', { email })
@@ -2284,15 +2408,28 @@ const resendOrganizationInvitation = (endpoint, email) => endpoint.api //
2284
2408
  * Get an invitation's details. This is generally used as the first step of accepting the invite.
2285
2409
  * A successful response will indicate that the invite token is still valid, and include some
2286
2410
  * metadata for the organization to style the acceptance screen.
2411
+ *
2412
+ * @group Organization Invitations
2413
+ * @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.
2414
+ * @apiSuccess IOrganizationInvitation . Requested invitation's details. Will always include summary details for the organization, to be used for branding the accept-invite view.
2287
2415
  */
2288
2416
  const getOrganizationInvitation = (endpoint, email, token) => endpoint.api //
2289
2417
  .get(`/v2/organization-invitations/${email}/${token}`)
2290
2418
  .then((r) => r.data);
2291
2419
  /**
2292
- * Accept an invitation. This will automatically create an Auth0 user for the caller as well as a profile
2420
+ * Accept an invitation. This will automatically create a user record for the caller as well as a profile
2293
2421
  * with the appropriate role as specified in the invite. The profile will be set as "current" for the caller,
2294
2422
  * and session tokens will be returned to access the new profile. The profile's email_verified flag will
2295
2423
  * also be set to true.
2424
+ *
2425
+ * @group Organization Invitations
2426
+ * @api POST /v2/organization-invitations/accept Accept an invitation
2427
+ * @apiBody string email Email address for the invitee
2428
+ * @apiBody string token Invite token for the invitee
2429
+ * @apiBody string first_name First name
2430
+ * @apiBody string last_name Last name
2431
+ * @apiBody string password Password
2432
+ * @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.
2296
2433
  */
2297
2434
  const acceptOrganizationInvitation = (endpoint, params) => endpoint.api //
2298
2435
  .post('/v2/organization-invitations/accept', params)
@@ -2301,6 +2438,13 @@ const acceptOrganizationInvitation = (endpoint, params) => endpoint.api //
2301
2438
  * Decline an invitation. This will mark the status "declined," providing a visual indication to the
2302
2439
  * organization's admins that the invite was declined, preventing further invites from being created
2303
2440
  * to the same email address, and also preventing the invitee from receiving reminders to join.
2441
+ *
2442
+ * @group Organization Invitations
2443
+ * @api POST /v2/organization-invitations/decline Decline an invitation
2444
+ * @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.
2445
+ * @apiBody string email Email address for the invitee
2446
+ * @apiBody string token Invite token for the invitee
2447
+ * @apiSuccess string . Success. The invitation will be marked declined and the token will be invalidated.
2304
2448
  */
2305
2449
  const declineOrganizationInvitation = (endpoint, email, token) => endpoint.api //
2306
2450
  .post('/v2/organization-invitations/decline', { email, token })
@@ -2319,6 +2463,10 @@ const declineOrganizationInvitation = (endpoint, email, token) => endpoint.api /
2319
2463
  *
2320
2464
  * const members = await getOrganizationMembers(VerdocsEndpoint.getDefault()});
2321
2465
  * ```
2466
+ *
2467
+ * @group Organization Members
2468
+ * @api GET /v2/organization-members List current organization's members
2469
+ * @apiSuccess array(items:IProfile) . List of caller's current organization's members
2322
2470
  */
2323
2471
  const getOrganizationMembers = (endpoint) => endpoint.api //
2324
2472
  .get(`/v2/organization-members`)
@@ -2332,6 +2480,10 @@ const getOrganizationMembers = (endpoint) => endpoint.api //
2332
2480
  *
2333
2481
  * await deleteOrganizationMember(VerdocsEndpoint.getDefault(), 'PROFILEID'});
2334
2482
  * ```
2483
+ *
2484
+ * @group Organization Members
2485
+ * @api DELETE /v2/organization-members/:profile_id Delete a member from the organization
2486
+ * @apiSuccess string . Success
2335
2487
  */
2336
2488
  const deleteOrganizationMember = (endpoint, profileId) => endpoint.api //
2337
2489
  .delete(`/v2/organization-members/${profileId}`)
@@ -2344,6 +2496,13 @@ const deleteOrganizationMember = (endpoint, profileId) => endpoint.api //
2344
2496
  *
2345
2497
  * const result = await updateOrganizationMember(VerdocsEndpoint.getDefault(), 'PROFILEID', {roles:['member']});
2346
2498
  * ```
2499
+ *
2500
+ * @group Organization Members
2501
+ * @api PATCH /v2/organization-members/:profile_id Update an organization member.
2502
+ * @apiBody array(items:TRole) roles URL to send Webhook events to. An empty or invalid URL will disable Webhook calls.
2503
+ * @apiBody string first_name Set to true to enable Webhooks calls.
2504
+ * @apiBody string last_name Record<TWebhookEvent, boolean> map of events to enable/disable.
2505
+ * @apiSuccess array(items:IProfile) . List of caller's current organization's members
2347
2506
  */
2348
2507
  const updateOrganizationMember = (endpoint, profileId, params) => endpoint.api //
2349
2508
  .patch(`/v2/organization-members/${profileId}`, params)
@@ -2371,6 +2530,10 @@ const updateOrganizationMember = (endpoint, profileId, params) => endpoint.api /
2371
2530
  *
2372
2531
  * const organizations = await getOrganization(VerdocsEndpoint.getDefault(), 'ORGID');
2373
2532
  * ```
2533
+ *
2534
+ * @group Organizations
2535
+ * @api GET /v2/organizations/:organization_id Get organization
2536
+ * @apiSuccess IOrganization . The requested organization. The caller must be a member.
2374
2537
  */
2375
2538
  const getOrganization = (endpoint, organizationId) => endpoint.api //
2376
2539
  .get(`/v2/organizations/${organizationId}`)
@@ -2385,6 +2548,18 @@ const getOrganization = (endpoint, organizationId) => endpoint.api //
2385
2548
  *
2386
2549
  * const organization = await createOrganization(VerdocsEndpoint.getDefault(), {name: 'NewOrg'});
2387
2550
  * ```
2551
+ *
2552
+ * @group Organizations
2553
+ * @api POST /v2/organizations Create organization
2554
+ * @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.
2555
+ * @apiBody string name The name of the new organization
2556
+ * @apiBody string contact_email? Contact email for the new organization
2557
+ * @apiBody string url? URL for the new organization
2558
+ * @apiBody string full_logo_url? URL of a large-format PNG logo
2559
+ * @apiBody string thumbnail_url? URL of a small-format (square is recommended) PNG logo
2560
+ * @apiBody string primary_color? URL of a small-format (square is recommended) PNG logo
2561
+ * @apiBody string secondary_color? URL of a small-format (square is recommended) PNG logo
2562
+ * @apiSuccess IAuthenticateResponse . Authentication credentials for user in the new organization. The user will be made an Owner automatically.
2388
2563
  */
2389
2564
  const createOrganization = (endpoint, params) => endpoint.api //
2390
2565
  .post(`/v2/organizations`, params)
@@ -2397,6 +2572,17 @@ const createOrganization = (endpoint, params) => endpoint.api //
2397
2572
  *
2398
2573
  * const organizations = await updateOrganization(VerdocsEndpoint.getDefault(), organizationId, {name:'ORGNAME'});
2399
2574
  * ```
2575
+ *
2576
+ * @group Organizations
2577
+ * @api PATCH /v2/organizations/:organization_id Update organization
2578
+ * @apiBody string name The name of the new organization
2579
+ * @apiBody string contact_email? Contact email for the new organization
2580
+ * @apiBody string url? URL for the new organization
2581
+ * @apiBody string full_logo_url? URL of a large-format PNG logo
2582
+ * @apiBody string thumbnail_url? URL of a small-format (square is recommended) PNG logo
2583
+ * @apiBody string primary_color? URL of a small-format (square is recommended) PNG logo
2584
+ * @apiBody string secondary_color? URL of a small-format (square is recommended) PNG logo
2585
+ * @apiSuccess IOrganization . The details for the updated organization
2400
2586
  */
2401
2587
  const updateOrganization = (endpoint, organizationId, params) => endpoint.api //
2402
2588
  .patch(`/v2/organizations/${organizationId}`, params)
@@ -2410,18 +2596,28 @@ const updateOrganization = (endpoint, organizationId, params) => endpoint.api //
2410
2596
  *
2411
2597
  * const newSession = await deleteOrganization(VerdocsEndpoint.getDefault(), organizationId);
2412
2598
  * ```
2599
+ *
2600
+ * @group Organizations
2601
+ * @api DELETE /v2/organizations/:organization_id Delete organization
2602
+ * @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.
2413
2603
  */
2414
2604
  const deleteOrganization = (endpoint, organizationId) => endpoint.api //
2415
2605
  .delete(`/v2/organizations/${organizationId}`)
2416
2606
  .then((r) => r.data);
2417
2607
  /**
2418
- * Update the organization's logo. This can only be called by an admin or owner.
2608
+ * Update the organization's full or thumbnail logo. This can only be called by an admin or owner.
2419
2609
  *
2420
2610
  * ```typescript
2421
2611
  * import {updateOrganizationLogo} from '@verdocs/js-sdk';
2422
2612
  *
2423
2613
  * await updateOrganizationLogo((VerdocsEndpoint.getDefault(), organizationId, file);
2424
2614
  * ```
2615
+ *
2616
+ * @group Organizations
2617
+ * @api PATCH /v2/organizations/:organization_id Update organization full or thumbnail logo.
2618
+ * @apiBody image/png logo? Form-url-encoded file to upload
2619
+ * @apiBody image/png thumbnail? Form-url-encoded file to upload
2620
+ * @apiSuccess IOrganization . The updated organization.
2425
2621
  */
2426
2622
  const updateOrganizationLogo = (endpoint, organizationId, file, onUploadProgress) => {
2427
2623
  const formData = new FormData();
@@ -2475,6 +2671,10 @@ const updateOrganizationThumbnail = (endpoint, organizationId, file, onUploadPro
2475
2671
  *
2476
2672
  * await getWebhooks(ORGID, params);
2477
2673
  * ```
2674
+ *
2675
+ * @group Webhooks
2676
+ * @api GET /v2/webhooks Get organization Webhooks config
2677
+ * @apiSuccess IWebhook . The current Webhooks config for the caller's organization.
2478
2678
  */
2479
2679
  const getWebhooks = (endpoint) => endpoint.api //
2480
2680
  .get(`/v2/webhooks`)
@@ -2489,6 +2689,14 @@ const getWebhooks = (endpoint) => endpoint.api //
2489
2689
  *
2490
2690
  * await setWebhooks(ORGID, params);
2491
2691
  * ```
2692
+ *
2693
+ * @group Webhooks
2694
+ * @api PATCH /v2/webhooks Update organization Webhooks config
2695
+ * @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.
2696
+ * @apiBody string url URL to send Webhook events to. An empty or invalid URL will disable Webhook calls.
2697
+ * @apiBody boolean active Set to true to enable Webhooks calls.
2698
+ * @apiBody object events Record<TWebhookEvent, boolean> map of events to enable/disable.
2699
+ * @apiSuccess IWebhook . The updated Webhooks config for the caller's organization.
2492
2700
  */
2493
2701
  const setWebhooks = (endpoint, params) => endpoint.api //
2494
2702
  .patch(`/v2/webhooks`, params)
@@ -2673,6 +2881,25 @@ const hasRequiredPermissions = (profile, permissions) => permissions.every((perm
2673
2881
  *
2674
2882
  * await createField((VerdocsEndpoint.getDefault(), template_id, { ... });
2675
2883
  * ```
2884
+ *
2885
+ * @group Fields
2886
+ * @api POST /v2/fields/:template_id Add a field to a template
2887
+ * @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.
2888
+ * @apiBody string role_name Role to assign to the field. Role names must be valid, so it is recommended to create roles before fields.
2889
+ * @apiBody string document_id ID of the document upon which to place the field.
2890
+ * @apiBody string(enum: 'signature' | 'initial' | 'checkbox' | 'radio' | 'textbox' | 'timestamp' | 'date' | 'dropdown' | 'textarea' | 'attachment' | 'payment') type Type of field to create
2891
+ * @apiBody boolean(default: false) required Whether the field is required
2892
+ * @apiBody integer(min: 0) page 0-based page number upon which to place the field
2893
+ * @apiBody integer(min: 0) x X position for the field (left to right)
2894
+ * @apiBody integer(min: 0) y Y position for the field (_bottom to top!_)
2895
+ * @apiBody string label? Optional label to display above the field
2896
+ * @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.
2897
+ * @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.
2898
+ * @apiBody string placeholder? Optional placeholder to display in text fields
2899
+ * @apiBody string group? For fields that support grouping (radio buttons and check boxes) the value selected will be stored under this name
2900
+ * @apiBody array(items:IDropdownOption) options? For dropdown fields, the options to display
2901
+ * @apiBody string value? Optional default value to set on the field
2902
+ * @apiSuccess ITemplateField . Template field
2676
2903
  */
2677
2904
  const createField = (endpoint, templateId, params) => endpoint.api //
2678
2905
  .post(`/v2/fields/${templateId}`, params)
@@ -2685,6 +2912,25 @@ const createField = (endpoint, templateId, params) => endpoint.api //
2685
2912
  *
2686
2913
  * await updateField((VerdocsEndpoint.getDefault(), template_id, field_name, { ... });
2687
2914
  * ```
2915
+ *
2916
+ * @group Fields
2917
+ * @api PATCH /v2/fields/:template_id/:field_name Update a field. See createField for additional details on the supported parameters.
2918
+ * @apiBody string name? Rename the field. Note that template field names must be unique within a template.
2919
+ * @apiBody string role_name Role to assign to the field.
2920
+ * @apiBody string document_id ID of the document upon which to place the field.
2921
+ * @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.
2922
+ * @apiBody boolean(default: false) required? Whether the field is required
2923
+ * @apiBody integer(min: 0) page? 0-based page number upon which to place the field
2924
+ * @apiBody integer(min: 0) x? X position for the field (left to right)
2925
+ * @apiBody integer(min: 0) y? Y position for the field (_bottom to top!_)
2926
+ * @apiBody string label? Optional label to display above the field
2927
+ * @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.
2928
+ * @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.
2929
+ * @apiBody string placeholder? Optional placeholder to display in text fields
2930
+ * @apiBody string group? For fields that support grouping (radio buttons and check boxes) the value selected will be stored under this name
2931
+ * @apiBody array(items:IDropdownOption) options? For dropdown fields, the options to display
2932
+ * @apiBody string value? Optional default value to set on the field
2933
+ * @apiSuccess ITemplateField . Updated template field
2688
2934
  */
2689
2935
  const updateField = (endpoint, templateId, name, params) => endpoint.api //
2690
2936
  .patch(`/v2/fields/${templateId}/${encodeURIComponent(name)}`, params)
@@ -2697,6 +2943,10 @@ const updateField = (endpoint, templateId, name, params) => endpoint.api //
2697
2943
  *
2698
2944
  * await deleteField((VerdocsEndpoint.getDefault(), template_id, field_name);
2699
2945
  * ```
2946
+ *
2947
+ * @group Fields
2948
+ * @api DELETE /v2/fields/:template_id/:field_name Delete a field
2949
+ * @apiSuccess string . Success
2700
2950
  */
2701
2951
  const deleteField = (endpoint, templateId, name) => endpoint.api //
2702
2952
  .delete(`/v2/fields/${templateId}/${encodeURIComponent(name)}`)
@@ -2822,6 +3072,20 @@ const userCanPreviewTemplate = (profile, template) => {
2822
3072
  *
2823
3073
  * const role = await createTemplateRole(VerdocsEndpoint.getDefault(), template_id, params...);
2824
3074
  * ```
3075
+ *
3076
+ * @group Roles
3077
+ * @api POST /v2/roles/:template_id Add a role to a template
3078
+ * @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.
3079
+ * @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.
3080
+ * @apiBody string full_name? Default full name for the role. May be completed/overridden later, when envelopes are made from the template.
3081
+ * @apiBody string email? Default email address for the role. May be completed/overridden later, when envelopes are made from the template.
3082
+ * @apiBody string phone? Default (SMS-capable) phone number for the role. May be completed/overridden later, when envelopes are made from the template.
3083
+ * @apiBody string message? Optional message to include in email and SMS signing invitations.
3084
+ * @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.
3085
+ * @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 />`.
3086
+ * @apiBody boolean delegator? If true, the role may delegate their signing responsibility to another party.
3087
+ * @apiBody string(enum:'pin'|'identity'|'') kba_method? Active PIN- or Identity-based KBA for the role. NOTE: Some KBA operations may incur additional fees.
3088
+ * @apiSuccess IRole . The newly-created role
2825
3089
  */
2826
3090
  const createTemplateRole = (endpoint, template_id, params) => endpoint.api //
2827
3091
  .post(`/v2/roles/${template_id}`, params)
@@ -2834,6 +3098,20 @@ const createTemplateRole = (endpoint, template_id, params) => endpoint.api //
2834
3098
  *
2835
3099
  * const role = await updateTemplateRole(VerdocsEndpoint.getDefault(), template_id, name, params...);
2836
3100
  * ```
3101
+ *
3102
+ * @group Roles
3103
+ * @api PATCH /v2/roles/:template_id/:role_id Update a role. See createRole for additional details on the parameters available.
3104
+ * @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.
3105
+ * @apiBody string(enum:'signer' | 'cc' | 'approver') type? Type of role.
3106
+ * @apiBody string full_name? Default full name for the role.
3107
+ * @apiBody string email? Default email address for the role.
3108
+ * @apiBody string phone? Default (SMS-capable) phone number for the role.
3109
+ * @apiBody string message? Optional message to include in email and SMS signing invitations.
3110
+ * @apiBody integer(min: 1, default: 1) sequence? Optional 1-based sequence number for the role.
3111
+ * @apiBody integer(min: 1, default: 1) order? Optional 1-based order number for the role.
3112
+ * @apiBody boolean delegator? If true, the role may delegate their signing responsibility to another party.
3113
+ * @apiBody string(enum:'pin'|'identity'|'') kba_method? Active PIN- or Identity-based KBA for the role.
3114
+ * @apiSuccess IRole . The newly-created role
2837
3115
  */
2838
3116
  const updateTemplateRole = (endpoint, template_id, name, params) => endpoint.api //
2839
3117
  .patch(`/v2/roles/${template_id}/${encodeURIComponent(name)}`, params)
@@ -2846,6 +3124,10 @@ const updateTemplateRole = (endpoint, template_id, name, params) => endpoint.api
2846
3124
  *
2847
3125
  * const profiles = await deleteTemplateRole(VerdocsEndpoint.getDefault(), template_id, name);
2848
3126
  * ```
3127
+ *
3128
+ * @group Roles
3129
+ * @api DELETE /v2/roles/:template_id/:role_id Delete a role.
3130
+ * @apiSuccess string . Success
2849
3131
  */
2850
3132
  const deleteTemplateRole = (endpoint, template_id, name) => endpoint.api //
2851
3133
  .delete(`/v2/roles/${template_id}/${encodeURIComponent(name)}`)
@@ -2952,6 +3234,10 @@ const getTemplates = (endpoint, params) => endpoint.api //
2952
3234
  *
2953
3235
  * const template = await getTemplate((VerdocsEndpoint.getDefault(), '83da3d70-7857-4392-b876-c4592a304bc9');
2954
3236
  * ```
3237
+ *
3238
+ * @group Templates
3239
+ * @api GET /v2/templates/:template_id Get a template. Note that the caller must have at least View access to the template.
3240
+ * @apiSuccess ITemplate . The requested template
2955
3241
  */
2956
3242
  const getTemplate = (endpoint, templateId) => {
2957
3243
  window?.console?.log('[JS_SDK] Loading template', templateId);
@@ -2998,6 +3284,21 @@ const ALLOWED_CREATE_FIELDS = [
2998
3284
  *
2999
3285
  * const newTemplate = await createTemplate((VerdocsEndpoint.getDefault(), {...});
3000
3286
  * ```
3287
+ *
3288
+ * @group Templates
3289
+ * @api POST /v2/templates Create a template
3290
+ * @apiBody string name Template name
3291
+ * @apiBody string description? Optional description
3292
+ * @apiBody TTemplateVisibility visibility? Visibility setting
3293
+ * @apiBody boolean is_personal? Deprecated. If true, the template is personal and can only be seen by the caller. (Use "visibility" for new calls.)
3294
+ * @apiBody boolean is_public? Deprecated. If true, the template is public and can be seen by anybody. (Use "visibility" for new calls.)
3295
+ * @apiBody TTemplateSender sender? Who may send envelopes using this template
3296
+ * @apiBody number initial_reminder? Delay (in seconds) before the first reminder is sent (min: 4hrs). Set to 0 or null to disable.
3297
+ * @apiBody number followup_reminders? Delay (in seconds) before the subsequent reminders are sent (min: 12hrs). Set to 0 or null to disable.
3298
+ * @apiBody array(items:object) documents? Optional list of documents to attach to the template
3299
+ * @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.
3300
+ * @apiBody array(fields:ITemplateField) fields? Optional list of fields to create. Note that if fields that do not match a role will be ignored.
3301
+ * @apiSuccess ITemplate . The newly-created template
3001
3302
  */
3002
3303
  const createTemplate = (endpoint, params, onUploadProgress) => {
3003
3304
  const options = {
@@ -3033,6 +3334,12 @@ const createTemplate = (endpoint, params, onUploadProgress) => {
3033
3334
  *
3034
3335
  * const newTemplate = await duplicateTemplate((VerdocsEndpoint.getDefault(), originalTemplateId, 'My Template Copy');
3035
3336
  * ```
3337
+ *
3338
+ * @group Templates
3339
+ * @api PUT /v2/templates/:template_id Perform an operation on a template
3340
+ * @apiBody string(enum:'duplicate') action Action to perform
3341
+ * @apiBody string name? If duplicating the template, a name for the new copy
3342
+ * @apiSuccess ITemplate . The newly-copied template
3036
3343
  */
3037
3344
  const duplicateTemplate = (endpoint, templateId, name) => endpoint.api //
3038
3345
  .put(`/v2/templates/${templateId}`, { action: 'duplicate', name })
@@ -3045,6 +3352,14 @@ const duplicateTemplate = (endpoint, templateId, name) => endpoint.api //
3045
3352
  *
3046
3353
  * const newTemplate = await createTemplateFromSharepoint((VerdocsEndpoint.getDefault(), {...});
3047
3354
  * ```
3355
+ *
3356
+ * @group Templates
3357
+ * @api POST /v2/templates/from-sharepoint Create a template from an asset in Sharepoint
3358
+ * @apiBody string name Name for the new template
3359
+ * @apiBody string siteId Name for the new template
3360
+ * @apiBody string itemId Name for the new template
3361
+ * @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.
3362
+ * @apiSuccess ITemplate . The newly-created template
3048
3363
  */
3049
3364
  const createTemplateFromSharepoint = (endpoint, params) => {
3050
3365
  const options = {
@@ -3060,6 +3375,18 @@ const createTemplateFromSharepoint = (endpoint, params) => {
3060
3375
  *
3061
3376
  * const updatedTemplate = await updateTemplate((VerdocsEndpoint.getDefault(), '83da3d70-7857-4392-b876-c4592a304bc9', { name: 'New Name' });
3062
3377
  * ```
3378
+ *
3379
+ * @group Templates
3380
+ * @api PATCH /v2/templates/:template_id Update a template
3381
+ * @apiBody string name? Template name
3382
+ * @apiBody string description? Optional description
3383
+ * @apiBody TTemplateVisibility visibility? Visibility setting
3384
+ * @apiBody boolean is_personal? Deprecated. If true, the template is personal and can only be seen by the caller. (Use "visibility" for new calls.)
3385
+ * @apiBody boolean is_public? Deprecated. If true, the template is public and can be seen by anybody. (Use "visibility" for new calls.)
3386
+ * @apiBody TTemplateSender sender? Who may send envelopes using this template
3387
+ * @apiBody number initial_reminder? Delay (in seconds) before the first reminder is sent (min: 4hrs). Set to 0 or null to disable.
3388
+ * @apiBody number followup_reminders? Delay (in seconds) before the subsequent reminders are sent (min: 12hrs). Set to 0 or null to disable.
3389
+ * @apiSuccess ITemplate . The updated template
3063
3390
  */
3064
3391
  const updateTemplate = (endpoint, templateId, params) => endpoint.api //
3065
3392
  .patch(`/v2/templates/${templateId}`, params)
@@ -3072,6 +3399,10 @@ const updateTemplate = (endpoint, templateId, params) => endpoint.api //
3072
3399
  *
3073
3400
  * await deleteTemplate((VerdocsEndpoint.getDefault(), '83da3d70-7857-4392-b876-c4592a304bc9');
3074
3401
  * ```
3402
+ *
3403
+ * @group Templates
3404
+ * @api DELETE /v2/templates/:template_id Delete a template
3405
+ * @apiSuccess string . Success
3075
3406
  */
3076
3407
  const deleteTemplate = (endpoint, templateId) => endpoint.api //
3077
3408
  .delete(`/v2/templates/${templateId}`)
@@ -3090,6 +3421,10 @@ const deleteTemplate = (endpoint, templateId) => endpoint.api //
3090
3421
  *
3091
3422
  * await TemplateDocument.geTemplateDocuments((VerdocsEndpoint.getDefault(), templateId);
3092
3423
  * ```
3424
+ *
3425
+ * @group Template Documents
3426
+ * @api GET /v2/templates/:template_id/documents List the documents assigned to a template
3427
+ * @apiSuccess array(items: ITemplateDocument) . Template documents
3093
3428
  */
3094
3429
  const getTemplateDocuments = (endpoint, templateId) => endpoint.api //
3095
3430
  .get(`/templates/${templateId}/documents/`)
@@ -3102,6 +3437,10 @@ const getTemplateDocuments = (endpoint, templateId) => endpoint.api //
3102
3437
  *
3103
3438
  * await TemplateDocument.geTemplateDocument((VerdocsEndpoint.getDefault(), templateId,documentId);
3104
3439
  * ```
3440
+ *
3441
+ * @group Template Documents
3442
+ * @api GET /v2/templates/:template_id/documents/:document_id Get an individual template document
3443
+ * @apiSuccess ITemplateDocument . Template document
3105
3444
  */
3106
3445
  const getTemplateDocument = (endpoint, templateId, documentId) => endpoint.api //
3107
3446
  .get(`/templates/${templateId}/documents/${documentId}`)
@@ -3114,6 +3453,11 @@ const getTemplateDocument = (endpoint, templateId, documentId) => endpoint.api /
3114
3453
  *
3115
3454
  * await TemplateDocument.createDocument((VerdocsEndpoint.getDefault(), templateID, params);
3116
3455
  * ```
3456
+ *
3457
+ * @group Template Documents
3458
+ * @api POST /v2/templates/:template_id/documents Attach a document to a template
3459
+ * @apiBody string(format:binary) file Document file to attach. The file name will automatically be used as the document name.
3460
+ * @apiSuccess ITemplateDocument . Template document
3117
3461
  */
3118
3462
  const createTemplateDocument = (endpoint, templateId, file, onUploadProgress) => {
3119
3463
  const formData = new FormData();
@@ -3137,6 +3481,10 @@ const createTemplateDocument = (endpoint, templateId, file, onUploadProgress) =>
3137
3481
  *
3138
3482
  * await TemplateDocument.deleteDocument((VerdocsEndpoint.getDefault(), templateID, documentID);
3139
3483
  * ```
3484
+ *
3485
+ * @group Template Documents
3486
+ * @api DELETE /v2/templates/:temlate_id/documents/:document_id Delete a template document
3487
+ * @apiSuccess string . Success
3140
3488
  */
3141
3489
  const deleteTemplateDocument = (endpoint, templateId, documentId) => endpoint.api //
3142
3490
  .delete(`/templates/${templateId}/documents/${documentId}`)