Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Removed

- **[BREAKING]** `OneBlinkUploader.uploadPDFConversion()`

### Added

- `pdfConversionId` and `pdfConversionJobId` to `OneBlinkUploader.uploadPDFConversion()` result
Expand Down
43 changes: 2 additions & 41 deletions src/OneBlinkUploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
UploadFormSubmissionOptions,
UploadOptions,
UploadEmailAttachmentOptions,
UploadPDFConversionOptions,
UploadCustomPDFOptions,
UploadAiBuilderAttachmentOptions,
} from './types.js'
import { SubmissionTypes } from '@oneblink/types'
Expand Down Expand Up @@ -506,45 +506,6 @@ export default class OneBlinkUploader {
})
}

/**
* Upload a PDF for conversion. PDF Conversions are always private.
*
* #### Example
*
* ```ts
* const abortController = new AbortController()
* const result = await uploader.uploadPDFConversion({
* onProgress: (progress) => {
* // ...
* },
* data: pdfData,
* formId: 1,
* abortSignal: abortController.signal,
* })
* ```
*
* @param data The PDF data and options
* @returns The upload result
*/
async uploadPDFConversion({
onProgress,
abortSignal,
data,
formId,
}: UploadPDFConversionOptions) {
return await uploadToS3<{
pdfConversionId: string
pdfConversionJobId: number
}>({
...this,
contentType: 'application/pdf',
body: data,
key: `forms/${formId}/pdf-conversion`,
abortSignal,
onProgress,
})
}

/**
* Upload an attachment for use with the AI builder.
*
Expand Down Expand Up @@ -612,7 +573,7 @@ export default class OneBlinkUploader {
abortSignal,
data,
formId,
}: UploadPDFConversionOptions) {
}: UploadCustomPDFOptions) {
return await uploadToS3({
...this,
contentType: 'application/pdf',
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export type UploadAssetOptions = UploadOptions & {
fileName: string
}

export type UploadPDFConversionOptions = UploadOptions & {
export type UploadCustomPDFOptions = UploadOptions & {
/** The PDF File to upload */
data: AttachmentUploadData
/** The id of the Form that the PDF Conversion is occurring on */
Expand Down