ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.277.4 (#94)

Co-authored-by: speakeasybot <bot@speakeasyapi.dev>
This commit is contained in:
github-actions[bot]
2024-05-01 11:03:53 +05:30
committed by GitHub
parent 8c928872a9
commit 5b4edcbb22
24 changed files with 559 additions and 394 deletions

View File

@@ -1,20 +1,19 @@
lockVersion: 2.0.0 lockVersion: 2.0.0
id: f28179cc-ef59-426d-9e85-60cec22fc642 id: f28179cc-ef59-426d-9e85-60cec22fc642
management: management:
docChecksum: 0008b3cde645369b98ab1f75381bb11a docChecksum: 1504d2d6c3f4514d30a37a76c74a48a5
docVersion: 0.0.1 docVersion: 0.0.1
speakeasyVersion: 1.276.0 speakeasyVersion: 1.277.4
generationVersion: 2.314.0 generationVersion: 2.318.3
releaseVersion: 0.25.2 releaseVersion: 0.26.0
configChecksum: a717018481b6fdc4d6146485565263e5 configChecksum: 640563cb2897eac551ae0d2397065a1c
repoURL: https://github.com/dubinc/dub-node.git repoURL: https://github.com/dubinc/dub-node.git
installationURL: https://github.com/dubinc/dub-node installationURL: https://github.com/dubinc/dub-node
published: true published: true
features: features:
typescript: typescript:
acceptHeaders: 2.81.1
constsAndDefaults: 0.1.5 constsAndDefaults: 0.1.5
core: 3.9.0 core: 3.9.2
deprecations: 2.81.1 deprecations: 2.81.1
examples: 2.81.3 examples: 2.81.3
flattening: 2.81.1 flattening: 2.81.1

View File

@@ -12,7 +12,7 @@ generation:
auth: auth:
oAuth2ClientCredentialsEnabled: false oAuth2ClientCredentialsEnabled: false
typescript: typescript:
version: 0.25.2 version: 0.26.0
additionalDependencies: additionalDependencies:
dependencies: {} dependencies: {}
devDependencies: devDependencies:

View File

@@ -1,17 +1,17 @@
speakeasyVersion: 1.276.0 speakeasyVersion: 1.277.4
sources: sources:
my-first-source: my-first-source:
sourceNamespace: my-first-source sourceNamespace: my-first-source
sourceRevisionDigest: sha256:365db128287dc83d36c7a0e2ce43b6abfe2e5108053a272988c8240fcafce541 sourceRevisionDigest: sha256:55ec84ef7f4cfe2ce4c37f825adf9e34af493fc6bd28fc897643faea892381a4
sourceBlobDigest: sha256:3b411021fd54342776cd1a1f631e53f2f51e7b299ba8ced635a3bdedaf86f225 sourceBlobDigest: sha256:646aaaaf591cd2d029735da923e4ddf83e85d98d268353bb9c884cd77000c4b2
tags: tags:
- latest - latest
targets: targets:
my-first-target: my-first-target:
source: my-first-source source: my-first-source
sourceNamespace: my-first-source sourceNamespace: my-first-source
sourceRevisionDigest: sha256:365db128287dc83d36c7a0e2ce43b6abfe2e5108053a272988c8240fcafce541 sourceRevisionDigest: sha256:55ec84ef7f4cfe2ce4c37f825adf9e34af493fc6bd28fc897643faea892381a4
sourceBlobDigest: sha256:3b411021fd54342776cd1a1f631e53f2f51e7b299ba8ced635a3bdedaf86f225 sourceBlobDigest: sha256:646aaaaf591cd2d029735da923e4ddf83e85d98d268353bb9c884cd77000c4b2
outLocation: /github/workspace/repo outLocation: /github/workspace/repo
workflow: workflow:
workflowVersion: 1.0.0 workflowVersion: 1.0.0

View File

@@ -206,4 +206,14 @@ Based on:
### Generated ### Generated
- [typescript v0.25.2] . - [typescript v0.25.2] .
### Releases ### Releases
- [NPM v0.25.2] https://www.npmjs.com/package/dub/v/0.25.2 - . - [NPM v0.25.2] https://www.npmjs.com/package/dub/v/0.25.2 - .
## 2024-05-01 01:17:50
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.277.4 (2.318.3) https://github.com/speakeasy-api/speakeasy
### Generated
- [typescript v0.26.0] .
### Releases
- [NPM v0.26.0] https://www.npmjs.com/package/dub/v/0.26.0 - .

View File

@@ -24,11 +24,11 @@ actions:
} }
run(); run();
- target: $["paths"]["/analytics/city"]["get"] - target: $["paths"]["/analytics/timeseries"]["get"]
update: update:
"x-codeSamples": "x-codeSamples":
- "lang": "typescript" - "lang": "typescript"
"label": "getCityAnalytics" "label": "getTimeseriesAnalytics"
"source": |- "source": |-
import { Dub } from "dub"; import { Dub } from "dub";
@@ -38,7 +38,80 @@ actions:
}); });
async function run() { async function run() {
const result = await dub.cities({}); const result = await dub.timeseries({});
// Handle the result
console.log(result)
}
run();
- target: $["paths"]["/analytics/device"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "getDeviceAnalytics"
"source": |-
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
workspaceId: "<value>",
});
async function run() {
const result = await dub.devices({});
// Handle the result
console.log(result)
}
run();
- target: $["paths"]["/analytics/referer"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "getRefererAnalytics"
"source": |-
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
workspaceId: "<value>",
});
async function run() {
const result = await dub.referers({});
// Handle the result
console.log(result)
}
run();
- target: $["paths"]["/domains/{slug}"]["patch"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "editDomain"
"source": "import { Dub } from \"dub\";\n\nconst dub = new Dub({\n token: \"DUB_API_KEY\",\n workspaceId: \"<value>\",\n});\n\nasync function run() {\n const slug = \"acme.com\";\n const requestBody = {};\n \n const result = await dub.update(slug, requestBody);\n\n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/links/bulk"]["post"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "bulkCreateLinks"
"source": |-
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
workspaceId: "<value>",
});
async function run() {
const result = await dub.createMany([
{
url: "https://google/com",
},
]);
// Handle the result // Handle the result
console.log(result) console.log(result)
@@ -86,168 +159,6 @@ actions:
console.log(result) console.log(result)
} }
run();
- target: $["paths"]["/links/{linkId}"]["put"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "editLink"
"source": "import { Dub } from \"dub\";\n\nconst dub = new Dub({\n token: \"DUB_API_KEY\",\n workspaceId: \"<value>\",\n});\n\nasync function run() {\n const linkId = \"<value>\";\n const requestBody = {\n url: \"https://google/com\",\n };\n \n const result = await dub.update(linkId, requestBody);\n\n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/domains"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "listDomains"
"source": |-
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
workspaceId: "<value>",
});
async function run() {
const result = await dub.list({});
// Handle the result
console.log(result)
}
run();
- target: $["paths"]["/analytics/timeseries"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "getTimeseriesAnalytics"
"source": |-
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
workspaceId: "<value>",
});
async function run() {
const result = await dub.timeseries({});
// Handle the result
console.log(result)
}
run();
- target: $["paths"]["/domains"]["post"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "addDomain"
"source": |-
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
workspaceId: "<value>",
});
async function run() {
const result = await dub.add({
slug: "acme.com",
});
// Handle the result
console.log(result)
}
run();
- target: $["paths"]["/links/info"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "getLinkInfo"
"source": |-
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
workspaceId: "<value>",
});
async function run() {
const result = await dub.get({
domain: "ringed-blow.name",
key: "<key>",
});
// Handle the result
console.log(result)
}
run();
- target: $["paths"]["/links/bulk"]["post"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "bulkCreateLinks"
"source": |-
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
workspaceId: "<value>",
});
async function run() {
const result = await dub.createMany([
{
url: "https://google/com",
},
]);
// Handle the result
console.log(result)
}
run();
- target: $["paths"]["/analytics/country"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "getCountryAnalytics"
"source": |-
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
workspaceId: "<value>",
});
async function run() {
const result = await dub.countries({});
// Handle the result
console.log(result)
}
run();
- target: $["paths"]["/analytics/device"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "getDeviceAnalytics"
"source": |-
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
workspaceId: "<value>",
});
async function run() {
const result = await dub.devices({});
// Handle the result
console.log(result)
}
run(); run();
- target: $["paths"]["/workspaces/{idOrSlug}"]["get"] - target: $["paths"]["/workspaces/{idOrSlug}"]["get"]
update: update:
@@ -272,11 +183,11 @@ actions:
} }
run(); run();
- target: $["paths"]["/tags"]["get"] - target: $["paths"]["/analytics/top_links"]["get"]
update: update:
"x-codeSamples": "x-codeSamples":
- "lang": "typescript" - "lang": "typescript"
"label": "getTags" "label": "getTopLinks"
"source": |- "source": |-
import { Dub } from "dub"; import { Dub } from "dub";
@@ -286,49 +197,7 @@ actions:
}); });
async function run() { async function run() {
const result = await dub.list({}); const result = await dub.topLinks({});
// Handle the result
console.log(result)
}
run();
- target: $["paths"]["/links"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "getLinks"
"source": |-
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
workspaceId: "<value>",
});
async function run() {
const result = await dub.list({});
// Handle the result
console.log(result)
}
run();
- target: $["paths"]["/workspaces"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "getWorkspaces"
"source": |-
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
workspaceId: "<value>",
});
async function run() {
const result = await dub.list();
// Handle the result // Handle the result
console.log(result) console.log(result)
@@ -341,17 +210,11 @@ actions:
- "lang": "typescript" - "lang": "typescript"
"label": "deleteDomain" "label": "deleteDomain"
"source": "import { Dub } from \"dub\";\n\nconst dub = new Dub({\n token: \"DUB_API_KEY\",\n workspaceId: \"<value>\",\n});\n\nasync function run() {\n const slug = \"acme.com\";\n \n const result = await dub.delete(slug);\n\n // Handle the result\n console.log(result)\n}\n\nrun();" "source": "import { Dub } from \"dub\";\n\nconst dub = new Dub({\n token: \"DUB_API_KEY\",\n workspaceId: \"<value>\",\n});\n\nasync function run() {\n const slug = \"acme.com\";\n \n const result = await dub.delete(slug);\n\n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/domains/{slug}/primary"]["post"] - target: $["paths"]["/analytics/country"]["get"]
update: update:
"x-codeSamples": "x-codeSamples":
- "lang": "typescript" - "lang": "typescript"
"label": "setPrimaryDomain" "label": "getCountryAnalytics"
"source": "import { Dub } from \"dub\";\n\nconst dub = new Dub({\n token: \"DUB_API_KEY\",\n workspaceId: \"<value>\",\n});\n\nasync function run() {\n const slug = \"acme.com\";\n \n const result = await dub.setPrimary(slug);\n\n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/metatags"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "getMetatags"
"source": |- "source": |-
import { Dub } from "dub"; import { Dub } from "dub";
@@ -361,8 +224,29 @@ actions:
}); });
async function run() { async function run() {
const result = await dub.get({ const result = await dub.countries({});
url: "https://dub.co",
// Handle the result
console.log(result)
}
run();
- target: $["paths"]["/tags"]["post"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "createTag"
"source": |-
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
workspaceId: "<value>",
});
async function run() {
const result = await dub.create({
tag: "<value>",
}); });
// Handle the result // Handle the result
@@ -370,12 +254,33 @@ actions:
} }
run(); run();
- target: $["paths"]["/domains/{slug}"]["patch"] - target: $["paths"]["/domains/{slug}/primary"]["post"]
update: update:
"x-codeSamples": "x-codeSamples":
- "lang": "typescript" - "lang": "typescript"
"label": "editDomain" "label": "setPrimaryDomain"
"source": "import { Dub } from \"dub\";\n\nconst dub = new Dub({\n token: \"DUB_API_KEY\",\n workspaceId: \"<value>\",\n});\n\nasync function run() {\n const slug = \"acme.com\";\n const requestBody = {};\n \n const result = await dub.update(slug, requestBody);\n\n // Handle the result\n console.log(result)\n}\n\nrun();" "source": "import { Dub } from \"dub\";\n\nconst dub = new Dub({\n token: \"DUB_API_KEY\",\n workspaceId: \"<value>\",\n});\n\nasync function run() {\n const slug = \"acme.com\";\n \n const result = await dub.setPrimary(slug);\n\n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/qr"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "getQRCode"
"source": |-
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
workspaceId: "<value>",
});
async function run() {
const result = await dub.get({});
// Handle the result
console.log(result)
}
run();
- target: $["paths"]["/links"]["post"] - target: $["paths"]["/links"]["post"]
update: update:
"x-codeSamples": "x-codeSamples":
@@ -398,6 +303,35 @@ actions:
console.log(result) console.log(result)
} }
run();
- target: $["paths"]["/links/{linkId}"]["put"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "editLink"
"source": "import { Dub } from \"dub\";\n\nconst dub = new Dub({\n token: \"DUB_API_KEY\",\n workspaceId: \"<value>\",\n});\n\nasync function run() {\n const linkId = \"<value>\";\n const requestBody = {\n url: \"https://google/com\",\n };\n \n const result = await dub.update(linkId, requestBody);\n\n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/domains"]["post"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "addDomain"
"source": |-
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
workspaceId: "<value>",
});
async function run() {
const result = await dub.add({
slug: "acme.com",
});
// Handle the result
console.log(result)
}
run(); run();
- target: $["paths"]["/links/count"]["get"] - target: $["paths"]["/links/count"]["get"]
update: update:
@@ -420,17 +354,11 @@ actions:
} }
run(); run();
- target: $["paths"]["/links/{linkId}"]["delete"] - target: $["paths"]["/links/info"]["get"]
update: update:
"x-codeSamples": "x-codeSamples":
- "lang": "typescript" - "lang": "typescript"
"label": "deleteLink" "label": "getLinkInfo"
"source": "import { Dub } from \"dub\";\n\nconst dub = new Dub({\n token: \"DUB_API_KEY\",\n workspaceId: \"<value>\",\n});\n\nasync function run() {\n const linkId = \"<value>\";\n \n const result = await dub.delete(linkId);\n\n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/qr"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "getQRCode"
"source": |- "source": |-
import { Dub } from "dub"; import { Dub } from "dub";
@@ -447,11 +375,11 @@ actions:
} }
run(); run();
- target: $["paths"]["/analytics/referer"]["get"] - target: $["paths"]["/analytics/os"]["get"]
update: update:
"x-codeSamples": "x-codeSamples":
- "lang": "typescript" - "lang": "typescript"
"label": "getRefererAnalytics" "label": "getOSAnalytics"
"source": |- "source": |-
import { Dub } from "dub"; import { Dub } from "dub";
@@ -461,51 +389,7 @@ actions:
}); });
async function run() { async function run() {
const result = await dub.referers({}); const result = await dub.os({});
// Handle the result
console.log(result)
}
run();
- target: $["paths"]["/analytics/top_links"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "getTopLinks"
"source": |-
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
workspaceId: "<value>",
});
async function run() {
const result = await dub.topLinks({});
// Handle the result
console.log(result)
}
run();
- target: $["paths"]["/tags"]["post"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "createTag"
"source": |-
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
workspaceId: "<value>",
});
async function run() {
const result = await dub.create({
tag: "<value>",
});
// Handle the result // Handle the result
console.log(result) console.log(result)
@@ -536,11 +420,11 @@ actions:
} }
run(); run();
- target: $["paths"]["/analytics/os"]["get"] - target: $["paths"]["/tags"]["get"]
update: update:
"x-codeSamples": "x-codeSamples":
- "lang": "typescript" - "lang": "typescript"
"label": "getOSAnalytics" "label": "getTags"
"source": |- "source": |-
import { Dub } from "dub"; import { Dub } from "dub";
@@ -550,7 +434,7 @@ actions:
}); });
async function run() { async function run() {
const result = await dub.os({}); const result = await dub.list({});
// Handle the result // Handle the result
console.log(result) console.log(result)
@@ -563,3 +447,116 @@ actions:
- "lang": "typescript" - "lang": "typescript"
"label": "transferDomain" "label": "transferDomain"
"source": "import { Dub } from \"dub\";\n\nconst dub = new Dub({\n token: \"DUB_API_KEY\",\n workspaceId: \"<value>\",\n});\n\nasync function run() {\n const slug = \"acme.com\";\n const requestBody = {\n newWorkspaceId: \"<value>\",\n };\n \n const result = await dub.transfer(slug, requestBody);\n\n // Handle the result\n console.log(result)\n}\n\nrun();" "source": "import { Dub } from \"dub\";\n\nconst dub = new Dub({\n token: \"DUB_API_KEY\",\n workspaceId: \"<value>\",\n});\n\nasync function run() {\n const slug = \"acme.com\";\n const requestBody = {\n newWorkspaceId: \"<value>\",\n };\n \n const result = await dub.transfer(slug, requestBody);\n\n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/links"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "getLinks"
"source": |-
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
workspaceId: "<value>",
});
async function run() {
const result = await dub.list({});
// Handle the result
console.log(result)
}
run();
- target: $["paths"]["/links/{linkId}"]["delete"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "deleteLink"
"source": "import { Dub } from \"dub\";\n\nconst dub = new Dub({\n token: \"DUB_API_KEY\",\n workspaceId: \"<value>\",\n});\n\nasync function run() {\n const linkId = \"<value>\";\n \n const result = await dub.delete(linkId);\n\n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/analytics/city"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "getCityAnalytics"
"source": |-
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
workspaceId: "<value>",
});
async function run() {
const result = await dub.cities({});
// Handle the result
console.log(result)
}
run();
- target: $["paths"]["/workspaces"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "getWorkspaces"
"source": |-
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
workspaceId: "<value>",
});
async function run() {
const result = await dub.list();
// Handle the result
console.log(result)
}
run();
- target: $["paths"]["/domains"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "listDomains"
"source": |-
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
workspaceId: "<value>",
});
async function run() {
const result = await dub.list({});
// Handle the result
console.log(result)
}
run();
- target: $["paths"]["/metatags"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "getMetatags"
"source": |-
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
workspaceId: "<value>",
});
async function run() {
const result = await dub.get({
url: "https://dub.co",
});
// Handle the result
console.log(result)
}
run();

View File

@@ -11,7 +11,7 @@
| `externalId` | *string* | :heavy_check_mark: | This is the ID of the link in your database. If set, it can be used to identify the link in the future. Must be prefixed with 'ext_' when passed as a query parameter. | | `externalId` | *string* | :heavy_check_mark: | This is the ID of the link in your database. If set, it can be used to identify the link in the future. Must be prefixed with 'ext_' when passed as a query parameter. |
| `url` | *string* | :heavy_check_mark: | The destination URL of the short link. | | `url` | *string* | :heavy_check_mark: | The destination URL of the short link. |
| `archived` | *boolean* | :heavy_minus_sign: | Whether the short link is archived. | | `archived` | *boolean* | :heavy_minus_sign: | Whether the short link is archived. |
| `expiresAt` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_check_mark: | The date and time when the short link will expire in ISO-8601 format. | | `expiresAt` | *string* | :heavy_check_mark: | The date and time when the short link will expire in ISO-8601 format. |
| `expiredUrl` | *string* | :heavy_check_mark: | The URL to redirect to when the short link has expired. | | `expiredUrl` | *string* | :heavy_check_mark: | The URL to redirect to when the short link has expired. |
| `password` | *string* | :heavy_check_mark: | The password required to access the destination URL of the short link. | | `password` | *string* | :heavy_check_mark: | The password required to access the destination URL of the short link. |
| `proxy` | *boolean* | :heavy_minus_sign: | Whether the short link uses Custom Social Media Cards feature. | | `proxy` | *boolean* | :heavy_minus_sign: | Whether the short link uses Custom Social Media Cards feature. |

View File

@@ -3,7 +3,9 @@
## Fields ## Fields
| Field | Type | Required | Description | | Field | Type | Required | Description | Example |
| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| `domain` | *string* | :heavy_check_mark: | N/A | | `domain` | *string* | :heavy_minus_sign: | N/A | |
| `key` | *string* | :heavy_check_mark: | The key of the link to retrieve. E.g. for `d.to/github`, the key is `github`. | | `key` | *string* | :heavy_minus_sign: | The key of the link to retrieve. E.g. for `d.to/github`, the key is `github`. | |
| `linkId` | *string* | :heavy_minus_sign: | The unique ID of the short link. | clux0rgak00011... |
| `externalId` | *string* | :heavy_minus_sign: | This is the ID of the link in the your database. Must be prefixed with `ext_`. when provided. | ext_123456 |

View File

@@ -168,7 +168,7 @@ run();
## get ## get
Retrieve the info for a link from their domain and key. Retrieve the info for a link.
### Example Usage ### Example Usage
@@ -181,10 +181,7 @@ const dub = new Dub({
}); });
async function run() { async function run() {
const result = await dub.links.get({ const result = await dub.links.get({});
domain: "ringed-blow.name",
key: "<key>",
});
// Handle the result // Handle the result
console.log(result) console.log(result)

View File

@@ -2,7 +2,7 @@
{ {
"name": "dub", "name": "dub",
"version": "0.25.2", "version": "0.26.0",
"exports": { "exports": {
".": "./src/index.ts", ".": "./src/index.ts",
"./models/errors": "./src/models/errors/index.ts", "./models/errors": "./src/models/errors/index.ts",

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "dub", "name": "dub",
"version": "0.25.2", "version": "0.26.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "dub", "name": "dub",
"version": "0.25.2", "version": "0.26.0",
"devDependencies": { "devDependencies": {
"@types/jsonpath": "^0.2.4", "@types/jsonpath": "^0.2.4",
"@types/node": "^20.12.7", "@types/node": "^20.12.7",

View File

@@ -1,6 +1,6 @@
{ {
"name": "dub", "name": "dub",
"version": "0.25.2", "version": "0.26.0",
"author": "Dub", "author": "Dub",
"main": "./index.js", "main": "./index.js",
"sideEffects": false, "sideEffects": false,

View File

@@ -64,7 +64,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
export const SDK_METADATA = { export const SDK_METADATA = {
language: "typescript", language: "typescript",
openapiDocVersion: "0.0.1", openapiDocVersion: "0.0.1",
sdkVersion: "0.25.2", sdkVersion: "0.26.0",
genVersion: "2.314.0", genVersion: "2.318.3",
userAgent: "speakeasy-sdk/typescript 0.25.2 2.314.0 0.0.1 dub", userAgent: "speakeasy-sdk/typescript 0.26.0 2.318.3 0.0.1 dub",
} as const; } as const;

View File

@@ -141,29 +141,56 @@ export class HTTPClient {
} }
} }
export function matchContentType(response: Response, pattern: string): boolean { // A semicolon surrounded by optional whitespace characters is used to separate
if (pattern === "*" || pattern === "*/*") { // segments in a media type string.
const mediaParamSeparator = /\s*;\s*/g;
function matchContentType(response: Response, pattern: string): boolean {
// `*` is a special case which means anything is acceptable.
if (pattern === "*") {
return true; return true;
} }
const contentType = let contentType =
response.headers.get("content-type") ?? "application/octet-stream"; response.headers.get("content-type")?.trim() || "application/octet-stream";
contentType = contentType.toLowerCase();
const idx = contentType.split(";").findIndex((raw) => { const wantParts = pattern.toLowerCase().trim().split(mediaParamSeparator);
const ctype = raw.trim(); const [wantType = "", ...wantParams] = wantParts;
if (ctype === pattern) {
return true;
}
const parts = ctype.split("/"); if (wantType.split("/").length !== 2) {
if (parts.length !== 2) { return false;
}
const gotParts = contentType.split(mediaParamSeparator);
const [gotType = "", ...gotParams] = gotParts;
const [type = "", subtype = ""] = gotType.split("/");
if (!type || !subtype) {
return false;
}
if (
wantType !== "*/*" &&
gotType !== wantType &&
`${type}/*` !== wantType &&
`*/${subtype}` !== wantType
) {
return false;
}
if (gotParams.length < wantParams.length) {
return false;
}
const params = new Set(gotParams);
for (const wantParam of wantParams) {
if (!params.has(wantParam)) {
return false; return false;
} }
}
return `${parts[0]}/*` === pattern || `*/${parts[1]}` === pattern; return true;
});
return idx >= 0;
} }
const codeRangeRE = new RegExp("^[0-9]xx$", "i"); const codeRangeRE = new RegExp("^[0-9]xx$", "i");

View File

@@ -68,7 +68,7 @@ type SecurityInputOAuth2 = {
type SecurityInputOAuth2ClientCredentials = { type SecurityInputOAuth2ClientCredentials = {
type: "oauth2:client_credentials"; type: "oauth2:client_credentials";
value: string | null | undefined; value: string | null | undefined;
fieldName: "clientID" | "clientSecret"; fieldName: string;
}; };
export type SecurityInput = export type SecurityInput =

View File

@@ -289,7 +289,7 @@ export type LinkSchema = {
/** /**
* The date and time when the short link will expire in ISO-8601 format. * The date and time when the short link will expire in ISO-8601 format.
*/ */
expiresAt: Date | null; expiresAt: string | null;
/** /**
* The URL to redirect to when the short link has expired. * The URL to redirect to when the short link has expired.
*/ */
@@ -1981,12 +1981,7 @@ export namespace LinkSchema$ {
externalId: z.nullable(z.string()), externalId: z.nullable(z.string()),
url: z.string(), url: z.string(),
archived: z.boolean().default(false), archived: z.boolean().default(false),
expiresAt: z.nullable( expiresAt: z.nullable(z.string()),
z
.string()
.datetime({ offset: true })
.transform((v) => new Date(v))
),
expiredUrl: z.nullable(z.string()), expiredUrl: z.nullable(z.string()),
password: z.nullable(z.string()), password: z.nullable(z.string()),
proxy: z.boolean().default(false), proxy: z.boolean().default(false),
@@ -2102,7 +2097,7 @@ export namespace LinkSchema$ {
externalId: z.nullable(z.string()), externalId: z.nullable(z.string()),
url: z.string(), url: z.string(),
archived: z.boolean().default(false), archived: z.boolean().default(false),
expiresAt: z.nullable(z.date().transform((v) => v.toISOString())), expiresAt: z.nullable(z.string()),
expiredUrl: z.nullable(z.string()), expiredUrl: z.nullable(z.string()),
password: z.nullable(z.string()), password: z.nullable(z.string()),
proxy: z.boolean().default(false), proxy: z.boolean().default(false),

View File

@@ -4,6 +4,7 @@
export class SDKError extends Error { export class SDKError extends Error {
public readonly statusCode: number; public readonly statusCode: number;
public readonly contentType: string;
constructor( constructor(
message: string, message: string,
@@ -11,11 +12,13 @@ export class SDKError extends Error {
public readonly body: string = "" public readonly body: string = ""
) { ) {
const statusCode = rawResponse.status; const statusCode = rawResponse.status;
const contentType = rawResponse.headers.get("content-type") || "";
const bodyString = body.length > 0 ? `\n${body}` : ""; const bodyString = body.length > 0 ? `\n${body}` : "";
super(`${message}: Status ${statusCode}${bodyString}`); super(`${message}: Status ${statusCode} Content-Type ${contentType} Body ${bodyString}`);
this.statusCode = statusCode; this.statusCode = statusCode;
this.contentType = contentType;
this.name = "SDKError"; this.name = "SDKError";
} }

View File

@@ -5,46 +5,66 @@
import * as z from "zod"; import * as z from "zod";
export type GetLinkInfoRequest = { export type GetLinkInfoRequest = {
domain: string; domain?: string | undefined;
/** /**
* The key of the link to retrieve. E.g. for `d.to/github`, the key is `github`. * The key of the link to retrieve. E.g. for `d.to/github`, the key is `github`.
*/ */
key: string; key?: string | undefined;
/**
* The unique ID of the short link.
*/
linkId?: string | undefined;
/**
* This is the ID of the link in the your database. Must be prefixed with `ext_`. when provided.
*/
externalId?: string | undefined;
}; };
/** @internal */ /** @internal */
export namespace GetLinkInfoRequest$ { export namespace GetLinkInfoRequest$ {
export type Inbound = { export type Inbound = {
domain: string; domain?: string | undefined;
key: string; key?: string | undefined;
linkId?: string | undefined;
externalId?: string | undefined;
}; };
export const inboundSchema: z.ZodType<GetLinkInfoRequest, z.ZodTypeDef, Inbound> = z export const inboundSchema: z.ZodType<GetLinkInfoRequest, z.ZodTypeDef, Inbound> = z
.object({ .object({
domain: z.string(), domain: z.string().optional(),
key: z.string(), key: z.string().optional(),
linkId: z.string().optional(),
externalId: z.string().optional(),
}) })
.transform((v) => { .transform((v) => {
return { return {
domain: v.domain, ...(v.domain === undefined ? null : { domain: v.domain }),
key: v.key, ...(v.key === undefined ? null : { key: v.key }),
...(v.linkId === undefined ? null : { linkId: v.linkId }),
...(v.externalId === undefined ? null : { externalId: v.externalId }),
}; };
}); });
export type Outbound = { export type Outbound = {
domain: string; domain?: string | undefined;
key: string; key?: string | undefined;
linkId?: string | undefined;
externalId?: string | undefined;
}; };
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetLinkInfoRequest> = z export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetLinkInfoRequest> = z
.object({ .object({
domain: z.string(), domain: z.string().optional(),
key: z.string(), key: z.string().optional(),
linkId: z.string().optional(),
externalId: z.string().optional(),
}) })
.transform((v) => { .transform((v) => {
return { return {
domain: v.domain, ...(v.domain === undefined ? null : { domain: v.domain }),
key: v.key, ...(v.key === undefined ? null : { key: v.key }),
...(v.linkId === undefined ? null : { linkId: v.linkId }),
...(v.externalId === undefined ? null : { externalId: v.externalId }),
}; };
}); });
} }

View File

@@ -287,7 +287,11 @@ export class Analytics extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
@@ -539,7 +543,11 @@ export class Analytics extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
@@ -793,7 +801,11 @@ export class Analytics extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
@@ -1047,7 +1059,11 @@ export class Analytics extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
@@ -1301,7 +1317,11 @@ export class Analytics extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
@@ -1555,7 +1575,11 @@ export class Analytics extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
@@ -1809,7 +1833,11 @@ export class Analytics extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
@@ -2063,7 +2091,11 @@ export class Analytics extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
@@ -2315,7 +2347,11 @@ export class Analytics extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
@@ -2567,7 +2603,11 @@ export class Analytics extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
} }

View File

@@ -250,7 +250,11 @@ export class Domains extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
@@ -474,7 +478,11 @@ export class Domains extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
@@ -705,7 +713,11 @@ export class Domains extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
@@ -939,7 +951,11 @@ export class Domains extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
@@ -1167,7 +1183,11 @@ export class Domains extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
@@ -1401,7 +1421,11 @@ export class Domains extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
} }

View File

@@ -277,7 +277,11 @@ export class Links extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
@@ -501,7 +505,11 @@ export class Links extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
@@ -741,7 +749,11 @@ export class Links extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
@@ -749,7 +761,7 @@ export class Links extends ClientSDK {
* Retrieve a link * Retrieve a link
* *
* @remarks * @remarks
* Retrieve the info for a link from their domain and key. * Retrieve the info for a link.
*/ */
async get( async get(
input: operations.GetLinkInfoRequest, input: operations.GetLinkInfoRequest,
@@ -770,7 +782,12 @@ export class Links extends ClientSDK {
const query$ = [ const query$ = [
enc$.encodeForm("domain", payload$.domain, { explode: true, charEncoding: "percent" }), enc$.encodeForm("domain", payload$.domain, { explode: true, charEncoding: "percent" }),
enc$.encodeForm("externalId", payload$.externalId, {
explode: true,
charEncoding: "percent",
}),
enc$.encodeForm("key", payload$.key, { explode: true, charEncoding: "percent" }), enc$.encodeForm("key", payload$.key, { explode: true, charEncoding: "percent" }),
enc$.encodeForm("linkId", payload$.linkId, { explode: true, charEncoding: "percent" }),
enc$.encodeForm("projectSlug", this.options$.projectSlug, { enc$.encodeForm("projectSlug", this.options$.projectSlug, {
explode: true, explode: true,
charEncoding: "percent", charEncoding: "percent",
@@ -965,7 +982,11 @@ export class Links extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
@@ -1199,7 +1220,11 @@ export class Links extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
@@ -1430,7 +1455,11 @@ export class Links extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
@@ -1654,7 +1683,11 @@ export class Links extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
} }

View File

@@ -110,7 +110,11 @@ export class Metatags extends ClientSDK {
return result; return result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
} }

View File

@@ -12,11 +12,6 @@ import * as errors from "../models/errors";
import * as operations from "../models/operations"; import * as operations from "../models/operations";
import * as z from "zod"; import * as z from "zod";
export enum GetAcceptEnum {
applicationJson = "application/json",
imagePng = "image/png",
}
export class QRCodes extends ClientSDK { export class QRCodes extends ClientSDK {
private readonly options$: SDKOptions & { hooks?: SDKHooks }; private readonly options$: SDKOptions & { hooks?: SDKHooks };
@@ -50,15 +45,10 @@ export class QRCodes extends ClientSDK {
* @remarks * @remarks
* Retrieve a QR code for a link. * Retrieve a QR code for a link.
*/ */
async get( async get(input: operations.GetQRCodeRequest, options?: RequestOptions): Promise<string> {
input: operations.GetQRCodeRequest,
options?: RequestOptions & { acceptHeaderOverride?: GetAcceptEnum }
): Promise<string> {
const headers$ = new Headers(); const headers$ = new Headers();
headers$.set("user-agent", SDK_METADATA.userAgent); headers$.set("user-agent", SDK_METADATA.userAgent);
headers$.set("Accept", "image/png");
const accept = options?.acceptHeaderOverride || "application/json;q=1, image/png;q=0";
headers$.set("Accept", accept);
const payload$ = schemas$.parse( const payload$ = schemas$.parse(
input, input,
@@ -271,7 +261,11 @@ export class QRCodes extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
} }

View File

@@ -250,7 +250,11 @@ export class Tags extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
@@ -474,7 +478,11 @@ export class Tags extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
} }

View File

@@ -236,7 +236,11 @@ export class Workspaces extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
@@ -450,7 +454,11 @@ export class Workspaces extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
@@ -667,7 +675,11 @@ export class Workspaces extends ClientSDK {
throw result; throw result;
} else { } else {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError(
"Unexpected API response status or content-type",
response,
responseBody
);
} }
} }
} }