Longbridge Developers
立即開始

討論回覆

獲取指定討論下的回覆列表,支持分頁。完整社區討論可瀏覽 社區。

每條回覆包含作者信息、正文(純文本)、互動數據及 reply_to_id 字段:"0" 表示頂層回覆,其他值表示對指定回覆的嵌套回覆。

>_ CLI
longbridge topic replies 6993508780031016960
longbridge topic replies 6993508780031016960 --page 2 --size 20

Request

HTTP MethodGET
HTTP URL/v1/content/topics/
/comments

Path Parameters

NameTypeRequiredDescription
topic_idstringYES討論 ID,如 6993508780031016960

Query Parameters

NameTypeRequiredDescription
pageint32NO頁碼,默認 1
sizeint32NO每頁數量,範圍 1~50,默認 20

Request Example

longbridge topic replies 6993508780031016960
longbridge topic replies 6993508780031016960 --page 2 --size 20
from longbridge.openapi import ContentContext, Config, OAuthBuilder

oauth = OAuthBuilder("your-client-id").build(lambda url: print("Visit:", url))
config = Config.from_oauth(oauth)
ctx = ContentContext(config)

replies = ctx.list_topic_replies("6993508780031016960", page=1, size=20)
for r in replies:
    print(r.author.name, r.body)
import asyncio
from longbridge.openapi import AsyncContentContext, Config, OAuthBuilder

async def main() -> None:
    oauth = await OAuthBuilder("your-client-id").build_async(lambda url: print("Visit:", url))
    config = Config.from_oauth(oauth)
    ctx = AsyncContentContext.create(config)

    replies = await ctx.list_topic_replies("6993508780031016960", page=1, size=20)
    for r in replies:
        print(r.author.name, r.body)

if __name__ == "__main__":
    asyncio.run(main())
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/longbridge/openapi-go/config"
	"github.com/longbridge/openapi-go/content"
)

func main() {
	conf, err := config.NewFromEnv()
	if err != nil {
		log.Fatal(err)
	}
	ctx, err := content.NewFromCfg(conf)
	if err != nil {
		log.Fatal(err)
	}
	replies, err := ctx.ListTopicReplies(context.Background(), "6993508780031016960",
		&content.ListTopicRepliesOptions{Page: 1, Size: 20},
	)
	if err != nil {
		log.Fatal(err)
	}
	for _, r := range replies {
		fmt.Printf("[%s] %s: %s\n", r.ID, r.Author.Name, r.Body)
	}
}
use std::sync::Arc;
use longbridge::{oauth::OAuthBuilder, content::{ContentContext, ListTopicRepliesOptions}, Config};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let oauth = OAuthBuilder::new("your-client-id").build(|url| println!("Open: {url}")).await?;
    let config = Arc::new(Config::from_oauth(oauth));
    let ctx = ContentContext::new(config);
    let replies = ctx.list_topic_replies(
        "6993508780031016960",
        ListTopicRepliesOptions { page: Some(1), size: Some(20) },
    ).await?;
    for r in &replies {
        println!("{}: {}", r.author.name, r.body);
    }
    Ok(())
}

Response

Response Headers

  • Content-Type: application/json

Response Example

{
  "code": 0,
  "message": "success",
  "data": {
    "items": [
      {
        "id": "7001234567890123456",
        "topic_id": "6993508780031016960",
        "body": "分析得很到位!",
        "reply_to_id": "0",
        "author": {
          "member_id": "10087",
          "name": "李四",
          "avatar": "https://example.com/avatar2.jpg"
        },
        "images": [],
        "likes_count": 5,
        "comments_count": 2,
        "created_at": "1742001500"
      }
    ]
  }
}

Response Status

StatusDescriptionSchema
200返回成功topic_replies_response
500內部錯誤None

Schemas

topic_replies_response

NameTypeRequiredDescription
itemsobject[]true回覆列表
∟ idstringtrue回覆 ID
∟ topic_idstringtrue所屬討論 ID
∟ bodystringfalse回覆正文(純文本)
∟ reply_to_idstringfalse父回覆 ID,"0" 表示頂層回覆
∟ authorobjectfalse作者信息
∟∟ member_idstringfalse作者 member ID
∟∟ namestringfalse作者暱稱
∟∟ avatarstringfalse作者頭像 URL
∟ imagesobject[]false附圖列表
∟∟ urlstringfalse原始圖片 URL
∟∟ smstringfalse小縮略圖 URL
∟∟ lgstringfalse大縮略圖 URL
∟ likes_countint32false點讚數
∟ comments_countint32false嵌套回覆數
∟ created_atstringtrue創建時間,Unix 時間戳(秒)