Skip to content

Commit

Permalink
Merge pull request #27 from OnedocLabs/upload-extract-split-docs
Browse files Browse the repository at this point in the history
minore updates
  • Loading branch information
Titou325 authored Jun 24, 2024
2 parents 73fe3f6 + 62e9a00 commit c8ae1e1
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 63 deletions.
2 changes: 1 addition & 1 deletion fern/sdk
Submodule sdk updated from 281993 to 4e9cc2
123 changes: 61 additions & 62 deletions openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ paths:
description: Get the status of the API
x-fern-availability: generally-available
responses:
"200":
'200':
description: Default Response
content:
application/json:
Expand Down Expand Up @@ -170,28 +170,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
x-fern-examples:
- response:
Expand Down Expand Up @@ -318,7 +318,7 @@ paths:
x-fern-sdk-method-name: generate
x-fern-availability: generally-available
responses:
"201":
'201':
description: PDF Document generated successfully
content:
application/pdf:
Expand All @@ -335,29 +335,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'
x-fern-examples:
- response:
body: null
Expand Down Expand Up @@ -444,28 +444,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
x-fern-examples:
- response:
Expand Down Expand Up @@ -551,7 +551,7 @@ paths:
x-fern-sdk-method-name: detect
x-fern-availability: beta
responses:
"200":
'200':
description: Document fields detected successfully
content:
application/json:
Expand All @@ -574,15 +574,15 @@ paths:
properties:
x:
type: number
"y":
'y':
type: number
width:
type: number
height:
type: number
required:
- x
- "y"
- 'y'
- width
- height
required:
Expand Down Expand Up @@ -675,21 +675,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
x-fern-examples:
- response:
Expand Down Expand Up @@ -768,28 +768,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
x-fern-examples:
- response:
Expand Down Expand Up @@ -959,28 +959,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
x-fern-examples:
- response:
Expand Down Expand Up @@ -1083,28 +1083,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
x-fern-examples:
- response:
Expand All @@ -1130,31 +1130,30 @@ paths:
});
try {
const extractRequest = {
const splitRequest = {
options: {
start: 1,
end: 1,
splitPage: 1,
},
};
const requestOptions = {
timeoutInSeconds: 60,
maxRetries: 3,
};
const extractStream = await ff.pdf.extract(
const splitArchiveStream = await ff.pdf.split(
new File(
[fs.readFileSync(__dirname + "/samples/form.pdf")],
"form.pdf",
{
type: "application/pdf",
},
),
extractRequest,
splitRequest,
requestOptions,
);
await pipeline(
extractStream,
fs.createWriteStream("./result_extract.pdf"),
splitArchiveStream,
fs.createWriteStream("./result_split.zip"),
);
console.log("Split successful. Zip Stream ready.");
} catch (error) {
Expand Down Expand Up @@ -1209,28 +1208,28 @@ 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:
Expand Down Expand Up @@ -1283,9 +1282,9 @@ paths:
extractStream,
fs.createWriteStream("./result_extract.pdf"),
);
console.log("Split successful. Zip Stream ready.");
console.log("Extraction successful.Stream ready.");
} catch (error) {
console.error("Error during PDF splitting:", error);
console.error("Error during PDF extraction:", error);
}
})();
servers:
Expand Down

0 comments on commit c8ae1e1

Please sign in to comment.