Longbridge Developers
立即开始

我的讨论

获取当前登录用户发布的讨论列表,支持分页与类型过滤。可在 社区查看。

>_ CLI
longbridge topic mine

Request

HTTP MethodGET
HTTP URL/v1/content/topics/mine

Query Parameters

NameTypeRequiredDescription
pageint32NO页码,默认 1
sizeint32NO每页数量,范围 1~500,默认 50
topic_typestringNO类型过滤,可选 article(长文)、post(短帖),不传返回全部

Request Example

longbridge topic mine                           # 全部类型(默认每页 50 条)
longbridge topic mine --type article            # 仅长文
longbridge topic mine --type post --size 10     # 短帖,每页 10 条
longbridge topic mine --page 2                  # 第二页
longbridge topic mine --format json             # JSON 格式,适合脚本处理
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)

resp = ctx.topics_mine(page=1, size=50, topic_type="article")
print(resp)
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)

    resp = await ctx.topics_mine(page=1, size=50, topic_type="article")
    print(resp)

if __name__ == "__main__":
    asyncio.run(main())
const { Config, ContentContext, OAuth } = require('longbridge')

async function main() {
  const oauth = await OAuth.build("your-client-id", (_, url) => { console.log("Open this URL to authorize: " + url) })
  const config = Config.fromOAuth(oauth)
  const ctx = ContentContext.new(config)
  const resp = await ctx.topicsMine({ page: 1, size: 50, topicType: "article" })
  console.log(resp)
}
main().catch(console.error)
import com.longbridge.*;
import com.longbridge.content.*;

class Main {
    public static void main(String[] args) throws Exception {
        try (OAuth oauth = new OAuthBuilder("your-client-id").build(url -> System.out.println("Open to authorize: " + url)).get();
             Config config = Config.fromOAuth(oauth);
             ContentContext ctx = ContentContext.create(config)) {
            ListMyTopicsOptions opts = new ListMyTopicsOptions()
                .setPage(1).setSize(50).setTopicType("article");
            OwnedTopic[] resp = ctx.getTopicsMine(opts).get();
            for (OwnedTopic item : resp) System.out.println(item);
        }
    }
}
use std::sync::Arc;
use longbridge::{oauth::OAuthBuilder, content::{ContentContext, ListMyTopicsOptions}, Config};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let oauth = OAuthBuilder::new("your-client-id").build(|url| println!("Open this URL to authorize: {url}")).await?;
    let config = Arc::new(Config::from_oauth(oauth));
    let ctx = ContentContext::new(config);
    let opts = ListMyTopicsOptions {
        page: Some(1),
        size: Some(50),
        topic_type: Some("article".to_string()),
    };
    let resp = ctx.topics_mine(opts).await?;
    println!("{:?}", resp);
    Ok(())
}
#include &lt;iostream&gt;
#include <longbridge.hpp>

#ifdef WIN32
#include <windows.h>
#endif

using namespace longbridge;
using namespace longbridge::content;

static void
run(const OAuth& oauth)
{
    Config config = Config::from_oauth(oauth);
    ContentContext ctx = ContentContext::create(config);

    ListMyTopicsOptions opts;
    opts.page = 1;
    opts.size = 50;
    opts.topic_type = "article";

    ctx.topics_mine(opts, [](auto res) {
        if (!res) { std::cout << "failed: " << *res.status().message() << std::endl; return; }
        std::cout << "my topics: " << res->size() << std::endl;
    });
}

int main(int argc, char const* argv[]) {
#ifdef WIN32
    SetConsoleOutputCP(CP_UTF8);
#endif

    const std::string client_id = "your-client-id";
    OAuthBuilder(client_id).build(
    [](const std::string& url) {
        std::cout << "Open this URL to authorize: " << url << std::endl;
    },
    [](auto res) {
        if (!res) {
            std::cout << "authorization failed: " << *res.status().message() << std::endl;
            return;
        }
        run(*res);
    });

    std::cin.get();
    return 0;
}
package main

import (
	"context"
	"fmt"
	"log"

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

func main() {
	o := oauth.New("your-client-id").
		OnOpenURL(func(url string) { fmt.Println("Open this URL to authorize:", url) })
	if err := o.Build(context.Background()); err != nil {
		log.Fatal(err)
	}
	conf, err := config.New(config.WithOAuthClient(o))
	if err != nil {
		log.Fatal(err)
	}
	ctx, err := content.NewFromCfg(conf)
	if err != nil {
		log.Fatal(err)
	}
	opts := content.ListMyTopicsOptions{Page: 1, Size: 50, TopicType: "article"}
	items, err := ctx.TopicsMine(context.Background(), opts)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println("my topics:", len(items))
}

Response

Response Headers

  • Content-Type: application/json

Response Example

{
  "code": 0,
  "message": "success",
  "data": {
    "items": [
      {
        "id": "39304657",
        "title": "我对苹果的分析",
        "description": "文章摘要...",
        "body": "Markdown 正文内容...",
        "topic_type": "article",
        "tickers": ["AAPL.US"],
        "hashtags": ["earnings"],
        "images": [],
        "likes_count": 12,
        "comments_count": 3,
        "views_count": 200,
        "shares_count": 1,
        "license": 1,
        "detail_url": "https://longbridge.com/topics/39304657",
        "author": {
          "member_id": "10086",
          "name": "张三",
          "avatar": "https://example.com/avatar.jpg"
        },
        "created_at": "1742000000",
        "updated_at": "1742000000"
      }
    ]
  }
}

Response Status

StatusDescriptionSchema
200返回成功my_topics_response
500内部错误None

Schemas

my_topics_response

NameTypeRequiredDescription
itemsobject[]true讨论列表
∟ idstringtrue讨论 ID
∟ titlestringfalse标题(短帖可能为空)
∟ descriptionstringfalse纯文本摘要
∟ bodystringfalseMarkdown 格式正文
∟ topic_typestringtrue内容类型,article(长文)或 post(短帖)
∟ tickersstring[]false关联标的代码,如 ["AAPL.US", "700.HK"]
∟ hashtagsstring[]false讨论标签名称列表
∟ imagesobject[]false附图列表
∟∟ urlstringfalse原始图片 URL
∟∟ smstringfalse小缩略图 URL
∟∟ lgstringfalse大缩略图 URL
∟ likes_countint32false点赞数
∟ comments_countint32false评论数
∟ views_countint32false浏览数
∟ shares_countint32false分享数
∟ licenseint32false版权声明,0=无声明,1=原创,2=非原创
∟ detail_urlstringfalse讨论详情页链接
∟ authorobjectfalse作者信息
∟∟ member_idstringfalse作者 member ID
∟∟ namestringfalse作者昵称
∟∟ avatarstringfalse作者头像 URL
∟ created_atstringtrue创建时间,Unix 时间戳(秒)
∟ updated_atstringfalse最后更新时间,Unix 时间戳(秒)