@doist/comms-sdk 0.4.4 → 0.4.5
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.
|
@@ -23,10 +23,6 @@ class CommentsClient extends base_client_1.BaseClient {
|
|
|
23
23
|
this.commentListSchema = this.linkBaseUrl
|
|
24
24
|
? zod_1.z.array(this.commentSchema)
|
|
25
25
|
: exports.CommentListSchema;
|
|
26
|
-
// `getone` wraps the comment in `{ comment: ... }`; built once per client.
|
|
27
|
-
this.wrappedCommentSchema = zod_1.z
|
|
28
|
-
.object({ comment: this.commentSchema })
|
|
29
|
-
.transform((data) => data.comment);
|
|
30
26
|
}
|
|
31
27
|
/**
|
|
32
28
|
* Gets all comments for a thread. `newerThan` / `olderThan` (`Date`) are
|
|
@@ -67,7 +63,8 @@ class CommentsClient extends base_client_1.BaseClient {
|
|
|
67
63
|
}).then((response) => this.commentListSchema.parse(response.data));
|
|
68
64
|
}
|
|
69
65
|
/**
|
|
70
|
-
* Gets a single comment object by id. The
|
|
66
|
+
* Gets a single comment object by id. The `getone` endpoint returns the
|
|
67
|
+
* comment object directly (the same shape as `add`), not wrapped.
|
|
71
68
|
*
|
|
72
69
|
* @param id - The comment ID.
|
|
73
70
|
* @returns The comment object.
|
|
@@ -80,7 +77,7 @@ class CommentsClient extends base_client_1.BaseClient {
|
|
|
80
77
|
apiToken: this.apiToken,
|
|
81
78
|
payload: { id },
|
|
82
79
|
customFetch: this.customFetch,
|
|
83
|
-
}).then((response) => this.
|
|
80
|
+
}).then((response) => this.commentSchema.parse(response.data));
|
|
84
81
|
}
|
|
85
82
|
/**
|
|
86
83
|
* Creates a new comment on a thread. `id` is auto-generated if not supplied.
|
|
@@ -20,10 +20,6 @@ export class CommentsClient extends BaseClient {
|
|
|
20
20
|
this.commentListSchema = this.linkBaseUrl
|
|
21
21
|
? z.array(this.commentSchema)
|
|
22
22
|
: CommentListSchema;
|
|
23
|
-
// `getone` wraps the comment in `{ comment: ... }`; built once per client.
|
|
24
|
-
this.wrappedCommentSchema = z
|
|
25
|
-
.object({ comment: this.commentSchema })
|
|
26
|
-
.transform((data) => data.comment);
|
|
27
23
|
}
|
|
28
24
|
/**
|
|
29
25
|
* Gets all comments for a thread. `newerThan` / `olderThan` (`Date`) are
|
|
@@ -64,7 +60,8 @@ export class CommentsClient extends BaseClient {
|
|
|
64
60
|
}).then((response) => this.commentListSchema.parse(response.data));
|
|
65
61
|
}
|
|
66
62
|
/**
|
|
67
|
-
* Gets a single comment object by id. The
|
|
63
|
+
* Gets a single comment object by id. The `getone` endpoint returns the
|
|
64
|
+
* comment object directly (the same shape as `add`), not wrapped.
|
|
68
65
|
*
|
|
69
66
|
* @param id - The comment ID.
|
|
70
67
|
* @returns The comment object.
|
|
@@ -77,7 +74,7 @@ export class CommentsClient extends BaseClient {
|
|
|
77
74
|
apiToken: this.apiToken,
|
|
78
75
|
payload: { id },
|
|
79
76
|
customFetch: this.customFetch,
|
|
80
|
-
}).then((response) => this.
|
|
77
|
+
}).then((response) => this.commentSchema.parse(response.data));
|
|
81
78
|
}
|
|
82
79
|
/**
|
|
83
80
|
* Creates a new comment on a thread. `id` is auto-generated if not supplied.
|
|
@@ -137,7 +137,6 @@ export declare class CommentsClient extends BaseClient {
|
|
|
137
137
|
private readonly linkBaseUrl;
|
|
138
138
|
private readonly commentSchema;
|
|
139
139
|
private readonly commentListSchema;
|
|
140
|
-
private readonly wrappedCommentSchema;
|
|
141
140
|
/**
|
|
142
141
|
* Gets all comments for a thread. `newerThan` / `olderThan` (`Date`) are
|
|
143
142
|
* converted to `newer_than_ts` / `older_than_ts` epoch seconds on the
|
|
@@ -161,7 +160,8 @@ export declare class CommentsClient extends BaseClient {
|
|
|
161
160
|
*/
|
|
162
161
|
getComments(args: GetCommentsArgs): Promise<Comment[]>;
|
|
163
162
|
/**
|
|
164
|
-
* Gets a single comment object by id. The
|
|
163
|
+
* Gets a single comment object by id. The `getone` endpoint returns the
|
|
164
|
+
* comment object directly (the same shape as `add`), not wrapped.
|
|
165
165
|
*
|
|
166
166
|
* @param id - The comment ID.
|
|
167
167
|
* @returns The comment object.
|