Reorder and normalize imports, add missing type imports, and fix whitespace/formatting across multiple files. Notable updates: eslint.config.ts import ordering; core bridge APIs (group-album, misc, web) now import Json types; tests/highway pipeline import ordering and added type imports; protocol changes (element-builder, highway client/pipeline) reorganized imports and added proto type imports; many oidb service modules moved protobuf encode/decode imports for consistency; web group modules (album, essence, honor, notice, request-util) reordered imports, adjusted typings/indentation, and small whitespace fixes. These edits are stylistic and typing improvements and should not change runtime behavior.
50 lines
1.8 KiB
TypeScript
50 lines
1.8 KiB
TypeScript
// 0x126E_200 — fetch a download URL for a group-scope rich-media node
|
|
// (voice in this case — busiType=3 means "ptt/voice", sceneType=2
|
|
// means group). Pairs with the c2c-scope variant `GetPrivatePttUrl`
|
|
// (0x126D_200) which only differs in scene.
|
|
|
|
import type { OidbBase } from '@snowluma/proto-defs/oidb';
|
|
import type { NTV2RichMediaReq, NTV2RichMediaResp } from '@snowluma/proto-defs/oidb-actions/media';
|
|
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
|
import { invokeOidb, type OidbSender } from '../../oidb-service';
|
|
import {
|
|
normalizeMediaNode, parseNtv2DownloadUrl, type NtMediaIndex,
|
|
} from './ntv2-download';
|
|
|
|
export namespace GetGroupPttUrl {
|
|
export const command = 0x126E;
|
|
export const subCommand = 200;
|
|
export const uinForm = true;
|
|
|
|
export interface Params { groupId: number; node: NtMediaIndex; }
|
|
export type Deps = OidbSender;
|
|
|
|
export const serialize = (_ctx: Deps, p: Params): NTV2RichMediaReq => ({
|
|
reqHead: {
|
|
common: { requestId: 4, command: 200 },
|
|
scene: {
|
|
requestType: 1,
|
|
businessType: 3,
|
|
sceneType: 2,
|
|
group: { groupUin: p.groupId },
|
|
},
|
|
client: { agentType: 2 },
|
|
},
|
|
download: {
|
|
node: normalizeMediaNode(p.node),
|
|
download: { video: { busiType: 0, sceneType: 0 } },
|
|
},
|
|
});
|
|
|
|
export const deserialize = (_ctx: Deps, body: NTV2RichMediaResp): string => parseNtv2DownloadUrl(body);
|
|
|
|
export const encode = (env: OidbBase<NTV2RichMediaReq>): Uint8Array =>
|
|
protobuf_encode<OidbBase<NTV2RichMediaReq>>(env);
|
|
|
|
export const decode = (bytes: Uint8Array): OidbBase<NTV2RichMediaResp> =>
|
|
protobuf_decode<OidbBase<NTV2RichMediaResp>>(bytes);
|
|
|
|
export const invoke = (deps: Deps, params: Params): Promise<string> =>
|
|
invokeOidb(deps, GetGroupPttUrl, params);
|
|
}
|