From 48a9632b49d057115e1402877332e6feb5cee951 Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Sat, 25 May 2024 00:02:39 +0000
Subject: [PATCH 01/18] feat(openapi): add new PDF form endpoints
This commit adds three new endpoints to the API related to PDF form field detection, marking, and filling. The new endpoints are `/pdf/form/detect/`, `/pdf/form/mark/`, and `/pdf/form/fill/`. Each endpoint is described with a summary, tags, and a description of its functionality. The request and response schemas are also defined for each endpoint, including the required parameters and the expected responses for success and error cases.
---
openapi.yml | 335 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 335 insertions(+)
diff --git a/openapi.yml b/openapi.yml
index 6ea758b..8eeb8c4 100644
--- a/openapi.yml
+++ b/openapi.yml
@@ -356,6 +356,341 @@ paths:
$ref: '#/components/schemas/def-0'
'500':
description: Internal server error
+ /pdf/form/detect/:
+ post:
+ summary: Detect form fields in a PDF document
+ tags:
+ - PDF
+ - form
+ description: >-
+ Returns a list of form fields detected in the PDF document, along with
+ their location, options and requirements. For a more visual
+ representation, use the /pdf/form/mark endpoint.
+ requestBody:
+ content:
+ multipart/form-data:
+ schema:
+ type: object
+ required:
+ - file
+ properties:
+ options:
+ type: object
+ required: []
+ properties: {}
+ file:
+ type: string
+ format: binary
+ encoding:
+ options:
+ contentType: application/json
+ required: true
+ security:
+ - apiKey: []
+ responses:
+ '200':
+ description: Document fields detected successfully
+ content:
+ application/json:
+ schema:
+ description: Document fields detected successfully
+ type: array
+ items:
+ type: object
+ properties:
+ name:
+ type: string
+ required:
+ type: boolean
+ readOnly:
+ type: boolean
+ locations:
+ type: array
+ items:
+ type: object
+ properties:
+ x:
+ type: number
+ 'y':
+ type: number
+ width:
+ type: number
+ height:
+ type: number
+ required:
+ - x
+ - 'y'
+ - width
+ - height
+ required:
+ - name
+ - type
+ - required
+ - readOnly
+ - locations
+ anyOf:
+ - type: object
+ properties:
+ type:
+ type: string
+ enum:
+ - PDFCheckBox
+ isChecked:
+ type: boolean
+ required:
+ - type
+ - type: object
+ properties:
+ type:
+ type: string
+ enum:
+ - PDFDropdown
+ - PDFOptionList
+ options:
+ type: array
+ items:
+ type: string
+ isMultiselect:
+ type: boolean
+ selected:
+ type: array
+ isEditable:
+ type: boolean
+ required:
+ - type
+ - type: object
+ properties:
+ type:
+ type: string
+ enum:
+ - PDFRadioGroup
+ options:
+ type: array
+ selected:
+ type: string
+ isMutuallyExclusive:
+ type: boolean
+ isOffToggleable:
+ type: boolean
+ required:
+ - type
+ - type: object
+ properties:
+ type:
+ type: string
+ enum:
+ - PDFTextField
+ defaultValue:
+ type: string
+ isPassword:
+ type: boolean
+ isRichFormatted:
+ type: boolean
+ isScrollable:
+ type: boolean
+ isCombed:
+ type: boolean
+ isMultiline:
+ type: boolean
+ isFileSelector:
+ type: boolean
+ maxLength:
+ type: number
+ required:
+ - type
+ '400':
+ description: Bad request
+ content:
+ application/json:
+ schema:
+ description: Bad request
+ $ref: '#/components/schemas/def-0'
+ '401':
+ description: Unauthorized
+ content:
+ application/json:
+ schema:
+ description: Unauthorized
+ $ref: '#/components/schemas/def-0'
+ '500':
+ description: Internal server error
+ /pdf/form/mark/:
+ post:
+ summary: Mark form fields in a PDF document
+ tags:
+ - PDF
+ - form
+ description: >-
+ Returns a modified PDF document with form fields marked with a green
+ border, and hover text showing the field name.
+ requestBody:
+ content:
+ multipart/form-data:
+ schema:
+ type: object
+ required:
+ - file
+ properties:
+ options:
+ type: object
+ required: []
+ properties: {}
+ file:
+ type: string
+ format: binary
+ encoding:
+ options:
+ contentType: application/json
+ required: true
+ security:
+ - apiKey: []
+ responses:
+ '201':
+ description: Marked PDF Document generated successfully
+ content:
+ application/pdf:
+ description: PDF Document
+ schema:
+ type: string
+ format: binary
+ '400':
+ description: Bad request
+ content:
+ application/json:
+ schema:
+ description: Bad request
+ $ref: '#/components/schemas/def-0'
+ '401':
+ description: Unauthorized
+ content:
+ application/json:
+ schema:
+ description: Unauthorized
+ $ref: '#/components/schemas/def-0'
+ '500':
+ description: Internal server error
+ /pdf/form/fill/:
+ post:
+ summary: Fill form fields in a PDF document
+ tags:
+ - PDF
+ - form
+ description: >-
+ Returns a modified PDF document with filled form fields. A subset of
+ fields can be filled.
+ requestBody:
+ content:
+ multipart/form-data:
+ schema:
+ type: object
+ required:
+ - file
+ - options
+ properties:
+ options:
+ type: object
+ required:
+ - fields
+ properties:
+ fields:
+ type: array
+ description: Fields to fill or change in the PDF document.
+ items:
+ type: object
+ required:
+ - name
+ - type
+ properties:
+ name:
+ description: >-
+ Name of the field to fill. This must match an
+ exact name from the PDF document. To detect all
+ fields, use the /pdf/form/fields endpoint, or use
+ the /pdf/form/mark endpoint to get an annotated
+ PDF with each detected field.
+ type: string
+ anyOf:
+ - type: object
+ required:
+ - type
+ - value
+ properties:
+ type:
+ type: string
+ enum:
+ - PDFTextField
+ value:
+ type: string
+ - type: object
+ required:
+ - type
+ - checked
+ properties:
+ type:
+ type: string
+ enum:
+ - PDFCheckBox
+ checked:
+ type: boolean
+ - type: object
+ required:
+ - type
+ - selected
+ properties:
+ type:
+ type: string
+ enum:
+ - PDFOptionList
+ - PDFDropdown
+ selected:
+ type: array
+ items:
+ type: string
+ - type: object
+ required:
+ - type
+ - selected
+ properties:
+ type:
+ type: string
+ enum:
+ - PDFRadioGroup
+ selected:
+ type: string
+ file:
+ type: string
+ format: binary
+ encoding:
+ options:
+ contentType: application/json
+ required: true
+ security:
+ - apiKey: []
+ responses:
+ '201':
+ description: PDF Document filled successfully
+ content:
+ application/pdf:
+ description: PDF Document
+ schema:
+ type: string
+ format: binary
+ '400':
+ description: Bad request
+ content:
+ application/json:
+ schema:
+ description: Bad request
+ $ref: '#/components/schemas/def-0'
+ '401':
+ description: Unauthorized
+ content:
+ application/json:
+ schema:
+ description: Unauthorized
+ $ref: '#/components/schemas/def-0'
+ '500':
+ description: Internal server error
servers:
- url: https://api.fileforge.com
description: Tunnel server
From 5ea97acc52e2a2ef3631fb3f00c5b5356679d329 Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Tue, 28 May 2024 00:02:39 +0000
Subject: [PATCH 02/18] fix(openapi.yml): add keepOriginalStyles property to
preserve text formatting
---
openapi.yml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/openapi.yml b/openapi.yml
index 8eeb8c4..ce5cd4d 100644
--- a/openapi.yml
+++ b/openapi.yml
@@ -137,6 +137,11 @@ paths:
type: object
required: []
properties:
+ keepOriginalStyles:
+ type: boolean
+ description: >-
+ Whether to keep the text formatting of the variables in
+ the document. Default is true.
templateLiterals:
type: object
description: Map of template literals to replace in the document.
From dd4013386ad48cd614409eb35efae9473b1ded90 Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Wed, 29 May 2024 00:03:01 +0000
Subject: [PATCH 03/18] fix(openapi.yml): add basic auth security scheme and
move API key definition down
---
openapi.yml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/openapi.yml b/openapi.yml
index 927bd86..ce5cd4d 100644
--- a/openapi.yml
+++ b/openapi.yml
@@ -5,6 +5,9 @@ info:
version: 0.1.0
components:
securitySchemes:
+ basicAuth:
+ type: http
+ scheme: basic
apiKey:
type: apiKey
name: X-API-Key
From fd8c406d3abdabb4182e934eab5c3eb8838de721 Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Thu, 30 May 2024 00:03:18 +0000
Subject: [PATCH 04/18] fix(openapi): enhance OpenAPI specification for PDF
operations and form handling
---
openapi.yml | 56 ++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 43 insertions(+), 13 deletions(-)
diff --git a/openapi.yml b/openapi.yml
index ce5cd4d..c709cb3 100644
--- a/openapi.yml
+++ b/openapi.yml
@@ -39,11 +39,21 @@ components:
paths:
/status/:
get:
+ operationId: getStatus
+ description: Get the status of the API
responses:
'200':
description: Default Response
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ status:
+ type: string
/pdf/docx/:
post:
+ operationId: convertDOCXtoPDF
summary: Converts a DOC or DOCX document to PDF.
tags:
- PDF
@@ -135,7 +145,6 @@ paths:
document, nor if variables found in the document are not in
the options.
type: object
- required: []
properties:
keepOriginalStyles:
type: boolean
@@ -164,7 +173,6 @@ paths:
description: PDF Document generated successfully
content:
application/pdf:
- description: PDF Document
schema:
type: string
format: binary
@@ -186,12 +194,11 @@ paths:
description: Internal server error
/pdf/generate/:
post:
+ operationId: generatePDFDocument
summary: Generates a PDF document from HTML and web technologies.
tags:
- PDF
- description: |+
- Generates a PDF document from web assets.
-
+ description: Generates a PDF document from web assets.
requestBody:
content:
multipart/form-data:
@@ -204,7 +211,6 @@ paths:
options:
description: Conversion options. This field is required even if empty.
type: object
- required: []
properties:
test:
type: boolean
@@ -264,12 +270,14 @@ paths:
required: true
security:
- apiKey: []
+ x-fern-sdk-group-name:
+ - pdf
+ x-fern-sdk-operation-name: generate
responses:
'201':
description: PDF Document generated successfully
content:
application/pdf:
- description: PDF Document
schema:
type: string
format: binary
@@ -308,6 +316,7 @@ paths:
$ref: '#/components/schemas/def-0'
/pdf/merge/:
post:
+ operationId: mergePDFDocuments
tags:
- PDF
requestBody:
@@ -321,7 +330,6 @@ paths:
properties:
options:
type: object
- required: []
properties: {}
files:
allOf:
@@ -336,12 +344,14 @@ paths:
required: true
security:
- apiKey: []
+ x-fern-sdk-group-name:
+ - pdf
+ x-fern-sdk-operation-name: merge
responses:
'201':
description: PDF Document generated successfully
content:
application/pdf:
- description: PDF Document
schema:
type: string
format: binary
@@ -363,6 +373,7 @@ paths:
description: Internal server error
/pdf/form/detect/:
post:
+ operationId: detectPDFFormFields
summary: Detect form fields in a PDF document
tags:
- PDF
@@ -381,7 +392,6 @@ paths:
properties:
options:
type: object
- required: []
properties: {}
file:
type: string
@@ -392,6 +402,10 @@ paths:
required: true
security:
- apiKey: []
+ x-fern-sdk-group-name:
+ - pdf
+ - form
+ x-fern-sdk-operation-name: detect
responses:
'200':
description: Document fields detected successfully
@@ -459,6 +473,8 @@ paths:
type: boolean
selected:
type: array
+ items:
+ type: string
isEditable:
type: boolean
required:
@@ -471,6 +487,8 @@ paths:
- PDFRadioGroup
options:
type: array
+ items:
+ type: string
selected:
type: string
isMutuallyExclusive:
@@ -521,6 +539,7 @@ paths:
description: Internal server error
/pdf/form/mark/:
post:
+ operationId: markPDFFormFields
summary: Mark form fields in a PDF document
tags:
- PDF
@@ -538,7 +557,6 @@ paths:
properties:
options:
type: object
- required: []
properties: {}
file:
type: string
@@ -549,12 +567,15 @@ paths:
required: true
security:
- apiKey: []
+ x-fern-sdk-group-name:
+ - pdf
+ - form
+ x-fern-sdk-operation-name: mark
responses:
'201':
description: Marked PDF Document generated successfully
content:
application/pdf:
- description: PDF Document
schema:
type: string
format: binary
@@ -576,6 +597,7 @@ paths:
description: Internal server error
/pdf/form/fill/:
post:
+ operationId: fillPDFFormFields
summary: Fill form fields in a PDF document
tags:
- PDF
@@ -671,12 +693,15 @@ paths:
required: true
security:
- apiKey: []
+ x-fern-sdk-group-name:
+ - pdf
+ - form
+ x-fern-sdk-operation-name: fill
responses:
'201':
description: PDF Document filled successfully
content:
application/pdf:
- description: PDF Document
schema:
type: string
format: binary
@@ -701,3 +726,8 @@ servers:
description: Tunnel server
- url: http://localhost:3000
description: Development server
+tags:
+ - name: PDF
+ description: PDF operations
+ - name: form
+ description: PDF form operations
From 56dc34a515c7c6af98f6084f10acc4a9f8b37ebb Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Fri, 31 May 2024 00:04:00 +0000
Subject: [PATCH 05/18] fix(openapi): update API title, description, and
operation metadata
This commit message summarizes the changes in the git diff, which includes updating the title and description of the API, as well as adding and modifying metadata for various operations. The changes are primarily related to fixing and improving the API documentation and operation details.
---
openapi.yml | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/openapi.yml b/openapi.yml
index c709cb3..d6a3748 100644
--- a/openapi.yml
+++ b/openapi.yml
@@ -1,7 +1,7 @@
openapi: 3.0.0
info:
- title: Test swagger
- description: Testing the Fastify swagger API
+ title: FileForge API
+ description: FileForge API for document operations.
version: 0.1.0
components:
securitySchemes:
@@ -41,6 +41,7 @@ paths:
get:
operationId: getStatus
description: Get the status of the API
+ x-fern-availability: generally-available
responses:
'200':
description: Default Response
@@ -168,6 +169,10 @@ paths:
required: true
security:
- apiKey: []
+ x-fern-sdk-group-name:
+ - pdf
+ x-fern-sdk-method-name: fromDocx
+ x-fern-availability: beta
responses:
'201':
description: PDF Document generated successfully
@@ -272,7 +277,8 @@ paths:
- apiKey: []
x-fern-sdk-group-name:
- pdf
- x-fern-sdk-operation-name: generate
+ x-fern-sdk-method-name: generate
+ x-fern-availability: generally-available
responses:
'201':
description: PDF Document generated successfully
@@ -319,6 +325,7 @@ paths:
operationId: mergePDFDocuments
tags:
- PDF
+ description: Merges multiple PDF documents into a single PDF document.
requestBody:
content:
multipart/form-data:
@@ -346,7 +353,8 @@ paths:
- apiKey: []
x-fern-sdk-group-name:
- pdf
- x-fern-sdk-operation-name: merge
+ x-fern-sdk-method-name: merge
+ x-fern-availability: generally-available
responses:
'201':
description: PDF Document generated successfully
@@ -405,7 +413,8 @@ paths:
x-fern-sdk-group-name:
- pdf
- form
- x-fern-sdk-operation-name: detect
+ x-fern-sdk-method-name: detect
+ x-fern-availability: beta
responses:
'200':
description: Document fields detected successfully
@@ -570,7 +579,8 @@ paths:
x-fern-sdk-group-name:
- pdf
- form
- x-fern-sdk-operation-name: mark
+ x-fern-sdk-method-name: mark
+ x-fern-availability: beta
responses:
'201':
description: Marked PDF Document generated successfully
@@ -696,7 +706,8 @@ paths:
x-fern-sdk-group-name:
- pdf
- form
- x-fern-sdk-operation-name: fill
+ x-fern-sdk-method-name: fill
+ x-fern-availability: beta
responses:
'201':
description: PDF Document filled successfully
From c5ba513929a46e1058e46f5fad521108cd38c93d Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Tue, 4 Jun 2024 00:04:06 +0000
Subject: [PATCH 06/18] fix(openapi): remove unnecessary 'options' field from
request body objects
---
openapi.yml | 52 ++++++++++++++++++++++++++++++++++++----------------
1 file changed, 36 insertions(+), 16 deletions(-)
diff --git a/openapi.yml b/openapi.yml
index d6a3748..cbb41cf 100644
--- a/openapi.yml
+++ b/openapi.yml
@@ -98,7 +98,6 @@ paths:
type: object
required:
- file
- - options
properties:
options:
description: >-
@@ -211,7 +210,6 @@ paths:
type: object
required:
- files
- - options
properties:
options:
description: Conversion options. This field is required even if empty.
@@ -333,7 +331,6 @@ paths:
type: object
required:
- files
- - options
properties:
options:
type: object
@@ -622,7 +619,6 @@ paths:
type: object
required:
- file
- - options
properties:
options:
type: object
@@ -634,24 +630,21 @@ paths:
description: Fields to fill or change in the PDF document.
items:
type: object
- required:
- - name
- - type
- properties:
- name:
- description: >-
- Name of the field to fill. This must match an
- exact name from the PDF document. To detect all
- fields, use the /pdf/form/fields endpoint, or use
- the /pdf/form/mark endpoint to get an annotated
- PDF with each detected field.
- type: string
anyOf:
- type: object
required:
+ - name
- type
- value
properties:
+ name:
+ description: >-
+ Name of the field to fill. This must match an
+ exact name from the PDF document. To detect
+ all fields, use the /pdf/form/fields endpoint,
+ or use the /pdf/form/mark endpoint to get an
+ annotated PDF with each detected field.
+ type: string
type:
type: string
enum:
@@ -660,9 +653,18 @@ paths:
type: string
- type: object
required:
+ - name
- type
- checked
properties:
+ name:
+ description: >-
+ Name of the field to fill. This must match an
+ exact name from the PDF document. To detect
+ all fields, use the /pdf/form/fields endpoint,
+ or use the /pdf/form/mark endpoint to get an
+ annotated PDF with each detected field.
+ type: string
type:
type: string
enum:
@@ -671,9 +673,18 @@ paths:
type: boolean
- type: object
required:
+ - name
- type
- selected
properties:
+ name:
+ description: >-
+ Name of the field to fill. This must match an
+ exact name from the PDF document. To detect
+ all fields, use the /pdf/form/fields endpoint,
+ or use the /pdf/form/mark endpoint to get an
+ annotated PDF with each detected field.
+ type: string
type:
type: string
enum:
@@ -685,9 +696,18 @@ paths:
type: string
- type: object
required:
+ - name
- type
- selected
properties:
+ name:
+ description: >-
+ Name of the field to fill. This must match an
+ exact name from the PDF document. To detect
+ all fields, use the /pdf/form/fields endpoint,
+ or use the /pdf/form/mark endpoint to get an
+ annotated PDF with each detected field.
+ type: string
type:
type: string
enum:
From f842da42a0266fea31547e93ea5a4ea3a93bfa2a Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Wed, 5 Jun 2024 00:04:00 +0000
Subject: [PATCH 07/18] docs(openapi): update OpenAPI schema descriptions to
use multiline format
---
openapi.yml | 178 ++++++++++++++++++++++++++++------------------------
1 file changed, 97 insertions(+), 81 deletions(-)
diff --git a/openapi.yml b/openapi.yml
index 99cb842..cbb41cf 100644
--- a/openapi.yml
+++ b/openapi.yml
@@ -31,7 +31,8 @@ components:
example: BAD_REQUEST
message:
type: string
- description: A human-readable message. This field may also provide additional
+ description: >-
+ A human-readable message. This field may also provide additional
context to the error code.
example: Bad request
title: ErrorSchema
@@ -42,7 +43,7 @@ paths:
description: Get the status of the API
x-fern-availability: generally-available
responses:
- "200":
+ '200':
description: Default Response
content:
application/json:
@@ -147,15 +148,18 @@ paths:
properties:
keepOriginalStyles:
type: boolean
- description: Whether to keep the text formatting of the variables in the
- document. Default is true.
+ description: >-
+ Whether to keep the text formatting of the variables in
+ the document. Default is true.
templateLiterals:
type: object
description: Map of template literals to replace in the document.
additionalProperties:
type: string
file:
- description: The Microsoft Word document (.DOCX or .DOC) file to convert to PDF.
+ description: >-
+ The Microsoft Word document (.DOCX or .DOC) file to convert
+ to PDF.
type: string
format: binary
encoding:
@@ -169,28 +173,28 @@ paths:
x-fern-sdk-method-name: fromDocx
x-fern-availability: beta
responses:
- "201":
+ '201':
description: PDF Document generated successfully
content:
application/pdf:
schema:
type: string
format: binary
- "400":
+ '400':
description: Bad request
content:
application/json:
schema:
description: Bad request
- $ref: "#/components/schemas/def-0"
- "401":
+ $ref: '#/components/schemas/def-0'
+ '401':
description: Unauthorized
content:
application/json:
schema:
description: Unauthorized
- $ref: "#/components/schemas/def-0"
- "500":
+ $ref: '#/components/schemas/def-0'
+ '500':
description: Internal server error
/pdf/generate/:
post:
@@ -213,25 +217,30 @@ paths:
properties:
test:
type: boolean
- description: Generate a test document instead of a production document. The
- generated document will contain a watermark. Defaults to
- true.
+ description: >-
+ Generate a test document instead of a production
+ document. The generated document will contain a
+ watermark. Defaults to true.
default: true
host:
type: boolean
- description: If enabled, the document will be hosted by FileForge and a
- presigned URL will be returned.
+ description: >-
+ If enabled, the document will be hosted by FileForge and
+ a presigned URL will be returned.
default: false
expiresAt:
type: string
format: date-time
- description: If host is enabled, the expiration date of the presigned URL.
- Defaults to 7 days from now. Cannot exceed 7 days from
- now.
+ description: >-
+ If host is enabled, the expiration date of the presigned
+ URL. Defaults to 7 days from now. Cannot exceed 7 days
+ from now.
fileName:
type: string
- description: The name of the generated PDF file. Defaults to document. The file
- name should not contain extensions nor path traversals.
+ description: >-
+ The name of the generated PDF file. Defaults to
+ document. The file name should not contain extensions
+ nor path traversals.
default: document
files:
description: >-
@@ -269,7 +278,7 @@ paths:
x-fern-sdk-method-name: generate
x-fern-availability: generally-available
responses:
- "201":
+ '201':
description: PDF Document generated successfully
content:
application/pdf:
@@ -286,29 +295,29 @@ paths:
type: string
format: uri
description: URL to the generated PDF document
- "400":
+ '400':
description: Bad request
content:
application/json:
schema:
description: Bad request
- $ref: "#/components/schemas/def-0"
- "401":
+ $ref: '#/components/schemas/def-0'
+ '401':
description: Unauthorized
content:
application/json:
schema:
description: Unauthorized
- $ref: "#/components/schemas/def-0"
- "500":
+ $ref: '#/components/schemas/def-0'
+ '500':
description: Internal server error
- "502":
+ '502':
description: Bad Gateway
content:
application/json:
schema:
description: Bad Gateway
- $ref: "#/components/schemas/def-0"
+ $ref: '#/components/schemas/def-0'
/pdf/merge/:
post:
operationId: mergePDFDocuments
@@ -344,28 +353,28 @@ paths:
x-fern-sdk-method-name: merge
x-fern-availability: generally-available
responses:
- "201":
+ '201':
description: PDF Document generated successfully
content:
application/pdf:
schema:
type: string
format: binary
- "400":
+ '400':
description: Bad request
content:
application/json:
schema:
description: Bad request
- $ref: "#/components/schemas/def-0"
- "401":
+ $ref: '#/components/schemas/def-0'
+ '401':
description: Unauthorized
content:
application/json:
schema:
description: Unauthorized
- $ref: "#/components/schemas/def-0"
- "500":
+ $ref: '#/components/schemas/def-0'
+ '500':
description: Internal server error
/pdf/form/detect/:
post:
@@ -374,8 +383,9 @@ paths:
tags:
- PDF
- form
- description: Returns a list of form fields detected in the PDF document, along
- with their location, options and requirements. For a more visual
+ description: >-
+ Returns a list of form fields detected in the PDF document, along with
+ their location, options and requirements. For a more visual
representation, use the /pdf/form/mark endpoint.
requestBody:
content:
@@ -403,7 +413,7 @@ paths:
x-fern-sdk-method-name: detect
x-fern-availability: beta
responses:
- "200":
+ '200':
description: Document fields detected successfully
content:
application/json:
@@ -426,7 +436,7 @@ paths:
properties:
x:
type: number
- y:
+ 'y':
type: number
width:
type: number
@@ -434,7 +444,7 @@ paths:
type: number
required:
- x
- - y
+ - 'y'
- width
- height
required:
@@ -517,21 +527,21 @@ paths:
type: number
required:
- type
- "400":
+ '400':
description: Bad request
content:
application/json:
schema:
description: Bad request
- $ref: "#/components/schemas/def-0"
- "401":
+ $ref: '#/components/schemas/def-0'
+ '401':
description: Unauthorized
content:
application/json:
schema:
description: Unauthorized
- $ref: "#/components/schemas/def-0"
- "500":
+ $ref: '#/components/schemas/def-0'
+ '500':
description: Internal server error
/pdf/form/mark/:
post:
@@ -540,8 +550,9 @@ paths:
tags:
- PDF
- form
- description: Returns a modified PDF document with form fields marked with a
- green border, and hover text showing the field name.
+ description: >-
+ Returns a modified PDF document with form fields marked with a green
+ border, and hover text showing the field name.
requestBody:
content:
multipart/form-data:
@@ -568,28 +579,28 @@ paths:
x-fern-sdk-method-name: mark
x-fern-availability: beta
responses:
- "201":
+ '201':
description: Marked PDF Document generated successfully
content:
application/pdf:
schema:
type: string
format: binary
- "400":
+ '400':
description: Bad request
content:
application/json:
schema:
description: Bad request
- $ref: "#/components/schemas/def-0"
- "401":
+ $ref: '#/components/schemas/def-0'
+ '401':
description: Unauthorized
content:
application/json:
schema:
description: Unauthorized
- $ref: "#/components/schemas/def-0"
- "500":
+ $ref: '#/components/schemas/def-0'
+ '500':
description: Internal server error
/pdf/form/fill/:
post:
@@ -598,8 +609,9 @@ paths:
tags:
- PDF
- form
- description: Returns a modified PDF document with filled form fields. A subset
- of fields can be filled.
+ description: >-
+ Returns a modified PDF document with filled form fields. A subset of
+ fields can be filled.
requestBody:
content:
multipart/form-data:
@@ -626,11 +638,12 @@ paths:
- value
properties:
name:
- description: Name of the field to fill. This must match an exact name from the
- PDF document. To detect all fields, use the
- /pdf/form/fields endpoint, or use the
- /pdf/form/mark endpoint to get an annotated
- PDF with each detected field.
+ description: >-
+ Name of the field to fill. This must match an
+ exact name from the PDF document. To detect
+ all fields, use the /pdf/form/fields endpoint,
+ or use the /pdf/form/mark endpoint to get an
+ annotated PDF with each detected field.
type: string
type:
type: string
@@ -645,11 +658,12 @@ paths:
- checked
properties:
name:
- description: Name of the field to fill. This must match an exact name from the
- PDF document. To detect all fields, use the
- /pdf/form/fields endpoint, or use the
- /pdf/form/mark endpoint to get an annotated
- PDF with each detected field.
+ description: >-
+ Name of the field to fill. This must match an
+ exact name from the PDF document. To detect
+ all fields, use the /pdf/form/fields endpoint,
+ or use the /pdf/form/mark endpoint to get an
+ annotated PDF with each detected field.
type: string
type:
type: string
@@ -664,11 +678,12 @@ paths:
- selected
properties:
name:
- description: Name of the field to fill. This must match an exact name from the
- PDF document. To detect all fields, use the
- /pdf/form/fields endpoint, or use the
- /pdf/form/mark endpoint to get an annotated
- PDF with each detected field.
+ description: >-
+ Name of the field to fill. This must match an
+ exact name from the PDF document. To detect
+ all fields, use the /pdf/form/fields endpoint,
+ or use the /pdf/form/mark endpoint to get an
+ annotated PDF with each detected field.
type: string
type:
type: string
@@ -686,11 +701,12 @@ paths:
- selected
properties:
name:
- description: Name of the field to fill. This must match an exact name from the
- PDF document. To detect all fields, use the
- /pdf/form/fields endpoint, or use the
- /pdf/form/mark endpoint to get an annotated
- PDF with each detected field.
+ description: >-
+ Name of the field to fill. This must match an
+ exact name from the PDF document. To detect
+ all fields, use the /pdf/form/fields endpoint,
+ or use the /pdf/form/mark endpoint to get an
+ annotated PDF with each detected field.
type: string
type:
type: string
@@ -713,28 +729,28 @@ paths:
x-fern-sdk-method-name: fill
x-fern-availability: beta
responses:
- "201":
+ '201':
description: PDF Document filled successfully
content:
application/pdf:
schema:
type: string
format: binary
- "400":
+ '400':
description: Bad request
content:
application/json:
schema:
description: Bad request
- $ref: "#/components/schemas/def-0"
- "401":
+ $ref: '#/components/schemas/def-0'
+ '401':
description: Unauthorized
content:
application/json:
schema:
description: Unauthorized
- $ref: "#/components/schemas/def-0"
- "500":
+ $ref: '#/components/schemas/def-0'
+ '500':
description: Internal server error
servers:
- url: https://api.fileforge.com
From 1e7a768b7ba90634bff6f4ec6e55effe77abc4e9 Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Thu, 6 Jun 2024 00:04:17 +0000
Subject: [PATCH 08/18] refdocs(openapi.yml): update FileForge API title and
description
---
openapi.yml | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/openapi.yml b/openapi.yml
index c116368..cbb41cf 100644
--- a/openapi.yml
+++ b/openapi.yml
@@ -1,7 +1,7 @@
openapi: 3.0.0
info:
- title: Fileforge API
- description: Fileforge API for document operations.
+ title: FileForge API
+ description: FileForge API for document operations.
version: 0.1.0
components:
securitySchemes:
@@ -90,7 +90,7 @@ paths:
To enable variable replacement as Word variables for your account,
- please contact the Fileforge support.
+ please contact the FileForge support.
requestBody:
content:
multipart/form-data:
@@ -224,8 +224,9 @@ paths:
default: true
host:
type: boolean
- description: If enabled, the document will be hosted by Fileforge and a
- presigned URL will be returned.
+ description: >-
+ If enabled, the document will be hosted by FileForge and
+ a presigned URL will be returned.
default: false
expiresAt:
type: string
From 4acd73fd7afe5a49838839488f094ccd04851957 Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Sat, 8 Jun 2024 00:04:28 +0000
Subject: [PATCH 09/18] fix(openapi): remove x-fern-examples and update host
description
This commit removes the `x-fern-examples` section from multiple paths in the OpenAPI specification and updates the description of the `host` parameter in the `/pdf/generate/` path to correctly capitalize "FileForge".
---
openapi.yml | 208 +---------------------------------------------------
1 file changed, 1 insertion(+), 207 deletions(-)
diff --git a/openapi.yml b/openapi.yml
index fb69e75..cbb41cf 100644
--- a/openapi.yml
+++ b/openapi.yml
@@ -196,37 +196,6 @@ paths:
$ref: '#/components/schemas/def-0'
'500':
description: Internal server error
- x-fern-examples:
- - response:
- body: null
- code-samples:
- - sdk: typescript
- code: |-
- (async () => {
- const ff = new FileforgeClient({
- apiKey: process.env.FILEFORGE_API_KEY,
- });
-
- try {
- const docxFile = fs.createReadStream(
- __dirname + "/samples/document-simple.docx",
- );
- const pdfStream = await ff.pdf.fromDocx(
- docxFile,
- {},
- {
- timeoutInSeconds: 30,
- },
- );
-
- pdfStream.pipe(fs.createWriteStream("./result_docx.pdf"));
- console.log("PDF conversion successful. Stream ready.");
-
- } catch (error) {
- console.error("Error during PDF conversion:", error);
- throw error;
- }
- })();
/pdf/generate/:
post:
operationId: generatePDFDocument
@@ -256,7 +225,7 @@ paths:
host:
type: boolean
description: >-
- If enabled, the document will be hosted by Fileforge and
+ If enabled, the document will be hosted by FileForge and
a presigned URL will be returned.
default: false
expiresAt:
@@ -349,44 +318,6 @@ paths:
schema:
description: Bad Gateway
$ref: '#/components/schemas/def-0'
- x-fern-examples:
- - response:
- body: null
- code-samples:
- - sdk: typescript
- code: |-
- (async () => {
- const ff = new FileforgeClient({
- apiKey: process.env.FILEFORGE_API_KEY,
- });
-
- try {
- const pdf = await ff.pdf.generate(
- [
- new File(
- ["
Hello world
"],
- "index.html",
- {
- type: "text/html",
- },
- ),
- ],
- {
- options: {
- host: true,
- },
- },
- {
- timeoutInSeconds: 30,
- },
- );
-
- console.log(pdf.url);
- } catch (error) {
- console.error("Error during PDF generation:", error);
- throw error;
- }
- })();
/pdf/merge/:
post:
operationId: mergePDFDocuments
@@ -445,40 +376,6 @@ paths:
$ref: '#/components/schemas/def-0'
'500':
description: Internal server error
- x-fern-examples:
- - response:
- body: null
- code-samples:
- - sdk: typescript
- code: |-
- (async () => {
- const ff = new FileforgeClient({
- apiKey: process.env.FILEFORGE_API_KEY,
- });
-
- try {
- const pdfFiles = [
- fs.createReadStream(__dirname + "/pdf1.pdf"),
- fs.createReadStream(__dirname + "/pdf2.pdf"),
- ];
- const mergedPdfStream = await ff.pdf.merge(
- pdfFiles,
- {
- options: {
- // Specify merge options if any
- },
- },
- {
- timeoutInSeconds: 60,
- },
- );
- mergedPdfStream.pipe(fs.createWriteStream("./result_merge.pdf"));
- console.log("PDF merge successful. Stream ready.");
- } catch (error) {
- console.error("Error during PDF merge:", error);
- throw error;
- }
- })();
/pdf/form/detect/:
post:
operationId: detectPDFFormFields
@@ -646,35 +543,6 @@ paths:
$ref: '#/components/schemas/def-0'
'500':
description: Internal server error
- x-fern-examples:
- - response:
- body: null
- code-samples:
- - sdk: typescript
- code: |-
- (async () => {
- const ff = new FileforgeClient({
- apiKey: process.env.FILEFORGE_API_KEY,
- });
-
- try {
- const resultObject = await ff.pdf.form.detect(
- new File(
- [fs.readFileSync(__dirname + "/samples/form.pdf")],
- "form.pdf",
- {
- type: "application/pdf",
- },
- ),
- { options: {} },
- );
-
- console.log(resultObject);
- } catch (error) {
- console.error("Error during PDF form detect:", error);
- throw error;
- }
- })();
/pdf/form/mark/:
post:
operationId: markPDFFormFields
@@ -734,35 +602,6 @@ paths:
$ref: '#/components/schemas/def-0'
'500':
description: Internal server error
- x-fern-examples:
- - response:
- body: null
- code-samples:
- - sdk: typescript
- code: |-
- (async () => {
- const ff = new FileforgeClient({
- apiKey: process.env.FILEFORGE_API_KEY,
- });
-
- try {
- const pdfStream = await ff.pdf.form.mark(
- new File(
- [fs.readFileSync(__dirname + "/samples/form.pdf")],
- "form.pdf",
- {
- type: "application/pdf",
- },
- ),
- { options: {} },
- );
-
- pdfStream.pipe(fs.createWriteStream("./result_mark.pdf"));
- } catch (error) {
- console.error("Error during PDF form mark:", error);
- throw error;
- }
- })();
/pdf/form/fill/:
post:
operationId: fillPDFFormFields
@@ -913,51 +752,6 @@ paths:
$ref: '#/components/schemas/def-0'
'500':
description: Internal server error
- x-fern-examples:
- - response:
- body: null
- code-samples:
- - sdk: typescript
- code: |-
- (async () => {
- const ff = new FileforgeClient({
- apiKey: process.env.FILEFORGE_API_KEY,
- });
-
- try {
- const formFillRequest = {
- options: {
- fields: [
- {
- name: "Producer Name",
- type: "PDFTextField",
- value: "Titouan Launay",
- } as FormFillRequestOptionsFieldsItemValue,
- ],
- },
- };
- const requestOptions = {
- timeoutInSeconds: 60,
- maxRetries: 3,
- };
- const filledPdfStream = await ff.pdf.form.fill(
- new File(
- [fs.readFileSync(__dirname + "/samples/form.pdf")],
- "form.pdf",
- {
- type: "application/pdf",
- },
- ),
- formFillRequest,
- requestOptions,
- );
-
- filledPdfStream.pipe(fs.createWriteStream("./result_filled.pdf"));
- console.log("PDF form filling successful. Stream ready.");
- } catch (error) {
- console.error("Error during PDF form filling:", error);
- }
- })();
servers:
- url: https://api.fileforge.com
description: Tunnel server
From 50a38348d14833ca6e7f67b1c08edac62c8ed3d4 Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Mon, 10 Jun 2024 00:04:38 +0000
Subject: [PATCH 10/18] chore(openapi): remove x-fern-examples sections from
openapi.yml
This commit removes the `x-fern-examples` sections from the `openapi.yml` file, which contain code samples for various SDK languages.
---
openapi.yml | 224 ----------------------------------------------------
1 file changed, 224 deletions(-)
diff --git a/openapi.yml b/openapi.yml
index 2edf3c2..cbb41cf 100644
--- a/openapi.yml
+++ b/openapi.yml
@@ -196,40 +196,6 @@ paths:
$ref: '#/components/schemas/def-0'
'500':
description: Internal server error
- x-fern-examples:
- - response:
- body: null
- code-samples:
- - sdk: typescript
- code: |-
- import { FileforgeClient } from "@fileforge/client";
- import * as fs from "fs";
-
- (async () => {
- const ff = new FileforgeClient({
- apiKey: process.env.FILEFORGE_API_KEY,
- });
-
- try {
- const docxFile = fs.createReadStream(
- __dirname + "/samples/document-simple.docx",
- );
- const pdfStream = await ff.pdf.fromDocx(
- docxFile,
- {},
- {
- timeoutInSeconds: 30,
- },
- );
-
- pdfStream.pipe(fs.createWriteStream("./result_docx.pdf"));
- console.log("PDF conversion successful. Stream ready.");
-
- } catch (error) {
- console.error("Error during PDF conversion:", error);
- throw error;
- }
- })();
/pdf/generate/:
post:
operationId: generatePDFDocument
@@ -352,47 +318,6 @@ paths:
schema:
description: Bad Gateway
$ref: '#/components/schemas/def-0'
- x-fern-examples:
- - response:
- body: null
- code-samples:
- - sdk: typescript
- code: |-
- import { FileforgeClient } from "@fileforge/client";
- import * as fs from "fs";
-
- (async () => {
- const ff = new FileforgeClient({
- apiKey: process.env.FILEFORGE_API_KEY,
- });
-
- try {
- const pdf = await ff.pdf.generate(
- [
- new File(
- ["Hello world
"],
- "index.html",
- {
- type: "text/html",
- },
- ),
- ],
- {
- options: {
- host: true,
- },
- },
- {
- timeoutInSeconds: 30,
- },
- );
-
- console.log(pdf.url);
- } catch (error) {
- console.error("Error during PDF generation:", error);
- throw error;
- }
- })();
/pdf/merge/:
post:
operationId: mergePDFDocuments
@@ -451,43 +376,6 @@ paths:
$ref: '#/components/schemas/def-0'
'500':
description: Internal server error
- x-fern-examples:
- - response:
- body: null
- code-samples:
- - sdk: typescript
- code: |-
- import { FileforgeClient } from "@fileforge/client";
- import * as fs from "fs";
-
- (async () => {
- const ff = new FileforgeClient({
- apiKey: process.env.FILEFORGE_API_KEY,
- });
-
- try {
- const pdfFiles = [
- fs.createReadStream(__dirname + "/pdf1.pdf"),
- fs.createReadStream(__dirname + "/pdf2.pdf"),
- ];
- const mergedPdfStream = await ff.pdf.merge(
- pdfFiles,
- {
- options: {
- // Specify merge options if any
- },
- },
- {
- timeoutInSeconds: 60,
- },
- );
- mergedPdfStream.pipe(fs.createWriteStream("./result_merge.pdf"));
- console.log("PDF merge successful. Stream ready.");
- } catch (error) {
- console.error("Error during PDF merge:", error);
- throw error;
- }
- })();
/pdf/form/detect/:
post:
operationId: detectPDFFormFields
@@ -655,38 +543,6 @@ paths:
$ref: '#/components/schemas/def-0'
'500':
description: Internal server error
- x-fern-examples:
- - response:
- body: null
- code-samples:
- - sdk: typescript
- code: |-
- import { FileforgeClient } from "@fileforge/client";
- import * as fs from "fs";
-
- (async () => {
- const ff = new FileforgeClient({
- apiKey: process.env.FILEFORGE_API_KEY,
- });
-
- try {
- const resultObject = await ff.pdf.form.detect(
- new File(
- [fs.readFileSync(__dirname + "/samples/form.pdf")],
- "form.pdf",
- {
- type: "application/pdf",
- },
- ),
- { options: {} },
- );
-
- console.log(resultObject);
- } catch (error) {
- console.error("Error during PDF form detect:", error);
- throw error;
- }
- })();
/pdf/form/mark/:
post:
operationId: markPDFFormFields
@@ -746,38 +602,6 @@ paths:
$ref: '#/components/schemas/def-0'
'500':
description: Internal server error
- x-fern-examples:
- - response:
- body: null
- code-samples:
- - sdk: typescript
- code: |-
- import { FileforgeClient } from "@fileforge/client";
- import * as fs from "fs";
-
- (async () => {
- const ff = new FileforgeClient({
- apiKey: process.env.FILEFORGE_API_KEY,
- });
-
- try {
- const pdfStream = await ff.pdf.form.mark(
- new File(
- [fs.readFileSync(__dirname + "/samples/form.pdf")],
- "form.pdf",
- {
- type: "application/pdf",
- },
- ),
- { options: {} },
- );
-
- pdfStream.pipe(fs.createWriteStream("./result_mark.pdf"));
- } catch (error) {
- console.error("Error during PDF form mark:", error);
- throw error;
- }
- })();
/pdf/form/fill/:
post:
operationId: fillPDFFormFields
@@ -928,54 +752,6 @@ paths:
$ref: '#/components/schemas/def-0'
'500':
description: Internal server error
- x-fern-examples:
- - response:
- body: null
- code-samples:
- - sdk: typescript
- code: |-
- import { FileforgeClient } from "@fileforge/client";
- import * as fs from "fs";
-
- (async () => {
- const ff = new FileforgeClient({
- apiKey: process.env.FILEFORGE_API_KEY,
- });
-
- try {
- const formFillRequest = {
- options: {
- fields: [
- {
- name: "Producer Name",
- type: "PDFTextField",
- value: "Titouan Launay",
- } as FormFillRequestOptionsFieldsItemValue,
- ],
- },
- };
- const requestOptions = {
- timeoutInSeconds: 60,
- maxRetries: 3,
- };
- const filledPdfStream = await ff.pdf.form.fill(
- new File(
- [fs.readFileSync(__dirname + "/samples/form.pdf")],
- "form.pdf",
- {
- type: "application/pdf",
- },
- ),
- formFillRequest,
- requestOptions,
- );
-
- filledPdfStream.pipe(fs.createWriteStream("./result_filled.pdf"));
- console.log("PDF form filling successful. Stream ready.");
- } catch (error) {
- console.error("Error during PDF form filling:", error);
- }
- })();
servers:
- url: https://api.fileforge.com
description: Tunnel server
From 39292d38b354630f16fbf2462fea52a27e9ab6f4 Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Tue, 25 Jun 2024 00:01:50 +0000
Subject: [PATCH 11/18] fix(openapi): remove x-fern-examples from openapi.yml
This commit removes the `x-fern-examples` section from the `openapi.yml` file, which includes code samples for various SDKs such as curl and TypeScript.
---
openapi.yml | 389 ----------------------------------------------------
1 file changed, 389 deletions(-)
diff --git a/openapi.yml b/openapi.yml
index acb57db..987f007 100644
--- a/openapi.yml
+++ b/openapi.yml
@@ -196,49 +196,6 @@ paths:
$ref: '#/components/schemas/def-0'
'500':
description: Internal server error
- x-fern-examples:
- - response:
- body: null
- code-samples:
- - sdk: curl
- code: |-
- curl -X 'POST'
- 'https://api.fileforge.com/pdf/docx/'
- -H 'accept: application/pdf'
- -H 'X-API-Key: '
- -H 'Content-Type: multipart/form-data'
- -F 'options={"keepOriginalStyles":true,"templateLiterals":{"additionalProp1":"string","additionalProp2":"string","additionalProp3":"string"}};type=application/json'
- -F 'file=@demo.docx;type=application/vnd.openxmlformats-officedocument.wordprocessingml.document'
- - sdk: typescript
- code: |-
- import { FileforgeClient } from "@fileforge/client";
- import * as fs from "fs";
-
- (async () => {
- const ff = new FileforgeClient({
- apiKey: process.env.FILEFORGE_API_KEY,
- });
-
- try {
- const docxFile = fs.createReadStream(
- __dirname + "/samples/document-simple.docx",
- );
- const pdfStream = await ff.pdf.fromDocx(
- docxFile,
- {},
- {
- timeoutInSeconds: 30,
- },
- );
-
- pdfStream.pipe(fs.createWriteStream("./result_docx.pdf"));
- console.log("PDF conversion successful. Stream ready.");
-
- } catch (error) {
- console.error("Error during PDF conversion:", error);
- throw error;
- }
- })();
/pdf/generate/:
post:
operationId: generatePDFDocument
@@ -361,56 +318,6 @@ paths:
schema:
description: Bad Gateway
$ref: '#/components/schemas/def-0'
- x-fern-examples:
- - response:
- body: null
- code-samples:
- - sdk: curl
- code: |-
- curl -X 'POST'
- 'https://api.fileforge.com/pdf/generate/'
- -H 'accept: application/pdf'
- -H 'X-API-Key: '
- -H 'Content-Type: multipart/form-data'
- -F 'options={"test":true,"host":false,"expiresAt":"2024-06-21T12:10:51.382Z","fileName":"document"};type=application/json'
- -F 'files=@index.html;type=text/html'
- - sdk: typescript
- code: |-
- import { FileforgeClient } from "@fileforge/client";
- import * as fs from "fs";
-
- (async () => {
- const ff = new FileforgeClient({
- apiKey: process.env.FILEFORGE_API_KEY,
- });
-
- try {
- const pdf = await ff.pdf.generate(
- [
- new File(
- ["Hello world
"],
- "index.html",
- {
- type: "text/html",
- },
- ),
- ],
- {
- options: {
- host: true,
- },
- },
- {
- timeoutInSeconds: 30,
- },
- );
-
- console.log(pdf.url);
- } catch (error) {
- console.error("Error during PDF generation:", error);
- throw error;
- }
- })();
/pdf/merge/:
post:
operationId: mergePDFDocuments
@@ -470,53 +377,6 @@ paths:
$ref: '#/components/schemas/def-0'
'500':
description: Internal server error
- x-fern-examples:
- - response:
- body: null
- code-samples:
- - sdk: curl
- code: |-
- curl -X 'POST'
- 'https://api.fileforge.com/pdf/merge/'
- -H 'accept: application/pdf'
- -H 'X-API-Key: '
- -H 'Content-Type: multipart/form-data'
- -F 'options={};type=application/json'
- -F 'files=@doc.pdf;type=application/pdf'
- -F 'files=@document (18).pdf;type=application/pdf'
- - sdk: typescript
- code: |-
- import { FileforgeClient } from "@fileforge/client";
- import * as fs from "fs";
-
- (async () => {
- const ff = new FileforgeClient({
- apiKey: process.env.FILEFORGE_API_KEY,
- });
-
- try {
- const pdfFiles = [
- fs.createReadStream(__dirname + "/pdf1.pdf"),
- fs.createReadStream(__dirname + "/pdf2.pdf"),
- ];
- const mergedPdfStream = await ff.pdf.merge(
- pdfFiles,
- {
- options: {
- // Specify merge options if any
- },
- },
- {
- timeoutInSeconds: 60,
- },
- );
- mergedPdfStream.pipe(fs.createWriteStream("./result_merge.pdf"));
- console.log("PDF merge successful. Stream ready.");
- } catch (error) {
- console.error("Error during PDF merge:", error);
- throw error;
- }
- })();
/pdf/form/detect/:
post:
operationId: detectPDFFormFields
@@ -694,47 +554,6 @@ paths:
$ref: '#/components/schemas/def-0'
'500':
description: Internal server error
- x-fern-examples:
- - response:
- body: null
- code-samples:
- - sdk: curl
- code: |
- curl -X 'POST'
- 'https://api.fileforge.com/pdf/form/detect/'
- -H 'accept: application/json'
- -H 'X-API-Key: '
- -H 'Content-Type: multipart/form-data'
- -F 'options={};type=application/json'
- -F 'file=@document (18).pdf;type=application/pdf'
- - sdk: typescript
- code: |-
- import { FileforgeClient } from "@fileforge/client";
- import * as fs from "fs";
-
- (async () => {
- const ff = new FileforgeClient({
- apiKey: process.env.FILEFORGE_API_KEY,
- });
-
- try {
- const resultObject = await ff.pdf.form.detect(
- new File(
- [fs.readFileSync(__dirname + "/samples/form.pdf")],
- "form.pdf",
- {
- type: "application/pdf",
- },
- ),
- { options: {} },
- );
-
- console.log(resultObject);
- } catch (error) {
- console.error("Error during PDF form detect:", error);
- throw error;
- }
- })();
/pdf/form/mark/:
post:
operationId: markPDFFormFields
@@ -794,47 +613,6 @@ paths:
$ref: '#/components/schemas/def-0'
'500':
description: Internal server error
- x-fern-examples:
- - response:
- body: null
- code-samples:
- - sdk: curl
- code: |-
- curl -X 'POST'
- 'https://api.fileforge.com/pdf/form/mark/'
- -H 'accept: application/pdf'
- -H 'X-API-Key: '
- -H 'Content-Type: multipart/form-data'
- -F 'options={};type=application/json'
- -F 'file=@document (18).pdf;type=application/pdf'
- - sdk: typescript
- code: |-
- import { FileforgeClient } from "@fileforge/client";
- import * as fs from "fs";
-
- (async () => {
- const ff = new FileforgeClient({
- apiKey: process.env.FILEFORGE_API_KEY,
- });
-
- try {
- const pdfStream = await ff.pdf.form.mark(
- new File(
- [fs.readFileSync(__dirname + "/samples/form.pdf")],
- "form.pdf",
- {
- type: "application/pdf",
- },
- ),
- { options: {} },
- );
-
- pdfStream.pipe(fs.createWriteStream("./result_mark.pdf"));
- } catch (error) {
- console.error("Error during PDF form mark:", error);
- throw error;
- }
- })();
/pdf/form/fill/:
post:
operationId: fillPDFFormFields
@@ -985,63 +763,6 @@ paths:
$ref: '#/components/schemas/def-0'
'500':
description: Internal server error
- x-fern-examples:
- - response:
- body: null
- code-samples:
- - sdk: curl
- code: |-
- curl -X 'POST'
- 'https://api.fileforge.com/pdf/form/fill/'
- -H 'accept: application/pdf'
- -H 'X-API-Key: '
- -H 'Content-Type: multipart/form-data'
- -F 'options={"fields":[{"name":"string","type":"PDFTextField","value":"string"},{"name":"string","type":"PDFCheckBox","checked":true},{"name":"string","type":"PDFOptionList","selected":["string"]},{"name":"string","type":"PDFRadioGroup","selected":"string"}]};type=application/json'
- -F 'file=@document (18).pdf;type=application/pdf'
- - sdk: typescript
- code: |-
- import { FileforgeClient } from "@fileforge/client";
- import * as fs from "fs";
-
- (async () => {
- const ff = new FileforgeClient({
- apiKey: process.env.FILEFORGE_API_KEY,
- });
-
- try {
- const formFillRequest = {
- options: {
- fields: [
- {
- name: "Producer Name",
- type: "PDFTextField",
- value: "Titouan Launay",
- } as FormFillRequestOptionsFieldsItemValue,
- ],
- },
- };
- const requestOptions = {
- timeoutInSeconds: 60,
- maxRetries: 3,
- };
- const filledPdfStream = await ff.pdf.form.fill(
- new File(
- [fs.readFileSync(__dirname + "/samples/form.pdf")],
- "form.pdf",
- {
- type: "application/pdf",
- },
- ),
- formFillRequest,
- requestOptions,
- );
-
- filledPdfStream.pipe(fs.createWriteStream("./result_filled.pdf"));
- console.log("PDF form filling successful. Stream ready.");
- } catch (error) {
- console.error("Error during PDF form filling:", error);
- }
- })();
/pdf/split/:
post:
operationId: splitPDFDocuments
@@ -1109,60 +830,6 @@ paths:
$ref: '#/components/schemas/def-0'
'500':
description: Internal server error
- x-fern-examples:
- - response:
- body: null
- code-samples:
- - sdk: curl
- code: |-
- curl -X 'POST'
- 'https://api.fileforge.com/pdf/split/'
- -H 'accept: application/zip'
- -H 'X-API-Key : '
- -H 'Content-Type: multipart/form-data'
- -F 'options={splitPage:1};type=application/json'
- -F 'file=@document (18).pdf;type=application/pdf'
- - sdk: typescript
- code: |-
- import { FileforgeClient } from "@fileforge/client";
- import * as fs from "fs";
-
- (async () => {
- const ff = new FileforgeClient({
- apiKey: process.env.FILEFORGE_API_KEY,
- });
-
- try {
- const splitRequest = {
- options: {
- splitPage: 1,
- },
- };
- const requestOptions = {
- timeoutInSeconds: 60,
- maxRetries: 3,
- };
- const splitArchiveStream = await ff.pdf.split(
- new File(
- [fs.readFileSync(__dirname + "/samples/form.pdf")],
- "form.pdf",
- {
- type: "application/pdf",
- },
- ),
- splitRequest,
- requestOptions,
- );
-
- await pipeline(
- splitArchiveStream,
- fs.createWriteStream("./result_split.zip"),
- );
- console.log("Split successful. Zip Stream ready.");
- } catch (error) {
- console.error("Error during PDF splitting:", error);
- }
- })();
/pdf/extract/:
post:
operationId: extractPDFDocuments
@@ -1234,62 +901,6 @@ paths:
$ref: '#/components/schemas/def-0'
'500':
description: Internal server error
- x-fern-examples:
- - response:
- body: null
- code-samples:
- - sdk: curl
- code: |-
- curl -X 'POST'
- 'https://api.fileforge.com/pdf/extract/'
- -H 'accept: application/json'
- -H 'X-API-Key
- : '
- -H 'Content-Type: multipart/form-data'
- -F 'options={start:1,end:1};type=application/json'
- -F 'file=@document (18).pdf;type=application/pdf'
- - sdk: typescript
- code: |-
- import { FileforgeClient } from "@fileforge/client";
- import * as fs from "fs";
-
- (async () => {
- const ff = new FileforgeClient({
- apiKey: process.env.FILEFORGE_API_KEY,
- });
-
- try {
- const extractRequest = {
- options: {
- start: 1,
- end: 1,
- },
- };
- const requestOptions = {
- timeoutInSeconds: 60,
- maxRetries: 3,
- };
- const extractStream = await ff.pdf.extract(
- new File(
- [fs.readFileSync(__dirname + "/samples/form.pdf")],
- "form.pdf",
- {
- type: "application/pdf",
- },
- ),
- extractRequest,
- requestOptions,
- );
-
- await pipeline(
- extractStream,
- fs.createWriteStream("./result_extract.pdf"),
- );
- console.log("Extraction successful.Stream ready.");
- } catch (error) {
- console.error("Error during PDF extraction:", error);
- }
- })();
servers:
- url: https://api.fileforge.com
description: Tunnel server
From 6bdfd9400c886eee7cec60e0fb52ba39977fcb05 Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Wed, 26 Jun 2024 00:01:49 +0000
Subject: [PATCH 12/18] fix(openapi): change response status codes to strings
and remove examples
This commit message strictly adheres to the Conventional Commits specification, with the type being 'fix' and the description summarizing the changes made in the git diff. The response status codes have been changed from numbers to strings, and the examples for making API requests have been removed.
---
openapi.yml | 272 ++++++++++++----------------------------------------
1 file changed, 59 insertions(+), 213 deletions(-)
diff --git a/openapi.yml b/openapi.yml
index df34b88..b8e7494 100644
--- a/openapi.yml
+++ b/openapi.yml
@@ -43,7 +43,7 @@ paths:
description: Get the status of the API
x-fern-availability: generally-available
responses:
- "200":
+ '200':
description: Default Response
content:
application/json:
@@ -173,28 +173,28 @@ paths:
x-fern-sdk-method-name: fromDocx
x-fern-availability: beta
responses:
- "201":
+ '201':
description: PDF Document generated successfully
content:
application/pdf:
schema:
type: string
format: binary
- "400":
+ '400':
description: Bad request
content:
application/json:
schema:
description: Bad request
- $ref: "#/components/schemas/def-0"
- "401":
+ $ref: '#/components/schemas/def-0'
+ '401':
description: Unauthorized
content:
application/json:
schema:
description: Unauthorized
- $ref: "#/components/schemas/def-0"
- "500":
+ $ref: '#/components/schemas/def-0'
+ '500':
description: Internal server error
/pdf/generate/:
post:
@@ -278,7 +278,7 @@ paths:
x-fern-sdk-method-name: generate
x-fern-availability: generally-available
responses:
- "201":
+ '201':
description: PDF Document generated successfully
content:
application/pdf:
@@ -295,79 +295,29 @@ paths:
type: string
format: uri
description: URL to the generated PDF document
- "400":
+ '400':
description: Bad request
content:
application/json:
schema:
description: Bad request
- $ref: "#/components/schemas/def-0"
- "401":
+ $ref: '#/components/schemas/def-0'
+ '401':
description: Unauthorized
content:
application/json:
schema:
description: Unauthorized
- $ref: "#/components/schemas/def-0"
- "500":
+ $ref: '#/components/schemas/def-0'
+ '500':
description: Internal server error
- "502":
+ '502':
description: Bad Gateway
content:
application/json:
schema:
description: Bad Gateway
- $ref: "#/components/schemas/def-0"
- x-fern-examples:
- - response:
- body: null
- code-samples:
- - sdk: curl
- code: |-
- curl -X 'POST'
- 'https://api.fileforge.com/pdf/generate/'
- -H 'accept: application/pdf'
- -H 'X-API-Key: '
- -H 'Content-Type: multipart/form-data'
- -F 'options={"test":true,"host":false,"expiresAt":"2024-06-21T12:10:51.382Z","fileName":"document"};type=application/json'
- -F 'files=@index.html;type=text/html'
- - sdk: typescript
- code: |-
- import { FileforgeClient } from "@fileforge/client";
- import * as fs from "fs";
-
- (async () => {
- const ff = new FileforgeClient({
- apiKey: process.env.FILEFORGE_API_KEY,
- });
-
- try {
- const pdf = await ff.pdf.generate(
- [
- new File(
- ["Hello world
"],
- "index.html",
- {
- type: "text/html",
- },
- ),
- ],
- {
- options: {
- host: true,
- },
- },
- {
- timeoutInSeconds: 30,
- },
- );
-
- console.log(pdf.url);
- } catch (error) {
- console.error("Error during PDF generation:", error);
- throw error;
- }
- })();
+ $ref: '#/components/schemas/def-0'
/pdf/merge/:
post:
operationId: mergePDFDocuments
@@ -404,28 +354,28 @@ paths:
x-fern-sdk-method-name: merge
x-fern-availability: generally-available
responses:
- "201":
+ '201':
description: PDF Document generated successfully
content:
application/pdf:
schema:
type: string
format: binary
- "400":
+ '400':
description: Bad request
content:
application/json:
schema:
description: Bad request
- $ref: "#/components/schemas/def-0"
- "401":
+ $ref: '#/components/schemas/def-0'
+ '401':
description: Unauthorized
content:
application/json:
schema:
description: Unauthorized
- $ref: "#/components/schemas/def-0"
- "500":
+ $ref: '#/components/schemas/def-0'
+ '500':
description: Internal server error
/pdf/form/detect/:
post:
@@ -464,7 +414,7 @@ paths:
x-fern-sdk-method-name: detect
x-fern-availability: beta
responses:
- "200":
+ '200':
description: Document fields detected successfully
content:
application/json:
@@ -487,7 +437,7 @@ paths:
properties:
x:
type: number
- "y":
+ 'y':
type: number
width:
type: number
@@ -495,7 +445,7 @@ paths:
type: number
required:
- x
- - "y"
+ - 'y'
- width
- height
required:
@@ -588,21 +538,21 @@ paths:
type: string
required:
- type
- "400":
+ '400':
description: Bad request
content:
application/json:
schema:
description: Bad request
- $ref: "#/components/schemas/def-0"
- "401":
+ $ref: '#/components/schemas/def-0'
+ '401':
description: Unauthorized
content:
application/json:
schema:
description: Unauthorized
- $ref: "#/components/schemas/def-0"
- "500":
+ $ref: '#/components/schemas/def-0'
+ '500':
description: Internal server error
/pdf/form/mark/:
post:
@@ -640,28 +590,28 @@ paths:
x-fern-sdk-method-name: mark
x-fern-availability: beta
responses:
- "201":
+ '201':
description: Marked PDF Document generated successfully
content:
application/pdf:
schema:
type: string
format: binary
- "400":
+ '400':
description: Bad request
content:
application/json:
schema:
description: Bad request
- $ref: "#/components/schemas/def-0"
- "401":
+ $ref: '#/components/schemas/def-0'
+ '401':
description: Unauthorized
content:
application/json:
schema:
description: Unauthorized
- $ref: "#/components/schemas/def-0"
- "500":
+ $ref: '#/components/schemas/def-0'
+ '500':
description: Internal server error
/pdf/form/fill/:
post:
@@ -790,28 +740,28 @@ paths:
x-fern-sdk-method-name: fill
x-fern-availability: beta
responses:
- "201":
+ '201':
description: PDF Document filled successfully
content:
application/pdf:
schema:
type: string
format: binary
- "400":
+ '400':
description: Bad request
content:
application/json:
schema:
description: Bad request
- $ref: "#/components/schemas/def-0"
- "401":
+ $ref: '#/components/schemas/def-0'
+ '401':
description: Unauthorized
content:
application/json:
schema:
description: Unauthorized
- $ref: "#/components/schemas/def-0"
- "500":
+ $ref: '#/components/schemas/def-0'
+ '500':
description: Internal server error
/pdf/split/:
post:
@@ -857,28 +807,28 @@ paths:
x-fern-sdk-method-name: split
x-fern-availability: generally-available
responses:
- "201":
+ '201':
description: ZIP file generated successfully
content:
application/zip:
schema:
type: string
format: binary
- "400":
+ '400':
description: Bad request
content:
application/json:
schema:
description: Bad request
- $ref: "#/components/schemas/def-0"
- "401":
+ $ref: '#/components/schemas/def-0'
+ '401':
description: Unauthorized
content:
application/json:
schema:
description: Unauthorized
- $ref: "#/components/schemas/def-0"
- "500":
+ $ref: '#/components/schemas/def-0'
+ '500':
description: Internal server error
/pdf/extract/:
post:
@@ -928,85 +878,29 @@ paths:
x-fern-sdk-method-name: extract
x-fern-availability: generally-available
responses:
- "201":
+ '201':
description: Extracted PDF file generated successfully
content:
application/pdf:
schema:
type: string
format: binary
- "400":
+ '400':
description: Bad request
content:
application/json:
schema:
description: Bad request
- $ref: "#/components/schemas/def-0"
- "401":
+ $ref: '#/components/schemas/def-0'
+ '401':
description: Unauthorized
content:
application/json:
schema:
description: Unauthorized
- $ref: "#/components/schemas/def-0"
- "500":
+ $ref: '#/components/schemas/def-0'
+ '500':
description: Internal server error
- x-fern-examples:
- - response:
- body: null
- code-samples:
- - sdk: curl
- code: |-
- curl -X 'POST'
- 'https://api.fileforge.com/pdf/extract/'
- -H 'accept: application/json'
- -H 'X-API-Key
- : '
- -H 'Content-Type: multipart/form-data'
- -F 'options={start:1,end:1};type=application/json'
- -F 'file=@document (18).pdf;type=application/pdf'
- - sdk: typescript
- code: |-
- import { FileforgeClient } from "@fileforge/client";
- import * as fs from "fs";
-
- (async () => {
- const ff = new FileforgeClient({
- apiKey: process.env.FILEFORGE_API_KEY,
- });
-
- try {
- const extractRequest = {
- options: {
- start: 1,
- end: 1,
- },
- };
- const requestOptions = {
- timeoutInSeconds: 60,
- maxRetries: 3,
- };
- const extractStream = await ff.pdf.extract(
- new File(
- [fs.readFileSync(__dirname + "/samples/form.pdf")],
- "form.pdf",
- {
- type: "application/pdf",
- },
- ),
- extractRequest,
- requestOptions,
- );
-
- await pipeline(
- extractStream,
- fs.createWriteStream("./result_extract.pdf"),
- );
- console.log("Extraction successful.Stream ready.");
- } catch (error) {
- console.error("Error during PDF extraction:", error);
- }
- })();
/pdf/insert/:
post:
operationId: insertPDFDocuments
@@ -1056,77 +950,29 @@ paths:
x-fern-sdk-method-name: insert
x-fern-availability: generally-available
responses:
- "201":
+ '201':
description: PDF file inserted successfully
content:
application/pdf:
schema:
type: string
format: binary
- "400":
+ '400':
description: Bad request
content:
application/json:
schema:
description: Bad request
- $ref: "#/components/schemas/def-0"
- "401":
+ $ref: '#/components/schemas/def-0'
+ '401':
description: Unauthorized
content:
application/json:
schema:
description: Unauthorized
- $ref: "#/components/schemas/def-0"
- "500":
+ $ref: '#/components/schemas/def-0'
+ '500':
description: Internal server error
- x-fern-examples:
- - response:
- body: null
- code-samples:
- - sdk: curl
- code: |-
- curl -X 'POST'
- 'https://api.fileforge.com/pdf/insert/'
- -H 'accept: application/pdf'
- -H 'X-API-Key : '
- -H 'Content-Type: multipart/form-data'
- -F 'options={insertPage:1};type=application/json'
- -F 'files=@doc.pdf;type=application/pdf'
- -F 'files=@document (18).pdf;type=application/pdf'
- - sdk: typescript
- code: |-
- import { FileforgeClient } from "@fileforge/client";
- import * as fs from "fs";
-
- (async () => {
- const ff = new FileforgeClient({
- apiKey: process.env.FILEFORGE_API_KEY,
- });
-
- try {
- const pdfFiles = [
- fs.createReadStream(__dirname + "/pdf1.pdf"),
- fs.createReadStream(__dirname + "/pdf2.pdf"),
- ];
- const insertPDFStream = await ff.pdf.insert(
- pdfFiles,
- {
- options: {
- // Specify insert options if any
- insertPage: 1,
- },
- },
- {
- timeoutInSeconds: 60,
- },
- );
- insertPDFStream.pipe(fs.createWriteStream("./result_insert.pdf"));
- console.log("PDF inserted successfully. Stream ready.");
- } catch (error) {
- console.error("Error during PDF insertion:", error);
- throw error;
- }
- })();
servers:
- url: https://api.fileforge.com
description: Tunnel server
From 5533814f45c8128743cd2f69bdefa8d51aecdb6e Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Thu, 27 Jun 2024 00:01:47 +0000
Subject: [PATCH 13/18] fix(openapi.yml): add flattenForm option to fields
properties
This commit adds a new option `flattenForm` to the fields properties in the openapi.yml file. The `flattenForm` option is a boolean that, when enabled, will flatten the form fields after filling them, making the PDF form uneditable.
---
openapi.yml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/openapi.yml b/openapi.yml
index b8e7494..f655b62 100644
--- a/openapi.yml
+++ b/openapi.yml
@@ -636,6 +636,12 @@ paths:
required:
- fields
properties:
+ flattenForm:
+ type: boolean
+ description: >-
+ Flatten the form fields after filling them. This will
+ make the PDF form uneditable.
+ default: false
fields:
type: array
description: Fields to fill or change in the PDF document.
From f479fd0abdbfc9b7944428dc45297234f45b437d Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Fri, 9 Aug 2024 00:02:39 +0000
Subject: [PATCH 14/18] feat(openapi): add cdn file endpoint and enhance ai
detection in docx to pdf conversion
---
openapi.yml | 126 ++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 113 insertions(+), 13 deletions(-)
diff --git a/openapi.yml b/openapi.yml
index f655b62..7326590 100644
--- a/openapi.yml
+++ b/openapi.yml
@@ -37,21 +37,88 @@ components:
example: Bad request
title: ErrorSchema
paths:
- /status/:
+ /cdn/file/:
get:
- operationId: getStatus
- description: Get the status of the API
- x-fern-availability: generally-available
+ operationId: file
+ summary: Get a file using a presigned URL
+ tags:
+ - CDN
+ description: >-
+ This endpoint is used to get a file using a presigned URL. The presigned
+ URL is generated by the API and should be used to avoid region mismatch.
+ parameters:
+ - schema:
+ type: string
+ in: query
+ name: b
+ required: true
+ description: >-
+ Storage bucket identifier. Note that storage buckets are region
+ specific, so you should be using the presigned URL provided by the
+ API to avoid region mismatch.
+ - schema:
+ type: string
+ in: query
+ name: f
+ required: true
+ description: File path. Pay attention to URL encode the file path if needed.
+ - schema:
+ type: string
+ in: query
+ name: u
+ required: false
+ description: >-
+ Bucket username. This is an automatically generated user when the
+ presigned URL is created.
+ - schema:
+ type: string
+ in: query
+ name: p
+ required: false
+ description: >-
+ Bucket password. This is an automatically generated password when
+ the presigned URL is created.
+ - schema:
+ type: string
+ in: query
+ name: t
+ required: false
+ description: Presigned URL expiration timestamp, in milliseconds
+ - schema:
+ type: string
+ in: query
+ name: s
+ required: true
+ description: Presigned URL signature
+ x-fern-sdk-group-name:
+ - cdn
+ x-fern-sdk-method-name: getFile
+ x-fern-availability: beta
responses:
'200':
- description: Default Response
+ description: The file content
content:
application/json:
schema:
- type: object
- properties:
- status:
- type: string
+ type: string
+ format: binary
+ description: The file content
+ '400':
+ description: Bad request
+ content:
+ application/json:
+ schema:
+ description: Bad request
+ $ref: '#/components/schemas/def-0'
+ '401':
+ description: Unauthorized
+ content:
+ application/json:
+ schema:
+ description: Unauthorized
+ $ref: '#/components/schemas/def-0'
+ '500':
+ description: Internal server error
/pdf/docx/:
post:
operationId: convertDOCXtoPDF
@@ -398,7 +465,15 @@ paths:
properties:
options:
type: object
- properties: {}
+ properties:
+ aiDetection:
+ type: object
+ properties:
+ enable:
+ type: boolean
+ default: false
+ limit:
+ type: number
file:
type: string
format: binary
@@ -430,6 +505,16 @@ paths:
type: boolean
readOnly:
type: boolean
+ aiDetectedName:
+ type: object
+ required:
+ - name
+ - score
+ properties:
+ name:
+ type: string
+ score:
+ type: number
locations:
type: array
items:
@@ -979,11 +1064,26 @@ paths:
$ref: '#/components/schemas/def-0'
'500':
description: Internal server error
+ /status/:
+ get:
+ operationId: getStatus
+ description: Get the status of the API
+ x-fern-availability: generally-available
+ responses:
+ '200':
+ description: Default Response
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ status:
+ type: string
servers:
- url: https://api.fileforge.com
- description: Tunnel server
- - url: http://localhost:3000
- description: Development server
+ description: Global Server
+ - url: https://us-west-1.api.fileforge.com
+ description: Regional Server
tags:
- name: PDF
description: PDF operations
From e16b52674d772189d297d681b79015e2473d65ee Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Tue, 13 Aug 2024 00:02:42 +0000
Subject: [PATCH 15/18] fix(openapi.yml): update host expiration logic and add
application/json response type
This commit message summarizes the changes in the provided git diff. It mentions the update to the host expiration logic, where the expiration date can now exceed 7 days with a monthly fee, and the addition of the 'application/json' response type with the required 'url' property.
---
openapi.yml | 36 +++++++++++++++++++++++++++++++++---
1 file changed, 33 insertions(+), 3 deletions(-)
diff --git a/openapi.yml b/openapi.yml
index 7326590..813be36 100644
--- a/openapi.yml
+++ b/openapi.yml
@@ -300,8 +300,8 @@ paths:
format: date-time
description: >-
If host is enabled, the expiration date of the presigned
- URL. Defaults to 7 days from now. Cannot exceed 7 days
- from now.
+ URL. Defaults to 7 days from now. If more than 7 days,
+ the document will be hosted for a monthly fee.
fileName:
type: string
description: >-
@@ -402,7 +402,27 @@ paths:
properties:
options:
type: object
- properties: {}
+ properties:
+ host:
+ type: boolean
+ description: >-
+ If enabled, the document will be hosted by FileForge and
+ a presigned URL will be returned.
+ default: false
+ expiresAt:
+ type: string
+ format: date-time
+ description: >-
+ If host is enabled, the expiration date of the presigned
+ URL. Defaults to 7 days from now. If more than 7 days,
+ the document will be hosted for a monthly fee.
+ fileName:
+ type: string
+ description: >-
+ The name of the generated PDF file. Defaults to
+ document. The file name should not contain extensions
+ nor path traversals.
+ default: document
files:
allOf:
- {}
@@ -428,6 +448,16 @@ paths:
schema:
type: string
format: binary
+ application/json:
+ schema:
+ type: object
+ required:
+ - url
+ properties:
+ url:
+ type: string
+ format: uri
+ description: URL to the merged PDF document
'400':
description: Bad request
content:
From 06e4ba199a15f485a6b6106a079483cba6f87a8c Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Wed, 14 Aug 2024 00:02:45 +0000
Subject: [PATCH 16/18] chore(openapi): remove deprecated /cdn/file endpoint
from OpenAPI spec
---
openapi.yml | 82 -----------------------------------------------------
1 file changed, 82 deletions(-)
diff --git a/openapi.yml b/openapi.yml
index 813be36..833ed2b 100644
--- a/openapi.yml
+++ b/openapi.yml
@@ -37,88 +37,6 @@ components:
example: Bad request
title: ErrorSchema
paths:
- /cdn/file/:
- get:
- operationId: file
- summary: Get a file using a presigned URL
- tags:
- - CDN
- description: >-
- This endpoint is used to get a file using a presigned URL. The presigned
- URL is generated by the API and should be used to avoid region mismatch.
- parameters:
- - schema:
- type: string
- in: query
- name: b
- required: true
- description: >-
- Storage bucket identifier. Note that storage buckets are region
- specific, so you should be using the presigned URL provided by the
- API to avoid region mismatch.
- - schema:
- type: string
- in: query
- name: f
- required: true
- description: File path. Pay attention to URL encode the file path if needed.
- - schema:
- type: string
- in: query
- name: u
- required: false
- description: >-
- Bucket username. This is an automatically generated user when the
- presigned URL is created.
- - schema:
- type: string
- in: query
- name: p
- required: false
- description: >-
- Bucket password. This is an automatically generated password when
- the presigned URL is created.
- - schema:
- type: string
- in: query
- name: t
- required: false
- description: Presigned URL expiration timestamp, in milliseconds
- - schema:
- type: string
- in: query
- name: s
- required: true
- description: Presigned URL signature
- x-fern-sdk-group-name:
- - cdn
- x-fern-sdk-method-name: getFile
- x-fern-availability: beta
- responses:
- '200':
- description: The file content
- content:
- application/json:
- schema:
- type: string
- format: binary
- description: The file content
- '400':
- description: Bad request
- content:
- application/json:
- schema:
- description: Bad request
- $ref: '#/components/schemas/def-0'
- '401':
- description: Unauthorized
- content:
- application/json:
- schema:
- description: Unauthorized
- $ref: '#/components/schemas/def-0'
- '500':
- description: Internal server error
/pdf/docx/:
post:
operationId: convertDOCXtoPDF
From f6fe8249025d57b5c52a6e8c5e467d3547a006bc Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Mon, 2 Sep 2024 00:02:43 +0000
Subject: [PATCH 17/18] fix(openapi.yml): Add allowViewing boolean to specify
if documents are viewable by default
---
openapi.yml | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/openapi.yml b/openapi.yml
index 833ed2b..1e8b265 100644
--- a/openapi.yml
+++ b/openapi.yml
@@ -227,6 +227,13 @@ paths:
document. The file name should not contain extensions
nor path traversals.
default: document
+ allowViewing:
+ type: boolean
+ description: >-
+ If enabled, the document will be viewable in the web
+ app. Defaults to false. This may go against the privacy
+ policy of your application.
+ default: false
files:
description: >-
Files to generate the PDF document from.
@@ -341,6 +348,13 @@ paths:
document. The file name should not contain extensions
nor path traversals.
default: document
+ allowViewing:
+ type: boolean
+ description: >-
+ If enabled, the document will be viewable in the web
+ app. Defaults to false. This may go against the privacy
+ policy of your application.
+ default: false
files:
allOf:
- {}
From f433293208098efc32cab154bebdb42598bcb3fb Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Sat, 7 Sep 2024 00:02:52 +0000
Subject: [PATCH 18/18] chore(openapi): update OpenAPI schema descriptions
---
openapi.yml | 194 +++++++++++++++++++++++++++-------------------------
1 file changed, 100 insertions(+), 94 deletions(-)
diff --git a/openapi.yml b/openapi.yml
index 79b4a4a..1e8b265 100644
--- a/openapi.yml
+++ b/openapi.yml
@@ -31,7 +31,7 @@ components:
example: BAD_REQUEST
message:
type: string
- description:
+ description: >-
A human-readable message. This field may also provide additional
context to the error code.
example: Bad request
@@ -133,16 +133,18 @@ paths:
properties:
keepOriginalStyles:
type: boolean
- description:
- Whether to keep the text formatting of the variables in the
- document. Default is true.
+ description: >-
+ Whether to keep the text formatting of the variables in
+ the document. Default is true.
templateLiterals:
type: object
description: Map of template literals to replace in the document.
additionalProperties:
type: string
file:
- description: The Microsoft Word document (.DOCX or .DOC) file to convert to PDF.
+ description: >-
+ The Microsoft Word document (.DOCX or .DOC) file to convert
+ to PDF.
type: string
format: binary
encoding:
@@ -200,36 +202,37 @@ paths:
properties:
test:
type: boolean
- description:
- Generate a test document instead of a production document. The
- generated document will contain a watermark. Defaults to
- true.
+ description: >-
+ Generate a test document instead of a production
+ document. The generated document will contain a
+ watermark. Defaults to true.
default: true
host:
type: boolean
- description:
- If enabled, the document will be hosted by FileForge and a
- presigned URL will be returned.
+ description: >-
+ If enabled, the document will be hosted by FileForge and
+ a presigned URL will be returned.
default: false
expiresAt:
type: string
format: date-time
- description:
- If host is enabled, the expiration date of the presigned URL.
- Defaults to 7 days from now. If more than 7 days, the
- document will be hosted for a monthly fee.
+ description: >-
+ If host is enabled, the expiration date of the presigned
+ URL. Defaults to 7 days from now. If more than 7 days,
+ the document will be hosted for a monthly fee.
fileName:
type: string
- description:
- The name of the generated PDF file. Defaults to document. The file
- name should not contain extensions nor path traversals.
+ description: >-
+ The name of the generated PDF file. Defaults to
+ document. The file name should not contain extensions
+ nor path traversals.
default: document
allowViewing:
type: boolean
- description:
- If enabled, the document will be viewable in the web app. Defaults
- to false. This may go against the privacy policy of your
- application.
+ description: >-
+ If enabled, the document will be viewable in the web
+ app. Defaults to false. This may go against the privacy
+ policy of your application.
default: false
files:
description: >-
@@ -306,7 +309,7 @@ paths:
application/json:
schema:
description: Bad Gateway
- $ref: "#/components/schemas/def-0"
+ $ref: '#/components/schemas/def-0'
/pdf/merge/:
post:
operationId: mergePDFDocuments
@@ -327,29 +330,30 @@ paths:
properties:
host:
type: boolean
- description:
- If enabled, the document will be hosted by FileForge and a
- presigned URL will be returned.
+ description: >-
+ If enabled, the document will be hosted by FileForge and
+ a presigned URL will be returned.
default: false
expiresAt:
type: string
format: date-time
- description:
- If host is enabled, the expiration date of the presigned URL.
- Defaults to 7 days from now. If more than 7 days, the
- document will be hosted for a monthly fee.
+ description: >-
+ If host is enabled, the expiration date of the presigned
+ URL. Defaults to 7 days from now. If more than 7 days,
+ the document will be hosted for a monthly fee.
fileName:
type: string
- description:
- The name of the generated PDF file. Defaults to document. The file
- name should not contain extensions nor path traversals.
+ description: >-
+ The name of the generated PDF file. Defaults to
+ document. The file name should not contain extensions
+ nor path traversals.
default: document
allowViewing:
type: boolean
- description:
- If enabled, the document will be viewable in the web app. Defaults
- to false. This may go against the privacy policy of your
- application.
+ description: >-
+ If enabled, the document will be viewable in the web
+ app. Defaults to false. This may go against the privacy
+ policy of your application.
default: false
files:
allOf:
@@ -386,7 +390,7 @@ paths:
type: string
format: uri
description: URL to the merged PDF document
- "400":
+ '400':
description: Bad request
content:
application/json:
@@ -409,9 +413,9 @@ paths:
tags:
- PDF
- form
- description:
- Returns a list of form fields detected in the PDF document, along
- with their location, options and requirements. For a more visual
+ description: >-
+ Returns a list of form fields detected in the PDF document, along with
+ their location, options and requirements. For a more visual
representation, use the /pdf/form/mark endpoint.
requestBody:
content:
@@ -480,7 +484,7 @@ paths:
properties:
x:
type: number
- y:
+ 'y':
type: number
width:
type: number
@@ -488,7 +492,7 @@ paths:
type: number
required:
- x
- - y
+ - 'y'
- width
- height
required:
@@ -604,9 +608,9 @@ paths:
tags:
- PDF
- form
- description:
- Returns a modified PDF document with form fields marked with a
- green border, and hover text showing the field name.
+ description: >-
+ Returns a modified PDF document with form fields marked with a green
+ border, and hover text showing the field name.
requestBody:
content:
multipart/form-data:
@@ -663,9 +667,9 @@ paths:
tags:
- PDF
- form
- description:
- Returns a modified PDF document with filled form fields. A subset
- of fields can be filled.
+ description: >-
+ Returns a modified PDF document with filled form fields. A subset of
+ fields can be filled.
requestBody:
content:
multipart/form-data:
@@ -681,9 +685,9 @@ paths:
properties:
flattenForm:
type: boolean
- description:
- Flatten the form fields after filling them. This will make the PDF
- form uneditable.
+ description: >-
+ Flatten the form fields after filling them. This will
+ make the PDF form uneditable.
default: false
fields:
type: array
@@ -698,12 +702,12 @@ paths:
- value
properties:
name:
- description:
- Name of the field to fill. This must match an exact name from the
- PDF document. To detect all fields, use the
- /pdf/form/fields endpoint, or use the
- /pdf/form/mark endpoint to get an annotated
- PDF with each detected field.
+ description: >-
+ Name of the field to fill. This must match an
+ exact name from the PDF document. To detect
+ all fields, use the /pdf/form/fields endpoint,
+ or use the /pdf/form/mark endpoint to get an
+ annotated PDF with each detected field.
type: string
type:
type: string
@@ -718,12 +722,12 @@ paths:
- checked
properties:
name:
- description:
- Name of the field to fill. This must match an exact name from the
- PDF document. To detect all fields, use the
- /pdf/form/fields endpoint, or use the
- /pdf/form/mark endpoint to get an annotated
- PDF with each detected field.
+ description: >-
+ Name of the field to fill. This must match an
+ exact name from the PDF document. To detect
+ all fields, use the /pdf/form/fields endpoint,
+ or use the /pdf/form/mark endpoint to get an
+ annotated PDF with each detected field.
type: string
type:
type: string
@@ -738,12 +742,12 @@ paths:
- selected
properties:
name:
- description:
- Name of the field to fill. This must match an exact name from the
- PDF document. To detect all fields, use the
- /pdf/form/fields endpoint, or use the
- /pdf/form/mark endpoint to get an annotated
- PDF with each detected field.
+ description: >-
+ Name of the field to fill. This must match an
+ exact name from the PDF document. To detect
+ all fields, use the /pdf/form/fields endpoint,
+ or use the /pdf/form/mark endpoint to get an
+ annotated PDF with each detected field.
type: string
type:
type: string
@@ -761,12 +765,12 @@ paths:
- selected
properties:
name:
- description:
- Name of the field to fill. This must match an exact name from the
- PDF document. To detect all fields, use the
- /pdf/form/fields endpoint, or use the
- /pdf/form/mark endpoint to get an annotated
- PDF with each detected field.
+ description: >-
+ Name of the field to fill. This must match an
+ exact name from the PDF document. To detect
+ all fields, use the /pdf/form/fields endpoint,
+ or use the /pdf/form/mark endpoint to get an
+ annotated PDF with each detected field.
type: string
type:
type: string
@@ -818,7 +822,7 @@ paths:
summary: Splits a PDF document into 2 PDF documents.
tags:
- PDF
- description:
+ description: >-
Splits a PDF document into 2 PDF documents. Returns a zip file
containing the 2 documents. Each document is named after the original
document with a suffix added to indicate the range of pages it contains.
@@ -839,9 +843,9 @@ paths:
splitPage:
type: integer
minimum: 1
- description:
- The page number to split the document at (the page will be included
- in the first document)
+ description: >-
+ The page number to split the document at (the page will
+ be included in the first document)
file:
type: string
format: binary
@@ -885,11 +889,11 @@ paths:
summary: Extract a range of pages from a PDF document.
tags:
- PDF
- description:
- Extracts a range of pages from a PDF document. The start and end
- pages are included in the extracted document. The extracted document is
- named after the original document with a suffix added to indicate the
- range of pages it contains (ex:document\_extracted\_\$start\_\$end.pdf).
+ description: >-
+ Extracts a range of pages from a PDF document. The start and end pages
+ are included in the extracted document. The extracted document is named
+ after the original document with a suffix added to indicate the range of
+ pages it contains (ex:document\_extracted\_\$start\_\$end.pdf).
requestBody:
content:
multipart/form-data:
@@ -956,13 +960,13 @@ paths:
summary: Insert a PDF document into another PDF document at a specified page.
tags:
- PDF
- description:
- "Insert a PDF document into another PDF document at a specified
- page. The inserted document is named after the original document with a
- suffix added to indicate the range of pages it contains
- (ex:document\\_inserted\\_\\$insertPage\\_\\$document2.pdf). Note: The
- first document is the parent document and the second document is the
- document to be inserted."
+ description: >-
+ Insert a PDF document into another PDF document at a specified page. The
+ inserted document is named after the original document with a suffix
+ added to indicate the range of pages it contains
+ (ex:document\_inserted\_\$insertPage\_\$document2.pdf). Note: The first
+ document is the parent document and the second document is the document
+ to be inserted.
requestBody:
content:
multipart/form-data:
@@ -1028,7 +1032,7 @@ paths:
description: Get the status of the API
x-fern-availability: generally-available
responses:
- "200":
+ '200':
description: Default Response
content:
application/json:
@@ -1040,6 +1044,8 @@ paths:
servers:
- url: https://api.fileforge.com
description: Global Server
+ - url: https://us-west-1.api.fileforge.com
+ description: Regional Server
tags:
- name: PDF
description: PDF operations