{
  "Title": "Messages",
  "Package": "sam",
  "Interface": "Message",
  "Struct": [
    {
      "fields": [
        {
          "name": "ID",
          "type": "uint64"
        },
        {
          "name": "Type",
          "type": "string"
        },
        {
          "name": "Message",
          "type": "string"
        },
        {
          "dbname": "rel_user",
          "name": "UserId",
          "type": "uint64"
        },
        {
          "dbname": "rel_channel",
          "name": "ChannelId",
          "type": "uint64"
        },
        {
          "dbname": "rel_message",
          "name": "ReplyTo",
          "type": "uint64"
        },
        {
          "complex": true,
          "name": "UpdatedAt",
          "tag": "json:\",omitempty\"",
          "type": "*time.Time"
        },
        {
          "complex": true,
          "name": "DeletedAt",
          "tag": "json:\",omitempty\"",
          "type": "*time.Time"
        }
      ],
      "imports": [
        "time"
      ],
      "name": "Message"
    },
    {
      "fields": [
        {
          "name": "ID",
          "type": "uint64"
        },
        {
          "dbname": "rel_user",
          "name": "UserId",
          "type": "uint64"
        },
        {
          "dbname": "rel_message",
          "name": "MessageId",
          "type": "uint64"
        },
        {
          "dbname": "rel_channel",
          "name": "ChannelId",
          "type": "uint64"
        },
        {
          "name": "Reaction",
          "type": "string"
        },
        {
          "complex": true,
          "name": "DeletedAt",
          "tag": "json:\",omitempty\"",
          "type": "*time.Time"
        }
      ],
      "imports": [
        "time"
      ],
      "name": "Reaction"
    },
    {
      "fields": [
        {
          "name": "ID",
          "type": "uint64"
        },
        {
          "dbname": "rel_user",
          "name": "UserId",
          "type": "uint64"
        },
        {
          "dbname": "rel_message",
          "name": "MessageId",
          "type": "uint64"
        },
        {
          "dbname": "rel_channel",
          "name": "ChannelId",
          "type": "uint64"
        },
        {
          "complex": true,
          "name": "Attachment",
          "type": "json.RawMessage"
        },
        {
          "complex": true,
          "name": "DeletedAt",
          "tag": "json:\",omitempty\"",
          "type": "*time.Time"
        }
      ],
      "imports": [
        "time",
        "encoding/json"
      ],
      "name": "Attachment"
    }
  ],
  "Protocol": "",
  "Authentication": [
    "Client ID",
    "Session ID"
  ],
  "Path": "/message",
  "APIs": [
    {
      "Name": "edit",
      "Method": "POST",
      "Title": "New message / edit message",
      "Path": "/edit",
      "Parameters": {
        "post": [
          {
            "name": "id",
            "required": false,
            "title": "Message ID",
            "type": "uint64"
          },
          {
            "name": "channel_id",
            "required": false,
            "title": "Channel ID where to post message",
            "type": "uint64"
          },
          {
            "name": "contents",
            "required": true,
            "title": "Message contents (markdown)",
            "type": "string"
          }
        ]
      }
    },
    {
      "Name": "attach",
      "Method": "PUT",
      "Title": "Attach file to message",
      "Path": "/attach",
      "Parameters": null
    },
    {
      "Name": "remove",
      "Method": "DELETE",
      "Title": "Remove message",
      "Path": "/remove",
      "Parameters": {
        "get": [
          {
            "name": "id",
            "required": true,
            "title": "Message ID",
            "type": "uint64"
          }
        ]
      }
    },
    {
      "Name": "read",
      "Method": "GET",
      "Title": "Read message details",
      "Path": "/read",
      "Parameters": {
        "post": [
          {
            "name": "channel_id",
            "required": true,
            "title": "Channel ID to read messages from",
            "type": "uint64"
          }
        ]
      }
    },
    {
      "Name": "search",
      "Method": "GET",
      "Title": "Search messages",
      "Path": "/search",
      "Parameters": {
        "get": [
          {
            "name": "query",
            "required": false,
            "title": "Search string to match against messages",
            "type": "string"
          },
          {
            "name": "message_type",
            "required": false,
            "title": "Limit results to message type",
            "type": "string",
            "values": [
              "history",
              "message",
              "attachment",
              "media"
            ]
          }
        ]
      }
    },
    {
      "Name": "pin",
      "Method": "POST",
      "Title": "Pin message to channel (public bookmark)",
      "Path": "/pin",
      "Parameters": {
        "post": [
          {
            "name": "id",
            "required": true,
            "title": "Message ID",
            "type": "uint64"
          }
        ]
      }
    },
    {
      "Name": "flag",
      "Method": "POST",
      "Title": "Flag message for user (bookmark)",
      "Path": "/flag",
      "Parameters": {
        "post": [
          {
            "name": "id",
            "required": true,
            "title": "Message ID",
            "type": "uint64"
          }
        ]
      }
    }
  ]
}