complete log docs

This commit is contained in:
gempir 2020-12-04 21:30:38 +01:00
parent ecfd51456a
commit c44090d880
4 changed files with 406 additions and 20 deletions

File diff suppressed because one or more lines are too long

View file

@ -112,3 +112,65 @@ type ChannelIdLogsYearMonthDayParams struct {
Day string `json:"day"`
LogParams
}
//swagger:parameters channelIdUserLogsRandom
type ChannelIdUserLogsRandomParams struct {
// in: path
ChannelId string `json:"channelid"`
// in: path
Username string `json:"username"`
LogParams
}
//swagger:parameters channelIdUserLogs
type ChannelIdUserLogsParams struct {
// in: path
ChannelId string `json:"channelid"`
// in: path
Username string `json:"username"`
LogParams
}
//swagger:parameters channelIdUserLogsYearMonth
type ChannelIdUserLogsYearMonthParams struct {
// in: path
ChannelId string `json:"channelid"`
// in: path
Username string `json:"username"`
// in: path
Year string `json:"year"`
// in: path
Month string `json:"month"`
LogParams
}
//swagger:parameters channelUserIdLogsRandom
type ChannelUserIdLogsRandomParams struct {
// in: path
Channel string `json:"channel"`
// in: path
UserId string `json:"userid"`
LogParams
}
//swagger:parameters channelUserIdLogs
type ChannelUserIdLogsParams struct {
// in: path
Channel string `json:"channel"`
// in: path
UserId string `json:"userid"`
LogParams
}
//swagger:parameters channelUserIdLogsYearMonth
type ChannelUserIdLogsYearMonthParams struct {
// in: path
Channel string `json:"channel"`
// in: path
Userid string `json:"userid"`
// in: path
Year string `json:"year"`
// in: path
Month string `json:"month"`
LogParams
}

View file

@ -94,6 +94,28 @@ func (s *Server) writeAvailableLogs(w http.ResponseWriter, r *http.Request, q ur
// Responses:
// 200: chatLog
// swagger:route GET /channelid/{channelid}/username/{username} logs channelIdUserLogs
//
// Get user logs in channel of current month
//
// Produces:
// - application/json
// - text/plain
//
// Responses:
// 200: chatLog
// swagger:route GET /channel/{channel}/userid/{userid} logs channelUserIdLogs
//
// Get user logs in channel of current month
//
// Produces:
// - application/json
// - text/plain
//
// Responses:
// 200: chatLog
// swagger:route GET /channel/{channel}/user/{username}/{year}/{month} logs channelUserLogsYearMonth
//
// Get user logs in channel of given year month
@ -115,6 +137,28 @@ func (s *Server) writeAvailableLogs(w http.ResponseWriter, r *http.Request, q ur
//
// Responses:
// 200: chatLog
// swagger:route GET /channelid/{channelid}/username/{username}/{year}/{month} logs channelIdUserLogsYearMonth
//
// Get user logs in channel of given year month
//
// Produces:
// - application/json
// - text/plain
//
// Responses:
// 200: chatLog
// swagger:route GET /channel/{channel}/userid/{userid}/{year}/{month} logs channelUserIdLogsYearMonth
//
// Get user logs in channel of given year month
//
// Produces:
// - application/json
// - text/plain
//
// Responses:
// 200: chatLog
func (s *Server) getUserLogs(request logRequest) (*chatLog, error) {
logMessages, err := s.fileLogger.ReadLogForUser(request.channelid, request.userid, request.time.year, request.time.month)
if err != nil {

View file

@ -276,6 +276,146 @@
}
}
},
"/channel/{channel}/userid/{userid}": {
"get": {
"description": "Get user logs in channel of current month",
"produces": [
"application/json",
"text/plain"
],
"tags": [
"logs"
],
"operationId": "channelUserIdLogs",
"parameters": [
{
"type": "string",
"x-go-name": "Json",
"name": "json",
"in": "query"
},
{
"type": "string",
"x-go-name": "Reverse",
"name": "reverse",
"in": "query"
},
{
"type": "integer",
"format": "int32",
"x-go-name": "From",
"name": "from",
"in": "query"
},
{
"type": "integer",
"format": "int32",
"x-go-name": "To",
"name": "to",
"in": "query"
},
{
"type": "string",
"x-go-name": "Channel",
"name": "channel",
"in": "path",
"required": true
},
{
"type": "string",
"x-go-name": "UserId",
"name": "userid",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "chatLog",
"schema": {
"$ref": "#/definitions/chatLog"
}
}
}
}
},
"/channel/{channel}/userid/{userid}/{year}/{month}": {
"get": {
"description": "Get user logs in channel of given year month",
"produces": [
"application/json",
"text/plain"
],
"tags": [
"logs"
],
"operationId": "channelUserIdLogsYearMonth",
"parameters": [
{
"type": "string",
"x-go-name": "Json",
"name": "json",
"in": "query"
},
{
"type": "string",
"x-go-name": "Reverse",
"name": "reverse",
"in": "query"
},
{
"type": "integer",
"format": "int32",
"x-go-name": "From",
"name": "from",
"in": "query"
},
{
"type": "integer",
"format": "int32",
"x-go-name": "To",
"name": "to",
"in": "query"
},
{
"type": "string",
"x-go-name": "Channel",
"name": "channel",
"in": "path",
"required": true
},
{
"type": "string",
"x-go-name": "Userid",
"name": "userid",
"in": "path",
"required": true
},
{
"type": "string",
"x-go-name": "Year",
"name": "year",
"in": "path",
"required": true
},
{
"type": "string",
"x-go-name": "Month",
"name": "month",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "chatLog",
"schema": {
"$ref": "#/definitions/chatLog"
}
}
}
}
},
"/channel/{channel}/{year}/{month}/{day}": {
"get": {
"description": "Get entire channel logs of given day",
@ -556,6 +696,146 @@
}
}
},
"/channelid/{channelid}/username/{username}": {
"get": {
"description": "Get user logs in channel of current month",
"produces": [
"application/json",
"text/plain"
],
"tags": [
"logs"
],
"operationId": "channelIdUserLogs",
"parameters": [
{
"type": "string",
"x-go-name": "Json",
"name": "json",
"in": "query"
},
{
"type": "string",
"x-go-name": "Reverse",
"name": "reverse",
"in": "query"
},
{
"type": "integer",
"format": "int32",
"x-go-name": "From",
"name": "from",
"in": "query"
},
{
"type": "integer",
"format": "int32",
"x-go-name": "To",
"name": "to",
"in": "query"
},
{
"type": "string",
"x-go-name": "ChannelId",
"name": "channelid",
"in": "path",
"required": true
},
{
"type": "string",
"x-go-name": "Username",
"name": "username",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "chatLog",
"schema": {
"$ref": "#/definitions/chatLog"
}
}
}
}
},
"/channelid/{channelid}/username/{username}/{year}/{month}": {
"get": {
"description": "Get user logs in channel of given year month",
"produces": [
"application/json",
"text/plain"
],
"tags": [
"logs"
],
"operationId": "channelIdUserLogsYearMonth",
"parameters": [
{
"type": "string",
"x-go-name": "Json",
"name": "json",
"in": "query"
},
{
"type": "string",
"x-go-name": "Reverse",
"name": "reverse",
"in": "query"
},
{
"type": "integer",
"format": "int32",
"x-go-name": "From",
"name": "from",
"in": "query"
},
{
"type": "integer",
"format": "int32",
"x-go-name": "To",
"name": "to",
"in": "query"
},
{
"type": "string",
"x-go-name": "ChannelId",
"name": "channelid",
"in": "path",
"required": true
},
{
"type": "string",
"x-go-name": "Username",
"name": "username",
"in": "path",
"required": true
},
{
"type": "string",
"x-go-name": "Year",
"name": "year",
"in": "path",
"required": true
},
{
"type": "string",
"x-go-name": "Month",
"name": "month",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "chatLog",
"schema": {
"$ref": "#/definitions/chatLog"
}
}
}
}
},
"/channels": {
"get": {
"description": "List currently logged channels",