init commit
This commit is contained in:
@@ -0,0 +1,216 @@
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.10.0).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package ru.mtusi.messenger.controller;
|
||||
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
import ru.mtusi.messenger.dto.ChatDTO;
|
||||
import ru.mtusi.messenger.dto.ChatPageDTO;
|
||||
import ru.mtusi.messenger.dto.CreateChatDTO;
|
||||
import ru.mtusi.messenger.dto.ErrorDTO;
|
||||
import java.util.UUID;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.annotation.Generated;
|
||||
import ru.mtusi.messenger.security.SessionPrincipal;
|
||||
|
||||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.10.0")
|
||||
@Validated
|
||||
@Tag(name = "Chats", description = "Управление чатами и доступ к чатам текущего пользователя.")
|
||||
@RequestMapping("${openapi.mTUSIMessenger2.base-path:}")
|
||||
public interface ChatsApi {
|
||||
|
||||
/**
|
||||
* POST /api/v1/chats : Создать чат; вызывающий должен входить в member_ids
|
||||
*
|
||||
* @param createChatDTO (required)
|
||||
* @return Успех (status code 201)
|
||||
* or Неверный запрос (status code 400)
|
||||
* or Нет действительной аутентификации (status code 401)
|
||||
* or Объект отсутствует или недоступен (status code 404)
|
||||
* or Конфликт (status code 409)
|
||||
* or Ограничение частоты запросов (status code 429)
|
||||
* or Зависимость недоступна (status code 503)
|
||||
* or Неожиданная ошибка без внутренних деталей (status code 500)
|
||||
*/
|
||||
@Operation(
|
||||
operationId = "createChat",
|
||||
summary = "Создать чат; вызывающий должен входить в member_ids",
|
||||
tags = { "Chats" },
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "201", description = "Успех", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ChatDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "400", description = "Неверный запрос", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "401", description = "Нет действительной аутентификации", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "404", description = "Объект отсутствует или недоступен", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "409", description = "Конфликт", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "429", description = "Ограничение частоты запросов", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "503", description = "Зависимость недоступна", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "500", description = "Неожиданная ошибка без внутренних деталей", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
})
|
||||
},
|
||||
security = {
|
||||
@SecurityRequirement(name = "bearerAuth")
|
||||
}
|
||||
)
|
||||
@RequestMapping(
|
||||
method = RequestMethod.POST,
|
||||
value = "/api/v1/chats",
|
||||
produces = { "application/json" },
|
||||
consumes = { "application/json" }
|
||||
)
|
||||
|
||||
ResponseEntity<ChatDTO> createChat(
|
||||
@Parameter(name = "CreateChatDTO", description = "", required = true) @Valid @RequestBody CreateChatDTO createChatDTO, @AuthenticationPrincipal SessionPrincipal principal
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* GET /api/v1/chats/{chat_id} : Получить доступный чат
|
||||
*
|
||||
* @param chatId (required)
|
||||
* @return Успех (status code 200)
|
||||
* or Неверный запрос (status code 400)
|
||||
* or Нет действительной аутентификации (status code 401)
|
||||
* or Объект отсутствует или недоступен (status code 404)
|
||||
* or Конфликт (status code 409)
|
||||
* or Ограничение частоты запросов (status code 429)
|
||||
* or Зависимость недоступна (status code 503)
|
||||
* or Неожиданная ошибка без внутренних деталей (status code 500)
|
||||
*/
|
||||
@Operation(
|
||||
operationId = "getChatDTO",
|
||||
summary = "Получить доступный чат",
|
||||
tags = { "Chats" },
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "Успех", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ChatDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "400", description = "Неверный запрос", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "401", description = "Нет действительной аутентификации", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "404", description = "Объект отсутствует или недоступен", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "409", description = "Конфликт", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "429", description = "Ограничение частоты запросов", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "503", description = "Зависимость недоступна", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "500", description = "Неожиданная ошибка без внутренних деталей", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
})
|
||||
},
|
||||
security = {
|
||||
@SecurityRequirement(name = "bearerAuth")
|
||||
}
|
||||
)
|
||||
@RequestMapping(
|
||||
method = RequestMethod.GET,
|
||||
value = "/api/v1/chats/{chat_id}",
|
||||
produces = { "application/json" }
|
||||
)
|
||||
|
||||
ResponseEntity<ChatDTO> getChat(
|
||||
@Parameter(name = "chat_id", description = "", required = true, in = ParameterIn.PATH) @PathVariable("chat_id") UUID chatId,
|
||||
@AuthenticationPrincipal SessionPrincipal principal
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* GET /api/v1/chats : Чаты текущего пользователя
|
||||
*
|
||||
* @param limit (optional, default to 50)
|
||||
* @param cursor (optional)
|
||||
* @return Успех (status code 200)
|
||||
* or Неверный запрос (status code 400)
|
||||
* or Нет действительной аутентификации (status code 401)
|
||||
* or Объект отсутствует или недоступен (status code 404)
|
||||
* or Конфликт (status code 409)
|
||||
* or Ограничение частоты запросов (status code 429)
|
||||
* or Зависимость недоступна (status code 503)
|
||||
* or Неожиданная ошибка без внутренних деталей (status code 500)
|
||||
*/
|
||||
@Operation(
|
||||
operationId = "listChats",
|
||||
summary = "Чаты текущего пользователя",
|
||||
tags = { "Chats" },
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "Успех", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ChatPageDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "400", description = "Неверный запрос", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "401", description = "Нет действительной аутентификации", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "404", description = "Объект отсутствует или недоступен", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "409", description = "Конфликт", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "429", description = "Ограничение частоты запросов", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "503", description = "Зависимость недоступна", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
}),
|
||||
@ApiResponse(responseCode = "500", description = "Неожиданная ошибка без внутренних деталей", content = {
|
||||
@Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))
|
||||
})
|
||||
},
|
||||
security = {
|
||||
@SecurityRequirement(name = "bearerAuth")
|
||||
}
|
||||
)
|
||||
@RequestMapping(
|
||||
method = RequestMethod.GET,
|
||||
value = "/api/v1/chats",
|
||||
produces = { "application/json" }
|
||||
)
|
||||
|
||||
ResponseEntity<ChatPageDTO> listChats(
|
||||
@Min(1) @Max(100) @Parameter(name = "limit", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "limit", required = false, defaultValue = "50") Integer limit,
|
||||
@Size(min = 1) @Parameter(name = "cursor", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "cursor", required = false) String cursor,
|
||||
@AuthenticationPrincipal SessionPrincipal principal
|
||||
);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user