hyperpocket 0.3.4__py3-none-any.whl → 0.3.5__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (455) hide show
  1. hyperpocket/auth/activeloop/README.md +8 -0
  2. hyperpocket/auth/activeloop/__init__.py +0 -0
  3. hyperpocket/auth/activeloop/context.py +15 -0
  4. hyperpocket/auth/activeloop/token_context.py +11 -0
  5. hyperpocket/auth/activeloop/token_handler.py +92 -0
  6. hyperpocket/auth/activeloop/token_schema.py +9 -0
  7. hyperpocket/auth/adobe/README.md +8 -0
  8. hyperpocket/auth/adobe/__init__.py +0 -0
  9. hyperpocket/auth/adobe/context.py +15 -0
  10. hyperpocket/auth/adobe/token_context.py +11 -0
  11. hyperpocket/auth/adobe/token_handler.py +89 -0
  12. hyperpocket/auth/adobe/token_schema.py +11 -0
  13. hyperpocket/auth/affinity/README.md +18 -0
  14. hyperpocket/auth/affinity/__init__.py +0 -0
  15. hyperpocket/auth/affinity/context.py +15 -0
  16. hyperpocket/auth/affinity/token_context.py +11 -0
  17. hyperpocket/auth/affinity/token_handler.py +92 -0
  18. hyperpocket/auth/affinity/token_schema.py +11 -0
  19. hyperpocket/auth/agentql/README.md +8 -0
  20. hyperpocket/auth/agentql/__init__.py +0 -0
  21. hyperpocket/auth/agentql/context.py +15 -0
  22. hyperpocket/auth/agentql/token_context.py +11 -0
  23. hyperpocket/auth/agentql/token_handler.py +92 -0
  24. hyperpocket/auth/agentql/token_schema.py +9 -0
  25. hyperpocket/auth/ahrefs/README.md +8 -0
  26. hyperpocket/auth/ahrefs/__init__.py +0 -0
  27. hyperpocket/auth/ahrefs/context.py +15 -0
  28. hyperpocket/auth/ahrefs/token_context.py +11 -0
  29. hyperpocket/auth/ahrefs/token_handler.py +89 -0
  30. hyperpocket/auth/ahrefs/token_schema.py +11 -0
  31. hyperpocket/auth/airtable/README.md +8 -0
  32. hyperpocket/auth/airtable/__init__.py +0 -0
  33. hyperpocket/auth/airtable/context.py +15 -0
  34. hyperpocket/auth/airtable/token_context.py +11 -0
  35. hyperpocket/auth/airtable/token_handler.py +92 -0
  36. hyperpocket/auth/airtable/token_schema.py +11 -0
  37. hyperpocket/auth/alchemy/README.md +8 -0
  38. hyperpocket/auth/alchemy/__init__.py +0 -0
  39. hyperpocket/auth/alchemy/context.py +15 -0
  40. hyperpocket/auth/alchemy/token_context.py +11 -0
  41. hyperpocket/auth/alchemy/token_handler.py +92 -0
  42. hyperpocket/auth/alchemy/token_schema.py +11 -0
  43. hyperpocket/auth/altoviz/README.md +8 -0
  44. hyperpocket/auth/altoviz/__init__.py +0 -0
  45. hyperpocket/auth/altoviz/context.py +15 -0
  46. hyperpocket/auth/altoviz/token_context.py +11 -0
  47. hyperpocket/auth/altoviz/token_handler.py +92 -0
  48. hyperpocket/auth/altoviz/token_schema.py +11 -0
  49. hyperpocket/auth/asana/README.md +13 -0
  50. hyperpocket/auth/asana/__init__.py +0 -0
  51. hyperpocket/auth/asana/context.py +15 -0
  52. hyperpocket/auth/asana/oauth2_context.py +36 -0
  53. hyperpocket/auth/asana/oauth2_handler.py +158 -0
  54. hyperpocket/auth/asana/oauth2_schema.py +18 -0
  55. hyperpocket/auth/bamboohr/README.md +9 -0
  56. hyperpocket/auth/bamboohr/__init__.py +0 -0
  57. hyperpocket/auth/bamboohr/context.py +15 -0
  58. hyperpocket/auth/bamboohr/token_context.py +11 -0
  59. hyperpocket/auth/bamboohr/token_handler.py +92 -0
  60. hyperpocket/auth/bamboohr/token_schema.py +11 -0
  61. hyperpocket/auth/bitbucket/README.md +13 -0
  62. hyperpocket/auth/bitbucket/__init__.py +0 -0
  63. hyperpocket/auth/bitbucket/context.py +15 -0
  64. hyperpocket/auth/bitbucket/oauth2_context.py +33 -0
  65. hyperpocket/auth/bitbucket/oauth2_handler.py +146 -0
  66. hyperpocket/auth/bitbucket/oauth2_schema.py +18 -0
  67. hyperpocket/auth/bitwarden/README.md +9 -0
  68. hyperpocket/auth/bitwarden/__init__.py +0 -0
  69. hyperpocket/auth/bitwarden/context.py +15 -0
  70. hyperpocket/auth/bitwarden/token_context.py +11 -0
  71. hyperpocket/auth/bitwarden/token_handler.py +92 -0
  72. hyperpocket/auth/bitwarden/token_schema.py +11 -0
  73. hyperpocket/auth/brevo/README.md +9 -0
  74. hyperpocket/auth/brevo/__init__.py +0 -0
  75. hyperpocket/auth/brevo/context.py +15 -0
  76. hyperpocket/auth/brevo/token_context.py +11 -0
  77. hyperpocket/auth/brevo/token_handler.py +89 -0
  78. hyperpocket/auth/brevo/token_schema.py +11 -0
  79. hyperpocket/auth/brex/README.md +9 -0
  80. hyperpocket/auth/brex/__init__.py +0 -0
  81. hyperpocket/auth/brex/context.py +15 -0
  82. hyperpocket/auth/brex/token_context.py +11 -0
  83. hyperpocket/auth/brex/token_handler.py +87 -0
  84. hyperpocket/auth/brex/token_schema.py +11 -0
  85. hyperpocket/auth/cal/README.md +9 -0
  86. hyperpocket/auth/cal/__init__.py +0 -0
  87. hyperpocket/auth/cal/context.py +15 -0
  88. hyperpocket/auth/cal/token_context.py +11 -0
  89. hyperpocket/auth/cal/token_handler.py +85 -0
  90. hyperpocket/auth/cal/token_schema.py +11 -0
  91. hyperpocket/auth/calendly/README.md +13 -0
  92. hyperpocket/auth/canvas/README.md +9 -0
  93. hyperpocket/auth/canvas/__init__.py +0 -0
  94. hyperpocket/auth/canvas/context.py +15 -0
  95. hyperpocket/auth/canvas/token_context.py +11 -0
  96. hyperpocket/auth/canvas/token_handler.py +89 -0
  97. hyperpocket/auth/canvas/token_schema.py +11 -0
  98. hyperpocket/auth/clickup/README.md +9 -0
  99. hyperpocket/auth/clickup/__init__.py +0 -0
  100. hyperpocket/auth/clickup/context.py +15 -0
  101. hyperpocket/auth/clickup/token_context.py +11 -0
  102. hyperpocket/auth/clickup/token_handler.py +92 -0
  103. hyperpocket/auth/clickup/token_schema.py +11 -0
  104. hyperpocket/auth/cloudflare/README.md +9 -0
  105. hyperpocket/auth/cloudflare/__init__.py +0 -0
  106. hyperpocket/auth/cloudflare/context.py +15 -0
  107. hyperpocket/auth/cloudflare/token_context.py +11 -0
  108. hyperpocket/auth/cloudflare/token_handler.py +92 -0
  109. hyperpocket/auth/cloudflare/token_schema.py +11 -0
  110. hyperpocket/auth/dailybot/README.md +9 -0
  111. hyperpocket/auth/dailybot/__init__.py +0 -0
  112. hyperpocket/auth/dailybot/context.py +15 -0
  113. hyperpocket/auth/dailybot/token_context.py +11 -0
  114. hyperpocket/auth/dailybot/token_handler.py +92 -0
  115. hyperpocket/auth/dailybot/token_schema.py +11 -0
  116. hyperpocket/auth/datadog/README.md +9 -0
  117. hyperpocket/auth/datadog/__init__.py +0 -0
  118. hyperpocket/auth/datadog/context.py +15 -0
  119. hyperpocket/auth/datadog/token_context.py +11 -0
  120. hyperpocket/auth/datadog/token_handler.py +92 -0
  121. hyperpocket/auth/datadog/token_schema.py +11 -0
  122. hyperpocket/auth/discord/README.md +14 -0
  123. hyperpocket/auth/discord/__init__.py +0 -0
  124. hyperpocket/auth/discord/context.py +15 -0
  125. hyperpocket/auth/discord/oauth2_context.py +35 -0
  126. hyperpocket/auth/discord/oauth2_handler.py +133 -0
  127. hyperpocket/auth/discord/oauth2_schema.py +18 -0
  128. hyperpocket/auth/discord/token_context.py +11 -0
  129. hyperpocket/auth/discord/token_handler.py +92 -0
  130. hyperpocket/auth/discord/token_schema.py +11 -0
  131. hyperpocket/auth/discordbot/README.md +14 -0
  132. hyperpocket/auth/discordbot/__init__.py +0 -0
  133. hyperpocket/auth/discordbot/context.py +15 -0
  134. hyperpocket/auth/discordbot/token_context.py +11 -0
  135. hyperpocket/auth/discordbot/token_handler.py +92 -0
  136. hyperpocket/auth/discordbot/token_schema.py +11 -0
  137. hyperpocket/auth/elevenlabs/README.md +9 -0
  138. hyperpocket/auth/elevenlabs/__init__.py +0 -0
  139. hyperpocket/auth/elevenlabs/context.py +15 -0
  140. hyperpocket/auth/elevenlabs/token_context.py +11 -0
  141. hyperpocket/auth/elevenlabs/token_handler.py +92 -0
  142. hyperpocket/auth/elevenlabs/token_schema.py +11 -0
  143. hyperpocket/auth/exa/README.md +9 -0
  144. hyperpocket/auth/exa/__init__.py +0 -0
  145. hyperpocket/auth/exa/context.py +15 -0
  146. hyperpocket/auth/exa/token_context.py +11 -0
  147. hyperpocket/auth/exa/token_handler.py +85 -0
  148. hyperpocket/auth/exa/token_schema.py +11 -0
  149. hyperpocket/auth/facebook/README.md +13 -0
  150. hyperpocket/auth/facebook/__init__.py +0 -0
  151. hyperpocket/auth/facebook/context.py +15 -0
  152. hyperpocket/auth/facebook/oauth2_context.py +33 -0
  153. hyperpocket/auth/facebook/oauth2_handler.py +134 -0
  154. hyperpocket/auth/facebook/oauth2_schema.py +17 -0
  155. hyperpocket/auth/finage/README.md +9 -0
  156. hyperpocket/auth/finage/__init__.py +0 -0
  157. hyperpocket/auth/finage/context.py +15 -0
  158. hyperpocket/auth/finage/token_context.py +11 -0
  159. hyperpocket/auth/finage/token_handler.py +89 -0
  160. hyperpocket/auth/finage/token_schema.py +11 -0
  161. hyperpocket/auth/github/README.md +14 -0
  162. hyperpocket/auth/google/README.md +13 -0
  163. hyperpocket/auth/gumloop/README.md +9 -0
  164. hyperpocket/auth/happyrobot/README.md +9 -0
  165. hyperpocket/auth/happyrobot/__init__.py +0 -0
  166. hyperpocket/auth/happyrobot/context.py +15 -0
  167. hyperpocket/auth/happyrobot/token_context.py +11 -0
  168. hyperpocket/auth/happyrobot/token_handler.py +92 -0
  169. hyperpocket/auth/happyrobot/token_schema.py +9 -0
  170. hyperpocket/auth/heygen/README.md +9 -0
  171. hyperpocket/auth/heygen/__init__.py +0 -0
  172. hyperpocket/auth/heygen/context.py +15 -0
  173. hyperpocket/auth/heygen/token_context.py +11 -0
  174. hyperpocket/auth/heygen/token_handler.py +89 -0
  175. hyperpocket/auth/heygen/token_schema.py +11 -0
  176. hyperpocket/auth/hubspot/README.md +14 -0
  177. hyperpocket/auth/hubspot/__init__.py +0 -0
  178. hyperpocket/auth/hubspot/context.py +15 -0
  179. hyperpocket/auth/hubspot/oauth2_context.py +35 -0
  180. hyperpocket/auth/hubspot/oauth2_handler.py +142 -0
  181. hyperpocket/auth/hubspot/oauth2_schema.py +17 -0
  182. hyperpocket/auth/hubspot/token_context.py +11 -0
  183. hyperpocket/auth/hubspot/token_handler.py +92 -0
  184. hyperpocket/auth/hubspot/token_schema.py +11 -0
  185. hyperpocket/auth/jira/README.md +14 -0
  186. hyperpocket/auth/jira/__init__.py +0 -0
  187. hyperpocket/auth/jira/context.py +15 -0
  188. hyperpocket/auth/jira/oauth2_context.py +35 -0
  189. hyperpocket/auth/jira/oauth2_handler.py +135 -0
  190. hyperpocket/auth/jira/oauth2_schema.py +17 -0
  191. hyperpocket/auth/jira/token_context.py +11 -0
  192. hyperpocket/auth/jira/token_handler.py +87 -0
  193. hyperpocket/auth/jira/token_schema.py +11 -0
  194. hyperpocket/auth/klaviyo/README.md +10 -0
  195. hyperpocket/auth/klaviyo/__init__.py +0 -0
  196. hyperpocket/auth/klaviyo/context.py +15 -0
  197. hyperpocket/auth/klaviyo/token_context.py +11 -0
  198. hyperpocket/auth/klaviyo/token_handler.py +92 -0
  199. hyperpocket/auth/klaviyo/token_schema.py +11 -0
  200. hyperpocket/auth/lever/README.md +9 -0
  201. hyperpocket/auth/lever/__init__.py +0 -0
  202. hyperpocket/auth/lever/context.py +15 -0
  203. hyperpocket/auth/lever/token_context.py +11 -0
  204. hyperpocket/auth/lever/token_handler.py +89 -0
  205. hyperpocket/auth/lever/token_schema.py +11 -0
  206. hyperpocket/auth/lever_sandbox/README.md +9 -0
  207. hyperpocket/auth/lever_sandbox/__init__.py +0 -0
  208. hyperpocket/auth/lever_sandbox/context.py +15 -0
  209. hyperpocket/auth/lever_sandbox/token_context.py +11 -0
  210. hyperpocket/auth/lever_sandbox/token_handler.py +94 -0
  211. hyperpocket/auth/lever_sandbox/token_schema.py +11 -0
  212. hyperpocket/auth/linear/README.md +17 -0
  213. hyperpocket/auth/linear/context.py +1 -1
  214. hyperpocket/auth/linear/oauth2_context.py +33 -0
  215. hyperpocket/auth/linear/oauth2_handler.py +155 -0
  216. hyperpocket/auth/linear/oauth2_schema.py +17 -0
  217. hyperpocket/auth/linkedin/README.md +16 -0
  218. hyperpocket/auth/linkedin/__init__.py +0 -0
  219. hyperpocket/auth/linkedin/context.py +15 -0
  220. hyperpocket/auth/linkedin/oauth2_context.py +33 -0
  221. hyperpocket/auth/linkedin/oauth2_handler.py +154 -0
  222. hyperpocket/auth/linkedin/oauth2_schema.py +18 -0
  223. hyperpocket/auth/listennotes/README.md +12 -0
  224. hyperpocket/auth/listennotes/__init__.py +0 -0
  225. hyperpocket/auth/listennotes/context.py +15 -0
  226. hyperpocket/auth/listennotes/token_context.py +11 -0
  227. hyperpocket/auth/listennotes/token_handler.py +92 -0
  228. hyperpocket/auth/listennotes/token_schema.py +11 -0
  229. hyperpocket/auth/mailchimp/README.md +16 -0
  230. hyperpocket/auth/mailchimp/__init__.py +0 -0
  231. hyperpocket/auth/mailchimp/context.py +15 -0
  232. hyperpocket/auth/mailchimp/oauth2_context.py +33 -0
  233. hyperpocket/auth/mailchimp/oauth2_handler.py +153 -0
  234. hyperpocket/auth/mailchimp/oauth2_schema.py +17 -0
  235. hyperpocket/auth/mem0/README.md +11 -0
  236. hyperpocket/auth/mem0/__init__.py +0 -0
  237. hyperpocket/auth/mem0/context.py +15 -0
  238. hyperpocket/auth/mem0/token_context.py +11 -0
  239. hyperpocket/auth/mem0/token_handler.py +87 -0
  240. hyperpocket/auth/mem0/token_schema.py +11 -0
  241. hyperpocket/auth/microsoft_clarity/README.md +12 -0
  242. hyperpocket/auth/microsoft_clarity/__init__.py +0 -0
  243. hyperpocket/auth/microsoft_clarity/context.py +15 -0
  244. hyperpocket/auth/microsoft_clarity/token_context.py +15 -0
  245. hyperpocket/auth/microsoft_clarity/token_handler.py +102 -0
  246. hyperpocket/auth/microsoft_clarity/token_schema.py +11 -0
  247. hyperpocket/auth/neon/README.md +11 -0
  248. hyperpocket/auth/neon/__init__.py +0 -0
  249. hyperpocket/auth/neon/context.py +15 -0
  250. hyperpocket/auth/neon/token_context.py +11 -0
  251. hyperpocket/auth/neon/token_handler.py +87 -0
  252. hyperpocket/auth/neon/token_schema.py +11 -0
  253. hyperpocket/auth/ngrok/README.md +12 -0
  254. hyperpocket/auth/ngrok/__init__.py +0 -0
  255. hyperpocket/auth/ngrok/context.py +15 -0
  256. hyperpocket/auth/ngrok/token_context.py +11 -0
  257. hyperpocket/auth/ngrok/token_handler.py +89 -0
  258. hyperpocket/auth/ngrok/token_schema.py +11 -0
  259. hyperpocket/auth/notion/README.md +10 -20
  260. hyperpocket/auth/notion/oauth2_context.py +33 -0
  261. hyperpocket/auth/notion/oauth2_handler.py +152 -0
  262. hyperpocket/auth/notion/oauth2_schema.py +22 -0
  263. hyperpocket/auth/oncehub/README.md +11 -0
  264. hyperpocket/auth/oncehub/__init__.py +0 -0
  265. hyperpocket/auth/oncehub/context.py +15 -0
  266. hyperpocket/auth/oncehub/token_context.py +11 -0
  267. hyperpocket/auth/oncehub/token_handler.py +92 -0
  268. hyperpocket/auth/oncehub/token_schema.py +11 -0
  269. hyperpocket/auth/pagerduty/README.md +12 -0
  270. hyperpocket/auth/pagerduty/__init__.py +0 -0
  271. hyperpocket/auth/pagerduty/context.py +15 -0
  272. hyperpocket/auth/pagerduty/token_context.py +11 -0
  273. hyperpocket/auth/pagerduty/token_handler.py +92 -0
  274. hyperpocket/auth/pagerduty/token_schema.py +11 -0
  275. hyperpocket/auth/pandadoc/README.md +12 -0
  276. hyperpocket/auth/pandadoc/__init__.py +0 -0
  277. hyperpocket/auth/pandadoc/context.py +15 -0
  278. hyperpocket/auth/pandadoc/token_context.py +11 -0
  279. hyperpocket/auth/pandadoc/token_handler.py +92 -0
  280. hyperpocket/auth/pandadoc/token_schema.py +11 -0
  281. hyperpocket/auth/pipedrive/README.md +12 -0
  282. hyperpocket/auth/pipedrive/__init__.py +0 -0
  283. hyperpocket/auth/pipedrive/context.py +15 -0
  284. hyperpocket/auth/pipedrive/token_context.py +11 -0
  285. hyperpocket/auth/pipedrive/token_handler.py +92 -0
  286. hyperpocket/auth/pipedrive/token_schema.py +11 -0
  287. hyperpocket/auth/posthog/README.md +12 -0
  288. hyperpocket/auth/posthog/__init__.py +0 -0
  289. hyperpocket/auth/posthog/context.py +15 -0
  290. hyperpocket/auth/posthog/token_context.py +11 -0
  291. hyperpocket/auth/posthog/token_handler.py +92 -0
  292. hyperpocket/auth/posthog/token_schema.py +11 -0
  293. hyperpocket/auth/provider.py +57 -0
  294. hyperpocket/auth/ravenseotools/README.md +12 -0
  295. hyperpocket/auth/ravenseotools/__init__.py +0 -0
  296. hyperpocket/auth/ravenseotools/context.py +15 -0
  297. hyperpocket/auth/ravenseotools/token_context.py +11 -0
  298. hyperpocket/auth/ravenseotools/token_handler.py +94 -0
  299. hyperpocket/auth/ravenseotools/token_schema.py +11 -0
  300. hyperpocket/auth/reddit/README.md +16 -0
  301. hyperpocket/auth/salesforce/README.md +16 -0
  302. hyperpocket/auth/salesforce/__init__.py +0 -0
  303. hyperpocket/auth/salesforce/context.py +15 -0
  304. hyperpocket/auth/salesforce/oauth2_context.py +33 -0
  305. hyperpocket/auth/salesforce/oauth2_handler.py +136 -0
  306. hyperpocket/auth/salesforce/oauth2_schema.py +21 -0
  307. hyperpocket/auth/sendgrid/README.md +12 -0
  308. hyperpocket/auth/sendgrid/__init__.py +0 -0
  309. hyperpocket/auth/sendgrid/context.py +15 -0
  310. hyperpocket/auth/sendgrid/token_context.py +11 -0
  311. hyperpocket/auth/sendgrid/token_handler.py +92 -0
  312. hyperpocket/auth/sendgrid/token_schema.py +11 -0
  313. hyperpocket/auth/serpapi/README.md +13 -0
  314. hyperpocket/auth/serpapi/token_context.py +2 -4
  315. hyperpocket/auth/serpapi/token_handler.py +44 -16
  316. hyperpocket/auth/slack/README.md +17 -0
  317. hyperpocket/auth/spotify/README.md +15 -0
  318. hyperpocket/auth/spotify/__init__.py +0 -0
  319. hyperpocket/auth/spotify/context.py +15 -0
  320. hyperpocket/auth/spotify/oauth2_context.py +33 -0
  321. hyperpocket/auth/spotify/oauth2_handler.py +163 -0
  322. hyperpocket/auth/spotify/oauth2_schema.py +18 -0
  323. hyperpocket/auth/stripe/README.md +12 -0
  324. hyperpocket/auth/stripe/__init__.py +0 -0
  325. hyperpocket/auth/stripe/context.py +15 -0
  326. hyperpocket/auth/stripe/token_context.py +11 -0
  327. hyperpocket/auth/stripe/token_handler.py +89 -0
  328. hyperpocket/auth/stripe/token_schema.py +11 -0
  329. hyperpocket/auth/supabase/README.md +11 -0
  330. hyperpocket/auth/supabase/__init__.py +0 -0
  331. hyperpocket/auth/supabase/context.py +15 -0
  332. hyperpocket/auth/supabase/token_context.py +11 -0
  333. hyperpocket/auth/supabase/token_handler.py +92 -0
  334. hyperpocket/auth/supabase/token_schema.py +11 -0
  335. hyperpocket/auth/tavily/README.md +11 -0
  336. hyperpocket/auth/tavily/__init__.py +0 -0
  337. hyperpocket/auth/tavily/context.py +15 -0
  338. hyperpocket/auth/tavily/token_context.py +11 -0
  339. hyperpocket/auth/tavily/token_handler.py +89 -0
  340. hyperpocket/auth/tavily/token_schema.py +11 -0
  341. hyperpocket/auth/timekit/README.md +11 -0
  342. hyperpocket/auth/timekit/__init__.py +0 -0
  343. hyperpocket/auth/timekit/context.py +15 -0
  344. hyperpocket/auth/timekit/token_context.py +11 -0
  345. hyperpocket/auth/timekit/token_handler.py +92 -0
  346. hyperpocket/auth/timekit/token_schema.py +11 -0
  347. hyperpocket/auth/trello/README.md +12 -0
  348. hyperpocket/auth/trello/__init__.py +0 -0
  349. hyperpocket/auth/trello/context.py +15 -0
  350. hyperpocket/auth/trello/token_context.py +11 -0
  351. hyperpocket/auth/trello/token_handler.py +89 -0
  352. hyperpocket/auth/trello/token_schema.py +11 -0
  353. hyperpocket/auth/wandb/README.md +11 -0
  354. hyperpocket/auth/wandb/__init__.py +0 -0
  355. hyperpocket/auth/wandb/context.py +15 -0
  356. hyperpocket/auth/wandb/token_context.py +11 -0
  357. hyperpocket/auth/wandb/token_handler.py +89 -0
  358. hyperpocket/auth/wandb/token_schema.py +9 -0
  359. hyperpocket/auth/workiom/README.md +12 -0
  360. hyperpocket/auth/workiom/__init__.py +0 -0
  361. hyperpocket/auth/workiom/context.py +15 -0
  362. hyperpocket/auth/workiom/token_context.py +11 -0
  363. hyperpocket/auth/workiom/token_handler.py +92 -0
  364. hyperpocket/auth/workiom/token_schema.py +11 -0
  365. hyperpocket/auth/x/README.md +15 -0
  366. hyperpocket/auth/zoom/README.md +16 -0
  367. hyperpocket/auth/zoom/__init__.py +0 -0
  368. hyperpocket/auth/zoom/context.py +15 -0
  369. hyperpocket/auth/zoom/oauth2_context.py +33 -0
  370. hyperpocket/auth/zoom/oauth2_handler.py +153 -0
  371. hyperpocket/auth/zoom/oauth2_schema.py +19 -0
  372. hyperpocket/cli/__main__.py +4 -1
  373. hyperpocket/cli/auth_oauth2.py +79 -38
  374. hyperpocket/cli/auth_token.py +28 -16
  375. hyperpocket/cli/codegen/auth/__init__.py +4 -1
  376. hyperpocket/cli/codegen/auth/auth_context_template.py +1 -1
  377. hyperpocket/cli/codegen/auth/auth_oauth2_context_template.py +5 -4
  378. hyperpocket/cli/codegen/auth/auth_oauth2_handler_template.py +20 -45
  379. hyperpocket/cli/codegen/auth/auth_oauth2_schema_template.py +4 -3
  380. hyperpocket/cli/codegen/auth/auth_token_context_template.py +6 -6
  381. hyperpocket/cli/codegen/auth/auth_token_handler_template.py +14 -14
  382. hyperpocket/cli/codegen/auth/auth_token_schema_template.py +3 -3
  383. hyperpocket/cli/codegen/auth/server_auth_template.py +20 -5
  384. hyperpocket/cli/codegen/tool/__init__.py +1 -1
  385. hyperpocket/cli/codegen/tool/tool_main_template.py +1 -0
  386. hyperpocket/cli/{tool.py → tool_create.py} +24 -19
  387. hyperpocket/cli/tool_export.py +240 -0
  388. hyperpocket/config/auth.py +78 -13
  389. hyperpocket/pocket_core.py +5 -3
  390. hyperpocket/server/auth/activeloop.py +25 -0
  391. hyperpocket/server/auth/adobe.py +14 -0
  392. hyperpocket/server/auth/affinity.py +14 -0
  393. hyperpocket/server/auth/agentql.py +25 -0
  394. hyperpocket/server/auth/ahrefs.py +14 -0
  395. hyperpocket/server/auth/airtable.py +14 -0
  396. hyperpocket/server/auth/alchemy.py +14 -0
  397. hyperpocket/server/auth/altoviz.py +14 -0
  398. hyperpocket/server/auth/asana.py +25 -0
  399. hyperpocket/server/auth/bamboohr.py +14 -0
  400. hyperpocket/server/auth/bitbucket.py +25 -0
  401. hyperpocket/server/auth/bitwarden.py +14 -0
  402. hyperpocket/server/auth/brevo.py +14 -0
  403. hyperpocket/server/auth/brex.py +14 -0
  404. hyperpocket/server/auth/cal.py +14 -0
  405. hyperpocket/server/auth/canvas.py +14 -0
  406. hyperpocket/server/auth/clickup.py +14 -0
  407. hyperpocket/server/auth/cloudflare.py +14 -0
  408. hyperpocket/server/auth/dailybot.py +14 -0
  409. hyperpocket/server/auth/datadog.py +14 -0
  410. hyperpocket/server/auth/discord.py +25 -0
  411. hyperpocket/server/auth/discordbot.py +14 -0
  412. hyperpocket/server/auth/elevenlabs.py +14 -0
  413. hyperpocket/server/auth/exa.py +14 -0
  414. hyperpocket/server/auth/facebook.py +25 -0
  415. hyperpocket/server/auth/finage.py +14 -0
  416. hyperpocket/server/auth/happyrobot.py +26 -0
  417. hyperpocket/server/auth/heygen.py +14 -0
  418. hyperpocket/server/auth/hubspot.py +26 -0
  419. hyperpocket/server/auth/jira.py +25 -0
  420. hyperpocket/server/auth/klaviyo.py +14 -0
  421. hyperpocket/server/auth/lever.py +14 -0
  422. hyperpocket/server/auth/lever_sandbox.py +14 -0
  423. hyperpocket/server/auth/linear.py +21 -2
  424. hyperpocket/server/auth/linkedin.py +25 -0
  425. hyperpocket/server/auth/listennotes.py +14 -0
  426. hyperpocket/server/auth/mailchimp.py +25 -0
  427. hyperpocket/server/auth/mem0.py +14 -0
  428. hyperpocket/server/auth/microsoft_clarity.py +14 -0
  429. hyperpocket/server/auth/neon.py +14 -0
  430. hyperpocket/server/auth/ngrok.py +14 -0
  431. hyperpocket/server/auth/notion.py +20 -1
  432. hyperpocket/server/auth/oncehub.py +14 -0
  433. hyperpocket/server/auth/pagerduty.py +14 -0
  434. hyperpocket/server/auth/pandadoc.py +14 -0
  435. hyperpocket/server/auth/pipedrive.py +14 -0
  436. hyperpocket/server/auth/posthog.py +14 -0
  437. hyperpocket/server/auth/ravenseotools.py +14 -0
  438. hyperpocket/server/auth/salesforce.py +25 -0
  439. hyperpocket/server/auth/sendgrid.py +14 -0
  440. hyperpocket/server/auth/serpapi.py +5 -5
  441. hyperpocket/server/auth/spotify.py +25 -0
  442. hyperpocket/server/auth/stripe.py +14 -0
  443. hyperpocket/server/auth/supabase.py +14 -0
  444. hyperpocket/server/auth/tavily.py +14 -0
  445. hyperpocket/server/auth/timekit.py +14 -0
  446. hyperpocket/server/auth/trello.py +14 -0
  447. hyperpocket/server/auth/wandb.py +25 -0
  448. hyperpocket/server/auth/workiom.py +14 -0
  449. hyperpocket/server/auth/zoom.py +25 -0
  450. hyperpocket/server/server.py +9 -6
  451. {hyperpocket-0.3.4.dist-info → hyperpocket-0.3.5.dist-info}/METADATA +1 -1
  452. hyperpocket-0.3.5.dist-info/RECORD +587 -0
  453. hyperpocket-0.3.4.dist-info/RECORD +0 -163
  454. {hyperpocket-0.3.4.dist-info → hyperpocket-0.3.5.dist-info}/WHEEL +0 -0
  455. {hyperpocket-0.3.4.dist-info → hyperpocket-0.3.5.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,155 @@
1
+ from typing import Optional
2
+ from urllib.parse import urljoin, urlencode
3
+
4
+ import httpx
5
+
6
+ from hyperpocket.auth import AuthProvider
7
+ from hyperpocket.auth.context import AuthContext
8
+ from hyperpocket.auth.handler import AuthHandlerInterface
9
+ from hyperpocket.auth.linear.oauth2_context import LinearOAuth2AuthContext
10
+ from hyperpocket.auth.linear.oauth2_schema import (
11
+ LinearOAuth2Response,
12
+ LinearOAuth2Request,
13
+ )
14
+ from hyperpocket.config import config
15
+ from hyperpocket.futures import FutureStore
16
+
17
+
18
+ class LinearOAuth2AuthHandler(AuthHandlerInterface):
19
+ _LINEAR_OAUTH_URL: str = "https://linear.app/oauth/authorize" # e.g. "https://slack.com/oauth/v2/authorize"
20
+ _LINEAR_TOKEN_URL: str = "https://api.linear.app/oauth/token" # e.g. "https://slack.com/api/oauth.v2.access"
21
+
22
+ name: str = "linear-oauth2"
23
+ description: str = "This handler is used to authenticate users using the Linear OAuth2 authentication method."
24
+ scoped: bool = True
25
+
26
+ @staticmethod
27
+ def provider() -> AuthProvider:
28
+ return AuthProvider.LINEAR
29
+
30
+ @staticmethod
31
+ def provider_default() -> bool:
32
+ return True
33
+
34
+ @staticmethod
35
+ def recommended_scopes() -> set[str]:
36
+ """
37
+ This method returns a set of recommended scopes for the service.
38
+ If the service has a recommended scope, it should be returned here.
39
+ Example:
40
+ return {
41
+ "channels:history",
42
+ "channels:read",
43
+ "chat:write",
44
+ "groups:history",
45
+ "groups:read",
46
+ "im:history",
47
+ "mpim:history",
48
+ "reactions:read",
49
+ "reactions:write",
50
+ }
51
+ """
52
+ return set()
53
+
54
+ def prepare(
55
+ self,
56
+ auth_req: LinearOAuth2Request,
57
+ thread_id: str,
58
+ profile: str,
59
+ future_uid: str,
60
+ *args,
61
+ **kwargs,
62
+ ) -> str:
63
+ redirect_uri = urljoin(
64
+ config().public_base_url + "/",
65
+ f"{config().callback_url_rewrite_prefix}/auth/linear/oauth2/callback",
66
+ )
67
+ auth_url = self._make_auth_url(
68
+ req=auth_req, redirect_uri=redirect_uri, state=future_uid
69
+ )
70
+
71
+ FutureStore.create_future(
72
+ future_uid,
73
+ data={
74
+ "redirect_uri": redirect_uri,
75
+ "thread_id": thread_id,
76
+ "profile": profile,
77
+ },
78
+ )
79
+
80
+ return f"User needs to authenticate using the following URL: {auth_url}"
81
+
82
+ async def authenticate(
83
+ self, auth_req: LinearOAuth2Request, future_uid: str, *args, **kwargs
84
+ ) -> AuthContext:
85
+ future_data = FutureStore.get_future(future_uid)
86
+ auth_code = await future_data.future
87
+
88
+ async with httpx.AsyncClient() as client:
89
+ resp = await client.post(
90
+ url=self._LINEAR_TOKEN_URL,
91
+ data={
92
+ "client_id": auth_req.client_id,
93
+ "client_secret": auth_req.client_secret,
94
+ "code": auth_code,
95
+ "redirect_uri": future_data.data["redirect_uri"],
96
+ "grant_type": "authorization_code",
97
+ },
98
+ )
99
+ resp.raise_for_status()
100
+ resp_json = resp.json()
101
+ resp_typed = LinearOAuth2Response(**resp_json)
102
+ return LinearOAuth2AuthContext.from_linear_oauth2_response(resp_typed)
103
+
104
+ async def refresh(
105
+ self, auth_req: LinearOAuth2Request, context: AuthContext, *args, **kwargs
106
+ ) -> AuthContext:
107
+ linear_context: LinearOAuth2AuthContext = context
108
+ refresh_token = linear_context.refresh_token
109
+
110
+ async with httpx.AsyncClient() as client:
111
+ resp = await client.post(
112
+ url=self._LINEAR_TOKEN_URL,
113
+ data={
114
+ "client_id": auth_req.client_id,
115
+ "client_secret": auth_req.client_secret,
116
+ "grant_type": "refresh_token",
117
+ "refresh_token": refresh_token,
118
+ },
119
+ )
120
+
121
+ resp.raise_for_status()
122
+ resp_json = resp.json()
123
+
124
+ new_resp = LinearOAuth2Response(
125
+ **{
126
+ "access_token": resp_json["access_token"],
127
+ "refresh_token": resp_json["refresh_token"],
128
+ "expires_in": resp_json["expires_in"],
129
+ "scope": resp_json["scope"],
130
+ }
131
+ )
132
+
133
+ return LinearOAuth2AuthContext.from_linear_oauth2_response(new_resp)
134
+
135
+ def _make_auth_url(self, req: LinearOAuth2Request, redirect_uri: str, state: str):
136
+ params = {
137
+ "scope": ",".join(req.auth_scopes),
138
+ "client_id": req.client_id,
139
+ "redirect_uri": redirect_uri,
140
+ "response_type": "code",
141
+ "state": state,
142
+ # 'prompt': 'consent', # This can be useful if you want to give users the opportunity to connect multiple workspaces.
143
+ "actor": "user", # application, createAsUser
144
+ }
145
+ auth_url = f"{self._LINEAR_OAUTH_URL}?{urlencode(params)}"
146
+ return auth_url
147
+
148
+ def make_request(
149
+ self, auth_scopes: Optional[list[str]] = None, **kwargs
150
+ ) -> LinearOAuth2Request:
151
+ return LinearOAuth2Request(
152
+ auth_scopes=auth_scopes,
153
+ client_id=config().auth.linear.client_id,
154
+ client_secret=config().auth.linear.client_secret,
155
+ )
@@ -0,0 +1,17 @@
1
+ from typing import Optional
2
+
3
+ from pydantic import BaseModel, Field
4
+
5
+ from hyperpocket.auth.schema import AuthenticateRequest, AuthenticateResponse
6
+
7
+
8
+ class LinearOAuth2Request(AuthenticateRequest):
9
+ client_id: str
10
+ client_secret: str
11
+
12
+
13
+ class LinearOAuth2Response(AuthenticateResponse):
14
+ access_token: str
15
+ expires_in: int
16
+ token_type: str
17
+ scope: Optional[str] = Field(default=None)
@@ -0,0 +1,16 @@
1
+ # Linkedin Authentication
2
+
3
+ This document provides instructions on how to set up OAuth2 authentication for Linkedin using Hyperpocket.
4
+
5
+ ## Supported Authentication Types
6
+
7
+ - OAuth2
8
+
9
+ ## How to Create an OAuth2 App
10
+
11
+ - See here: [link](https://learn.microsoft.com/en-us/linkedin/shared/authentication/authentication)
12
+
13
+ ## Additional Resources
14
+
15
+ - [Official Documentation](https://docs.microsoft.com/en-us/linkedin/shared/authentication/authentication)
16
+ - [Support](https://www.linkedin.com/help/linkedin)
File without changes
@@ -0,0 +1,15 @@
1
+ from hyperpocket.auth.context import AuthContext
2
+
3
+
4
+ class LinkedinAuthContext(AuthContext):
5
+ _ACCESS_TOKEN_KEY: str = "LINKEDIN_TOKEN"
6
+
7
+ def to_dict(self) -> dict[str, str]:
8
+ return {
9
+ self._ACCESS_TOKEN_KEY: self.access_token,
10
+ }
11
+
12
+ def to_profiled_dict(self, profile: str) -> dict[str, str]:
13
+ return {
14
+ f"{profile.upper()}_{self._ACCESS_TOKEN_KEY}": self.access_token,
15
+ }
@@ -0,0 +1,33 @@
1
+ from datetime import datetime, timedelta, timezone
2
+ from typing import Optional
3
+
4
+ from pydantic import Field
5
+
6
+ from hyperpocket.auth.linkedin.context import LinkedinAuthContext
7
+ from hyperpocket.auth.linkedin.oauth2_schema import LinkedinOAuth2Response
8
+
9
+
10
+ class LinkedinOAuth2AuthContext(LinkedinAuthContext):
11
+ refresh_token: Optional[str] = Field(default=None, description="refresh token")
12
+
13
+ @classmethod
14
+ def from_linkedin_oauth2_response(cls, response: LinkedinOAuth2Response):
15
+ description = f"Linkedin OAuth2 Context logged in"
16
+ now = datetime.now(tz=timezone.utc)
17
+
18
+ access_token = response.access_token
19
+ refresh_token = response.refresh_token
20
+ expires_in = response.expires_in
21
+
22
+ if expires_in:
23
+ expires_at = now + timedelta(seconds=response.expires_in)
24
+ else:
25
+ expires_at = None
26
+
27
+ return cls(
28
+ access_token=access_token,
29
+ refresh_token=refresh_token,
30
+ expires_at=expires_at,
31
+ description=description,
32
+ detail=response,
33
+ )
@@ -0,0 +1,154 @@
1
+ from typing import Optional
2
+ from urllib.parse import urljoin, urlencode
3
+
4
+ import httpx
5
+
6
+ from hyperpocket.auth import AuthProvider
7
+ from hyperpocket.auth.context import AuthContext
8
+ from hyperpocket.auth.handler import AuthHandlerInterface
9
+ from hyperpocket.auth.linkedin.oauth2_context import LinkedinOAuth2AuthContext
10
+ from hyperpocket.auth.linkedin.oauth2_schema import (
11
+ LinkedinOAuth2Response,
12
+ LinkedinOAuth2Request,
13
+ )
14
+ from hyperpocket.config import config
15
+ from hyperpocket.futures import FutureStore
16
+
17
+
18
+ class LinkedinOAuth2AuthHandler(AuthHandlerInterface):
19
+ _LINKEDIN_OAUTH_URL: str = "https://www.linkedin.com/oauth/v2/authorization" # e.g. "https://slack.com/oauth/v2/authorize"
20
+ _LINKEDIN_TOKEN_URL: str = "https://www.linkedin.com/oauth/v2/accessToken" # e.g. "https://slack.com/api/oauth.v2.access"
21
+
22
+ name: str = "linkedin-oauth2"
23
+ description: str = "This handler is used to authenticate users using the Linkedin OAuth2 authentication method."
24
+ scoped: bool = True
25
+
26
+ @staticmethod
27
+ def provider() -> AuthProvider:
28
+ return AuthProvider.LINKEDIN
29
+
30
+ @staticmethod
31
+ def provider_default() -> bool:
32
+ return True
33
+
34
+ @staticmethod
35
+ def recommended_scopes() -> set[str]:
36
+ """
37
+ This method returns a set of recommended scopes for the service.
38
+ If the service has a recommended scope, it should be returned here.
39
+ Example:
40
+ return {
41
+ "channels:history",
42
+ "channels:read",
43
+ "chat:write",
44
+ "groups:history",
45
+ "groups:read",
46
+ "im:history",
47
+ "mpim:history",
48
+ "reactions:read",
49
+ "reactions:write",
50
+ }
51
+ """
52
+ return set()
53
+
54
+ def prepare(
55
+ self,
56
+ auth_req: LinkedinOAuth2Request,
57
+ thread_id: str,
58
+ profile: str,
59
+ future_uid: str,
60
+ *args,
61
+ **kwargs,
62
+ ) -> str:
63
+ redirect_uri = urljoin(
64
+ config().public_base_url + "/",
65
+ f"{config().callback_url_rewrite_prefix}/auth/linkedin/oauth2/callback",
66
+ )
67
+ auth_url = self._make_auth_url(
68
+ req=auth_req, redirect_uri=redirect_uri, state=future_uid
69
+ )
70
+
71
+ FutureStore.create_future(
72
+ future_uid,
73
+ data={
74
+ "redirect_uri": redirect_uri,
75
+ "thread_id": thread_id,
76
+ "profile": profile,
77
+ },
78
+ )
79
+
80
+ return f"User needs to authenticate using the following URL: {auth_url}"
81
+
82
+ async def authenticate(
83
+ self, auth_req: LinkedinOAuth2Request, future_uid: str, *args, **kwargs
84
+ ) -> AuthContext:
85
+ future_data = FutureStore.get_future(future_uid)
86
+ auth_code = await future_data.future
87
+
88
+ async with httpx.AsyncClient() as client:
89
+ resp = await client.post(
90
+ url=self._LINKEDIN_TOKEN_URL,
91
+ data={
92
+ "client_id": auth_req.client_id,
93
+ "client_secret": auth_req.client_secret,
94
+ "code": auth_code,
95
+ "grant_type": "authorization_code",
96
+ "redirect_uri": future_data.data["redirect_uri"],
97
+ },
98
+ )
99
+ resp.raise_for_status()
100
+ resp_json = resp.json()
101
+ resp_typed = LinkedinOAuth2Response(**resp_json)
102
+ return LinkedinOAuth2AuthContext.from_linkedin_oauth2_response(resp_typed)
103
+
104
+ async def refresh(
105
+ self, auth_req: LinkedinOAuth2Request, context: AuthContext, *args, **kwargs
106
+ ) -> AuthContext:
107
+ linkedin_context: LinkedinOAuth2AuthContext = context
108
+ refresh_token = linkedin_context.refresh_token
109
+
110
+ async with httpx.AsyncClient() as client:
111
+ resp = await client.post(
112
+ url=self._LINKEDIN_TOKEN_URL,
113
+ data={
114
+ "client_id": auth_req.client_id,
115
+ "client_secret": auth_req.client_secret,
116
+ "grant_type": "refresh_token",
117
+ "refresh_token": refresh_token,
118
+ },
119
+ )
120
+
121
+ resp.raise_for_status()
122
+ resp_json = resp.json()
123
+
124
+ new_resp = LinkedinOAuth2Response(
125
+ **{
126
+ "access_token": resp_json["access_token"],
127
+ "refresh_token": resp_json["refresh_token"],
128
+ "refresh_token_expires_in": resp_json["refresh_token_expires_in"],
129
+ "expires_in": resp_json["expires_in"],
130
+ "scope": resp_json["scope"],
131
+ }
132
+ )
133
+
134
+ return LinkedinOAuth2AuthContext.from_linkedin_oauth2_response(new_resp)
135
+
136
+ def _make_auth_url(self, req: LinkedinOAuth2Request, redirect_uri: str, state: str):
137
+ params = {
138
+ "scope": " ".join(req.auth_scopes),
139
+ "client_id": req.client_id,
140
+ "redirect_uri": redirect_uri,
141
+ "response_type": "code",
142
+ "state": state,
143
+ }
144
+ auth_url = f"{self._LINKEDIN_OAUTH_URL}?{urlencode(params)}"
145
+ return auth_url
146
+
147
+ def make_request(
148
+ self, auth_scopes: Optional[list[str]] = None, **kwargs
149
+ ) -> LinkedinOAuth2Request:
150
+ return LinkedinOAuth2Request(
151
+ auth_scopes=auth_scopes,
152
+ client_id=config().auth.linkedin.client_id,
153
+ client_secret=config().auth.linkedin.client_secret,
154
+ )
@@ -0,0 +1,18 @@
1
+ from typing import Optional
2
+
3
+ from pydantic import BaseModel, Field
4
+
5
+ from hyperpocket.auth.schema import AuthenticateRequest, AuthenticateResponse
6
+
7
+
8
+ class LinkedinOAuth2Request(AuthenticateRequest):
9
+ client_id: str
10
+ client_secret: str
11
+
12
+
13
+ class LinkedinOAuth2Response(AuthenticateResponse):
14
+ access_token: str
15
+ expires_in: int
16
+ refresh_token: Optional[str] = Field(default=None)
17
+ refresh_token_expires_in: Optional[int] = Field(default=None)
18
+ scope: Optional[str] = Field(default=None)
@@ -0,0 +1,12 @@
1
+ # Listennotes Authentication
2
+
3
+ This document provides instructions on how to set up token-based authentication for Listennotes using Hyperpocket.
4
+
5
+ ## Supported Authentication Types
6
+
7
+ - Token
8
+
9
+ ## Additional Resources
10
+
11
+ - [Official Documentation](https://www.listennotes.com/api/docs/)
12
+ - [Support](https://www.listennotes.com/contact/)
File without changes
@@ -0,0 +1,15 @@
1
+ from hyperpocket.auth.context import AuthContext
2
+
3
+
4
+ class ListennotesAuthContext(AuthContext):
5
+ _ACCESS_TOKEN_KEY: str = "LISTENNOTES_TOKEN"
6
+
7
+ def to_dict(self) -> dict[str, str]:
8
+ return {
9
+ self._ACCESS_TOKEN_KEY: self.access_token,
10
+ }
11
+
12
+ def to_profiled_dict(self, profile: str) -> dict[str, str]:
13
+ return {
14
+ f"{profile.upper()}_{self._ACCESS_TOKEN_KEY}": self.access_token,
15
+ }
@@ -0,0 +1,11 @@
1
+ from hyperpocket.auth.listennotes.context import ListennotesAuthContext
2
+ from hyperpocket.auth.listennotes.token_schema import ListennotesTokenResponse
3
+
4
+
5
+ class ListennotesTokenAuthContext(ListennotesAuthContext):
6
+ @classmethod
7
+ def from_listennotes_token_response(cls, response: ListennotesTokenResponse):
8
+ description = f"Listennotes Token Context logged in"
9
+ return cls(
10
+ access_token=response.access_token, description=description, expires_at=None
11
+ )
@@ -0,0 +1,92 @@
1
+ from typing import Optional
2
+ from urllib.parse import urljoin, urlencode
3
+
4
+ from hyperpocket.auth import AuthProvider
5
+ from hyperpocket.auth.context import AuthContext
6
+ from hyperpocket.auth.handler import AuthHandlerInterface, AuthenticateRequest
7
+ from hyperpocket.auth.listennotes.token_context import ListennotesTokenAuthContext
8
+ from hyperpocket.auth.listennotes.token_schema import (
9
+ ListennotesTokenResponse,
10
+ ListennotesTokenRequest,
11
+ )
12
+ from hyperpocket.config import config
13
+ from hyperpocket.futures import FutureStore
14
+
15
+
16
+ class ListennotesTokenAuthHandler(AuthHandlerInterface):
17
+ name: str = "listennotes-token"
18
+ description: str = (
19
+ "This handler is used to authenticate users using the Listennotes token."
20
+ )
21
+ scoped: bool = False
22
+
23
+ _TOKEN_URL: str = urljoin(
24
+ config().public_base_url + "/",
25
+ f"{config().callback_url_rewrite_prefix}/auth/token",
26
+ )
27
+
28
+ @staticmethod
29
+ def provider() -> AuthProvider:
30
+ return AuthProvider.LISTENNOTES
31
+
32
+ @staticmethod
33
+ def recommended_scopes() -> set[str]:
34
+ return set()
35
+
36
+ def prepare(
37
+ self,
38
+ auth_req: ListennotesTokenRequest,
39
+ thread_id: str,
40
+ profile: str,
41
+ future_uid: str,
42
+ *args,
43
+ **kwargs,
44
+ ) -> str:
45
+ redirect_uri = urljoin(
46
+ config().public_base_url + "/",
47
+ f"{config().callback_url_rewrite_prefix}/auth/listennotes/token/callback",
48
+ )
49
+ url = self._make_auth_url(
50
+ auth_req=auth_req, redirect_uri=redirect_uri, state=future_uid
51
+ )
52
+ FutureStore.create_future(
53
+ future_uid,
54
+ data={
55
+ "redirect_uri": redirect_uri,
56
+ "thread_id": thread_id,
57
+ "profile": profile,
58
+ },
59
+ )
60
+
61
+ return f"User needs to authenticate using the following URL: {url}"
62
+
63
+ async def authenticate(
64
+ self, auth_req: ListennotesTokenRequest, future_uid: str, *args, **kwargs
65
+ ) -> AuthContext:
66
+ future_data = FutureStore.get_future(future_uid)
67
+ access_token = await future_data.future
68
+
69
+ response = ListennotesTokenResponse(access_token=access_token)
70
+ context = ListennotesTokenAuthContext.from_listennotes_token_response(response)
71
+
72
+ return context
73
+
74
+ async def refresh(
75
+ self, auth_req: ListennotesTokenRequest, context: AuthContext, *args, **kwargs
76
+ ) -> AuthContext:
77
+ raise Exception("Listennotes token doesn't support refresh")
78
+
79
+ def _make_auth_url(
80
+ self, auth_req: ListennotesTokenRequest, redirect_uri: str, state: str
81
+ ):
82
+ params = {
83
+ "redirect_uri": redirect_uri,
84
+ "state": state,
85
+ }
86
+ auth_url = f"{self._TOKEN_URL}?{urlencode(params)}"
87
+ return auth_url
88
+
89
+ def make_request(
90
+ self, auth_scopes: Optional[list[str]] = None, **kwargs
91
+ ) -> ListennotesTokenRequest:
92
+ return ListennotesTokenRequest()
@@ -0,0 +1,11 @@
1
+ from typing import List, Optional
2
+ from pydantic import BaseModel
3
+ from hyperpocket.auth.schema import AuthenticateRequest, AuthenticateResponse
4
+
5
+
6
+ class ListennotesTokenRequest(AuthenticateRequest):
7
+ pass
8
+
9
+
10
+ class ListennotesTokenResponse(AuthenticateResponse):
11
+ access_token: str
@@ -0,0 +1,16 @@
1
+ # Mailchimp Authentication
2
+
3
+ This document provides instructions on how to set up OAuth2 authentication for Mailchimp using Hyperpocket.
4
+
5
+ ## Supported Authentication Types
6
+
7
+ - OAuth2
8
+
9
+ ## How to Create an OAuth2 App
10
+
11
+ - See here: [link](https://mailchimp.com/developer/marketing/guides/access-user-data-oauth-2/)
12
+
13
+ ## Additional Resources
14
+
15
+ - [Official Documentation](https://mailchimp.com/developer/marketing/guides/quick-start/)
16
+ - [Support](https://mailchimp.com/help/)
File without changes
@@ -0,0 +1,15 @@
1
+ from hyperpocket.auth.context import AuthContext
2
+
3
+
4
+ class MailchimpAuthContext(AuthContext):
5
+ _ACCESS_TOKEN_KEY: str = "MAILCHIMP_TOKEN"
6
+
7
+ def to_dict(self) -> dict[str, str]:
8
+ return {
9
+ self._ACCESS_TOKEN_KEY: self.access_token,
10
+ }
11
+
12
+ def to_profiled_dict(self, profile: str) -> dict[str, str]:
13
+ return {
14
+ f"{profile.upper()}_{self._ACCESS_TOKEN_KEY}": self.access_token,
15
+ }
@@ -0,0 +1,33 @@
1
+ from datetime import datetime, timedelta, timezone
2
+ from typing import Optional
3
+
4
+ from pydantic import Field
5
+
6
+ from hyperpocket.auth.mailchimp.context import MailchimpAuthContext
7
+ from hyperpocket.auth.mailchimp.oauth2_schema import MailchimpOAuth2Response
8
+
9
+
10
+ class MailchimpOAuth2AuthContext(MailchimpAuthContext):
11
+ refresh_token: Optional[str] = Field(default=None, description="refresh token")
12
+
13
+ @classmethod
14
+ def from_mailchimp_oauth2_response(cls, response: MailchimpOAuth2Response):
15
+ description = f"Mailchimp OAuth2 Context logged in"
16
+ now = datetime.now(tz=timezone.utc)
17
+
18
+ access_token = response.access_token
19
+ refresh_token = response.refresh_token
20
+ expires_in = response.expires_in
21
+
22
+ if expires_in:
23
+ expires_at = now + timedelta(seconds=response.expires_in)
24
+ else:
25
+ expires_at = None
26
+
27
+ return cls(
28
+ access_token=access_token,
29
+ refresh_token=refresh_token,
30
+ expires_at=expires_at,
31
+ description=description,
32
+ detail=response,
33
+ )