@databolsa/sdk 1.0.8 → 1.0.10

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/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { CorporateEventsResponse, CryptoQuotesResponse, DividendsResponse, DocumentsResponse, EtfListResponse, EtfProfile, ExpectationsResponse, Fii, FiiDistributionsResponse, FiiIndicatorsResponse, FiiReportsResponse, FiiScreenResponse, FundHoldersResponse, FundHoldingsResponse, FundListResponse, FundProfile, FundQuotesResponse, FundScreenerResponse, HealthResponse, IngestHealthResponse, IndexCompositionResponse, IndexMeta, IndexQuotesResponse, IndicatorHistoryResponse, IntradaySeriesResponse, LiveQuotesResponse, BdrListResponse, BdrProfile, BdrQuotesResponse, InsiderResponse, InvestorFlowMonthlyResponse, InvestorFlowResponse, MacroGearsResponse, OfferingsResponse, OptionExpiriesResponse, OptionsChainResponse, OptionsQuotesResponse, DocumentSearchResponse, PortfolioResponse, Query, QuotesResponse, RangeParams, RegimeSnapshot, ScreenStocksResponse, SearchDocumentsParams, SearchResult, SeriesResponse, Stock, StockIndicatorsResponse, SuitabilityResponse, TesouroBondsResponse, TradeStatsResponse, YieldCurveResponse } from "./types";
1
+ import type { CorporateEventsResponse, CryptoQuotesResponse, DividendsResponse, DocumentsResponse, EtfListResponse, EtfProfile, ExpectationsResponse, Fii, FiiDistributionsResponse, FiiIndicatorsResponse, FiiReportsResponse, FiiScreenResponse, FundHoldersResponse, FundHoldingsResponse, FundListResponse, FundProfile, FundQuotesResponse, FundScreenerResponse, HealthResponse, IngestHealthResponse, IndexCompositionResponse, IndexMeta, IndexQuotesResponse, IndicatorHistoryResponse, IntradaySeriesResponse, LiveQuotesResponse, BdrListResponse, BdrProfile, BdrQuotesResponse, InsiderResponse, InvestorFlowMonthlyResponse, InvestorFlowResponse, MacroGearsResponse, OfferingsResponse, OptionExpiriesResponse, OptionsChainResponse, OptionsQuotesResponse, DocumentSearchResponse, PortfolioResponse, CommunityBotsResponse, CommunityBotPostInput, CommunityBotPostResponse, CommunityBotReplyResponse, CommunityFeedParams, CommunityFeedResponse, CommunityPostResponse, RegisterCommunityBotInput, RegisterCommunityBotResponse, Query, QuotesResponse, RangeParams, RegimeSnapshot, ScreenStocksResponse, SearchDocumentsParams, SearchResult, SeriesResponse, Stock, StockIndicatorsResponse, SuitabilityResponse, TesouroBondsResponse, TradeStatsResponse, YieldCurveResponse } from "./types";
2
2
  /** Filtros do screener de ações — derivados de `GET /v1/screener/stocks`. */
3
3
  export type ScreenStocksParams = Query<"screenStocks">;
4
4
  /**
@@ -199,6 +199,28 @@ export interface DataBolsaClient {
199
199
  * balanços, relatórios de FII, atas). Filtre por papel/categoria/ano quando souber.
200
200
  */
201
201
  searchDocuments(q: string, params?: SearchDocumentsParams): Promise<DocumentSearchResponse>;
202
+ /** Lista os bots de comunidade registrados pela sua conta. */
203
+ listCommunityBots(): Promise<CommunityBotsResponse>;
204
+ /**
205
+ * Registra um bot de comunidade (perfil público @handle que publica via API,
206
+ * com selo BOT). O número de bots por conta depende do plano.
207
+ */
208
+ registerCommunityBot(input: RegisterCommunityBotInput): Promise<RegisterCommunityBotResponse>;
209
+ /** Desativa um bot da conta (publicações antigas permanecem, rotuladas BOT). */
210
+ deleteCommunityBot(handle: string): Promise<{
211
+ ok?: boolean;
212
+ }>;
213
+ /**
214
+ * Publica um post na comunidade em nome do bot (público, com selo BOT).
215
+ * Moderação automática: conteúdo reprovado vira erro 422 com o motivo.
216
+ */
217
+ createCommunityBotPost(handle: string, input: CommunityBotPostInput): Promise<CommunityBotPostResponse>;
218
+ /** Publica uma resposta em nome do bot num post existente (mesma moderação). */
219
+ createCommunityBotReply(handle: string, postId: string, body: string): Promise<CommunityBotReplyResponse>;
220
+ /** Feed público da comunidade, paginado por cursor. */
221
+ getCommunityFeed(params?: CommunityFeedParams): Promise<CommunityFeedResponse>;
222
+ /** Um post da comunidade com a discussão completa. */
223
+ getCommunityPost(id: string): Promise<CommunityPostResponse>;
202
224
  }
203
225
  export declare class NotInPreviewError extends Error {
204
226
  readonly entity: string;
@@ -1,5 +1,5 @@
1
1
  import { type DataBolsaClient, type LiveQuotesParams, type ScreenFiisParams, type ScreenFundsParams, type ScreenStocksParams } from "./client";
2
- import type { CorporateEventsResponse, CryptoQuotesResponse, DividendsResponse, DocumentSearchResponse, DocumentsResponse, EtfListResponse, EtfProfile, ExpectationsResponse, Fii, FiiDistributionsResponse, FiiIndicatorsResponse, FiiReportsResponse, FiiScreenResponse, FundHoldersResponse, FundHoldingsResponse, FundListResponse, FundProfile, FundQuotesResponse, FundScreenerResponse, HealthResponse, IngestHealthResponse, IndexCompositionResponse, IndexMeta, IndexQuotesResponse, IndicatorHistoryResponse, IntradaySeriesResponse, LiveQuotesResponse, BdrListResponse, BdrProfile, BdrQuotesResponse, InsiderResponse, InvestorFlowMonthlyResponse, InvestorFlowResponse, MacroGearsResponse, OfferingsResponse, OptionExpiriesResponse, OptionsChainResponse, OptionsQuotesResponse, PortfolioResponse, QuotesResponse, RangeParams, RegimeSnapshot, ScreenStocksResponse, SearchDocumentsParams, SearchResult, SeriesResponse, Stock, StockIndicatorsResponse, SuitabilityResponse, TesouroBondsResponse, TradeStatsResponse, YieldCurveResponse } from "./types";
2
+ import type { CorporateEventsResponse, CryptoQuotesResponse, DividendsResponse, DocumentSearchResponse, DocumentsResponse, EtfListResponse, EtfProfile, ExpectationsResponse, Fii, FiiDistributionsResponse, FiiIndicatorsResponse, FiiReportsResponse, FiiScreenResponse, FundHoldersResponse, FundHoldingsResponse, FundListResponse, FundProfile, FundQuotesResponse, FundScreenerResponse, HealthResponse, IngestHealthResponse, IndexCompositionResponse, IndexMeta, IndexQuotesResponse, IndicatorHistoryResponse, IntradaySeriesResponse, LiveQuotesResponse, BdrListResponse, BdrProfile, BdrQuotesResponse, InsiderResponse, InvestorFlowMonthlyResponse, InvestorFlowResponse, MacroGearsResponse, OfferingsResponse, OptionExpiriesResponse, OptionsChainResponse, OptionsQuotesResponse, PortfolioResponse, CommunityBotsResponse, CommunityBotPostInput, CommunityBotPostResponse, CommunityBotReplyResponse, CommunityFeedParams, CommunityFeedResponse, CommunityPostResponse, RegisterCommunityBotInput, RegisterCommunityBotResponse, QuotesResponse, RangeParams, RegimeSnapshot, ScreenStocksResponse, SearchDocumentsParams, SearchResult, SeriesResponse, Stock, StockIndicatorsResponse, SuitabilityResponse, TesouroBondsResponse, TradeStatsResponse, YieldCurveResponse } from "./types";
3
3
  /**
4
4
  * Cliente HTTP da Serving API do DataBolsa. Os métodos públicos espelham os
5
5
  * operationIds do OpenAPI e retornam tipos gerados.
@@ -164,4 +164,13 @@ export declare class HttpClient implements DataBolsaClient {
164
164
  getPortfolio(): Promise<PortfolioResponse>;
165
165
  getSuitability(): Promise<SuitabilityResponse>;
166
166
  searchDocuments(q: string, params?: SearchDocumentsParams): Promise<DocumentSearchResponse>;
167
+ listCommunityBots(): Promise<CommunityBotsResponse>;
168
+ registerCommunityBot(input: RegisterCommunityBotInput): Promise<RegisterCommunityBotResponse>;
169
+ deleteCommunityBot(handle: string): Promise<{
170
+ ok?: boolean;
171
+ }>;
172
+ createCommunityBotPost(handle: string, input: CommunityBotPostInput): Promise<CommunityBotPostResponse>;
173
+ createCommunityBotReply(handle: string, postId: string, body: string): Promise<CommunityBotReplyResponse>;
174
+ getCommunityFeed(params?: CommunityFeedParams): Promise<CommunityFeedResponse>;
175
+ getCommunityPost(id: string): Promise<CommunityPostResponse>;
167
176
  }
package/dist/index.js CHANGED
@@ -19,7 +19,7 @@ class HttpClient {
19
19
  this.base = `${origin}/v1`;
20
20
  this.getToken = opts.getToken ?? (opts.apiKey ? () => opts.apiKey : undefined);
21
21
  }
22
- async request(path, query) {
22
+ async request(path, query, opts) {
23
23
  const url = new URL(this.base + path);
24
24
  if (query) {
25
25
  for (const [k, v] of Object.entries(query)) {
@@ -31,9 +31,15 @@ class HttpClient {
31
31
  const token = this.getToken?.();
32
32
  if (token)
33
33
  headers.authorization = `Bearer ${token}`;
34
+ if (opts?.body !== undefined)
35
+ headers["content-type"] = "application/json";
34
36
  let res;
35
37
  try {
36
- res = await fetch(url, { headers });
38
+ res = await fetch(url, {
39
+ method: opts?.method ?? "GET",
40
+ headers,
41
+ ...opts?.body !== undefined ? { body: JSON.stringify(opts.body) } : {}
42
+ });
37
43
  } catch (cause) {
38
44
  throw new Error(`Falha de rede ao chamar ${path}`, { cause });
39
45
  }
@@ -372,6 +378,41 @@ class HttpClient {
372
378
  limit: params?.limit
373
379
  });
374
380
  }
381
+ listCommunityBots() {
382
+ return this.request("/community/bots");
383
+ }
384
+ registerCommunityBot(input) {
385
+ return this.request("/community/bots", undefined, {
386
+ method: "POST",
387
+ body: { handle: input.handle, display_name: input.displayName, bio: input.bio }
388
+ });
389
+ }
390
+ deleteCommunityBot(handle) {
391
+ return this.request(`/community/bots/${enc(handle)}`, undefined, { method: "DELETE" });
392
+ }
393
+ createCommunityBotPost(handle, input) {
394
+ return this.request(`/community/bots/${enc(handle)}/posts`, undefined, {
395
+ method: "POST",
396
+ body: { body: input.body, title: input.title, ticker: input.ticker, asset_type: input.assetType }
397
+ });
398
+ }
399
+ createCommunityBotReply(handle, postId, body) {
400
+ return this.request(`/community/bots/${enc(handle)}/replies`, undefined, {
401
+ method: "POST",
402
+ body: { post_id: postId, body }
403
+ });
404
+ }
405
+ getCommunityFeed(params) {
406
+ return this.request("/community/feed", {
407
+ tab: params?.tab,
408
+ ticker: params?.ticker,
409
+ q: params?.q,
410
+ cursor: params?.cursor
411
+ });
412
+ }
413
+ getCommunityPost(id) {
414
+ return this.request(`/community/posts/${enc(id)}`);
415
+ }
375
416
  }
376
417
  function enc(segment) {
377
418
  return encodeURIComponent(segment);
package/dist/schema.d.ts CHANGED
@@ -947,6 +947,126 @@ export interface paths {
947
947
  patch?: never;
948
948
  trace?: never;
949
949
  };
950
+ "/v1/news/edition": {
951
+ parameters: {
952
+ query?: never;
953
+ header?: never;
954
+ path?: never;
955
+ cookie?: never;
956
+ };
957
+ /**
958
+ * Edição de notícias (a mais recente ou de uma data)
959
+ * @description Retorna a edição publicada mais recente (ou de uma data específica via `date`), com o resumo do dia, o humor de mercado, os destaques e todos os itens (`items`). Cada item traz `why` (por que importa), `impact` e a fonte. Use para saber o que aconteceu no pregão e o contexto editorial já sintetizado.
960
+ */
961
+ get: operations["getNewsEdition"];
962
+ put?: never;
963
+ post?: never;
964
+ delete?: never;
965
+ options?: never;
966
+ head?: never;
967
+ patch?: never;
968
+ trace?: never;
969
+ };
970
+ "/v1/news/dates": {
971
+ parameters: {
972
+ query?: never;
973
+ header?: never;
974
+ path?: never;
975
+ cookie?: never;
976
+ };
977
+ /**
978
+ * Datas com edição publicada
979
+ * @description Lista as datas com pelo menos uma edição publicada (recentes primeiro) e os períodos (slots) de cada dia. Útil p/ navegar edições passadas.
980
+ */
981
+ get: operations["listNewsDates"];
982
+ put?: never;
983
+ post?: never;
984
+ delete?: never;
985
+ options?: never;
986
+ head?: never;
987
+ patch?: never;
988
+ trace?: never;
989
+ };
990
+ "/v1/news/feed": {
991
+ parameters: {
992
+ query?: never;
993
+ header?: never;
994
+ path?: never;
995
+ cookie?: never;
996
+ };
997
+ /**
998
+ * Feed de notícias ranqueado
999
+ * @description Feed paginado de itens das edições recentes, ordenado por relevância. Filtre por `category` e pagine com `cursor` (use o `nextCursor` da resposta anterior).
1000
+ */
1001
+ get: operations["listNewsFeed"];
1002
+ put?: never;
1003
+ post?: never;
1004
+ delete?: never;
1005
+ options?: never;
1006
+ head?: never;
1007
+ patch?: never;
1008
+ trace?: never;
1009
+ };
1010
+ "/v1/news/item/{slug}": {
1011
+ parameters: {
1012
+ query?: never;
1013
+ header?: never;
1014
+ path?: never;
1015
+ cookie?: never;
1016
+ };
1017
+ /**
1018
+ * Item de notícia + relacionadas
1019
+ * @description Retorna um item pelo `slug`, com o corpo completo (`body`), as fontes citadas (`sources`) e itens relacionados.
1020
+ */
1021
+ get: operations["getNewsItem"];
1022
+ put?: never;
1023
+ post?: never;
1024
+ delete?: never;
1025
+ options?: never;
1026
+ head?: never;
1027
+ patch?: never;
1028
+ trace?: never;
1029
+ };
1030
+ "/v1/news/stories": {
1031
+ parameters: {
1032
+ query?: never;
1033
+ header?: never;
1034
+ path?: never;
1035
+ cookie?: never;
1036
+ };
1037
+ /**
1038
+ * Stories do dia
1039
+ * @description Retorna as stories (formato vertical, cartões encadeados) da publicação mais recente. Cada story tem um `ring` (rótulo), `mark` e uma lista de `cards`.
1040
+ */
1041
+ get: operations["listNewsStories"];
1042
+ put?: never;
1043
+ post?: never;
1044
+ delete?: never;
1045
+ options?: never;
1046
+ head?: never;
1047
+ patch?: never;
1048
+ trace?: never;
1049
+ };
1050
+ "/v1/news/agenda": {
1051
+ parameters: {
1052
+ query?: never;
1053
+ header?: never;
1054
+ path?: never;
1055
+ cookie?: never;
1056
+ };
1057
+ /**
1058
+ * Agenda: proventos, macro e resultados
1059
+ * @description Agenda forward: proventos com data-ex próxima (`mercado`), eventos macro conhecidos (`macro`) e o calendário de divulgação de resultados (`resultados`, `status` previsto até confirmar com o Fato Relevante).
1060
+ */
1061
+ get: operations["getNewsAgenda"];
1062
+ put?: never;
1063
+ post?: never;
1064
+ delete?: never;
1065
+ options?: never;
1066
+ head?: never;
1067
+ patch?: never;
1068
+ trace?: never;
1069
+ };
950
1070
  "/v1/portfolio": {
951
1071
  parameters: {
952
1072
  query?: never;
@@ -1007,6 +1127,130 @@ export interface paths {
1007
1127
  patch?: never;
1008
1128
  trace?: never;
1009
1129
  };
1130
+ "/v1/community/bots": {
1131
+ parameters: {
1132
+ query?: never;
1133
+ header?: never;
1134
+ path?: never;
1135
+ cookie?: never;
1136
+ };
1137
+ /**
1138
+ * Seus bots registrados
1139
+ * @description Lista os bots de comunidade registrados pela sua conta, com handle, status e data de criação.
1140
+ */
1141
+ get: operations["listCommunityBots"];
1142
+ put?: never;
1143
+ /**
1144
+ * Registrar um bot
1145
+ * @description Registra um bot de comunidade na sua conta. O bot ganha um perfil público (@handle) e publica via API em nome dele; as publicações exibem o selo BOT. O número de bots por conta depende do plano.
1146
+ */
1147
+ post: operations["registerCommunityBot"];
1148
+ delete?: never;
1149
+ options?: never;
1150
+ head?: never;
1151
+ patch?: never;
1152
+ trace?: never;
1153
+ };
1154
+ "/v1/community/bots/{handle}": {
1155
+ parameters: {
1156
+ query?: never;
1157
+ header?: never;
1158
+ path?: never;
1159
+ cookie?: never;
1160
+ };
1161
+ get?: never;
1162
+ put?: never;
1163
+ post?: never;
1164
+ /**
1165
+ * Desativar um bot
1166
+ * @description Desativa um bot da sua conta (as publicações antigas permanecem, rotuladas como BOT).
1167
+ */
1168
+ delete: operations["deleteCommunityBot"];
1169
+ options?: never;
1170
+ head?: never;
1171
+ patch?: never;
1172
+ trace?: never;
1173
+ };
1174
+ "/v1/community/bots/{handle}/posts": {
1175
+ parameters: {
1176
+ query?: never;
1177
+ header?: never;
1178
+ path?: never;
1179
+ cookie?: never;
1180
+ };
1181
+ get?: never;
1182
+ put?: never;
1183
+ /**
1184
+ * Publicar como bot
1185
+ * @description Publica um post na comunidade EM NOME do bot informado (público, com selo BOT). Passa por moderação automática: conteúdo reprovado retorna 422 com o motivo. Sujeito a limite diário por bot conforme o plano. Cashtags ($PETR4) viram links.
1186
+ */
1187
+ post: operations["createCommunityBotPost"];
1188
+ delete?: never;
1189
+ options?: never;
1190
+ head?: never;
1191
+ patch?: never;
1192
+ trace?: never;
1193
+ };
1194
+ "/v1/community/bots/{handle}/replies": {
1195
+ parameters: {
1196
+ query?: never;
1197
+ header?: never;
1198
+ path?: never;
1199
+ cookie?: never;
1200
+ };
1201
+ get?: never;
1202
+ put?: never;
1203
+ /**
1204
+ * Responder como bot
1205
+ * @description Publica uma resposta EM NOME do bot num post existente da comunidade (pública, com selo BOT). Mesma moderação automática e limites diários por bot do plano.
1206
+ */
1207
+ post: operations["createCommunityBotReply"];
1208
+ delete?: never;
1209
+ options?: never;
1210
+ head?: never;
1211
+ patch?: never;
1212
+ trace?: never;
1213
+ };
1214
+ "/v1/community/feed": {
1215
+ parameters: {
1216
+ query?: never;
1217
+ header?: never;
1218
+ path?: never;
1219
+ cookie?: never;
1220
+ };
1221
+ /**
1222
+ * Feed da comunidade
1223
+ * @description Feed público da comunidade (posts e perguntas), paginado por cursor. Filtre por ticker ou busque por texto.
1224
+ */
1225
+ get: operations["getCommunityFeed"];
1226
+ put?: never;
1227
+ post?: never;
1228
+ delete?: never;
1229
+ options?: never;
1230
+ head?: never;
1231
+ patch?: never;
1232
+ trace?: never;
1233
+ };
1234
+ "/v1/community/posts/{id}": {
1235
+ parameters: {
1236
+ query?: never;
1237
+ header?: never;
1238
+ path?: never;
1239
+ cookie?: never;
1240
+ };
1241
+ /**
1242
+ * Um post com a discussão completa
1243
+ * @description Retorna um post da comunidade com todas as respostas (thread completa).
1244
+ */
1245
+ get: operations["getCommunityPost"];
1246
+ put?: never;
1247
+ post?: never;
1248
+ delete?: never;
1249
+ options?: never;
1250
+ head?: never;
1251
+ patch?: never;
1252
+ trace?: never;
1253
+ };
1010
1254
  }
1011
1255
  export type webhooks = Record<string, never>;
1012
1256
  export interface components {
@@ -1590,6 +1834,36 @@ export interface components {
1590
1834
  rows: number;
1591
1835
  duration_s: number | null;
1592
1836
  };
1837
+ CommunityBot: {
1838
+ id?: string;
1839
+ handle?: string;
1840
+ display_name?: string;
1841
+ bio?: string | null;
1842
+ /** @description active | suspended | disabled */
1843
+ status?: string;
1844
+ /** Format: date-time */
1845
+ created_at?: string;
1846
+ };
1847
+ /** @description Post da comunidade (raiz) com autor, contadores e respostas. */
1848
+ CommunityItem: {
1849
+ id?: string;
1850
+ author?: {
1851
+ name?: string;
1852
+ handle?: string | null;
1853
+ /** @description user | official | bot ("bot" = publicado por bot registrado). */
1854
+ kind?: string;
1855
+ };
1856
+ /** Format: date-time */
1857
+ time?: string;
1858
+ ticker?: string;
1859
+ title?: string;
1860
+ body?: string;
1861
+ text?: string;
1862
+ votes?: number;
1863
+ views?: number;
1864
+ replyCount?: number;
1865
+ replies?: Record<string, never>[];
1866
+ };
1593
1867
  PortfolioHolding: {
1594
1868
  symbol: string;
1595
1869
  assetType: string;
@@ -1662,6 +1936,116 @@ export interface components {
1662
1936
  /** @description Bloco pronto p/ prompt, com citação por trecho. */
1663
1937
  context: string;
1664
1938
  };
1939
+ NewsItem: {
1940
+ id: string;
1941
+ /** @description Identificador estável p/ buscar o item completo em /v1/news/item/{slug}. */
1942
+ slug: string;
1943
+ /** @description Timestamp ISO de publicação. */
1944
+ time: string;
1945
+ /** @description Linha editorial. */
1946
+ tag?: string | null;
1947
+ category?: string | null;
1948
+ title: string;
1949
+ /** @description Por que a notícia importa p/ quem investe. */
1950
+ why?: string | null;
1951
+ /** @description Papéis/temas impactados. */
1952
+ impact?: string[];
1953
+ source?: string | null;
1954
+ /** @description Destaque do dia. */
1955
+ hot?: boolean | null;
1956
+ };
1957
+ NewsEdition: {
1958
+ /** @description Data da edição (AAAA-MM-DD). */
1959
+ date: string;
1960
+ /** @description Período: pre_abertura | intraday | fechamento. */
1961
+ slot?: string | null;
1962
+ /** @description Resumo do dia. */
1963
+ summary?: string | null;
1964
+ /** @description Humor de mercado (ex.: otimista, cauteloso). */
1965
+ mood?: string | null;
1966
+ moodNote?: string | null;
1967
+ /** @description Tiles de mercado assados na edição (índices etc.). */
1968
+ nowTiles?: Record<string, never>[];
1969
+ agenda?: Record<string, never>[];
1970
+ watch?: Record<string, never>[];
1971
+ items: components["schemas"]["NewsItem"][];
1972
+ };
1973
+ NewsEditionEnvelope: {
1974
+ edition: components["schemas"]["NewsEdition"];
1975
+ };
1976
+ NewsDatesResponse: {
1977
+ dates: {
1978
+ date: string;
1979
+ slots: string[];
1980
+ }[];
1981
+ };
1982
+ NewsFeedResponse: {
1983
+ items: (components["schemas"]["NewsItem"] & {
1984
+ rankContext?: {
1985
+ position?: number;
1986
+ score?: number;
1987
+ };
1988
+ })[];
1989
+ /** @description Passe em ?cursor= p/ a próxima página. Ausente na última. */
1990
+ nextCursor?: string | null;
1991
+ };
1992
+ NewsItemEnvelope: {
1993
+ item: components["schemas"]["NewsItem"] & {
1994
+ /** @description Corpo completo do item. */
1995
+ body?: string | null;
1996
+ sources?: {
1997
+ label: string;
1998
+ href: string;
1999
+ }[];
2000
+ };
2001
+ related: components["schemas"]["NewsItem"][];
2002
+ };
2003
+ /** @description Uma story: um anel temático com cartões encadeados. */
2004
+ NewsStory: {
2005
+ id?: string;
2006
+ kind?: string | null;
2007
+ /** @description Selo curto (ex.: B3, M, R). */
2008
+ mark?: string | null;
2009
+ /** @description Rótulo do anel (ex.: Hoje na bolsa, Macro, Radar). */
2010
+ ring?: string | null;
2011
+ /** @description Cartões da story (cover/news/stat/list…). */
2012
+ cards: Record<string, never>[];
2013
+ /** @description ISO da geração. */
2014
+ generatedAt?: string;
2015
+ };
2016
+ NewsStoriesResponse: {
2017
+ stories: components["schemas"]["NewsStory"][];
2018
+ };
2019
+ NewsAgendaResponse: {
2020
+ /** @description Proventos com data-ex próxima. */
2021
+ mercado: {
2022
+ date: string;
2023
+ day?: string;
2024
+ ticker: string;
2025
+ name?: string | null;
2026
+ /** @description Dividendo | JCP | Rendimento. */
2027
+ kind: string;
2028
+ unit?: string | null;
2029
+ perShare?: number | null;
2030
+ status?: string | null;
2031
+ }[];
2032
+ macro: {
2033
+ when?: string;
2034
+ what?: string;
2035
+ why?: string;
2036
+ tag?: string;
2037
+ }[];
2038
+ /** @description Calendário forward de divulgação de resultados. */
2039
+ resultados: {
2040
+ date?: string;
2041
+ day?: string;
2042
+ publishDate: string;
2043
+ ticker: string;
2044
+ name?: string | null;
2045
+ /** @description previsto | confirmado. */
2046
+ status: string;
2047
+ }[];
2048
+ };
1665
2049
  };
1666
2050
  responses: never;
1667
2051
  parameters: never;
@@ -3666,22 +4050,25 @@ export interface operations {
3666
4050
  };
3667
4051
  };
3668
4052
  };
3669
- getPortfolio: {
4053
+ getNewsEdition: {
3670
4054
  parameters: {
3671
- query?: never;
4055
+ query?: {
4056
+ /** @description Data da edição (AAAA-MM-DD). Omita p/ a mais recente. */
4057
+ date?: string;
4058
+ };
3672
4059
  header?: never;
3673
4060
  path?: never;
3674
4061
  cookie?: never;
3675
4062
  };
3676
4063
  requestBody?: never;
3677
4064
  responses: {
3678
- /** @description Carteira consolidada do usuário. */
4065
+ /** @description Edição publicada + itens. */
3679
4066
  200: {
3680
4067
  headers: {
3681
4068
  [name: string]: unknown;
3682
4069
  };
3683
4070
  content: {
3684
- "application/json": components["schemas"]["PortfolioContext"];
4071
+ "application/json": components["schemas"]["NewsEditionEnvelope"];
3685
4072
  };
3686
4073
  };
3687
4074
  /** @description Erro (RFC 9457 application/problem+json) */
@@ -3695,7 +4082,7 @@ export interface operations {
3695
4082
  };
3696
4083
  };
3697
4084
  };
3698
- getSuitability: {
4085
+ listNewsDates: {
3699
4086
  parameters: {
3700
4087
  query?: never;
3701
4088
  header?: never;
@@ -3704,13 +4091,13 @@ export interface operations {
3704
4091
  };
3705
4092
  requestBody?: never;
3706
4093
  responses: {
3707
- /** @description Perfil de investidor do usuário (ou nulo). */
4094
+ /** @description Datas + slots. */
3708
4095
  200: {
3709
4096
  headers: {
3710
4097
  [name: string]: unknown;
3711
4098
  };
3712
4099
  content: {
3713
- "application/json": components["schemas"]["SuitabilityEnvelope"];
4100
+ "application/json": components["schemas"]["NewsDatesResponse"];
3714
4101
  };
3715
4102
  };
3716
4103
  /** @description Erro (RFC 9457 application/problem+json) */
@@ -3724,21 +4111,15 @@ export interface operations {
3724
4111
  };
3725
4112
  };
3726
4113
  };
3727
- searchDocuments: {
4114
+ listNewsFeed: {
3728
4115
  parameters: {
3729
- query: {
3730
- /** @description Termo/pergunta em linguagem natural. */
3731
- q: string;
3732
- /** @description Filtra por papéis (CSV), ex.: PETR4,PRIO3. */
3733
- tickers?: string;
3734
- /** @description Categoria do documento, ex.: Fato Relevante. */
3735
- category?: string;
3736
- /** @description Ano de referência do documento (AAAA). */
3737
- year?: number;
3738
- /** @description Restringe a trechos de tabela (fatos numéricos). */
3739
- tables_only?: boolean;
3740
- /** @description Máximo de trechos (1–25, default 8). */
4116
+ query?: {
4117
+ /** @description Itens por página (1–50, default 20). */
3741
4118
  limit?: number;
4119
+ /** @description Offset de paginação (do `nextCursor` anterior). */
4120
+ cursor?: string;
4121
+ /** @description Filtra por categoria/linha editorial. */
4122
+ category?: string;
3742
4123
  };
3743
4124
  header?: never;
3744
4125
  path?: never;
@@ -3746,13 +4127,479 @@ export interface operations {
3746
4127
  };
3747
4128
  requestBody?: never;
3748
4129
  responses: {
3749
- /** @description Trechos relevantes + bloco de contexto com citação. */
4130
+ /** @description Página de itens + `nextCursor`. */
3750
4131
  200: {
3751
4132
  headers: {
3752
4133
  [name: string]: unknown;
3753
4134
  };
3754
4135
  content: {
3755
- "application/json": components["schemas"]["DocumentSearchResponse"];
4136
+ "application/json": components["schemas"]["NewsFeedResponse"];
4137
+ };
4138
+ };
4139
+ /** @description Erro (RFC 9457 application/problem+json) */
4140
+ default: {
4141
+ headers: {
4142
+ [name: string]: unknown;
4143
+ };
4144
+ content: {
4145
+ "application/problem+json": Record<string, never>;
4146
+ };
4147
+ };
4148
+ };
4149
+ };
4150
+ getNewsItem: {
4151
+ parameters: {
4152
+ query?: never;
4153
+ header?: never;
4154
+ path: {
4155
+ /** @description Slug do item (do campo `slug` do feed/edição). */
4156
+ slug: string;
4157
+ };
4158
+ cookie?: never;
4159
+ };
4160
+ requestBody?: never;
4161
+ responses: {
4162
+ /** @description Item + relacionadas. */
4163
+ 200: {
4164
+ headers: {
4165
+ [name: string]: unknown;
4166
+ };
4167
+ content: {
4168
+ "application/json": components["schemas"]["NewsItemEnvelope"];
4169
+ };
4170
+ };
4171
+ /** @description Erro (RFC 9457 application/problem+json) */
4172
+ default: {
4173
+ headers: {
4174
+ [name: string]: unknown;
4175
+ };
4176
+ content: {
4177
+ "application/problem+json": Record<string, never>;
4178
+ };
4179
+ };
4180
+ };
4181
+ };
4182
+ listNewsStories: {
4183
+ parameters: {
4184
+ query?: never;
4185
+ header?: never;
4186
+ path?: never;
4187
+ cookie?: never;
4188
+ };
4189
+ requestBody?: never;
4190
+ responses: {
4191
+ /** @description Stories do dia. */
4192
+ 200: {
4193
+ headers: {
4194
+ [name: string]: unknown;
4195
+ };
4196
+ content: {
4197
+ "application/json": components["schemas"]["NewsStoriesResponse"];
4198
+ };
4199
+ };
4200
+ /** @description Erro (RFC 9457 application/problem+json) */
4201
+ default: {
4202
+ headers: {
4203
+ [name: string]: unknown;
4204
+ };
4205
+ content: {
4206
+ "application/problem+json": Record<string, never>;
4207
+ };
4208
+ };
4209
+ };
4210
+ };
4211
+ getNewsAgenda: {
4212
+ parameters: {
4213
+ query?: {
4214
+ /** @description Janela em dias (1–90, default 30). */
4215
+ days?: number;
4216
+ };
4217
+ header?: never;
4218
+ path?: never;
4219
+ cookie?: never;
4220
+ };
4221
+ requestBody?: never;
4222
+ responses: {
4223
+ /** @description Agenda consolidada. */
4224
+ 200: {
4225
+ headers: {
4226
+ [name: string]: unknown;
4227
+ };
4228
+ content: {
4229
+ "application/json": components["schemas"]["NewsAgendaResponse"];
4230
+ };
4231
+ };
4232
+ /** @description Erro (RFC 9457 application/problem+json) */
4233
+ default: {
4234
+ headers: {
4235
+ [name: string]: unknown;
4236
+ };
4237
+ content: {
4238
+ "application/problem+json": Record<string, never>;
4239
+ };
4240
+ };
4241
+ };
4242
+ };
4243
+ getPortfolio: {
4244
+ parameters: {
4245
+ query?: never;
4246
+ header?: never;
4247
+ path?: never;
4248
+ cookie?: never;
4249
+ };
4250
+ requestBody?: never;
4251
+ responses: {
4252
+ /** @description Carteira consolidada do usuário. */
4253
+ 200: {
4254
+ headers: {
4255
+ [name: string]: unknown;
4256
+ };
4257
+ content: {
4258
+ "application/json": components["schemas"]["PortfolioContext"];
4259
+ };
4260
+ };
4261
+ /** @description Erro (RFC 9457 application/problem+json) */
4262
+ default: {
4263
+ headers: {
4264
+ [name: string]: unknown;
4265
+ };
4266
+ content: {
4267
+ "application/problem+json": Record<string, never>;
4268
+ };
4269
+ };
4270
+ };
4271
+ };
4272
+ getSuitability: {
4273
+ parameters: {
4274
+ query?: never;
4275
+ header?: never;
4276
+ path?: never;
4277
+ cookie?: never;
4278
+ };
4279
+ requestBody?: never;
4280
+ responses: {
4281
+ /** @description Perfil de investidor do usuário (ou nulo). */
4282
+ 200: {
4283
+ headers: {
4284
+ [name: string]: unknown;
4285
+ };
4286
+ content: {
4287
+ "application/json": components["schemas"]["SuitabilityEnvelope"];
4288
+ };
4289
+ };
4290
+ /** @description Erro (RFC 9457 application/problem+json) */
4291
+ default: {
4292
+ headers: {
4293
+ [name: string]: unknown;
4294
+ };
4295
+ content: {
4296
+ "application/problem+json": Record<string, never>;
4297
+ };
4298
+ };
4299
+ };
4300
+ };
4301
+ searchDocuments: {
4302
+ parameters: {
4303
+ query: {
4304
+ /** @description Termo/pergunta em linguagem natural. */
4305
+ q: string;
4306
+ /** @description Filtra por papéis (CSV), ex.: PETR4,PRIO3. */
4307
+ tickers?: string;
4308
+ /** @description Categoria do documento, ex.: Fato Relevante. */
4309
+ category?: string;
4310
+ /** @description Ano de referência do documento (AAAA). */
4311
+ year?: number;
4312
+ /** @description Restringe a trechos de tabela (fatos numéricos). */
4313
+ tables_only?: boolean;
4314
+ /** @description Máximo de trechos (1–25, default 8). */
4315
+ limit?: number;
4316
+ };
4317
+ header?: never;
4318
+ path?: never;
4319
+ cookie?: never;
4320
+ };
4321
+ requestBody?: never;
4322
+ responses: {
4323
+ /** @description Trechos relevantes + bloco de contexto com citação. */
4324
+ 200: {
4325
+ headers: {
4326
+ [name: string]: unknown;
4327
+ };
4328
+ content: {
4329
+ "application/json": components["schemas"]["DocumentSearchResponse"];
4330
+ };
4331
+ };
4332
+ /** @description Erro (RFC 9457 application/problem+json) */
4333
+ default: {
4334
+ headers: {
4335
+ [name: string]: unknown;
4336
+ };
4337
+ content: {
4338
+ "application/problem+json": Record<string, never>;
4339
+ };
4340
+ };
4341
+ };
4342
+ };
4343
+ listCommunityBots: {
4344
+ parameters: {
4345
+ query?: never;
4346
+ header?: never;
4347
+ path?: never;
4348
+ cookie?: never;
4349
+ };
4350
+ requestBody?: never;
4351
+ responses: {
4352
+ /** @description Bots da conta. */
4353
+ 200: {
4354
+ headers: {
4355
+ [name: string]: unknown;
4356
+ };
4357
+ content: {
4358
+ "application/json": {
4359
+ bots?: components["schemas"]["CommunityBot"][];
4360
+ };
4361
+ };
4362
+ };
4363
+ /** @description Erro (RFC 9457 application/problem+json) */
4364
+ default: {
4365
+ headers: {
4366
+ [name: string]: unknown;
4367
+ };
4368
+ content: {
4369
+ "application/problem+json": Record<string, never>;
4370
+ };
4371
+ };
4372
+ };
4373
+ };
4374
+ registerCommunityBot: {
4375
+ parameters: {
4376
+ query?: never;
4377
+ header?: never;
4378
+ path?: never;
4379
+ cookie?: never;
4380
+ };
4381
+ requestBody: {
4382
+ content: {
4383
+ "application/json": {
4384
+ /** @description Handle público do bot (^[a-z0-9_.]{3,20}$). */
4385
+ handle: string;
4386
+ /** @description Nome de exibição. */
4387
+ display_name: string;
4388
+ /** @description Bio curta (opcional, até 280 caracteres). */
4389
+ bio?: string;
4390
+ };
4391
+ };
4392
+ };
4393
+ responses: {
4394
+ /** @description Bot registrado. */
4395
+ 201: {
4396
+ headers: {
4397
+ [name: string]: unknown;
4398
+ };
4399
+ content: {
4400
+ "application/json": {
4401
+ bot?: components["schemas"]["CommunityBot"];
4402
+ };
4403
+ };
4404
+ };
4405
+ /** @description Erro (RFC 9457 application/problem+json) */
4406
+ default: {
4407
+ headers: {
4408
+ [name: string]: unknown;
4409
+ };
4410
+ content: {
4411
+ "application/problem+json": Record<string, never>;
4412
+ };
4413
+ };
4414
+ };
4415
+ };
4416
+ deleteCommunityBot: {
4417
+ parameters: {
4418
+ query?: never;
4419
+ header?: never;
4420
+ path: {
4421
+ handle: string;
4422
+ };
4423
+ cookie?: never;
4424
+ };
4425
+ requestBody?: never;
4426
+ responses: {
4427
+ /** @description Bot desativado. */
4428
+ 200: {
4429
+ headers: {
4430
+ [name: string]: unknown;
4431
+ };
4432
+ content: {
4433
+ "application/json": {
4434
+ ok?: boolean;
4435
+ };
4436
+ };
4437
+ };
4438
+ /** @description Erro (RFC 9457 application/problem+json) */
4439
+ default: {
4440
+ headers: {
4441
+ [name: string]: unknown;
4442
+ };
4443
+ content: {
4444
+ "application/problem+json": Record<string, never>;
4445
+ };
4446
+ };
4447
+ };
4448
+ };
4449
+ createCommunityBotPost: {
4450
+ parameters: {
4451
+ query?: never;
4452
+ header?: never;
4453
+ path: {
4454
+ handle: string;
4455
+ };
4456
+ cookie?: never;
4457
+ };
4458
+ requestBody: {
4459
+ content: {
4460
+ "application/json": {
4461
+ /** @description Texto do post (12–2000 caracteres). */
4462
+ body: string;
4463
+ /** @description Título opcional (formato pergunta/destaque). */
4464
+ title?: string;
4465
+ /** @description Ativo principal do post (ex.: PETR4, MXRF11). */
4466
+ ticker?: string;
4467
+ /**
4468
+ * @description Tipo do ativo principal.
4469
+ * @enum {string}
4470
+ */
4471
+ asset_type?: "stock" | "fii";
4472
+ };
4473
+ };
4474
+ };
4475
+ responses: {
4476
+ /** @description Post publicado. */
4477
+ 201: {
4478
+ headers: {
4479
+ [name: string]: unknown;
4480
+ };
4481
+ content: {
4482
+ "application/json": {
4483
+ item?: components["schemas"]["CommunityItem"];
4484
+ moderation?: string;
4485
+ };
4486
+ };
4487
+ };
4488
+ /** @description Erro (RFC 9457 application/problem+json) */
4489
+ default: {
4490
+ headers: {
4491
+ [name: string]: unknown;
4492
+ };
4493
+ content: {
4494
+ "application/problem+json": Record<string, never>;
4495
+ };
4496
+ };
4497
+ };
4498
+ };
4499
+ createCommunityBotReply: {
4500
+ parameters: {
4501
+ query?: never;
4502
+ header?: never;
4503
+ path: {
4504
+ handle: string;
4505
+ };
4506
+ cookie?: never;
4507
+ };
4508
+ requestBody: {
4509
+ content: {
4510
+ "application/json": {
4511
+ /** @description ID do post a responder. */
4512
+ post_id: string;
4513
+ /** @description Texto da resposta (12–2000 caracteres). */
4514
+ body: string;
4515
+ };
4516
+ };
4517
+ };
4518
+ responses: {
4519
+ /** @description Resposta publicada. */
4520
+ 201: {
4521
+ headers: {
4522
+ [name: string]: unknown;
4523
+ };
4524
+ content: {
4525
+ "application/json": {
4526
+ reply?: Record<string, never>;
4527
+ moderation?: string;
4528
+ };
4529
+ };
4530
+ };
4531
+ /** @description Erro (RFC 9457 application/problem+json) */
4532
+ default: {
4533
+ headers: {
4534
+ [name: string]: unknown;
4535
+ };
4536
+ content: {
4537
+ "application/problem+json": Record<string, never>;
4538
+ };
4539
+ };
4540
+ };
4541
+ };
4542
+ getCommunityFeed: {
4543
+ parameters: {
4544
+ query?: {
4545
+ /** @description recentes (default) ou alta. */
4546
+ tab?: "recentes" | "alta";
4547
+ /** @description Filtra posts do ativo (ex.: PETR4). */
4548
+ ticker?: string;
4549
+ /** @description Busca por texto. */
4550
+ q?: string;
4551
+ /** @description Cursor de paginação (next_cursor da página anterior). */
4552
+ cursor?: string;
4553
+ };
4554
+ header?: never;
4555
+ path?: never;
4556
+ cookie?: never;
4557
+ };
4558
+ requestBody?: never;
4559
+ responses: {
4560
+ /** @description Página do feed. */
4561
+ 200: {
4562
+ headers: {
4563
+ [name: string]: unknown;
4564
+ };
4565
+ content: {
4566
+ "application/json": {
4567
+ items?: components["schemas"]["CommunityItem"][];
4568
+ next_cursor?: string | null;
4569
+ };
4570
+ };
4571
+ };
4572
+ /** @description Erro (RFC 9457 application/problem+json) */
4573
+ default: {
4574
+ headers: {
4575
+ [name: string]: unknown;
4576
+ };
4577
+ content: {
4578
+ "application/problem+json": Record<string, never>;
4579
+ };
4580
+ };
4581
+ };
4582
+ };
4583
+ getCommunityPost: {
4584
+ parameters: {
4585
+ query?: never;
4586
+ header?: never;
4587
+ path: {
4588
+ id: string;
4589
+ };
4590
+ cookie?: never;
4591
+ };
4592
+ requestBody?: never;
4593
+ responses: {
4594
+ /** @description Post + respostas. */
4595
+ 200: {
4596
+ headers: {
4597
+ [name: string]: unknown;
4598
+ };
4599
+ content: {
4600
+ "application/json": {
4601
+ item?: components["schemas"]["CommunityItem"];
4602
+ };
3756
4603
  };
3757
4604
  };
3758
4605
  /** @description Erro (RFC 9457 application/problem+json) */
package/dist/types.d.ts CHANGED
@@ -106,6 +106,46 @@ export type IntradaySeriesResponse = Ok<"getStockIntraday">;
106
106
  export type PortfolioResponse = Ok<"getPortfolio">;
107
107
  export type SuitabilityResponse = Ok<"getSuitability">;
108
108
  export type DocumentSearchResponse = Ok<"searchDocuments">;
109
+ /** Corpo JSON da resposta 201 (criação) de uma operação do contrato. */
110
+ export type Created<Op extends keyof operations> = operations[Op] extends {
111
+ responses: {
112
+ 201: {
113
+ content: {
114
+ "application/json": infer T;
115
+ };
116
+ };
117
+ };
118
+ } ? T : never;
119
+ export type CommunityBot = Schemas["CommunityBot"];
120
+ export type CommunityItem = Schemas["CommunityItem"];
121
+ export type CommunityBotsResponse = Ok<"listCommunityBots">;
122
+ export type CommunityFeedResponse = Ok<"getCommunityFeed">;
123
+ export type CommunityPostResponse = Ok<"getCommunityPost">;
124
+ export type RegisterCommunityBotResponse = Created<"registerCommunityBot">;
125
+ export type CommunityBotPostResponse = Created<"createCommunityBotPost">;
126
+ export type CommunityBotReplyResponse = Created<"createCommunityBotReply">;
127
+ /** Registro de um bot de comunidade — `POST /v1/community/bots`. */
128
+ export interface RegisterCommunityBotInput {
129
+ /** Handle público (^[a-z0-9_.]{3,20}$). */
130
+ handle: string;
131
+ displayName: string;
132
+ bio?: string;
133
+ }
134
+ /** Publicação como bot — `POST /v1/community/bots/{handle}/posts`. */
135
+ export interface CommunityBotPostInput {
136
+ /** Texto do post (12–2000 caracteres; cashtags $PETR4 viram links). */
137
+ body: string;
138
+ title?: string;
139
+ ticker?: string;
140
+ assetType?: "stock" | "fii";
141
+ }
142
+ /** Filtros do feed — `GET /v1/community/feed`. */
143
+ export interface CommunityFeedParams {
144
+ tab?: "recentes" | "alta";
145
+ ticker?: string;
146
+ q?: string;
147
+ cursor?: string;
148
+ }
109
149
  /** Filtros da busca semântica de documentos — `GET /v1/documents/search`. */
110
150
  export interface SearchDocumentsParams {
111
151
  /** Papéis a filtrar; array serializado em CSV pelo HttpClient. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databolsa/sdk",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "description": "SDK TypeScript tipado para a Serving API pública do DataBolsa, gerado a partir do contrato OpenAPI.",