-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathtopicresponsedto.ts
More file actions
96 lines (88 loc) · 2.12 KB
/
topicresponsedto.ts
File metadata and controls
96 lines (88 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { remap as remap$ } from "../../lib/primitives.js";
import { NovuError } from "./novuerror.js";
export type TopicResponseDtoData = {
/**
* The identifier of the topic
*/
id: string;
/**
* The unique key of the topic
*/
key: string;
/**
* The name of the topic
*/
name?: string | undefined;
/**
* The date the topic was created
*/
createdAt?: string | undefined;
/**
* The date the topic was last updated
*/
updatedAt?: string | undefined;
};
export class TopicResponseDto extends NovuError {
/**
* The identifier of the topic
*/
id: string;
/**
* The unique key of the topic
*/
key: string;
/**
* The date the topic was created
*/
createdAt?: string | undefined;
/**
* The date the topic was last updated
*/
updatedAt?: string | undefined;
/** The original data that was passed to this error instance. */
data$: TopicResponseDtoData;
constructor(
err: TopicResponseDtoData,
httpMeta: { response: Response; request: Request; body: string },
) {
const message = "message" in err && typeof err.message === "string"
? err.message
: `API error occurred: ${JSON.stringify(err)}`;
super(message, httpMeta);
this.data$ = err;
this.id = err.id;
this.key = err.key;
if (err.createdAt != null) this.createdAt = err.createdAt;
if (err.updatedAt != null) this.updatedAt = err.updatedAt;
this.name = "TopicResponseDto";
}
}
/** @internal */
export const TopicResponseDto$inboundSchema: z.ZodType<
TopicResponseDto,
z.ZodTypeDef,
unknown
> = z.object({
_id: z.string(),
key: z.string(),
name: z.string().optional(),
createdAt: z.string().optional(),
updatedAt: z.string().optional(),
request$: z.instanceof(Request),
response$: z.instanceof(Response),
body$: z.string(),
})
.transform((v) => {
const remapped = remap$(v, {
"_id": "id",
});
return new TopicResponseDto(remapped, {
request: v.request$,
response: v.response$,
body: v.body$,
});
});