@anvilco/anvil
Advanced tools
Comparing version 2.12.0 to 2.13.0
@@ -10,6 +10,17 @@ # Changelog | ||
## [v2.12.0](https://github.com/anvilco/node-anvil/compare/v2.11.1...v2.12.0) | ||
## [v2.13.0](https://github.com/anvilco/node-anvil/compare/v2.12.0...v2.13.0) | ||
### Merged | ||
- Updated types [`#180`](https://github.com/anvilco/node-anvil/pull/180) | ||
- Add `versionNumber` support for fillPDF [`#179`](https://github.com/anvilco/node-anvil/pull/179) | ||
### Commits | ||
- Add VERSION_LATEST_PUBLISHED, documentation [`ffa8ab7`](https://github.com/anvilco/node-anvil/commit/ffa8ab70ae9dad186a5989d5d2a9829aa7b3cd25) | ||
## [v2.12.0](https://github.com/anvilco/node-anvil/compare/v2.11.1...v2.12.0) - 2022-07-14 | ||
### Merged | ||
- Improve TypeScript types [`#153`](https://github.com/anvilco/node-anvil/pull/153) | ||
@@ -16,0 +27,0 @@ |
{ | ||
"name": "@anvilco/anvil", | ||
"version": "2.12.0", | ||
"version": "2.13.0", | ||
"description": "Anvil API Client", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -52,2 +52,11 @@ ![Horizontal Lockupblack](https://user-images.githubusercontent.com/293079/169453889-ae211c6c-7634-4ccd-8ca9-8970c2621b6f.png#gh-light-mode-only) | ||
// A version number can also be passed in. This will retrieve a specific | ||
// version of the PDF to be filled if you don't want the current version | ||
// to be used. | ||
// You can also use the constant `Anvil.VERSION_LATEST` to fill a PDF that has not | ||
// been published yet. Use this if you'd like to fill out a draft version of | ||
// your template/PDF. | ||
const options = { versionNumber: Anvil.VERSION_LATEST } | ||
const { statusCode, data } = await anvilClient.fillPDF(pdfTemplateID, exampleData, options) | ||
console.log(statusCode) // => 200 | ||
@@ -54,0 +63,0 @@ |
@@ -100,2 +100,8 @@ const fs = require('fs') | ||
// Version number to use for latest versions (usually drafts) | ||
const VERSION_LATEST = -1 | ||
// Version number to use for the latest published version. | ||
// This is the default when a version is not provided. | ||
const VERSION_LATEST_PUBLISHED = -2 | ||
const defaultOptions = { | ||
@@ -261,4 +267,9 @@ baseURL: 'https://app.useanvil.com', | ||
const versionNumber = clientOptions?.versionNumber | ||
const url = versionNumber | ||
? `/api/v1/fill/${pdfTemplateID}.pdf?versionNumber=${versionNumber}` | ||
: `/api/v1/fill/${pdfTemplateID}.pdf` | ||
return this.requestREST( | ||
`/api/v1/fill/${pdfTemplateID}.pdf`, | ||
url, | ||
{ | ||
@@ -718,2 +729,5 @@ method: 'POST', | ||
Anvil.VERSION_LATEST = VERSION_LATEST | ||
Anvil.VERSION_LATEST_PUBLISHED = VERSION_LATEST_PUBLISHED | ||
module.exports = Anvil |
@@ -181,3 +181,3 @@ export = Anvil; | ||
declare namespace Anvil { | ||
export { UploadWithOptions, AnvilOptions, GraphQLResponse, GraphQLResponseData, RESTResponse, ResponseError, ResponseErrorField }; | ||
export { UploadWithOptions, VERSION_LATEST, VERSION_LATEST_PUBLISHED, AnvilOptions, GraphQLResponse, GraphQLResponseData, RESTResponse, ResponseError, ResponseErrorField }; | ||
} | ||
@@ -215,2 +215,4 @@ import { RateLimiter } from "limiter/dist/cjs/RateLimiter"; | ||
}; | ||
declare const VERSION_LATEST: -1; | ||
declare const VERSION_LATEST_PUBLISHED: -2; | ||
type GraphQLResponseData = { | ||
@@ -217,0 +219,0 @@ data: { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
416281
52
1201
422