openapi.yaml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. openapi: 3.0.0
  2. info:
  3. title: BYOM Trends API
  4. version: '1.0'
  5. description: API for managing BYOM Trends
  6. contact:
  7. name: BYOM Support
  8. servers:
  9. - url: /api/v1/trends
  10. description: BYOM Trends API
  11. tags:
  12. - name: Trends
  13. description: Trend analysis operations
  14. - name: Social
  15. description: Social media profile operations
  16. - name: Google
  17. description: Google Trends operations
  18. - name: Suggestions
  19. description: Product and service suggestions based on trend analysis
  20. paths:
  21. /api/v1/trends/analyze/profile/{id}:
  22. post:
  23. tags:
  24. - Trends
  25. summary: Analyze trends for a social media profile
  26. parameters:
  27. - name: id
  28. in: path
  29. required: true
  30. schema:
  31. type: string
  32. format: uuid
  33. description: Profile ID to analyze
  34. responses:
  35. '201':
  36. description: Trend analysis created successfully
  37. content:
  38. application/json:
  39. schema:
  40. $ref: '#/components/schemas/TrendAnalysis'
  41. '404':
  42. description: Profile not found
  43. '500':
  44. description: Internal server error
  45. /api/v1/trends/analysis/{id}:
  46. get:
  47. tags:
  48. - Trends
  49. summary: Get trend analysis report
  50. parameters:
  51. - name: id
  52. in: path
  53. required: true
  54. schema:
  55. type: string
  56. format: uuid
  57. description: Analysis ID
  58. responses:
  59. '200':
  60. description: Trend analysis retrieved successfully
  61. content:
  62. application/json:
  63. schema:
  64. $ref: '#/components/schemas/TrendAnalysis'
  65. '404':
  66. description: Analysis not found
  67. '500':
  68. description: Internal server error
  69. /api/v1/trends/social/connect:
  70. post:
  71. tags:
  72. - Social
  73. summary: Connect a social media profile
  74. requestBody:
  75. required: true
  76. content:
  77. application/json:
  78. schema:
  79. $ref: '#/components/schemas/ConnectProfileRequest'
  80. responses:
  81. '201':
  82. description: Profile connected successfully
  83. content:
  84. application/json:
  85. schema:
  86. $ref: '#/components/schemas/SocialProfile'
  87. '400':
  88. description: Invalid request
  89. '500':
  90. description: Internal server error
  91. /api/v1/trends/google/analyze:
  92. post:
  93. tags:
  94. - Google
  95. summary: Analyze Google Trends data
  96. requestBody:
  97. required: true
  98. content:
  99. application/json:
  100. schema:
  101. $ref: '#/components/schemas/GoogleTrendsRequest'
  102. responses:
  103. '200':
  104. description: Analysis successful
  105. content:
  106. application/json:
  107. schema:
  108. $ref: '#/components/schemas/GoogleTrendsResponse'
  109. '400':
  110. description: Invalid request
  111. '500':
  112. description: Internal server error
  113. /api/v1/trends/google/topics:
  114. get:
  115. tags:
  116. - Google
  117. summary: Get related topics for keywords
  118. parameters:
  119. - name: keyword
  120. in: query
  121. required: true
  122. schema:
  123. type: string
  124. description: Keyword to get related topics for
  125. responses:
  126. '200':
  127. description: Related topics retrieved successfully
  128. content:
  129. application/json:
  130. schema:
  131. type: array
  132. items:
  133. $ref: '#/components/schemas/RelatedTopic'
  134. '400':
  135. description: Invalid request
  136. '500':
  137. description: Internal server error
  138. /api/v1/trends/google/regional:
  139. get:
  140. tags:
  141. - Google
  142. summary: Get regional interest data
  143. parameters:
  144. - name: keyword
  145. in: query
  146. required: true
  147. schema:
  148. type: string
  149. description: Keyword to get regional interest for
  150. - name: region
  151. in: query
  152. required: false
  153. schema:
  154. type: string
  155. description: Specific region to analyze
  156. responses:
  157. '200':
  158. description: Regional interest data retrieved successfully
  159. content:
  160. application/json:
  161. schema:
  162. type: object
  163. additionalProperties:
  164. type: integer
  165. '400':
  166. description: Invalid request
  167. '500':
  168. description: Internal server error
  169. /api/v1/trends/google/analysis/{id}:
  170. get:
  171. tags:
  172. - Google
  173. summary: Get Google Trends analysis by ID
  174. parameters:
  175. - name: id
  176. in: path
  177. required: true
  178. schema:
  179. type: string
  180. format: uuid
  181. description: Analysis ID
  182. responses:
  183. '200':
  184. description: Analysis retrieved successfully
  185. content:
  186. application/json:
  187. schema:
  188. $ref: '#/components/schemas/GoogleTrend'
  189. '404':
  190. description: Analysis not found
  191. '500':
  192. description: Internal server error
  193. /api/v1/trends/social/{platform}/stats:
  194. get:
  195. tags:
  196. - Social
  197. summary: Get platform-specific statistics
  198. parameters:
  199. - name: platform
  200. in: path
  201. required: true
  202. schema:
  203. type: string
  204. enum: [instagram, tiktok, youtube]
  205. description: Social media platform
  206. responses:
  207. '200':
  208. description: Platform statistics retrieved successfully
  209. content:
  210. application/json:
  211. schema:
  212. $ref: '#/components/schemas/PlatformStats'
  213. '400':
  214. description: Invalid platform
  215. '500':
  216. description: Internal server error
  217. /api/v1/trends/social/{platform}/engagement/{id}:
  218. get:
  219. tags:
  220. - Social
  221. summary: Get engagement metrics for a social profile
  222. parameters:
  223. - name: platform
  224. in: path
  225. required: true
  226. schema:
  227. type: string
  228. enum: [instagram, tiktok, youtube]
  229. description: Social media platform
  230. - name: id
  231. in: path
  232. required: true
  233. schema:
  234. type: string
  235. format: uuid
  236. description: Profile ID
  237. responses:
  238. '200':
  239. description: Engagement metrics retrieved successfully
  240. content:
  241. application/json:
  242. schema:
  243. $ref: '#/components/schemas/EngagementMetrics'
  244. '404':
  245. description: Profile not found
  246. '500':
  247. description: Internal server error
  248. /api/v1/trends/suggestions:
  249. post:
  250. tags:
  251. - Suggestions
  252. summary: Get product suggestions based on social trends
  253. description: Analyzes social media trends and suggests potential products or services
  254. requestBody:
  255. required: true
  256. content:
  257. application/json:
  258. schema:
  259. $ref: '#/components/schemas/GetSuggestionsRequest'
  260. responses:
  261. '200':
  262. description: Suggestions retrieved successfully
  263. content:
  264. application/json:
  265. schema:
  266. type: array
  267. items:
  268. $ref: '#/components/schemas/ProductSuggestion'
  269. '400':
  270. description: Invalid request format
  271. '500':
  272. description: Internal server error
  273. /api/v1/trends/suggestions/user/{user_id}:
  274. get:
  275. tags:
  276. - Suggestions
  277. summary: Get all suggestions for a user
  278. parameters:
  279. - name: user_id
  280. in: path
  281. required: true
  282. schema:
  283. type: string
  284. responses:
  285. '200':
  286. description: Suggestions retrieved successfully
  287. content:
  288. application/json:
  289. schema:
  290. type: array
  291. items:
  292. $ref: '#/components/schemas/ProductSuggestion'
  293. /api/v1/trends/suggestions/{id}:
  294. get:
  295. tags:
  296. - Suggestions
  297. summary: Get a specific suggestion
  298. parameters:
  299. - name: id
  300. in: path
  301. required: true
  302. schema:
  303. type: string
  304. format: uuid
  305. responses:
  306. '200':
  307. description: Suggestion retrieved successfully
  308. content:
  309. application/json:
  310. schema:
  311. $ref: '#/components/schemas/ProductSuggestion'
  312. components:
  313. schemas:
  314. TrendAnalysis:
  315. type: object
  316. properties:
  317. id:
  318. type: string
  319. format: uuid
  320. profile_id:
  321. type: string
  322. format: uuid
  323. type:
  324. type: string
  325. enum: [social, google]
  326. created_at:
  327. type: string
  328. format: date-time
  329. updated_at:
  330. type: string
  331. format: date-time
  332. SocialProfile:
  333. type: object
  334. properties:
  335. id:
  336. type: string
  337. format: uuid
  338. platform:
  339. type: string
  340. enum: [instagram, tiktok, youtube]
  341. username:
  342. type: string
  343. profile_url:
  344. type: string
  345. follower_count:
  346. type: integer
  347. format: int64
  348. engagement:
  349. type: number
  350. format: float
  351. created_at:
  352. type: string
  353. format: date-time
  354. updated_at:
  355. type: string
  356. format: date-time
  357. ConnectProfileRequest:
  358. type: object
  359. required:
  360. - platform
  361. - username
  362. properties:
  363. platform:
  364. type: string
  365. enum: [instagram, tiktok, youtube]
  366. username:
  367. type: string
  368. GoogleTrendsRequest:
  369. type: object
  370. required:
  371. - keywords
  372. properties:
  373. keywords:
  374. type: array
  375. items:
  376. type: string
  377. time_range:
  378. type: string
  379. enum: [LAST_HOUR, LAST_DAY, LAST_WEEK, LAST_MONTH]
  380. region:
  381. type: string
  382. GoogleTrendsResponse:
  383. type: object
  384. properties:
  385. results:
  386. type: object
  387. additionalProperties:
  388. type: integer
  389. related_topics:
  390. type: object
  391. additionalProperties:
  392. type: array
  393. items:
  394. $ref: '#/components/schemas/RelatedTopic'
  395. regional_interest:
  396. type: object
  397. additionalProperties:
  398. type: integer
  399. RelatedTopic:
  400. type: object
  401. properties:
  402. title:
  403. type: string
  404. type:
  405. type: string
  406. value:
  407. type: integer
  408. GoogleTrend:
  409. type: object
  410. properties:
  411. id:
  412. type: string
  413. format: uuid
  414. keyword:
  415. type: string
  416. interest_over_time:
  417. type: object
  418. additionalProperties:
  419. type: integer
  420. created_at:
  421. type: string
  422. format: date-time
  423. PlatformStats:
  424. type: object
  425. properties:
  426. platform:
  427. type: string
  428. enum: [instagram, tiktok, youtube]
  429. total_profiles:
  430. type: integer
  431. avg_engagement:
  432. type: number
  433. format: float
  434. trending_topics:
  435. type: array
  436. items:
  437. type: string
  438. EngagementMetrics:
  439. type: object
  440. properties:
  441. profile_id:
  442. type: string
  443. format: uuid
  444. platform:
  445. type: string
  446. enum: [instagram, tiktok, youtube]
  447. engagement_rate:
  448. type: number
  449. format: float
  450. likes:
  451. type: integer
  452. comments:
  453. type: integer
  454. shares:
  455. type: integer
  456. period:
  457. type: string
  458. enum: [daily, weekly, monthly]
  459. timestamp:
  460. type: string
  461. format: date-time
  462. GetSuggestionsRequest:
  463. type: object
  464. required:
  465. - user_id
  466. - socials
  467. properties:
  468. user_id:
  469. type: string
  470. description: ID of the user requesting suggestions
  471. socials:
  472. type: array
  473. description: List of social media profiles to analyze for suggestions
  474. items:
  475. $ref: '#/components/schemas/Social'
  476. Social:
  477. type: object
  478. required:
  479. - platform
  480. - username
  481. properties:
  482. platform:
  483. type: string
  484. enum: [instagram, tiktok, youtube]
  485. username:
  486. type: string
  487. ProductSuggestion:
  488. type: object
  489. properties:
  490. name:
  491. type: string
  492. description: Name of the suggested product or service
  493. description:
  494. type: string
  495. description: Short description of the product/service
  496. target_audience:
  497. type: string
  498. description: Description of the target market
  499. relevance_score:
  500. type: number
  501. format: float
  502. minimum: 1
  503. maximum: 10
  504. description: Score indicating how well the suggestion matches current trends
  505. success_factors:
  506. type: array
  507. items:
  508. type: string
  509. description: List of factors supporting the potential success
  510. securitySchemes:
  511. BearerAuth:
  512. type: http
  513. scheme: bearer
  514. bearerFormat: JWT
  515. security:
  516. - BearerAuth: []