mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[feature] Conversations API (#3013)
* Implement conversations API * Sort and page conversations by last status ID * Appease linter * Fix deleting conversations and statuses * Refactor to make migrations automatic * Lint * Update tests post-merge * Fixes from live-fire testing * Linter caught a format problem * Refactor tests, fix cache * Negative test for non-DMs * Run conversations advanced migration on testrig startup as well as regular server startup * Document (lack of) side effects of API method for deleting a conversation * Make not-found check less nested for readability * Rename PutConversation to UpsertConversation * Use util.Ptr instead of IIFE * Reduce cache used by conversations * Remove unnecessary TableExpr/ColumnExpr * Use struct tags for both unique constraints on Conversation * Make it clear how paging with GetDirectStatusIDsBatch should be used * Let conversation paging skip conversations it can't render * Use Bun NewDropTable * Convert delete raw query to Bun * Convert update raw query to Bun * Convert latestConversationStatusesTempTable raw query partially to Bun * Convert conversationStatusesTempTable raw query partially to Bun * Rename field used to store result of MaxDirectStatusID * Move advanced migrations to their own tiny processor * Catch up util function name with main * Remove json.… wrappers * Remove redundant check * Combine error checks * Replace map with slice of structs * Address processor/type converter comments - Add context info for errors - Extract some common processor code into shared methods - Move conversation eligibility check ahead of populating conversation * Add error context when dropping temp tables
This commit is contained in:
@@ -6208,11 +6208,43 @@ paths:
|
||||
- read:bookmarks
|
||||
tags:
|
||||
- bookmarks
|
||||
/api/v1/conversation/{id}/read:
|
||||
post:
|
||||
operationId: conversationRead
|
||||
parameters:
|
||||
- description: ID of the conversation.
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Updated conversation.
|
||||
schema:
|
||||
$ref: '#/definitions/conversation'
|
||||
"400":
|
||||
description: bad request
|
||||
"401":
|
||||
description: unauthorized
|
||||
"404":
|
||||
description: not found
|
||||
"406":
|
||||
description: not acceptable
|
||||
"422":
|
||||
description: unprocessable content
|
||||
"500":
|
||||
description: internal server error
|
||||
security:
|
||||
- OAuth2 Bearer:
|
||||
- write:conversations
|
||||
summary: Mark a conversation with the given ID as read.
|
||||
tags:
|
||||
- conversations
|
||||
/api/v1/conversations:
|
||||
get:
|
||||
description: |-
|
||||
NOT IMPLEMENTED YET: Will currently always return an array of length 0.
|
||||
|
||||
The next and previous queries can be parsed from the returned Link header.
|
||||
Example:
|
||||
|
||||
@@ -6221,15 +6253,15 @@ paths:
|
||||
````
|
||||
operationId: conversationsGet
|
||||
parameters:
|
||||
- description: 'Return only conversations *OLDER* than the given max ID. The conversation with the specified ID will not be included in the response. NOTE: the ID is of the internal conversation, use the Link header for pagination.'
|
||||
- description: 'Return only conversations with last statuses *OLDER* than the given max ID. The conversation with the specified ID will not be included in the response. NOTE: The ID is a status ID. Use the Link header for pagination.'
|
||||
in: query
|
||||
name: max_id
|
||||
type: string
|
||||
- description: 'Return only conversations *NEWER* than the given since ID. The conversation with the specified ID will not be included in the response. NOTE: the ID is of the internal conversation, use the Link header for pagination.'
|
||||
- description: 'Return only conversations with last statuses *NEWER* than the given since ID. The conversation with the specified ID will not be included in the response. NOTE: The ID is a status ID. Use the Link header for pagination.'
|
||||
in: query
|
||||
name: since_id
|
||||
type: string
|
||||
- description: 'Return only conversations *IMMEDIATELY NEWER* than the given min ID. The conversation with the specified ID will not be included in the response. NOTE: the ID is of the internal conversation, use the Link header for pagination.'
|
||||
- description: 'Return only conversations with last statuses *IMMEDIATELY NEWER* than the given min ID. The conversation with the specified ID will not be included in the response. NOTE: The ID is a status ID. Use the Link header for pagination.'
|
||||
in: query
|
||||
name: min_id
|
||||
type: string
|
||||
@@ -6269,6 +6301,39 @@ paths:
|
||||
summary: Get an array of (direct message) conversations that requesting account is involved in.
|
||||
tags:
|
||||
- conversations
|
||||
/api/v1/conversations/{id}:
|
||||
delete:
|
||||
description: |-
|
||||
This doesn't delete the actual statuses in the conversation,
|
||||
nor does it prevent a new conversation from being created later from the same thread and participants.
|
||||
operationId: conversationDelete
|
||||
parameters:
|
||||
- description: ID of the conversation
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: conversation deleted
|
||||
"400":
|
||||
description: bad request
|
||||
"401":
|
||||
description: unauthorized
|
||||
"404":
|
||||
description: not found
|
||||
"406":
|
||||
description: not acceptable
|
||||
"500":
|
||||
description: internal server error
|
||||
security:
|
||||
- OAuth2 Bearer:
|
||||
- write:conversations
|
||||
summary: Delete a single conversation with the given ID.
|
||||
tags:
|
||||
- conversations
|
||||
/api/v1/custom_emojis:
|
||||
get:
|
||||
operationId: customEmojisGet
|
||||
|
Reference in New Issue
Block a user