@lokalise/chatter-api-contracts 0.0.0-stage → 0.1.0

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 (66) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +28 -2
  3. package/dist/api/contracts/comments/delete-comment-reply.d.ts +62 -0
  4. package/dist/api/contracts/comments/delete-comment-reply.js +32 -0
  5. package/dist/api/contracts/comments/delete-comment-reply.js.map +1 -0
  6. package/dist/api/contracts/comments/delete-comment.d.ts +59 -0
  7. package/dist/api/contracts/comments/delete-comment.js +31 -0
  8. package/dist/api/contracts/comments/delete-comment.js.map +1 -0
  9. package/dist/api/contracts/comments/get-comment-replies.d.ts +137 -0
  10. package/dist/api/contracts/comments/get-comment-replies.js +61 -0
  11. package/dist/api/contracts/comments/get-comment-replies.js.map +1 -0
  12. package/dist/api/contracts/comments/get-comments.d.ts +70 -0
  13. package/dist/api/contracts/comments/get-comments.js +40 -0
  14. package/dist/api/contracts/comments/get-comments.js.map +1 -0
  15. package/dist/api/contracts/comments/patch-comment-reply.d.ts +153 -0
  16. package/dist/api/contracts/comments/patch-comment-reply.js +41 -0
  17. package/dist/api/contracts/comments/patch-comment-reply.js.map +1 -0
  18. package/dist/api/contracts/comments/patch-comment.d.ts +188 -0
  19. package/dist/api/contracts/comments/patch-comment.js +49 -0
  20. package/dist/api/contracts/comments/patch-comment.js.map +1 -0
  21. package/dist/api/contracts/comments/post-comment-reply.d.ts +150 -0
  22. package/dist/api/contracts/comments/post-comment-reply.js +40 -0
  23. package/dist/api/contracts/comments/post-comment-reply.js.map +1 -0
  24. package/dist/api/contracts/comments/post-comment.d.ts +177 -0
  25. package/dist/api/contracts/comments/post-comment.js +48 -0
  26. package/dist/api/contracts/comments/post-comment.js.map +1 -0
  27. package/dist/api/contracts/comments/post-comments-actions-search.d.ts +166 -0
  28. package/dist/api/contracts/comments/post-comments-actions-search.js +65 -0
  29. package/dist/api/contracts/comments/post-comments-actions-search.js.map +1 -0
  30. package/dist/api/contracts/comments/put-comment-read-state.d.ts +66 -0
  31. package/dist/api/contracts/comments/put-comment-read-state.js +45 -0
  32. package/dist/api/contracts/comments/put-comment-read-state.js.map +1 -0
  33. package/dist/api/contracts/comments/put-comment-subscription.d.ts +77 -0
  34. package/dist/api/contracts/comments/put-comment-subscription.js +43 -0
  35. package/dist/api/contracts/comments/put-comment-subscription.js.map +1 -0
  36. package/dist/api/contracts/common.d.ts +10 -0
  37. package/dist/api/contracts/common.js +11 -0
  38. package/dist/api/contracts/common.js.map +1 -0
  39. package/dist/api/contracts/index.d.ts +11 -0
  40. package/dist/api/contracts/index.js +12 -0
  41. package/dist/api/contracts/index.js.map +1 -0
  42. package/dist/api/errors/index.d.ts +1 -0
  43. package/dist/api/errors/index.js +2 -0
  44. package/dist/api/errors/index.js.map +1 -0
  45. package/dist/api/errors/team-access-denied.d.ts +10 -0
  46. package/dist/api/errors/team-access-denied.js +7 -0
  47. package/dist/api/errors/team-access-denied.js.map +1 -0
  48. package/dist/api/objects/comment-reply.d.ts +26 -0
  49. package/dist/api/objects/comment-reply.js +16 -0
  50. package/dist/api/objects/comment-reply.js.map +1 -0
  51. package/dist/api/objects/comment.d.ts +50 -0
  52. package/dist/api/objects/comment.js +47 -0
  53. package/dist/api/objects/comment.js.map +1 -0
  54. package/dist/api/objects/index.d.ts +3 -0
  55. package/dist/api/objects/index.js +4 -0
  56. package/dist/api/objects/index.js.map +1 -0
  57. package/dist/api/objects/message.d.ts +47 -0
  58. package/dist/api/objects/message.js +57 -0
  59. package/dist/api/objects/message.js.map +1 -0
  60. package/dist/api/open-api-tags.d.ts +17 -0
  61. package/dist/api/open-api-tags.js +18 -0
  62. package/dist/api/open-api-tags.js.map +1 -0
  63. package/dist/index.d.ts +4 -0
  64. package/dist/index.js +5 -0
  65. package/dist/index.js.map +1 -0
  66. package/package.json +45 -3
@@ -0,0 +1,70 @@
1
+ import z from 'zod/v4';
2
+ declare const GET_COMMENTS_PATH_PARAMS_SCHEMA: z.ZodObject<{
3
+ teamId: z.ZodUUID;
4
+ }, z.core.$strip>;
5
+ export type GetCommentsPathParams = z.infer<typeof GET_COMMENTS_PATH_PARAMS_SCHEMA>;
6
+ declare const GET_COMMENTS_QUERY_SCHEMA: z.ZodObject<{
7
+ 'filter-projectId': z.ZodUUID;
8
+ 'filter-entityType': z.ZodEnum<{
9
+ readonly SEGMENT: 'SEGMENT';
10
+ }>;
11
+ }, z.core.$strip>;
12
+ export type GetCommentsQuery = z.infer<typeof GET_COMMENTS_QUERY_SCHEMA>;
13
+ export declare const getCommentsContract: Omit<{
14
+ readonly method: "get";
15
+ readonly visibility: "internal";
16
+ readonly summary: "Subscribe to comments";
17
+ readonly description: "Streams live comment changes of a project as Server-Sent Events.";
18
+ readonly tags: readonly ["Comments"];
19
+ readonly requestHeaderSchema: z.ZodObject<{
20
+ authorization: z.ZodString;
21
+ }, z.core.$strip>;
22
+ readonly requestPathParamsSchema: z.ZodObject<{
23
+ teamId: z.ZodUUID;
24
+ }, z.core.$strip>;
25
+ readonly requestQuerySchema: z.ZodObject<{
26
+ 'filter-projectId': z.ZodUUID;
27
+ 'filter-entityType': z.ZodEnum<{
28
+ readonly SEGMENT: 'SEGMENT';
29
+ }>;
30
+ }, z.core.$strip>;
31
+ readonly pathResolver: ({ teamId }: {
32
+ teamId: string;
33
+ }) => `/v1/teams/${string}/comments`;
34
+ readonly responsesByStatusCode: {
35
+ 200: {
36
+ readonly content: {
37
+ readonly 'text/event-stream': import("@lokalise/api-contracts").SseBody<{
38
+ 'comment.created': z.ZodObject<{}, z.core.$strip>;
39
+ }>;
40
+ };
41
+ readonly description?: string | undefined;
42
+ };
43
+ 400: z.ZodObject<{
44
+ message: z.ZodString;
45
+ code: z.ZodString;
46
+ errorCode: z.ZodString;
47
+ details: z.ZodOptional<z.ZodUnknown>;
48
+ }, z.core.$strip>;
49
+ 401: z.ZodObject<{
50
+ message: z.ZodString;
51
+ code: z.ZodString;
52
+ errorCode: z.ZodString;
53
+ details: z.ZodOptional<z.ZodUnknown>;
54
+ }, z.core.$strip>;
55
+ 403: z.ZodObject<{
56
+ message: z.ZodString;
57
+ code: z.ZodLiteral<"TEAM_ACCESS_DENIED">;
58
+ errorCode: z.ZodLiteral<"TEAM_ACCESS_DENIED">;
59
+ }, z.core.$strip>;
60
+ 500: z.ZodObject<{
61
+ message: z.ZodString;
62
+ code: z.ZodString;
63
+ errorCode: z.ZodString;
64
+ details: z.ZodOptional<z.ZodUnknown>;
65
+ }, z.core.$strip>;
66
+ };
67
+ }, "visibility"> & {
68
+ visibility: import("@lokalise/api-contracts").RouteVisibility;
69
+ };
70
+ export {};
@@ -0,0 +1,40 @@
1
+ import { defineApiContract, sseResponse } from '@lokalise/api-contracts';
2
+ import z from 'zod/v4';
3
+ import { teamAccessDeniedErrorDefinition } from '../../errors/index.js';
4
+ import { CommentEntityTypeEnum } from '../../objects/comment.js';
5
+ import { OpenApiTags } from '../../open-api-tags.js';
6
+ import { AUTH_HEADERS, ERROR_RESPONSE_SCHEMA } from '../common.js';
7
+ // ------------------------------------------------------------
8
+ // GET /v1/teams/:teamId/comments
9
+ // ------------------------------------------------------------
10
+ const GET_COMMENTS_PATH_PARAMS_SCHEMA = z.compile(z.object({
11
+ teamId: z.uuid().describe('Id of the team'),
12
+ }));
13
+ const GET_COMMENTS_QUERY_SCHEMA = z.compile(z.object({
14
+ 'filter-projectId': z.uuid().describe('Only comments of this project'),
15
+ 'filter-entityType': z
16
+ .enum(CommentEntityTypeEnum)
17
+ .describe('Only comments on this type of entity'),
18
+ }));
19
+ export const getCommentsContract = defineApiContract({
20
+ method: 'get',
21
+ visibility: 'internal',
22
+ summary: 'Subscribe to comments',
23
+ description: 'Streams live comment changes of a project as Server-Sent Events.',
24
+ tags: [OpenApiTags.Comments.name],
25
+ requestHeaderSchema: AUTH_HEADERS,
26
+ requestPathParamsSchema: GET_COMMENTS_PATH_PARAMS_SCHEMA,
27
+ requestQuerySchema: GET_COMMENTS_QUERY_SCHEMA,
28
+ pathResolver: ({ teamId }) => `/v1/teams/${teamId}/comments`,
29
+ responsesByStatusCode: {
30
+ 200: sseResponse({
31
+ // TODO: define the events. A route needs at least one
32
+ 'comment.created': z.object({}),
33
+ }),
34
+ 400: ERROR_RESPONSE_SCHEMA,
35
+ 401: ERROR_RESPONSE_SCHEMA,
36
+ 403: teamAccessDeniedErrorDefinition.schema,
37
+ 500: ERROR_RESPONSE_SCHEMA,
38
+ },
39
+ });
40
+ //# sourceMappingURL=get-comments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-comments.js","sourceRoot":"","sources":["../../../../src/api/contracts/comments/get-comments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACxE,OAAO,CAAC,MAAM,QAAQ,CAAA;AACtB,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAA;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAElE,+DAA+D;AAC/D,iCAAiC;AACjC,+DAA+D;AAC/D,MAAM,+BAA+B,GAAG,CAAC,CAAC,OAAO,CAC/C,CAAC,CAAC,MAAM,CAAC;IACP,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;CAC5C,CAAC,CACH,CAAA;AAGD,MAAM,yBAAyB,GAAG,CAAC,CAAC,OAAO,CACzC,CAAC,CAAC,MAAM,CAAC;IACP,kBAAkB,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;IACtE,mBAAmB,EAAE,CAAC;SACnB,IAAI,CAAC,qBAAqB,CAAC;SAC3B,QAAQ,CAAC,sCAAsC,CAAC;CACpD,CAAC,CACH,CAAA;AAGD,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;IACnD,MAAM,EAAE,KAAK;IACb,UAAU,EAAE,UAAU;IACtB,OAAO,EAAE,uBAAuB;IAChC,WAAW,EAAE,kEAAkE;IAC/E,IAAI,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;IACjC,mBAAmB,EAAE,YAAY;IACjC,uBAAuB,EAAE,+BAA+B;IACxD,kBAAkB,EAAE,yBAAyB;IAC7C,YAAY,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,aAAa,MAAM,WAAW;IAC5D,qBAAqB,EAAE;QACrB,GAAG,EAAE,WAAW,CAAC;YACf,sDAAsD;YACtD,iBAAiB,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;SAChC,CAAC;QACF,GAAG,EAAE,qBAAqB;QAC1B,GAAG,EAAE,qBAAqB;QAC1B,GAAG,EAAE,+BAA+B,CAAC,MAAM;QAC3C,GAAG,EAAE,qBAAqB;KAC3B;CACF,CAAC,CAAA"}
@@ -0,0 +1,153 @@
1
+ import z from 'zod/v4';
2
+ declare const PATCH_COMMENT_REPLY_PATH_PARAMS_SCHEMA: z.ZodObject<{
3
+ teamId: z.ZodUUID;
4
+ commentId: z.ZodUUID;
5
+ replyId: z.ZodUUID;
6
+ }, z.core.$strip>;
7
+ export type PatchCommentReplyPathParams = z.infer<typeof PATCH_COMMENT_REPLY_PATH_PARAMS_SCHEMA>;
8
+ declare const PATCH_COMMENT_REPLY_REQUEST_BODY_SCHEMA: z.ZodObject<{
9
+ message: z.ZodObject<{
10
+ version: z.ZodLiteral<1>;
11
+ blocks: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
12
+ type: z.ZodLiteral<"paragraph">;
13
+ content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
14
+ type: z.ZodLiteral<"text">;
15
+ text: z.ZodString;
16
+ }, z.core.$strip>, z.ZodObject<{
17
+ type: z.ZodLiteral<"userMention">;
18
+ userId: z.ZodUUID;
19
+ }, z.core.$strip>, z.ZodObject<{
20
+ type: z.ZodLiteral<"link">;
21
+ href: z.ZodURL;
22
+ text: z.ZodString;
23
+ }, z.core.$strip>], "type">>;
24
+ }, z.core.$strip>], "type">>;
25
+ }, z.core.$strip>;
26
+ }, z.core.$strip>;
27
+ export type PatchCommentReplyRequestBody = z.infer<typeof PATCH_COMMENT_REPLY_REQUEST_BODY_SCHEMA>;
28
+ declare const PATCH_COMMENT_REPLY_RESPONSE_BODY_SCHEMA: z.ZodObject<{
29
+ data: z.ZodObject<{
30
+ id: z.ZodUUID;
31
+ commentId: z.ZodUUID;
32
+ message: z.ZodObject<{
33
+ version: z.ZodLiteral<1>;
34
+ blocks: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
35
+ type: z.ZodLiteral<"paragraph">;
36
+ content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
37
+ type: z.ZodLiteral<"text">;
38
+ text: z.ZodString;
39
+ }, z.core.$strip>, z.ZodObject<{
40
+ type: z.ZodLiteral<"userMention">;
41
+ userId: z.ZodUUID;
42
+ }, z.core.$strip>, z.ZodObject<{
43
+ type: z.ZodLiteral<"link">;
44
+ href: z.ZodURL;
45
+ text: z.ZodString;
46
+ }, z.core.$strip>], "type">>;
47
+ }, z.core.$strip>], "type">>;
48
+ }, z.core.$strip>;
49
+ messageUpdatedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
50
+ createdBy: z.ZodUUID;
51
+ createdAt: z.ZodISODateTime;
52
+ }, z.core.$strip>;
53
+ }, z.core.$strip>;
54
+ export type PatchCommentReplyResponseBody = z.infer<typeof PATCH_COMMENT_REPLY_RESPONSE_BODY_SCHEMA>;
55
+ export declare const patchCommentReplyContract: Omit<{
56
+ readonly method: "patch";
57
+ readonly visibility: "internal";
58
+ readonly summary: "Update a reply";
59
+ readonly description: "Edits the message of a reply. Only the author can edit it.";
60
+ readonly tags: readonly ["Comments"];
61
+ readonly requestHeaderSchema: z.ZodObject<{
62
+ authorization: z.ZodString;
63
+ }, z.core.$strip>;
64
+ readonly requestPathParamsSchema: z.ZodObject<{
65
+ teamId: z.ZodUUID;
66
+ commentId: z.ZodUUID;
67
+ replyId: z.ZodUUID;
68
+ }, z.core.$strip>;
69
+ readonly requestBodySchema: z.ZodObject<{
70
+ message: z.ZodObject<{
71
+ version: z.ZodLiteral<1>;
72
+ blocks: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
73
+ type: z.ZodLiteral<"paragraph">;
74
+ content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
75
+ type: z.ZodLiteral<"text">;
76
+ text: z.ZodString;
77
+ }, z.core.$strip>, z.ZodObject<{
78
+ type: z.ZodLiteral<"userMention">;
79
+ userId: z.ZodUUID;
80
+ }, z.core.$strip>, z.ZodObject<{
81
+ type: z.ZodLiteral<"link">;
82
+ href: z.ZodURL;
83
+ text: z.ZodString;
84
+ }, z.core.$strip>], "type">>;
85
+ }, z.core.$strip>], "type">>;
86
+ }, z.core.$strip>;
87
+ }, z.core.$strip>;
88
+ readonly pathResolver: ({ teamId, commentId, replyId }: {
89
+ teamId: string;
90
+ commentId: string;
91
+ replyId: string;
92
+ }) => `/v1/teams/${string}/comments/${string}/replies/${string}`;
93
+ readonly responsesByStatusCode: {
94
+ 200: z.ZodObject<{
95
+ data: z.ZodObject<{
96
+ id: z.ZodUUID;
97
+ commentId: z.ZodUUID;
98
+ message: z.ZodObject<{
99
+ version: z.ZodLiteral<1>;
100
+ blocks: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
101
+ type: z.ZodLiteral<"paragraph">;
102
+ content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
103
+ type: z.ZodLiteral<"text">;
104
+ text: z.ZodString;
105
+ }, z.core.$strip>, z.ZodObject<{
106
+ type: z.ZodLiteral<"userMention">;
107
+ userId: z.ZodUUID;
108
+ }, z.core.$strip>, z.ZodObject<{
109
+ type: z.ZodLiteral<"link">;
110
+ href: z.ZodURL;
111
+ text: z.ZodString;
112
+ }, z.core.$strip>], "type">>;
113
+ }, z.core.$strip>], "type">>;
114
+ }, z.core.$strip>;
115
+ messageUpdatedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
116
+ createdBy: z.ZodUUID;
117
+ createdAt: z.ZodISODateTime;
118
+ }, z.core.$strip>;
119
+ }, z.core.$strip>;
120
+ 400: z.ZodObject<{
121
+ message: z.ZodString;
122
+ code: z.ZodString;
123
+ errorCode: z.ZodString;
124
+ details: z.ZodOptional<z.ZodUnknown>;
125
+ }, z.core.$strip>;
126
+ 401: z.ZodObject<{
127
+ message: z.ZodString;
128
+ code: z.ZodString;
129
+ errorCode: z.ZodString;
130
+ details: z.ZodOptional<z.ZodUnknown>;
131
+ }, z.core.$strip>;
132
+ 403: z.ZodObject<{
133
+ message: z.ZodString;
134
+ code: z.ZodLiteral<"TEAM_ACCESS_DENIED">;
135
+ errorCode: z.ZodLiteral<"TEAM_ACCESS_DENIED">;
136
+ }, z.core.$strip>;
137
+ 404: z.ZodObject<{
138
+ message: z.ZodString;
139
+ code: z.ZodString;
140
+ errorCode: z.ZodString;
141
+ details: z.ZodOptional<z.ZodUnknown>;
142
+ }, z.core.$strip>;
143
+ 500: z.ZodObject<{
144
+ message: z.ZodString;
145
+ code: z.ZodString;
146
+ errorCode: z.ZodString;
147
+ details: z.ZodOptional<z.ZodUnknown>;
148
+ }, z.core.$strip>;
149
+ };
150
+ }, "visibility"> & {
151
+ visibility: import("@lokalise/api-contracts").RouteVisibility;
152
+ };
153
+ export {};
@@ -0,0 +1,41 @@
1
+ import { defineApiContract } from '@lokalise/api-contracts';
2
+ import z from 'zod/v4';
3
+ import { teamAccessDeniedErrorDefinition } from '../../errors/index.js';
4
+ import { COMMENT_REPLY_SCHEMA } from '../../objects/comment-reply.js';
5
+ import { MESSAGE_SCHEMA } from '../../objects/message.js';
6
+ import { OpenApiTags } from '../../open-api-tags.js';
7
+ import { AUTH_HEADERS, ERROR_RESPONSE_SCHEMA } from '../common.js';
8
+ // ------------------------------------------------------------
9
+ // PATCH /v1/teams/:teamId/comments/:commentId/replies/:replyId
10
+ // ------------------------------------------------------------
11
+ const PATCH_COMMENT_REPLY_PATH_PARAMS_SCHEMA = z.compile(z.object({
12
+ teamId: z.uuid().describe('Id of the team'),
13
+ commentId: z.uuid().describe('Id of the comment'),
14
+ replyId: z.uuid().describe('Id of the reply'),
15
+ }));
16
+ const PATCH_COMMENT_REPLY_REQUEST_BODY_SCHEMA = z.compile(z.object({
17
+ message: MESSAGE_SCHEMA,
18
+ }));
19
+ const PATCH_COMMENT_REPLY_RESPONSE_BODY_SCHEMA = z.compile(z.object({
20
+ data: COMMENT_REPLY_SCHEMA,
21
+ }));
22
+ export const patchCommentReplyContract = defineApiContract({
23
+ method: 'patch',
24
+ visibility: 'internal',
25
+ summary: 'Update a reply',
26
+ description: 'Edits the message of a reply. Only the author can edit it.',
27
+ tags: [OpenApiTags.Comments.name],
28
+ requestHeaderSchema: AUTH_HEADERS,
29
+ requestPathParamsSchema: PATCH_COMMENT_REPLY_PATH_PARAMS_SCHEMA,
30
+ requestBodySchema: PATCH_COMMENT_REPLY_REQUEST_BODY_SCHEMA,
31
+ pathResolver: ({ teamId, commentId, replyId }) => `/v1/teams/${teamId}/comments/${commentId}/replies/${replyId}`,
32
+ responsesByStatusCode: {
33
+ 200: PATCH_COMMENT_REPLY_RESPONSE_BODY_SCHEMA,
34
+ 400: ERROR_RESPONSE_SCHEMA,
35
+ 401: ERROR_RESPONSE_SCHEMA,
36
+ 403: teamAccessDeniedErrorDefinition.schema,
37
+ 404: ERROR_RESPONSE_SCHEMA,
38
+ 500: ERROR_RESPONSE_SCHEMA,
39
+ },
40
+ });
41
+ //# sourceMappingURL=patch-comment-reply.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patch-comment-reply.js","sourceRoot":"","sources":["../../../../src/api/contracts/comments/patch-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EAAE,YAAY;IACjC,uBAAuB,EAAE,sCAAsC;IAC/D,iBAAiB,EAAE,uCAAuC;IAC1D,YAAY,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,CAC/C,aAAa,MAAM,aAAa,SAAS,YAAY,OAAO,EAAE;IAChE,qBAAqB,EAAE;QACrB,GAAG,EAAE,wCAAwC;QAC7C,GAAG,EAAE,qBAAqB;QAC1B,GAAG,EAAE,qBAAqB;QAC1B,GAAG,EAAE,+BAA+B,CAAC,MAAM;QAC3C,GAAG,EAAE,qBAAqB;QAC1B,GAAG,EAAE,qBAAqB;KAC3B;CACF,CAAC,CAAA"}
@@ -0,0 +1,188 @@
1
+ import z from 'zod/v4';
2
+ declare const PATCH_COMMENT_PATH_PARAMS_SCHEMA: z.ZodObject<{
3
+ teamId: z.ZodUUID;
4
+ commentId: z.ZodUUID;
5
+ }, z.core.$strip>;
6
+ export type PatchCommentPathParams = z.infer<typeof PATCH_COMMENT_PATH_PARAMS_SCHEMA>;
7
+ declare const PATCH_COMMENT_REQUEST_BODY_SCHEMA: z.ZodObject<{
8
+ message: z.ZodOptional<z.ZodObject<{
9
+ version: z.ZodLiteral<1>;
10
+ blocks: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
11
+ type: z.ZodLiteral<"paragraph">;
12
+ content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
13
+ type: z.ZodLiteral<"text">;
14
+ text: z.ZodString;
15
+ }, z.core.$strip>, z.ZodObject<{
16
+ type: z.ZodLiteral<"userMention">;
17
+ userId: z.ZodUUID;
18
+ }, z.core.$strip>, z.ZodObject<{
19
+ type: z.ZodLiteral<"link">;
20
+ href: z.ZodURL;
21
+ text: z.ZodString;
22
+ }, z.core.$strip>], "type">>;
23
+ }, z.core.$strip>], "type">>;
24
+ }, z.core.$strip>>;
25
+ status: z.ZodOptional<z.ZodEnum<{
26
+ readonly OPEN: 'OPEN';
27
+ readonly RESOLVED: 'RESOLVED';
28
+ }>>;
29
+ }, z.core.$strip>;
30
+ export type PatchCommentRequestBody = z.infer<typeof PATCH_COMMENT_REQUEST_BODY_SCHEMA>;
31
+ declare const PATCH_COMMENT_RESPONSE_BODY_SCHEMA: z.ZodObject<{
32
+ data: z.ZodObject<{
33
+ id: z.ZodUUID;
34
+ teamId: z.ZodUUID;
35
+ projectId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
36
+ entityType: z.ZodEnum<{
37
+ readonly SEGMENT: 'SEGMENT';
38
+ }>;
39
+ entityId: z.ZodUUID;
40
+ status: z.ZodEnum<{
41
+ readonly OPEN: 'OPEN';
42
+ readonly RESOLVED: 'RESOLVED';
43
+ }>;
44
+ message: z.ZodObject<{
45
+ version: z.ZodLiteral<1>;
46
+ blocks: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
47
+ type: z.ZodLiteral<"paragraph">;
48
+ content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
49
+ type: z.ZodLiteral<"text">;
50
+ text: z.ZodString;
51
+ }, z.core.$strip>, z.ZodObject<{
52
+ type: z.ZodLiteral<"userMention">;
53
+ userId: z.ZodUUID;
54
+ }, z.core.$strip>, z.ZodObject<{
55
+ type: z.ZodLiteral<"link">;
56
+ href: z.ZodURL;
57
+ text: z.ZodString;
58
+ }, z.core.$strip>], "type">>;
59
+ }, z.core.$strip>], "type">>;
60
+ }, z.core.$strip>;
61
+ messageUpdatedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
62
+ resolvedBy: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
63
+ resolvedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
64
+ replyCount: z.ZodInt;
65
+ lastActivityAt: z.ZodISODateTime;
66
+ lastReadAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
67
+ subscribed: z.ZodBoolean;
68
+ createdBy: z.ZodUUID;
69
+ createdAt: z.ZodISODateTime;
70
+ }, z.core.$strip>;
71
+ }, z.core.$strip>;
72
+ export type PatchCommentResponseBody = z.infer<typeof PATCH_COMMENT_RESPONSE_BODY_SCHEMA>;
73
+ export declare const patchCommentContract: Omit<{
74
+ readonly method: "patch";
75
+ readonly visibility: "internal";
76
+ readonly summary: "Update a comment";
77
+ readonly description: string;
78
+ readonly tags: readonly ["Comments"];
79
+ readonly requestHeaderSchema: z.ZodObject<{
80
+ authorization: z.ZodString;
81
+ }, z.core.$strip>;
82
+ readonly requestPathParamsSchema: z.ZodObject<{
83
+ teamId: z.ZodUUID;
84
+ commentId: z.ZodUUID;
85
+ }, z.core.$strip>;
86
+ readonly requestBodySchema: z.ZodObject<{
87
+ message: z.ZodOptional<z.ZodObject<{
88
+ version: z.ZodLiteral<1>;
89
+ blocks: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
90
+ type: z.ZodLiteral<"paragraph">;
91
+ content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
92
+ type: z.ZodLiteral<"text">;
93
+ text: z.ZodString;
94
+ }, z.core.$strip>, z.ZodObject<{
95
+ type: z.ZodLiteral<"userMention">;
96
+ userId: z.ZodUUID;
97
+ }, z.core.$strip>, z.ZodObject<{
98
+ type: z.ZodLiteral<"link">;
99
+ href: z.ZodURL;
100
+ text: z.ZodString;
101
+ }, z.core.$strip>], "type">>;
102
+ }, z.core.$strip>], "type">>;
103
+ }, z.core.$strip>>;
104
+ status: z.ZodOptional<z.ZodEnum<{
105
+ readonly OPEN: 'OPEN';
106
+ readonly RESOLVED: 'RESOLVED';
107
+ }>>;
108
+ }, z.core.$strip>;
109
+ readonly pathResolver: ({ teamId, commentId }: {
110
+ teamId: string;
111
+ commentId: string;
112
+ }) => `/v1/teams/${string}/comments/${string}`;
113
+ readonly responsesByStatusCode: {
114
+ 200: z.ZodObject<{
115
+ data: z.ZodObject<{
116
+ id: z.ZodUUID;
117
+ teamId: z.ZodUUID;
118
+ projectId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
119
+ entityType: z.ZodEnum<{
120
+ readonly SEGMENT: 'SEGMENT';
121
+ }>;
122
+ entityId: z.ZodUUID;
123
+ status: z.ZodEnum<{
124
+ readonly OPEN: 'OPEN';
125
+ readonly RESOLVED: 'RESOLVED';
126
+ }>;
127
+ message: z.ZodObject<{
128
+ version: z.ZodLiteral<1>;
129
+ blocks: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
130
+ type: z.ZodLiteral<"paragraph">;
131
+ content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
132
+ type: z.ZodLiteral<"text">;
133
+ text: z.ZodString;
134
+ }, z.core.$strip>, z.ZodObject<{
135
+ type: z.ZodLiteral<"userMention">;
136
+ userId: z.ZodUUID;
137
+ }, z.core.$strip>, z.ZodObject<{
138
+ type: z.ZodLiteral<"link">;
139
+ href: z.ZodURL;
140
+ text: z.ZodString;
141
+ }, z.core.$strip>], "type">>;
142
+ }, z.core.$strip>], "type">>;
143
+ }, z.core.$strip>;
144
+ messageUpdatedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
145
+ resolvedBy: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
146
+ resolvedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
147
+ replyCount: z.ZodInt;
148
+ lastActivityAt: z.ZodISODateTime;
149
+ lastReadAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
150
+ subscribed: z.ZodBoolean;
151
+ createdBy: z.ZodUUID;
152
+ createdAt: z.ZodISODateTime;
153
+ }, z.core.$strip>;
154
+ }, z.core.$strip>;
155
+ 400: z.ZodObject<{
156
+ message: z.ZodString;
157
+ code: z.ZodString;
158
+ errorCode: z.ZodString;
159
+ details: z.ZodOptional<z.ZodUnknown>;
160
+ }, z.core.$strip>;
161
+ 401: z.ZodObject<{
162
+ message: z.ZodString;
163
+ code: z.ZodString;
164
+ errorCode: z.ZodString;
165
+ details: z.ZodOptional<z.ZodUnknown>;
166
+ }, z.core.$strip>;
167
+ 403: z.ZodObject<{
168
+ message: z.ZodString;
169
+ code: z.ZodLiteral<"TEAM_ACCESS_DENIED">;
170
+ errorCode: z.ZodLiteral<"TEAM_ACCESS_DENIED">;
171
+ }, z.core.$strip>;
172
+ 404: z.ZodObject<{
173
+ message: z.ZodString;
174
+ code: z.ZodString;
175
+ errorCode: z.ZodString;
176
+ details: z.ZodOptional<z.ZodUnknown>;
177
+ }, z.core.$strip>;
178
+ 500: z.ZodObject<{
179
+ message: z.ZodString;
180
+ code: z.ZodString;
181
+ errorCode: z.ZodString;
182
+ details: z.ZodOptional<z.ZodUnknown>;
183
+ }, z.core.$strip>;
184
+ };
185
+ }, "visibility"> & {
186
+ visibility: import("@lokalise/api-contracts").RouteVisibility;
187
+ };
188
+ export {};
@@ -0,0 +1,49 @@
1
+ import { defineApiContract } from '@lokalise/api-contracts';
2
+ import z from 'zod/v4';
3
+ import { teamAccessDeniedErrorDefinition } from '../../errors/index.js';
4
+ import { COMMENT_SCHEMA, CommentStatusEnum } from '../../objects/comment.js';
5
+ import { MESSAGE_SCHEMA } from '../../objects/message.js';
6
+ import { OpenApiTags } from '../../open-api-tags.js';
7
+ import { AUTH_HEADERS, ERROR_RESPONSE_SCHEMA } from '../common.js';
8
+ // ------------------------------------------------------------
9
+ // PATCH /v1/teams/:teamId/comments/:commentId
10
+ // ------------------------------------------------------------
11
+ const PATCH_COMMENT_PATH_PARAMS_SCHEMA = z.compile(z.object({
12
+ teamId: z.uuid().describe('Id of the team'),
13
+ commentId: z.uuid().describe('Id of the comment'),
14
+ }));
15
+ const PATCH_COMMENT_REQUEST_BODY_SCHEMA = z.compile(z
16
+ .object({
17
+ message: MESSAGE_SCHEMA.optional(),
18
+ status: z
19
+ .enum(CommentStatusEnum)
20
+ .optional()
21
+ .describe('New status of the thread: `RESOLVED` resolves it, `OPEN` reopens it'),
22
+ })
23
+ .refine((body) => body.message !== undefined || body.status !== undefined, {
24
+ message: 'At least one of `message` or `status` is required',
25
+ }));
26
+ const PATCH_COMMENT_RESPONSE_BODY_SCHEMA = z.compile(z.object({
27
+ data: COMMENT_SCHEMA,
28
+ }));
29
+ export const patchCommentContract = defineApiContract({
30
+ method: 'patch',
31
+ visibility: 'internal',
32
+ summary: 'Update a comment',
33
+ description: 'Edits the message of a comment, or resolves or reopens its thread. Send at least one of `message` or `status`. ' +
34
+ 'Only the author can change the message; anyone with access to the comment can change the status. ',
35
+ tags: [OpenApiTags.Comments.name],
36
+ requestHeaderSchema: AUTH_HEADERS,
37
+ requestPathParamsSchema: PATCH_COMMENT_PATH_PARAMS_SCHEMA,
38
+ requestBodySchema: PATCH_COMMENT_REQUEST_BODY_SCHEMA,
39
+ pathResolver: ({ teamId, commentId }) => `/v1/teams/${teamId}/comments/${commentId}`,
40
+ responsesByStatusCode: {
41
+ 200: PATCH_COMMENT_RESPONSE_BODY_SCHEMA,
42
+ 400: ERROR_RESPONSE_SCHEMA,
43
+ 401: ERROR_RESPONSE_SCHEMA,
44
+ 403: teamAccessDeniedErrorDefinition.schema,
45
+ 404: ERROR_RESPONSE_SCHEMA,
46
+ 500: ERROR_RESPONSE_SCHEMA,
47
+ },
48
+ });
49
+ //# sourceMappingURL=patch-comment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patch-comment.js","sourceRoot":"","sources":["../../../../src/api/contracts/comments/patch-comment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,CAAC,MAAM,QAAQ,CAAA;AACtB,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAA;AACvE,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,cAA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