Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ####################################################################################################
- # Content Categorisation (CCat) API
- #
- # Consumed by lemmy-core
- # Provided by CCat extensions
- #
- # Side-effect free. There will be no modification to content/data.
- # Only produces stats about the content to help w/ mod operations.
- ####################################################################################################
- ######
- # Expected to be slow.
- #
- # Run preferably only once for each content.
- ######
- POST /ccat/cateorise/:contentId
- PAYLOAD:
- {
- "additionContext": { ... }
- }
- RESPONSE:
- {
- "contentId": :contentId,
- "categories": {
- "category_X": {
- "score": 80,
- "additionalData": { ... }
- }
- "cat_Y": {
- "score": 3,
- "additionalData": { ... }
- }
- }
- }
- ######
- # Expected to be fast.
- #
- # Run many times per content. Preferably returns the result produced and cached
- # in the POST endpoint.
- #####
- GET /ccat/categories/:contentId
- RESPONSE:
- {
- "contentId": :contentId,
- "categories": {
- "category_X": {
- "score": 80,
- "additionalData": { ... }
- }
- "cat_Y": {
- "score": 3,
- "additionalData": { ... }
- }
- }
- }
- ####################################################################################################
- # Somewhere in lemmy-core
- ####################################################################################################
- after_store_content(content) {
- ccat_extensions = instance.get_active_ccat_extensions()
- ccat_result = {};
- for each cce in ccat_extensions {
- ccat_result += http.post(cce, content.id, ...)
- }
- }
- ####################################################################################################
- # Somewhere in lemmy-ui
- ####################################################################################################
- load_content_for_mod_review(content, ccat_extensions) {
- for each cce in ccat_extensions {
- ccat_result = http.get(cce, content.id)
- display_ccat_result_next_to_content(ccat_result, content.id)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement