From 7179c5e4aea435584365ae2339c904b490ec389b Mon Sep 17 00:00:00 2001 From: GurumNyang Date: Mon, 15 Jul 2024 09:08:20 +0900 Subject: [PATCH] feature(proto): Add `comment_id` to commentSectionParams --- .../(Params)/Options.ts | 17 +++++++++++++++++ src/proto/index.ts | 6 ++++-- src/proto/youtube.proto | 1 + 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/(Params)/Options.ts b/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/(Params)/Options.ts index 582cd07eb..bc4928d78 100644 --- a/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/(Params)/Options.ts +++ b/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/(Params)/Options.ts @@ -21,6 +21,7 @@ export declare namespace $.youtube.GetCommentsSectionParams.Params { videoId: string; sortBy: number; type: number; + commentId?: string; } } @@ -31,6 +32,7 @@ export function getDefaultValue(): $.youtube.GetCommentsSectionParams.Params.Opt videoId: "", sortBy: 0, type: 0, + commentId: undefined, }; } @@ -46,6 +48,7 @@ export function encodeJson(value: $.youtube.GetCommentsSectionParams.Params.Opti if (value.videoId !== undefined) result.videoId = tsValueToJsonValueFns.string(value.videoId); if (value.sortBy !== undefined) result.sortBy = tsValueToJsonValueFns.int32(value.sortBy); if (value.type !== undefined) result.type = tsValueToJsonValueFns.int32(value.type); + if (value.commentId !== undefined) result.commentId = tsValueToJsonValueFns.string(value.commentId); return result; } @@ -54,6 +57,7 @@ export function decodeJson(value: any): $.youtube.GetCommentsSectionParams.Param if (value.videoId !== undefined) result.videoId = jsonValueToTsValueFns.string(value.videoId); if (value.sortBy !== undefined) result.sortBy = jsonValueToTsValueFns.int32(value.sortBy); if (value.type !== undefined) result.type = jsonValueToTsValueFns.int32(value.type); + if (value.commentId !== undefined) result.commentId = jsonValueToTsValueFns.string(value.commentId); return result; } @@ -77,6 +81,12 @@ export function encodeBinary(value: $.youtube.GetCommentsSectionParams.Params.Op [15, tsValueToWireValueFns.int32(tsValue)], ); } + if (value.commentId !== undefined) { + const tsValue = value.commentId; + result.push( + [16, tsValueToWireValueFns.string(tsValue)], + ); + } return serialize(result); } @@ -105,5 +115,12 @@ export function decodeBinary(binary: Uint8Array): $.youtube.GetCommentsSectionPa if (value === undefined) break field; result.type = value; } + field: { + const wireValue = wireFields.get(16); + if (wireValue === undefined) break field; + const value = wireValueToTsValueFns.string(wireValue); + if (value === undefined) break field; + result.commentId = value; + } return result; } diff --git a/src/proto/index.ts b/src/proto/index.ts index 8f72a9042..eee1aa110 100644 --- a/src/proto/index.ts +++ b/src/proto/index.ts @@ -155,7 +155,8 @@ export function encodeMessageParams(channel_id: string, video_id: string): strin export function encodeCommentsSectionParams(video_id: string, options: { type?: number, - sort_by?: 'TOP_COMMENTS' | 'NEWEST_FIRST' + sort_by?: 'TOP_COMMENTS' | 'NEWEST_FIRST', + comment_id?: string } = {}): string { const sort_options = { TOP_COMMENTS: 0, @@ -171,7 +172,8 @@ export function encodeCommentsSectionParams(video_id: string, options: { opts: { videoId: video_id, sortBy: sort_options[options.sort_by || 'TOP_COMMENTS'], - type: options.type || 2 + type: options.type || 2, + commentId: options.comment_id || '' }, target: 'comments-section' } diff --git a/src/proto/youtube.proto b/src/proto/youtube.proto index cfa271814..ffb795a78 100644 --- a/src/proto/youtube.proto +++ b/src/proto/youtube.proto @@ -162,6 +162,7 @@ message GetCommentsSectionParams { required string video_id = 4; required int32 sort_by = 6; required int32 type = 15; + optional string comment_id = 16; } message RepliesOptions {