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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ management:
docVersion: 0.0.0
speakeasyVersion: 1.469.10
generationVersion: 2.493.31
releaseVersion: 0.1.1
configChecksum: e5e857e20b1a8ded6ae8e626c09aa97d
releaseVersion: 0.1.2
configChecksum: b9cc53548e6012078ebb6189b18868ed
repoURL: https://github.com/documenso/sdk-typescript.git
installationURL: https://github.com/documenso/sdk-typescript
published: true
features:
typescript:
additionalDependencies: 0.1.0
constsAndDefaults: 0.1.11
core: 3.18.16
defaultEnabledRetries: 0.1.0
devContainers: 2.90.0
enumUnions: 0.1.0
envVarSecurityUsage: 0.1.2
globalSecurity: 2.82.12
Expand All @@ -29,9 +30,6 @@ features:
sdkHooks: 0.2.0
unions: 2.85.8
generatedFiles:
- .devcontainer/README.md
- .devcontainer/devcontainer.json
- .devcontainer/setup.sh
- .eslintrc.cjs
- .gitattributes
- .npmignore
Expand Down
4 changes: 2 additions & 2 deletions .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ generation:
oAuth2ClientCredentialsEnabled: true
oAuth2PasswordEnabled: true
typescript:
version: 0.1.1
version: 0.1.2
additionalDependencies:
dependencies: {}
devDependencies: {}
Expand Down Expand Up @@ -41,7 +41,7 @@ typescript:
methodArguments: require-security-and-request
moduleFormat: commonjs
outputModelSuffix: output
packageName: "@documenso/sdk-typescript"
packageName: '@documenso/sdk-typescript'
responseFormat: flat
templateVersion: v2
useIndexModules: true
7 changes: 4 additions & 3 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@ speakeasyVersion: 1.469.10
sources:
Documenso v2 beta API:
sourceNamespace: documenso-v-2-beta-api
sourceRevisionDigest: sha256:95ffeb1aa479735642965b97f50f53ca294a5fa116f6a7ae22d62695b0f54460
sourceRevisionDigest: sha256:93ee78e094f9f5de4c126c6a06c363e22412c11a874255e545a8cb610b3bf047
sourceBlobDigest: sha256:b54d7f793fedc532b07ad3a417aa86f4af3d1b4f9e7496550ce6cf5a455187fb
tags:
- latest
- speakeasy-sdk-regen-1737368101
- 0.0.0
targets:
documenso:
source: Documenso v2 beta API
sourceNamespace: documenso-v-2-beta-api
sourceRevisionDigest: sha256:95ffeb1aa479735642965b97f50f53ca294a5fa116f6a7ae22d62695b0f54460
sourceRevisionDigest: sha256:93ee78e094f9f5de4c126c6a06c363e22412c11a874255e545a8cb610b3bf047
sourceBlobDigest: sha256:b54d7f793fedc532b07ad3a417aa86f4af3d1b4f9e7496550ce6cf5a455187fb
codeSamplesNamespace: documenso-v-2-beta-api-typescript-code-samples
codeSamplesRevisionDigest: sha256:3cfbd3ec88e22ee235f505b444abaf45460dc42ec037be02119b4c3ae8db798d
codeSamplesRevisionDigest: sha256:88d3d249a42c45220d4b668f0fe65b78cc17890da031e29c7211419a2442e992
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
Expand Down
79 changes: 79 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Documenso v2 beta API: Subject to breaking changes until v2 is fully released.
* [Standalone functions](#standalone-functions)
* [Retries](#retries)
* [Error Handling](#error-handling)
* [Server Selection](#server-selection)
* [Custom HTTP Client](#custom-http-client)
* [Debugging](#debugging)
* [Development](#development)
* [Maturity](#maturity)
Expand Down Expand Up @@ -424,6 +426,83 @@ In some rare cases, the SDK can fail to get a response from the server or even m
<!-- End Error Handling [errors] -->


<!-- Start Server Selection [server] -->
## Server Selection

### Override Server URL Per-Client

The default server can also be overridden globally by passing a URL to the `serverURL: string` optional parameter when initializing the SDK client instance. For example:
```typescript
import { Documenso } from "@documenso/sdk-typescript";

const documenso = new Documenso({
serverURL: "https://app.documenso.com/api/v2-beta",
apiKey: process.env["DOCUMENSO_API_KEY"] ?? "",
});

async function run() {
const result = await documenso.documents.find({
orderByDirection: "desc",
});

// Handle the result
console.log(result);
}

run();

```
<!-- End Server Selection [server] -->

<!-- Start Custom HTTP Client [http-client] -->
## Custom HTTP Client

The TypeScript SDK makes API calls using an `HTTPClient` that wraps the native
[Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). This
client is a thin wrapper around `fetch` and provides the ability to attach hooks
around the request lifecycle that can be used to modify the request or handle
errors and response.

The `HTTPClient` constructor takes an optional `fetcher` argument that can be
used to integrate a third-party HTTP client or when writing tests to mock out
the HTTP client and feed in fixtures.

The following example shows how to use the `"beforeRequest"` hook to to add a
custom header and a timeout to requests and how to use the `"requestError"` hook
to log errors:

```typescript
import { Documenso } from "@documenso/sdk-typescript";
import { HTTPClient } from "@documenso/sdk-typescript/lib/http";

const httpClient = new HTTPClient({
// fetcher takes a function that has the same signature as native `fetch`.
fetcher: (request) => {
return fetch(request);
}
});

httpClient.addHook("beforeRequest", (request) => {
const nextRequest = new Request(request, {
signal: request.signal || AbortSignal.timeout(5000)
});

nextRequest.headers.set("x-custom-header", "custom value");

return nextRequest;
});

httpClient.addHook("requestError", (error, request) => {
console.group("Request Error");
console.log("Reason:", `${error}`);
console.log("Endpoint:", `${request.method} ${request.url}`);
console.groupEnd();
});

const sdk = new Documenso({ httpClient });
```
<!-- End Custom HTTP Client [http-client] -->

<!-- Start Debugging [debug] -->
## Debugging

Expand Down
11 changes: 11 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@


## 2025-01-20 10:23:14
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.469.10 (2.493.31) https://github.com/speakeasy-api/speakeasy
### Generated
- [typescript v0.1.2] .
### Releases
- [NPM v0.1.2] https://www.npmjs.com/package/@documenso/sdk-typescript/v/0.1.2 - .
2 changes: 1 addition & 1 deletion docs/models/operations/directlink.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let value: DirectLink = {
id: "<id>",
templateId: 514767,
token: "<value>",
createdAt: "1710260121777",
createdAt: "1710261542647",
enabled: false,
directTemplateRecipientId: 712893,
};
Expand Down
4 changes: 2 additions & 2 deletions docs/models/operations/document.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ let value: Document = {
},
title: "<value>",
documentDataId: "<id>",
createdAt: "1718997069708",
updatedAt: "1737292163076",
createdAt: "1718998489873",
updatedAt: "1737293583241",
completedAt: "<value>",
deletedAt: "<value>",
teamId: 604118,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ let value: DocumentCreateDocumentTemporaryResponseBody = {
},
title: "<value>",
documentDataId: "<id>",
createdAt: "1727795489058",
updatedAt: "1737351120842",
createdAt: "1727796909232",
updatedAt: "1737352541016",
completedAt: "<value>",
deletedAt: "<value>",
teamId: 509807,
Expand Down
4 changes: 2 additions & 2 deletions docs/models/operations/documentfinddocumentsdata.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ let value: DocumentFindDocumentsData = {
},
title: "<value>",
documentDataId: "<id>",
createdAt: "1719662956408",
updatedAt: "1737366214030",
createdAt: "1719664376312",
updatedAt: "1737367633934",
completedAt: "<value>",
deletedAt: "<value>",
teamId: 102044,
Expand Down
4 changes: 2 additions & 2 deletions docs/models/operations/documentfinddocumentsresponsebody.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ let value: DocumentFindDocumentsResponseBody = {
},
title: "<value>",
documentDataId: "<id>",
createdAt: "1728421313518",
updatedAt: "1737305823922",
createdAt: "1728422733427",
updatedAt: "1737307243831",
completedAt: "<value>",
deletedAt: "<value>",
teamId: 183191,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ let value: DocumentGetDocumentWithDetailsByIdResponseBody = {
},
title: "<value>",
documentDataId: "<id>",
createdAt: "1712671282693",
updatedAt: "1737338108904",
createdAt: "1712672702673",
updatedAt: "1737339528884",
completedAt: "<value>",
deletedAt: "<value>",
teamId: 263322,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ let value: DocumentMoveDocumentToTeamResponseBody = {
},
title: "<value>",
documentDataId: "<id>",
createdAt: "1721529111949",
updatedAt: "1737331024780",
createdAt: "1721530532201",
updatedAt: "1737332445032",
completedAt: "<value>",
deletedAt: "<value>",
teamId: 241557,
Expand Down
4 changes: 2 additions & 2 deletions docs/models/operations/documentsenddocumentresponsebody.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ let value: DocumentSendDocumentResponseBody = {
},
title: "<value>",
documentDataId: "<id>",
createdAt: "1719447206859",
updatedAt: "1737333914484",
createdAt: "1719448627130",
updatedAt: "1737335334755",
completedAt: "<value>",
deletedAt: "<value>",
teamId: 70042,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ let value: DocumentSetSettingsForDocumentResponseBody = {
},
title: "<value>",
documentDataId: "<id>",
createdAt: "1707806508794",
updatedAt: "1737301719930",
createdAt: "1707807929024",
updatedAt: "1737303140161",
completedAt: "<value>",
deletedAt: "<value>",
teamId: 432281,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ let value: TemplateCreateDocumentFromTemplateResponseBody = {
},
title: "<value>",
documentDataId: "<id>",
createdAt: "1715613546296",
updatedAt: "1737325354277",
createdAt: "1715614967366",
updatedAt: "1737326775348",
completedAt: "<value>",
deletedAt: "<value>",
teamId: 415953,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let value: TemplateCreateTemplateDirectLinkResponseBody = {
id: "<id>",
templateId: 933847,
token: "<value>",
createdAt: "1730235478042",
createdAt: "1730236899675",
enabled: false,
directTemplateRecipientId: 358861,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ let value: TemplateDuplicateTemplateResponseBody = {
globalActionAuth: "TWO_FACTOR_AUTH",
},
templateDocumentDataId: "<id>",
createdAt: "1718812272893",
updatedAt: "1737307196042",
createdAt: "1718813693866",
updatedAt: "1737308617015",
publicTitle: "<value>",
publicDescription: "<value>",
};
Expand Down
4 changes: 2 additions & 2 deletions docs/models/operations/templatefindtemplatesdata.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ let value: TemplateFindTemplatesData = {
globalActionAuth: "PASSKEY",
},
templateDocumentDataId: "<id>",
createdAt: "1722862173160",
updatedAt: "1737336595499",
createdAt: "1722863594003",
updatedAt: "1737338016343",
publicTitle: "<value>",
publicDescription: "<value>",
team: {
Expand Down
4 changes: 2 additions & 2 deletions docs/models/operations/templatefindtemplatesresponsebody.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ let value: TemplateFindTemplatesResponseBody = {
globalActionAuth: "ACCOUNT",
},
templateDocumentDataId: "<id>",
createdAt: "1715813661601",
updatedAt: "1737306632855",
createdAt: "1715815082451",
updatedAt: "1737308053705",
publicTitle: "<value>",
publicDescription: "<value>",
team: {
Expand Down
6 changes: 3 additions & 3 deletions docs/models/operations/templategettemplatebyidresponsebody.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ let value: TemplateGetTemplateByIdResponseBody = {
globalActionAuth: "TWO_FACTOR_AUTH",
},
templateDocumentDataId: "<id>",
createdAt: "1734473741211",
updatedAt: "1737293811299",
createdAt: "1734475162147",
updatedAt: "1737295232235",
publicTitle: "<value>",
publicDescription: "<value>",
templateDocumentData: {
Expand All @@ -48,7 +48,7 @@ let value: TemplateGetTemplateByIdResponseBody = {
id: "<id>",
templateId: 738152,
token: "<value>",
createdAt: "1734418419060",
createdAt: "1734419839998",
enabled: false,
directTemplateRecipientId: 799866,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ let value: TemplateMoveTemplateToTeamResponseBody = {
globalActionAuth: "PASSKEY",
},
templateDocumentDataId: "<id>",
createdAt: "1729781243761",
updatedAt: "1737296217774",
createdAt: "1729782664846",
updatedAt: "1737297638859",
publicTitle: "<value>",
publicDescription: "<value>",
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let value: TemplateToggleTemplateDirectLinkResponseBody = {
id: "<id>",
templateId: 409295,
token: "<value>",
createdAt: "1708881108768",
createdAt: "1708882530406",
enabled: false,
directTemplateRecipientId: 656939,
};
Expand Down
4 changes: 2 additions & 2 deletions docs/models/operations/templateupdatetemplateresponsebody.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ let value: TemplateUpdateTemplateResponseBody = {
globalActionAuth: "ACCOUNT",
},
templateDocumentDataId: "<id>",
createdAt: "1737320754424",
updatedAt: "1737292189301",
createdAt: "1737322175387",
updatedAt: "1737293610264",
publicTitle: "<value>",
publicDescription: "<value>",
};
Expand Down
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{
"name": "@documenso/sdk-typescript",
"version": "0.1.1",
"version": "0.1.2",
"exports": {
".": "./src/index.ts",
"./models/errors": "./src/models/errors/index.ts",
Expand Down
Loading