@devvit/protos 0.11.4-next-2024-12-03-534d9fc60.0 → 0.11.4-next-2024-12-03-7d3fffba9.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.
- package/meta.min.json +6 -6
- package/package.json +6 -6
- package/protos.min.js +1 -1
- package/protos.min.js.map +3 -3
- package/schema/devvit/plugin/redditapi/linksandcomments/linksandcomments_msg.proto +18 -0
- package/schema/devvit/plugin/redditapi/linksandcomments/linksandcomments_svc.proto +4 -0
- package/schema/snootobuf.devenv.lock +1678 -1016
- package/schema/snootobuf.lock +661 -352
- package/schema/snootobuf.redditapi.lock +661 -352
- package/schema/snootobuf.ts.lock +661 -352
- package/types/devvit/plugin/redditapi/linksandcomments/linksandcomments_msg.d.ts +31 -0
- package/types/devvit/plugin/redditapi/linksandcomments/linksandcomments_msg.d.ts.map +1 -1
- package/types/devvit/plugin/redditapi/linksandcomments/linksandcomments_msg.js +115 -0
- package/types/devvit/plugin/redditapi/linksandcomments/linksandcomments_svc.d.ts +38 -7
- package/types/devvit/plugin/redditapi/linksandcomments/linksandcomments_svc.d.ts.map +1 -1
- package/types/devvit/plugin/redditapi/linksandcomments/linksandcomments_svc.js +16 -1
- package/types/devvit/plugin/redditapi/linksandcomments/linksandcomments_svc.twirp-client.d.ts +4 -1
- package/types/devvit/plugin/redditapi/linksandcomments/linksandcomments_svc.twirp-client.d.ts.map +1 -1
- package/types/devvit/plugin/redditapi/linksandcomments/linksandcomments_svc.twirp-client.js +13 -1
- package/types/devvit/plugin/redditapi/linksandcomments/linksandcomments_svc.twirp.d.ts +3 -1
- package/types/devvit/plugin/redditapi/linksandcomments/linksandcomments_svc.twirp.d.ts.map +1 -1
- package/types/devvit/plugin/redditapi/linksandcomments/linksandcomments_svc.twirp.js +67 -1
@@ -1,5 +1,5 @@
|
|
1
1
|
import { TwirpServer, TwirpError, TwirpErrorCode, TwirpContentType, chainInterceptors, } from 'twirp-ts';
|
2
|
-
import { CommentRequest, JsonWrappedComment, BasicIdRequest, FollowPostRequest, InfoRequest, MoreChildrenRequest, ReportRequest, ReportAwardRequest, SaveRequest, SendRepliesRequest, SetContestModeRequest, EditCustomPostRequest, SetSubredditStickyRequest, SetSuggestedSortRequest, SubmitRequest, SubmitResponse, VoteRequest, } from './linksandcomments_msg.js';
|
2
|
+
import { CommentRequest, JsonWrappedComment, BasicIdRequest, FollowPostRequest, InfoRequest, MoreChildrenRequest, ReportRequest, ReportAwardRequest, SaveRequest, SendRepliesRequest, SetContestModeRequest, EditCustomPostRequest, SetCustomPostPreviewRequest, SetSubredditStickyRequest, SetSuggestedSortRequest, SubmitRequest, SubmitResponse, VoteRequest, } from './linksandcomments_msg.js';
|
3
3
|
import { Empty } from '../../../../google/protobuf/empty.js';
|
4
4
|
import { Listing, JsonStatus, JsonRedditObjects } from '../common/common_msg.js';
|
5
5
|
export var LinksAndCommentsMethod;
|
@@ -19,6 +19,7 @@ export var LinksAndCommentsMethod;
|
|
19
19
|
LinksAndCommentsMethod["SendReplies"] = "SendReplies";
|
20
20
|
LinksAndCommentsMethod["SetContestMode"] = "SetContestMode";
|
21
21
|
LinksAndCommentsMethod["EditCustomPost"] = "EditCustomPost";
|
22
|
+
LinksAndCommentsMethod["SetCustomPostPreview"] = "SetCustomPostPreview";
|
22
23
|
LinksAndCommentsMethod["SetSubredditSticky"] = "SetSubredditSticky";
|
23
24
|
LinksAndCommentsMethod["SetSuggestedSort"] = "SetSuggestedSort";
|
24
25
|
LinksAndCommentsMethod["Spoiler"] = "Spoiler";
|
@@ -47,6 +48,7 @@ export const LinksAndCommentsMethodList = [
|
|
47
48
|
LinksAndCommentsMethod.SendReplies,
|
48
49
|
LinksAndCommentsMethod.SetContestMode,
|
49
50
|
LinksAndCommentsMethod.EditCustomPost,
|
51
|
+
LinksAndCommentsMethod.SetCustomPostPreview,
|
50
52
|
LinksAndCommentsMethod.SetSubredditSticky,
|
51
53
|
LinksAndCommentsMethod.SetSuggestedSort,
|
52
54
|
LinksAndCommentsMethod.Spoiler,
|
@@ -160,6 +162,12 @@ function matchLinksAndCommentsRoute(method, events) {
|
|
160
162
|
await events.onMatch(ctx);
|
161
163
|
return handleLinksAndCommentsEditCustomPostRequest(ctx, service, data, interceptors);
|
162
164
|
};
|
165
|
+
case 'SetCustomPostPreview':
|
166
|
+
return async (ctx, service, data, interceptors) => {
|
167
|
+
ctx = { ...ctx, methodName: 'SetCustomPostPreview' };
|
168
|
+
await events.onMatch(ctx);
|
169
|
+
return handleLinksAndCommentsSetCustomPostPreviewRequest(ctx, service, data, interceptors);
|
170
|
+
};
|
163
171
|
case 'SetSubredditSticky':
|
164
172
|
return async (ctx, service, data, interceptors) => {
|
165
173
|
ctx = { ...ctx, methodName: 'SetSubredditSticky' };
|
@@ -397,6 +405,17 @@ function handleLinksAndCommentsEditCustomPostRequest(ctx, service, data, interce
|
|
397
405
|
throw new TwirpError(TwirpErrorCode.BadRoute, msg);
|
398
406
|
}
|
399
407
|
}
|
408
|
+
function handleLinksAndCommentsSetCustomPostPreviewRequest(ctx, service, data, interceptors) {
|
409
|
+
switch (ctx.contentType) {
|
410
|
+
case TwirpContentType.JSON:
|
411
|
+
return handleLinksAndCommentsSetCustomPostPreviewJSON(ctx, service, data, interceptors);
|
412
|
+
case TwirpContentType.Protobuf:
|
413
|
+
return handleLinksAndCommentsSetCustomPostPreviewProtobuf(ctx, service, data, interceptors);
|
414
|
+
default:
|
415
|
+
const msg = 'unexpected Content-Type';
|
416
|
+
throw new TwirpError(TwirpErrorCode.BadRoute, msg);
|
417
|
+
}
|
418
|
+
}
|
400
419
|
function handleLinksAndCommentsSetSubredditStickyRequest(ctx, service, data, interceptors) {
|
401
420
|
switch (ctx.contentType) {
|
402
421
|
case TwirpContentType.JSON:
|
@@ -878,6 +897,30 @@ async function handleLinksAndCommentsEditCustomPostJSON(ctx, service, data, inte
|
|
878
897
|
}
|
879
898
|
return JSON.stringify(JsonRedditObjects.toJSON(response));
|
880
899
|
}
|
900
|
+
async function handleLinksAndCommentsSetCustomPostPreviewJSON(ctx, service, data, interceptors) {
|
901
|
+
let request;
|
902
|
+
let response;
|
903
|
+
try {
|
904
|
+
const body = JSON.parse(data.toString() || '{}');
|
905
|
+
request = SetCustomPostPreviewRequest.fromJSON(body);
|
906
|
+
}
|
907
|
+
catch (e) {
|
908
|
+
if (e instanceof Error) {
|
909
|
+
const msg = 'the json request could not be decoded';
|
910
|
+
throw new TwirpError(TwirpErrorCode.Malformed, msg).withCause(e, true);
|
911
|
+
}
|
912
|
+
}
|
913
|
+
if (interceptors && interceptors.length > 0) {
|
914
|
+
const interceptor = chainInterceptors(...interceptors);
|
915
|
+
response = await interceptor(ctx, request, (ctx, inputReq) => {
|
916
|
+
return service.SetCustomPostPreview(ctx, inputReq);
|
917
|
+
});
|
918
|
+
}
|
919
|
+
else {
|
920
|
+
response = await service.SetCustomPostPreview(ctx, request);
|
921
|
+
}
|
922
|
+
return JSON.stringify(Empty.toJSON(response));
|
923
|
+
}
|
881
924
|
async function handleLinksAndCommentsSetSubredditStickyJSON(ctx, service, data, interceptors) {
|
882
925
|
let request;
|
883
926
|
let response;
|
@@ -1487,6 +1530,29 @@ async function handleLinksAndCommentsEditCustomPostProtobuf(ctx, service, data,
|
|
1487
1530
|
}
|
1488
1531
|
return Buffer.from(JsonRedditObjects.encode(response).finish());
|
1489
1532
|
}
|
1533
|
+
async function handleLinksAndCommentsSetCustomPostPreviewProtobuf(ctx, service, data, interceptors) {
|
1534
|
+
let request;
|
1535
|
+
let response;
|
1536
|
+
try {
|
1537
|
+
request = SetCustomPostPreviewRequest.decode(data);
|
1538
|
+
}
|
1539
|
+
catch (e) {
|
1540
|
+
if (e instanceof Error) {
|
1541
|
+
const msg = 'the protobuf request could not be decoded';
|
1542
|
+
throw new TwirpError(TwirpErrorCode.Malformed, msg).withCause(e, true);
|
1543
|
+
}
|
1544
|
+
}
|
1545
|
+
if (interceptors && interceptors.length > 0) {
|
1546
|
+
const interceptor = chainInterceptors(...interceptors);
|
1547
|
+
response = await interceptor(ctx, request, (ctx, inputReq) => {
|
1548
|
+
return service.SetCustomPostPreview(ctx, inputReq);
|
1549
|
+
});
|
1550
|
+
}
|
1551
|
+
else {
|
1552
|
+
response = await service.SetCustomPostPreview(ctx, request);
|
1553
|
+
}
|
1554
|
+
return Buffer.from(Empty.encode(response).finish());
|
1555
|
+
}
|
1490
1556
|
async function handleLinksAndCommentsSetSubredditStickyProtobuf(ctx, service, data, interceptors) {
|
1491
1557
|
let request;
|
1492
1558
|
let response;
|