AmplicaLabs / social-app-template

Social Application Template that uses Gateway Services
Apache License 2.0
0 stars 2 forks source link

Implement Endpoint to Retrieve Post Details #8

Closed enddynayn closed 2 months ago

enddynayn commented 3 months ago

Description We need to implement a new GET endpoint to allow retrieval of detailed information about a specific post using its unique identifier and content hash

Acceptance Criteria:

Tech Specs

Endpoint: GET /v1/content/{dsnpId}/{contentHash} Security Requirement: tokenAuth Parameters:

200 OK: Returns post details matching the BroadcastExtended schema. 401 Unauthorized: Access attempt without valid authentication. 404 Not Found: No content found matching the provided identifiers. Open API Snippet

{
  "/v1/content/{dsnpId}/{contentHash}": {
    "get": {
      "operationId": "getContent",
      "summary": "Get details of a specific post",
      "security": [
        {
          "tokenAuth": []
        }
      ],
      "parameters": [
        {
          "name": "dsnpId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "contentHash",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "responses": {
        "200": {
          "description": "Successful response",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BroadcastExtended"
              }
            }
          }
        },
        "401": {
          "$ref": "#/components/responses/UnauthorizedError"
        },
        "404": {
          "description": "Content not found"
        }
      }
    }
  }
}
{
  "components": {
    "schemas": {
      "BroadcastExtended": {
        "type": "object",
        "properties": {
          "fromId": {
            "type": "string"
          },
          "contentHash": {
            "type": "string"
          },
          "content": {
            "description": "JSON-encoded Activity Content Note",
            "type": "string"
          },
          "timestamp": {
            "type": "string",
            "description": "Timestamp of the post"
          },
          "replies": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReplyExtended"
            },
            "description": "Array of ReplyExtended objects"
          }
        },
        "required": [
          "fromId",
          "contentHash",
          "content",
          "timestamp"
        ]
      }
    }
  }
}