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
id: f28179cc-ef59-426d-9e85-60cec22fc642
management:
docChecksum: 0008b3cde645369b98ab1f75381bb11a
docChecksum: 1504d2d6c3f4514d30a37a76c74a48a5
docVersion: 0.0.1
speakeasyVersion: 1.276.0
generationVersion: 2.314.0
releaseVersion: 0.25.2
configChecksum: a717018481b6fdc4d6146485565263e5
speakeasyVersion: 1.277.4
generationVersion: 2.318.3
releaseVersion: 0.26.0
configChecksum: 640563cb2897eac551ae0d2397065a1c
repoURL: https://github.com/dubinc/dub-node.git
installationURL: https://github.com/dubinc/dub-node
published: true
features:
typescript:
acceptHeaders: 2.81.1
constsAndDefaults: 0.1.5
core: 3.9.0
core: 3.9.2
deprecations: 2.81.1
examples: 2.81.3
flattening: 2.81.1

View File

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

View File

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

View File

@@ -207,3 +207,13 @@ Based on:
- [typescript v0.25.2] .
### Releases
- [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();
- target: $["paths"]["/analytics/city"]["get"]
- target: $["paths"]["/analytics/timeseries"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "getCityAnalytics"
"label": "getTimeseriesAnalytics"
"source": |-
import { Dub } from "dub";
@@ -38,7 +38,80 @@ actions:
});
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
console.log(result)
@@ -86,168 +159,6 @@ actions:
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();
- target: $["paths"]["/workspaces/{idOrSlug}"]["get"]
update:
@@ -272,11 +183,11 @@ actions:
}
run();
- target: $["paths"]["/tags"]["get"]
- target: $["paths"]["/analytics/top_links"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "getTags"
"label": "getTopLinks"
"source": |-
import { Dub } from "dub";
@@ -286,49 +197,7 @@ actions:
});
async function run() {
const result = await dub.list({});
// 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();
const result = await dub.topLinks({});
// Handle the result
console.log(result)
@@ -341,17 +210,11 @@ actions:
- "lang": "typescript"
"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();"
- target: $["paths"]["/domains/{slug}/primary"]["post"]
- target: $["paths"]["/analytics/country"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"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 \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"
"label": "getCountryAnalytics"
"source": |-
import { Dub } from "dub";
@@ -361,8 +224,29 @@ actions:
});
async function run() {
const result = await dub.get({
url: "https://dub.co",
const result = await dub.countries({});
// 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
@@ -370,12 +254,33 @@ actions:
}
run();
- target: $["paths"]["/domains/{slug}"]["patch"]
- target: $["paths"]["/domains/{slug}/primary"]["post"]
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();"
"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 \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"]
update:
"x-codeSamples":
@@ -398,6 +303,35 @@ actions:
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();
- target: $["paths"]["/links/count"]["get"]
update:
@@ -420,17 +354,11 @@ actions:
}
run();
- target: $["paths"]["/links/{linkId}"]["delete"]
- target: $["paths"]["/links/info"]["get"]
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"]["/qr"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "getQRCode"
"label": "getLinkInfo"
"source": |-
import { Dub } from "dub";
@@ -447,11 +375,11 @@ actions:
}
run();
- target: $["paths"]["/analytics/referer"]["get"]
- target: $["paths"]["/analytics/os"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "getRefererAnalytics"
"label": "getOSAnalytics"
"source": |-
import { Dub } from "dub";
@@ -461,51 +389,7 @@ actions:
});
async function run() {
const result = await dub.referers({});
// 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>",
});
const result = await dub.os({});
// Handle the result
console.log(result)
@@ -536,11 +420,11 @@ actions:
}
run();
- target: $["paths"]["/analytics/os"]["get"]
- target: $["paths"]["/tags"]["get"]
update:
"x-codeSamples":
- "lang": "typescript"
"label": "getOSAnalytics"
"label": "getTags"
"source": |-
import { Dub } from "dub";
@@ -550,7 +434,7 @@ actions:
});
async function run() {
const result = await dub.os({});
const result = await dub.list({});
// Handle the result
console.log(result)
@@ -563,3 +447,116 @@ actions:
- "lang": "typescript"
"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();"
- 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. |
| `url` | *string* | :heavy_check_mark: | The destination URL of the short link. |
| `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. |
| `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. |

View File

@@ -3,7 +3,9 @@
## Fields
| Field | Type | Required | Description |
| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| `domain` | *string* | :heavy_check_mark: | N/A |
| `key` | *string* | :heavy_check_mark: | The key of the link to retrieve. E.g. for `d.to/github`, the key is `github`. |
| Field | Type | Required | Description | Example |
| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| `domain` | *string* | :heavy_minus_sign: | N/A | |
| `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
Retrieve the info for a link from their domain and key.
Retrieve the info for a link.
### Example Usage
@@ -181,10 +181,7 @@ const dub = new Dub({
});
async function run() {
const result = await dub.links.get({
domain: "ringed-blow.name",
key: "<key>",
});
const result = await dub.links.get({});
// Handle the result
console.log(result)

View File

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

4
package-lock.json generated
View File

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

View File

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

View File

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

View File

@@ -141,29 +141,56 @@ export class HTTPClient {
}
}
export function matchContentType(response: Response, pattern: string): boolean {
if (pattern === "*" || pattern === "*/*") {
// A semicolon surrounded by optional whitespace characters is used to separate
// 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;
}
const contentType =
response.headers.get("content-type") ?? "application/octet-stream";
let contentType =
response.headers.get("content-type")?.trim() || "application/octet-stream";
contentType = contentType.toLowerCase();
const idx = contentType.split(";").findIndex((raw) => {
const ctype = raw.trim();
if (ctype === pattern) {
return true;
}
const wantParts = pattern.toLowerCase().trim().split(mediaParamSeparator);
const [wantType = "", ...wantParams] = wantParts;
const parts = ctype.split("/");
if (parts.length !== 2) {
if (wantType.split("/").length !== 2) {
return false;
}
return `${parts[0]}/*` === pattern || `*/${parts[1]}` === pattern;
});
const gotParts = contentType.split(mediaParamSeparator);
const [gotType = "", ...gotParams] = gotParts;
return idx >= 0;
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 true;
}
const codeRangeRE = new RegExp("^[0-9]xx$", "i");

View File

@@ -68,7 +68,7 @@ type SecurityInputOAuth2 = {
type SecurityInputOAuth2ClientCredentials = {
type: "oauth2:client_credentials";
value: string | null | undefined;
fieldName: "clientID" | "clientSecret";
fieldName: string;
};
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.
*/
expiresAt: Date | null;
expiresAt: string | null;
/**
* The URL to redirect to when the short link has expired.
*/
@@ -1981,12 +1981,7 @@ export namespace LinkSchema$ {
externalId: z.nullable(z.string()),
url: z.string(),
archived: z.boolean().default(false),
expiresAt: z.nullable(
z
.string()
.datetime({ offset: true })
.transform((v) => new Date(v))
),
expiresAt: z.nullable(z.string()),
expiredUrl: z.nullable(z.string()),
password: z.nullable(z.string()),
proxy: z.boolean().default(false),
@@ -2102,7 +2097,7 @@ export namespace LinkSchema$ {
externalId: z.nullable(z.string()),
url: z.string(),
archived: z.boolean().default(false),
expiresAt: z.nullable(z.date().transform((v) => v.toISOString())),
expiresAt: z.nullable(z.string()),
expiredUrl: z.nullable(z.string()),
password: z.nullable(z.string()),
proxy: z.boolean().default(false),

View File

@@ -4,6 +4,7 @@
export class SDKError extends Error {
public readonly statusCode: number;
public readonly contentType: string;
constructor(
message: string,
@@ -11,11 +12,13 @@ export class SDKError extends Error {
public readonly body: string = ""
) {
const statusCode = rawResponse.status;
const contentType = rawResponse.headers.get("content-type") || "";
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.contentType = contentType;
this.name = "SDKError";
}

View File

@@ -5,46 +5,66 @@
import * as z from "zod";
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`.
*/
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 */
export namespace GetLinkInfoRequest$ {
export type Inbound = {
domain: string;
key: string;
domain?: string | undefined;
key?: string | undefined;
linkId?: string | undefined;
externalId?: string | undefined;
};
export const inboundSchema: z.ZodType<GetLinkInfoRequest, z.ZodTypeDef, Inbound> = z
.object({
domain: z.string(),
key: z.string(),
domain: z.string().optional(),
key: z.string().optional(),
linkId: z.string().optional(),
externalId: z.string().optional(),
})
.transform((v) => {
return {
domain: v.domain,
key: v.key,
...(v.domain === undefined ? null : { domain: v.domain }),
...(v.key === undefined ? null : { key: v.key }),
...(v.linkId === undefined ? null : { linkId: v.linkId }),
...(v.externalId === undefined ? null : { externalId: v.externalId }),
};
});
export type Outbound = {
domain: string;
key: string;
domain?: string | undefined;
key?: string | undefined;
linkId?: string | undefined;
externalId?: string | undefined;
};
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetLinkInfoRequest> = z
.object({
domain: z.string(),
key: z.string(),
domain: z.string().optional(),
key: z.string().optional(),
linkId: z.string().optional(),
externalId: z.string().optional(),
})
.transform((v) => {
return {
domain: v.domain,
key: v.key,
...(v.domain === undefined ? null : { domain: v.domain }),
...(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;
} else {
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;
} else {
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;
} else {
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;
} else {
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;
} else {
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;
} else {
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;
} else {
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;
} else {
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;
} else {
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;
} else {
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;
} else {
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;
} else {
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;
} else {
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;
} else {
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;
} else {
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;
} else {
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;
} else {
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;
} else {
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;
} else {
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
*
* @remarks
* Retrieve the info for a link from their domain and key.
* Retrieve the info for a link.
*/
async get(
input: operations.GetLinkInfoRequest,
@@ -770,7 +782,12 @@ export class Links extends ClientSDK {
const query$ = [
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("linkId", payload$.linkId, { explode: true, charEncoding: "percent" }),
enc$.encodeForm("projectSlug", this.options$.projectSlug, {
explode: true,
charEncoding: "percent",
@@ -965,7 +982,11 @@ export class Links extends ClientSDK {
throw result;
} else {
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;
} else {
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;
} else {
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;
} else {
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;
} else {
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 z from "zod";
export enum GetAcceptEnum {
applicationJson = "application/json",
imagePng = "image/png",
}
export class QRCodes extends ClientSDK {
private readonly options$: SDKOptions & { hooks?: SDKHooks };
@@ -50,15 +45,10 @@ export class QRCodes extends ClientSDK {
* @remarks
* Retrieve a QR code for a link.
*/
async get(
input: operations.GetQRCodeRequest,
options?: RequestOptions & { acceptHeaderOverride?: GetAcceptEnum }
): Promise<string> {
async get(input: operations.GetQRCodeRequest, options?: RequestOptions): Promise<string> {
const headers$ = new Headers();
headers$.set("user-agent", SDK_METADATA.userAgent);
const accept = options?.acceptHeaderOverride || "application/json;q=1, image/png;q=0";
headers$.set("Accept", accept);
headers$.set("Accept", "image/png");
const payload$ = schemas$.parse(
input,
@@ -271,7 +261,11 @@ export class QRCodes extends ClientSDK {
throw result;
} else {
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;
} else {
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;
} else {
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;
} else {
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;
} else {
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;
} else {
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
);
}
}
}