Skip to content

Commit 1b2b516

Browse files
authored
v5.3.0 (#24)
- "Sender" parameter is added to the document send endpoint - Add a new endpoint "document update"
1 parent fa338a4 commit 1b2b516

File tree

12 files changed

+316
-3
lines changed

12 files changed

+316
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ Class | Method | HTTP request | Description
8787
*DocumentsApi* | [**statusDocument**](docs/DocumentsApi.md#statusdocument) | **GET** /public/v1/documents/{id} | Document status
8888
*DocumentsApi* | [**transferAllDocumentsOwnership**](docs/DocumentsApi.md#transferalldocumentsownership) | **PATCH** /public/v1/documents/ownership | Transfer all documents ownership
8989
*DocumentsApi* | [**transferDocumentOwnership**](docs/DocumentsApi.md#transferdocumentownership) | **PATCH** /public/v1/documents/{id}/ownership | Update document ownership
90+
*DocumentsApi* | [**updateDocument**](docs/DocumentsApi.md#updatedocument) | **PATCH** /public/v1/documents/{id} | Update Document only in the draft status
9091
*FoldersAPIApi* | [**createDocumentFolder**](docs/FoldersAPIApi.md#createdocumentfolder) | **POST** /public/v1/documents/folders | Create Documents Folder
9192
*FoldersAPIApi* | [**createTemplateFolder**](docs/FoldersAPIApi.md#createtemplatefolder) | **POST** /public/v1/templates/folders | Create Templates Folder
9293
*FoldersAPIApi* | [**listDocumentFolders**](docs/FoldersAPIApi.md#listdocumentfolders) | **GET** /public/v1/documents/folders | List Documents Folders

docs/DocumentsApi.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Method | HTTP request | Description
1919
[**statusDocument**](DocumentsApi.md#statusDocument) | **GET** /public/v1/documents/{id} | Document status
2020
[**transferAllDocumentsOwnership**](DocumentsApi.md#transferAllDocumentsOwnership) | **PATCH** /public/v1/documents/ownership | Transfer all documents ownership
2121
[**transferDocumentOwnership**](DocumentsApi.md#transferDocumentOwnership) | **PATCH** /public/v1/documents/{id}/ownership | Update document ownership
22+
[**updateDocument**](DocumentsApi.md#updateDocument) | **PATCH** /public/v1/documents/{id} | Update Document only in the draft status
2223

2324

2425
# **changeDocumentStatus**
@@ -919,6 +920,9 @@ const body:pd_api.DocumentsApiSendDocumentRequest = {
919920
message: "Hello! This document was sent from the PandaDoc API",
920921
subject: "Please check this test API document from PandaDoc",
921922
silent: true,
923+
sender: {
924+
"key": "key_example",
925+
},
922926
},
923927
};
924928

@@ -1151,3 +1155,109 @@ Name | Type | Description | Notes
11511155

11521156
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
11531157

1158+
# **updateDocument**
1159+
> void updateDocument(documentUpdateRequest)
1160+
1161+
1162+
### Example
1163+
1164+
1165+
```typescript
1166+
import * as pd_api from 'pandadoc-node-client';
1167+
1168+
// replace it with your API key
1169+
const API_KEY = "YOUR_API_KEY";
1170+
const configuration = pd_api.createConfiguration(
1171+
{ authMethods: {apiKey: `API-Key ${API_KEY}`} }
1172+
);
1173+
const apiInstance = new pd_api.DocumentsApi(configuration);
1174+
1175+
const body:pd_api.DocumentsApiUpdateDocumentRequest = {
1176+
// string | Document ID
1177+
id: "BhVzRcxH9Z2LgfPPGXFUBa",
1178+
// DocumentUpdateRequest
1179+
documentUpdateRequest: {
1180+
recipients: [
1181+
{
1182+
id: "id_example",
1183+
1184+
firstName: "Josh",
1185+
lastName: "Ron",
1186+
},
1187+
],
1188+
fields: {},
1189+
tokens: [
1190+
{
1191+
name: "Favorite.Pet",
1192+
value: "Panda",
1193+
},
1194+
],
1195+
metadata: {},
1196+
pricingTables: [
1197+
{
1198+
name: "Pricing Table 1",
1199+
dataMerge: true,
1200+
options: {},
1201+
sections: [
1202+
{
1203+
title: "Sample Section",
1204+
_default: true,
1205+
multichoiceEnabled: false,
1206+
rows: [
1207+
{
1208+
options: {
1209+
qtyEditable: true,
1210+
optionalSelected: true,
1211+
optional: true,
1212+
},
1213+
data: {},
1214+
customFields: {},
1215+
},
1216+
],
1217+
},
1218+
],
1219+
},
1220+
],
1221+
},
1222+
};
1223+
1224+
apiInstance.updateDocument(body).then((data) => {
1225+
console.log('API called successfully. Returned data: %o', data);
1226+
}).catch((error) => console.error(error));
1227+
```
1228+
1229+
1230+
### Parameters
1231+
1232+
Name | Type | Description | Notes
1233+
------------- | ------------- | ------------- | -------------
1234+
**documentUpdateRequest** | **DocumentUpdateRequest**| |
1235+
**id** | [**string**] | Document ID | defaults to undefined
1236+
1237+
1238+
### Return type
1239+
1240+
**void**
1241+
1242+
### Authorization
1243+
1244+
[apiKey](../README.md#apiKey), [oauth2](../README.md#oauth2)
1245+
1246+
### HTTP request headers
1247+
1248+
- **Content-Type**: application/json
1249+
- **Accept**: application/json
1250+
1251+
1252+
### HTTP response details
1253+
| Status code | Description | Response headers |
1254+
|-------------|-------------|------------------|
1255+
**204** | No content | - |
1256+
**400** | Bad Request | - |
1257+
**401** | Authentication error | - |
1258+
**403** | Permission error | - |
1259+
**404** | Not found | - |
1260+
**429** | Too Many Requests | - |
1261+
1262+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1263+

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pandadoc-node-client",
3-
"version": "5.2.0",
3+
"version": "5.3.0",
44
"description": "The Official PandaDoc Node client SDK",
55
"author": "PandaDoc",
66
"keywords": [

src/apis/DocumentsApi.ts

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { DocumentStatusRequestEnum } from '../models/DocumentStatusRequestEnum';
2424
import { DocumentStatusResponse } from '../models/DocumentStatusResponse';
2525
import { DocumentTransferAllOwnershipRequest } from '../models/DocumentTransferAllOwnershipRequest';
2626
import { DocumentTransferOwnershipRequest } from '../models/DocumentTransferOwnershipRequest';
27+
import { DocumentUpdateRequest } from '../models/DocumentUpdateRequest';
2728
import { LinkedObjectCreateRequest } from '../models/LinkedObjectCreateRequest';
2829
import { LinkedObjectCreateResponse } from '../models/LinkedObjectCreateResponse';
2930
import { LinkedObjectListResponse } from '../models/LinkedObjectListResponse';
@@ -974,6 +975,66 @@ export class DocumentsApiRequestFactory extends BaseAPIRequestFactory {
974975
return requestContext;
975976
}
976977

978+
/**
979+
* Update Document only in the draft status
980+
* @param id Document ID
981+
* @param documentUpdateRequest
982+
*/
983+
public async updateDocument(id: string, documentUpdateRequest: DocumentUpdateRequest, _options?: Configuration): Promise<RequestContext> {
984+
let _config = _options || this.configuration;
985+
986+
// verify required parameter 'id' is not null or undefined
987+
if (id === null || id === undefined) {
988+
throw new RequiredError("DocumentsApi", "updateDocument", "id");
989+
}
990+
991+
992+
// verify required parameter 'documentUpdateRequest' is not null or undefined
993+
if (documentUpdateRequest === null || documentUpdateRequest === undefined) {
994+
throw new RequiredError("DocumentsApi", "updateDocument", "documentUpdateRequest");
995+
}
996+
997+
998+
// Path Params
999+
const localVarPath = '/public/v1/documents/{id}'
1000+
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
1001+
1002+
// Make Request Context
1003+
const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH);
1004+
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
1005+
1006+
1007+
// Body Params
1008+
const contentType = ObjectSerializer.getPreferredMediaType([
1009+
"application/json"
1010+
]);
1011+
requestContext.setHeaderParam("Content-Type", contentType);
1012+
const serializedBody = ObjectSerializer.stringify(
1013+
ObjectSerializer.serialize(documentUpdateRequest, "DocumentUpdateRequest", ""),
1014+
contentType
1015+
);
1016+
requestContext.setBody(serializedBody);
1017+
1018+
let authMethod: SecurityAuthentication | undefined;
1019+
// Apply auth methods
1020+
authMethod = _config.authMethods["apiKey"]
1021+
if (authMethod?.applySecurityAuthentication) {
1022+
await authMethod?.applySecurityAuthentication(requestContext);
1023+
}
1024+
// Apply auth methods
1025+
authMethod = _config.authMethods["oauth2"]
1026+
if (authMethod?.applySecurityAuthentication) {
1027+
await authMethod?.applySecurityAuthentication(requestContext);
1028+
}
1029+
1030+
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
1031+
if (defaultAuth?.applySecurityAuthentication) {
1032+
await defaultAuth?.applySecurityAuthentication(requestContext);
1033+
}
1034+
1035+
return requestContext;
1036+
}
1037+
9771038
}
9781039

9791040
export class DocumentsApiResponseProcessor {
@@ -1856,4 +1917,64 @@ export class DocumentsApiResponseProcessor {
18561917
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
18571918
}
18581919

1920+
/**
1921+
* Unwraps the actual response sent by the server from the response context and deserializes the response content
1922+
* to the expected objects
1923+
*
1924+
* @params response Response returned by the server for a request to updateDocument
1925+
* @throws ApiException if the response code was not in [200, 299]
1926+
*/
1927+
public async updateDocument(response: ResponseContext): Promise<void > {
1928+
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
1929+
if (isCodeInRange("204", response.httpStatusCode)) {
1930+
return;
1931+
}
1932+
if (isCodeInRange("400", response.httpStatusCode)) {
1933+
const body: any = ObjectSerializer.deserialize(
1934+
ObjectSerializer.parse(await response.body.text(), contentType),
1935+
"any", ""
1936+
) as any;
1937+
throw new ApiException<any>(400, "Bad Request", body, response.headers);
1938+
}
1939+
if (isCodeInRange("401", response.httpStatusCode)) {
1940+
const body: any = ObjectSerializer.deserialize(
1941+
ObjectSerializer.parse(await response.body.text(), contentType),
1942+
"any", ""
1943+
) as any;
1944+
throw new ApiException<any>(401, "Authentication error", body, response.headers);
1945+
}
1946+
if (isCodeInRange("403", response.httpStatusCode)) {
1947+
const body: any = ObjectSerializer.deserialize(
1948+
ObjectSerializer.parse(await response.body.text(), contentType),
1949+
"any", ""
1950+
) as any;
1951+
throw new ApiException<any>(403, "Permission error", body, response.headers);
1952+
}
1953+
if (isCodeInRange("404", response.httpStatusCode)) {
1954+
const body: any = ObjectSerializer.deserialize(
1955+
ObjectSerializer.parse(await response.body.text(), contentType),
1956+
"any", ""
1957+
) as any;
1958+
throw new ApiException<any>(404, "Not found", body, response.headers);
1959+
}
1960+
if (isCodeInRange("429", response.httpStatusCode)) {
1961+
const body: any = ObjectSerializer.deserialize(
1962+
ObjectSerializer.parse(await response.body.text(), contentType),
1963+
"any", ""
1964+
) as any;
1965+
throw new ApiException<any>(429, "Too Many Requests", body, response.headers);
1966+
}
1967+
1968+
// Work around for missing responses in specification, e.g. for petstore.yaml
1969+
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
1970+
const body: void = ObjectSerializer.deserialize(
1971+
ObjectSerializer.parse(await response.body.text(), contentType),
1972+
"void", ""
1973+
) as void;
1974+
return body;
1975+
}
1976+
1977+
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
1978+
}
1979+
18591980
}

src/http/http.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export type RequestBody = undefined | string | FormData | URLSearchParams;
5050
*/
5151
export class RequestContext {
5252
private headers: { [key: string]: string } = {
53-
"User-Agent": "pandadoc_node_client/5.2.0",
53+
"User-Agent": "pandadoc_node_client/5.3.0",
5454
};
5555
private body: RequestBody = undefined;
5656
private url: URLParse;

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ export * from "./apis/exception";
77
export * from "./servers";
88

99
export { PromiseMiddleware as Middleware } from './middleware';
10-
export { APILogsApiDetailsLogRequest, APILogsApiListLogsRequest, ObjectAPILogsApi as APILogsApi, ContactsApiCreateContactRequest, ContactsApiDeleteContactRequest, ContactsApiDetailsContactRequest, ContactsApiListContactsRequest, ContactsApiUpdateContactRequest, ObjectContactsApi as ContactsApi, ContentLibraryItemsApiDetailsContentLibraryItemRequest, ContentLibraryItemsApiListContentLibraryItemsRequest, ObjectContentLibraryItemsApi as ContentLibraryItemsApi, DocumentAttachmentsApiCreateDocumentAttachmentRequest, DocumentAttachmentsApiDeleteDocumentAttachmentRequest, DocumentAttachmentsApiDetailsDocumentAttachmentRequest, DocumentAttachmentsApiDownloadDocumentAttachmentRequest, DocumentAttachmentsApiListDocumentAttachmentsRequest, ObjectDocumentAttachmentsApi as DocumentAttachmentsApi, DocumentsApiChangeDocumentStatusRequest, DocumentsApiCreateDocumentRequest, DocumentsApiCreateDocumentLinkRequest, DocumentsApiCreateLinkedObjectRequest, DocumentsApiDeleteDocumentRequest, DocumentsApiDeleteLinkedObjectRequest, DocumentsApiDetailsDocumentRequest, DocumentsApiDownloadDocumentRequest, DocumentsApiDownloadProtectedDocumentRequest, DocumentsApiListDocumentsRequest, DocumentsApiListLinkedObjectsRequest, DocumentsApiSendDocumentRequest, DocumentsApiStatusDocumentRequest, DocumentsApiTransferAllDocumentsOwnershipRequest, DocumentsApiTransferDocumentOwnershipRequest, ObjectDocumentsApi as DocumentsApi, FoldersAPIApiCreateDocumentFolderRequest, FoldersAPIApiCreateTemplateFolderRequest, FoldersAPIApiListDocumentFoldersRequest, FoldersAPIApiListTemplateFoldersRequest, FoldersAPIApiRenameDocumentFolderRequest, FoldersAPIApiRenameTemplateFolderRequest, ObjectFoldersAPIApi as FoldersAPIApi, FormsApiListFormRequest, ObjectFormsApi as FormsApi, MembersApiDetailsCurrentMemberRequest, MembersApiDetailsMemberRequest, MembersApiListMembersRequest, ObjectMembersApi as MembersApi, OAuth20AuthenticationApiAccessTokenRequest, ObjectOAuth20AuthenticationApi as OAuth20AuthenticationApi, TemplatesApiDeleteTemplateRequest, TemplatesApiDetailsTemplateRequest, TemplatesApiListTemplatesRequest, ObjectTemplatesApi as TemplatesApi, WebhookEventsApiDetailsWebhookEventRequest, WebhookEventsApiListWebhookEventRequest, ObjectWebhookEventsApi as WebhookEventsApi, WebhookSubscriptionsApiCreateWebhookSubscriptionRequest, WebhookSubscriptionsApiDeleteWebhookSubscriptionRequest, WebhookSubscriptionsApiDetailsWebhookSubscriptionRequest, WebhookSubscriptionsApiListWebhookSubscriptionsRequest, WebhookSubscriptionsApiUpdateWebhookSubscriptionRequest, WebhookSubscriptionsApiUpdateWebhookSubscriptionSharedKeyRequest, ObjectWebhookSubscriptionsApi as WebhookSubscriptionsApi } from './types/ObjectParamAPI';
10+
export { APILogsApiDetailsLogRequest, APILogsApiListLogsRequest, ObjectAPILogsApi as APILogsApi, ContactsApiCreateContactRequest, ContactsApiDeleteContactRequest, ContactsApiDetailsContactRequest, ContactsApiListContactsRequest, ContactsApiUpdateContactRequest, ObjectContactsApi as ContactsApi, ContentLibraryItemsApiDetailsContentLibraryItemRequest, ContentLibraryItemsApiListContentLibraryItemsRequest, ObjectContentLibraryItemsApi as ContentLibraryItemsApi, DocumentAttachmentsApiCreateDocumentAttachmentRequest, DocumentAttachmentsApiDeleteDocumentAttachmentRequest, DocumentAttachmentsApiDetailsDocumentAttachmentRequest, DocumentAttachmentsApiDownloadDocumentAttachmentRequest, DocumentAttachmentsApiListDocumentAttachmentsRequest, ObjectDocumentAttachmentsApi as DocumentAttachmentsApi, DocumentsApiChangeDocumentStatusRequest, DocumentsApiCreateDocumentRequest, DocumentsApiCreateDocumentLinkRequest, DocumentsApiCreateLinkedObjectRequest, DocumentsApiDeleteDocumentRequest, DocumentsApiDeleteLinkedObjectRequest, DocumentsApiDetailsDocumentRequest, DocumentsApiDownloadDocumentRequest, DocumentsApiDownloadProtectedDocumentRequest, DocumentsApiListDocumentsRequest, DocumentsApiListLinkedObjectsRequest, DocumentsApiSendDocumentRequest, DocumentsApiStatusDocumentRequest, DocumentsApiTransferAllDocumentsOwnershipRequest, DocumentsApiTransferDocumentOwnershipRequest, DocumentsApiUpdateDocumentRequest, ObjectDocumentsApi as DocumentsApi, FoldersAPIApiCreateDocumentFolderRequest, FoldersAPIApiCreateTemplateFolderRequest, FoldersAPIApiListDocumentFoldersRequest, FoldersAPIApiListTemplateFoldersRequest, FoldersAPIApiRenameDocumentFolderRequest, FoldersAPIApiRenameTemplateFolderRequest, ObjectFoldersAPIApi as FoldersAPIApi, FormsApiListFormRequest, ObjectFormsApi as FormsApi, MembersApiDetailsCurrentMemberRequest, MembersApiDetailsMemberRequest, MembersApiListMembersRequest, ObjectMembersApi as MembersApi, OAuth20AuthenticationApiAccessTokenRequest, ObjectOAuth20AuthenticationApi as OAuth20AuthenticationApi, TemplatesApiDeleteTemplateRequest, TemplatesApiDetailsTemplateRequest, TemplatesApiListTemplatesRequest, ObjectTemplatesApi as TemplatesApi, WebhookEventsApiDetailsWebhookEventRequest, WebhookEventsApiListWebhookEventRequest, ObjectWebhookEventsApi as WebhookEventsApi, WebhookSubscriptionsApiCreateWebhookSubscriptionRequest, WebhookSubscriptionsApiDeleteWebhookSubscriptionRequest, WebhookSubscriptionsApiDetailsWebhookSubscriptionRequest, WebhookSubscriptionsApiListWebhookSubscriptionsRequest, WebhookSubscriptionsApiUpdateWebhookSubscriptionRequest, WebhookSubscriptionsApiUpdateWebhookSubscriptionSharedKeyRequest, ObjectWebhookSubscriptionsApi as WebhookSubscriptionsApi } from './types/ObjectParamAPI';
1111

src/models/DocumentSendRequest.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ export class DocumentSendRequest {
2222
* Disables sent, viewed, comment, and completed email notifications for document recipients and the document sender. By default, notifications emails are sent for specific actions. If set as true, it won't affect the \"Approve document\" email notification sent to the Approver.
2323
*/
2424
'silent'?: boolean;
25+
/**
26+
* You can set a sender of a document as an `email` or `membership_id`
27+
*/
28+
'sender'?: { [key: string]: string; };
2529

2630
static readonly discriminator: string | undefined = undefined;
2731

@@ -43,6 +47,12 @@ export class DocumentSendRequest {
4347
"baseName": "silent",
4448
"type": "boolean",
4549
"format": ""
50+
},
51+
{
52+
"name": "sender",
53+
"baseName": "sender",
54+
"type": "{ [key: string]: string; }",
55+
"format": ""
4656
} ];
4757

4858
static getAttributeTypeMap() {

src/models/ObjectSerializer.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ export * from './DocumentStatusRequestEnum';
4444
export * from './DocumentStatusResponse';
4545
export * from './DocumentTransferAllOwnershipRequest';
4646
export * from './DocumentTransferOwnershipRequest';
47+
export * from './DocumentUpdateRequest';
48+
export * from './DocumentUpdateRequestRecipients';
4749
export * from './DocumentsFolderCreateRequest';
4850
export * from './DocumentsFolderCreateResponse';
4951
export * from './DocumentsFolderListResponse';
@@ -143,6 +145,8 @@ import { DocumentStatusRequestEnum } from './DocumentStatusRequestEnum';
143145
import { DocumentStatusResponse } from './DocumentStatusResponse';
144146
import { DocumentTransferAllOwnershipRequest } from './DocumentTransferAllOwnershipRequest';
145147
import { DocumentTransferOwnershipRequest } from './DocumentTransferOwnershipRequest';
148+
import { DocumentUpdateRequest } from './DocumentUpdateRequest';
149+
import { DocumentUpdateRequestRecipients } from './DocumentUpdateRequestRecipients';
146150
import { DocumentsFolderCreateRequest } from './DocumentsFolderCreateRequest';
147151
import { DocumentsFolderCreateResponse } from './DocumentsFolderCreateResponse';
148152
import { DocumentsFolderListResponse } from './DocumentsFolderListResponse';
@@ -271,6 +275,8 @@ let typeMap: {[index: string]: any} = {
271275
"DocumentStatusResponse": DocumentStatusResponse,
272276
"DocumentTransferAllOwnershipRequest": DocumentTransferAllOwnershipRequest,
273277
"DocumentTransferOwnershipRequest": DocumentTransferOwnershipRequest,
278+
"DocumentUpdateRequest": DocumentUpdateRequest,
279+
"DocumentUpdateRequestRecipients": DocumentUpdateRequestRecipients,
274280
"DocumentsFolderCreateRequest": DocumentsFolderCreateRequest,
275281
"DocumentsFolderCreateResponse": DocumentsFolderCreateResponse,
276282
"DocumentsFolderListResponse": DocumentsFolderListResponse,

0 commit comments

Comments
 (0)