dub 0.22.1 → 0.22.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/.speakeasy/gen.lock +14 -5
  2. package/.speakeasy/gen.yaml +1 -1
  3. package/README.md +36 -32
  4. package/docs/sdks/analytics/README.md +60 -60
  5. package/docs/sdks/links/README.md +45 -51
  6. package/docs/sdks/metatags/README.md +50 -0
  7. package/docs/sdks/qrcodes/README.md +6 -6
  8. package/docs/sdks/tags/README.md +12 -12
  9. package/docs/sdks/workspaces/README.md +18 -18
  10. package/lib/config.d.ts +3 -3
  11. package/lib/config.js +3 -3
  12. package/models/components/linkschema.d.ts +769 -5
  13. package/models/components/linkschema.d.ts.map +1 -1
  14. package/models/components/linkschema.js +1021 -3
  15. package/models/components/linkschema.js.map +1 -1
  16. package/models/operations/bulkcreatelinks.d.ts +1543 -29
  17. package/models/operations/bulkcreatelinks.d.ts.map +1 -1
  18. package/models/operations/bulkcreatelinks.js +1037 -19
  19. package/models/operations/bulkcreatelinks.js.map +1 -1
  20. package/models/operations/createlink.d.ts +1543 -29
  21. package/models/operations/createlink.d.ts.map +1 -1
  22. package/models/operations/createlink.js +1037 -19
  23. package/models/operations/createlink.js.map +1 -1
  24. package/models/operations/editlink.d.ts +1543 -29
  25. package/models/operations/editlink.d.ts.map +1 -1
  26. package/models/operations/editlink.js +1037 -19
  27. package/models/operations/editlink.js.map +1 -1
  28. package/models/operations/getlinks.d.ts +1 -1
  29. package/models/operations/getlinkscount.d.ts +1 -1
  30. package/models/operations/getmetatags.d.ts +48 -0
  31. package/models/operations/getmetatags.d.ts.map +1 -0
  32. package/models/operations/getmetatags.js +83 -0
  33. package/models/operations/getmetatags.js.map +1 -0
  34. package/models/operations/index.d.ts +1 -0
  35. package/models/operations/index.d.ts.map +1 -1
  36. package/models/operations/index.js +1 -0
  37. package/models/operations/index.js.map +1 -1
  38. package/package.json +1 -1
  39. package/sdk/metatags.d.ts +15 -0
  40. package/sdk/metatags.d.ts.map +1 -0
  41. package/sdk/metatags.js +117 -0
  42. package/sdk/metatags.js.map +1 -0
  43. package/sdk/sdk.d.ts +3 -0
  44. package/sdk/sdk.d.ts.map +1 -1
  45. package/sdk/sdk.js +5 -0
  46. package/sdk/sdk.js.map +1 -1
  47. package/src/lib/config.ts +3 -3
  48. package/src/models/components/linkschema.ts +1788 -7
  49. package/src/models/operations/bulkcreatelinks.ts +2578 -47
  50. package/src/models/operations/createlink.ts +2578 -47
  51. package/src/models/operations/editlink.ts +2578 -47
  52. package/src/models/operations/getlinks.ts +1 -1
  53. package/src/models/operations/getlinkscount.ts +1 -1
  54. package/src/models/operations/getmetatags.ts +101 -0
  55. package/src/models/operations/index.ts +1 -0
  56. package/src/sdk/metatags.ts +115 -0
  57. package/src/sdk/sdk.ts +6 -0
@@ -28,7 +28,7 @@ export type GetLinksRequest = {
28
28
  */
29
29
  domain?: string | undefined;
30
30
  /**
31
- * [DEPRECATED] (use tagIds instead): The tag ID to filter the links by.
31
+ * The tag ID to filter the links by. This field is deprecated – use `tagIds` instead.
32
32
  */
33
33
  tagId?: string | undefined;
34
34
  /**
@@ -30,7 +30,7 @@ export type GetLinksCountRequest = {
30
30
  */
31
31
  domain?: string | undefined;
32
32
  /**
33
- * [DEPRECATED] (use tagIds instead): The tag ID to filter the links by.
33
+ * The tag ID to filter the links by. This field is deprecated – use `tagIds` instead.
34
34
  */
35
35
  tagId?: string | undefined;
36
36
  /**
@@ -0,0 +1,101 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+
7
+ export type GetMetatagsRequest = {
8
+ url: string;
9
+ };
10
+
11
+ /**
12
+ * The retrieved metatags
13
+ */
14
+ export type GetMetatagsResponseBody = {
15
+ /**
16
+ * The meta title tag for the URL
17
+ */
18
+ title?: string | undefined;
19
+ /**
20
+ * The meta description tag for the URL
21
+ */
22
+ description?: string | undefined;
23
+ /**
24
+ * The OpenGraph image for the URL
25
+ */
26
+ image?: string | undefined;
27
+ };
28
+
29
+ /** @internal */
30
+ export namespace GetMetatagsRequest$ {
31
+ export type Inbound = {
32
+ url: string;
33
+ };
34
+
35
+ export const inboundSchema: z.ZodType<GetMetatagsRequest, z.ZodTypeDef, Inbound> = z
36
+ .object({
37
+ url: z.string(),
38
+ })
39
+ .transform((v) => {
40
+ return {
41
+ url: v.url,
42
+ };
43
+ });
44
+
45
+ export type Outbound = {
46
+ url: string;
47
+ };
48
+
49
+ export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetMetatagsRequest> = z
50
+ .object({
51
+ url: z.string(),
52
+ })
53
+ .transform((v) => {
54
+ return {
55
+ url: v.url,
56
+ };
57
+ });
58
+ }
59
+
60
+ /** @internal */
61
+ export namespace GetMetatagsResponseBody$ {
62
+ export type Inbound = {
63
+ title?: string | undefined;
64
+ description?: string | undefined;
65
+ image?: string | undefined;
66
+ };
67
+
68
+ export const inboundSchema: z.ZodType<GetMetatagsResponseBody, z.ZodTypeDef, Inbound> = z
69
+ .object({
70
+ title: z.string().optional(),
71
+ description: z.string().optional(),
72
+ image: z.string().optional(),
73
+ })
74
+ .transform((v) => {
75
+ return {
76
+ ...(v.title === undefined ? null : { title: v.title }),
77
+ ...(v.description === undefined ? null : { description: v.description }),
78
+ ...(v.image === undefined ? null : { image: v.image }),
79
+ };
80
+ });
81
+
82
+ export type Outbound = {
83
+ title?: string | undefined;
84
+ description?: string | undefined;
85
+ image?: string | undefined;
86
+ };
87
+
88
+ export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetMetatagsResponseBody> = z
89
+ .object({
90
+ title: z.string().optional(),
91
+ description: z.string().optional(),
92
+ image: z.string().optional(),
93
+ })
94
+ .transform((v) => {
95
+ return {
96
+ ...(v.title === undefined ? null : { title: v.title }),
97
+ ...(v.description === undefined ? null : { description: v.description }),
98
+ ...(v.image === undefined ? null : { image: v.image }),
99
+ };
100
+ });
101
+ }
@@ -16,6 +16,7 @@ export * from "./getdeviceanalytics";
16
16
  export * from "./getlinkinfo";
17
17
  export * from "./getlinks";
18
18
  export * from "./getlinkscount";
19
+ export * from "./getmetatags";
19
20
  export * from "./getosanalytics";
20
21
  export * from "./getqrcode";
21
22
  export * from "./getrefereranalytics";
@@ -0,0 +1,115 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
3
+ */
4
+
5
+ import { SDKHooks } from "../hooks";
6
+ import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config";
7
+ import * as enc$ from "../lib/encodings";
8
+ import { HTTPClient } from "../lib/http";
9
+ import * as schemas$ from "../lib/schemas";
10
+ import { ClientSDK, RequestOptions } from "../lib/sdks";
11
+ import * as errors from "../models/errors";
12
+ import * as operations from "../models/operations";
13
+
14
+ export class Metatags extends ClientSDK {
15
+ private readonly options$: SDKOptions & { hooks?: SDKHooks };
16
+
17
+ constructor(options: SDKOptions = {}) {
18
+ const opt = options as unknown;
19
+ let hooks: SDKHooks;
20
+ if (
21
+ typeof opt === "object" &&
22
+ opt != null &&
23
+ "hooks" in opt &&
24
+ opt.hooks instanceof SDKHooks
25
+ ) {
26
+ hooks = opt.hooks;
27
+ } else {
28
+ hooks = new SDKHooks();
29
+ }
30
+
31
+ super({
32
+ client: options.httpClient || new HTTPClient(),
33
+ baseURL: serverURLFromOptions(options),
34
+ hooks,
35
+ });
36
+
37
+ this.options$ = { ...options, hooks };
38
+ void this.options$;
39
+ }
40
+
41
+ /**
42
+ * Retrieve the metatags for a URL
43
+ *
44
+ * @remarks
45
+ * Retrieve the metatags for a URL
46
+ */
47
+ async get(
48
+ input: operations.GetMetatagsRequest,
49
+ options?: RequestOptions
50
+ ): Promise<operations.GetMetatagsResponseBody> {
51
+ const headers$ = new Headers();
52
+ headers$.set("user-agent", SDK_METADATA.userAgent);
53
+ headers$.set("Accept", "application/json");
54
+
55
+ const payload$ = schemas$.parse(
56
+ input,
57
+ (value$) => operations.GetMetatagsRequest$.outboundSchema.parse(value$),
58
+ "Input validation failed"
59
+ );
60
+ const body$ = null;
61
+
62
+ const path$ = this.templateURLComponent("/metatags")();
63
+
64
+ const query$ = [
65
+ enc$.encodeForm("url", payload$.url, { explode: true, charEncoding: "percent" }),
66
+ ]
67
+ .filter(Boolean)
68
+ .join("&");
69
+
70
+ let security$;
71
+ if (typeof this.options$.token === "function") {
72
+ security$ = { token: await this.options$.token() };
73
+ } else if (this.options$.token) {
74
+ security$ = { token: this.options$.token };
75
+ } else {
76
+ security$ = {};
77
+ }
78
+ const context = {
79
+ operationID: "getMetatags",
80
+ oAuth2Scopes: [],
81
+ securitySource: this.options$.token,
82
+ };
83
+ const securitySettings$ = this.resolveGlobalSecurity(security$);
84
+
85
+ const doOptions = { context, errorCodes: ["4XX", "5XX"] };
86
+ const request = this.createRequest$(
87
+ {
88
+ security: securitySettings$,
89
+ method: "GET",
90
+ path: path$,
91
+ headers: headers$,
92
+ query: query$,
93
+ body: body$,
94
+ },
95
+ options
96
+ );
97
+
98
+ const response = await this.do$(request, doOptions);
99
+
100
+ if (this.matchResponse(response, 200, "application/json")) {
101
+ const responseBody = await response.json();
102
+ const result = schemas$.parse(
103
+ responseBody,
104
+ (val$) => {
105
+ return operations.GetMetatagsResponseBody$.inboundSchema.parse(val$);
106
+ },
107
+ "Response validation failed"
108
+ );
109
+ return result;
110
+ } else {
111
+ const responseBody = await response.text();
112
+ throw new errors.SDKError("Unexpected API response", response, responseBody);
113
+ }
114
+ }
115
+ }
package/src/sdk/sdk.ts CHANGED
@@ -8,6 +8,7 @@ import { HTTPClient } from "../lib/http";
8
8
  import { ClientSDK } from "../lib/sdks";
9
9
  import { Analytics } from "./analytics";
10
10
  import { Links } from "./links";
11
+ import { Metatags } from "./metatags";
11
12
  import { QRCodes } from "./qrcodes";
12
13
  import { Tags } from "./tags";
13
14
  import { Workspaces } from "./workspaces";
@@ -63,4 +64,9 @@ export class Dub extends ClientSDK {
63
64
  get tags() {
64
65
  return (this._tags ??= new Tags(this.options$));
65
66
  }
67
+
68
+ private _metatags?: Metatags;
69
+ get metatags() {
70
+ return (this._metatags ??= new Metatags(this.options$));
71
+ }
66
72
  }