Реализация на 5

This commit is contained in:
Grbisba
2026-11-17 13:08:13 +03:00
parent 470d9d6f1e
commit 60f48c0337
229 changed files with 74928 additions and 47 deletions
+232
View File
@@ -0,0 +1,232 @@
// Package contracts provides primitives to interact with the openapi HTTP API.
//
// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.1 DO NOT EDIT.
package contracts
import (
"time"
openapi_types "github.com/oapi-codegen/runtime/types"
)
const (
BasicAuthScopes = "basicAuth.Scopes"
BearerAuthScopes = "bearerAuth.Scopes"
)
// Defines values for AttachmentContentType.
const (
AttachmentContentTypeImagejpeg AttachmentContentType = "image/jpeg"
AttachmentContentTypeImagepng AttachmentContentType = "image/png"
)
// Defines values for AttachmentStatus.
const (
Failed AttachmentStatus = "failed"
Processing AttachmentStatus = "processing"
Queued AttachmentStatus = "queued"
Ready AttachmentStatus = "ready"
)
// Defines values for ErrorErrorCode.
const (
Conflict ErrorErrorCode = "conflict"
InternalError ErrorErrorCode = "internal_error"
InvalidRequest ErrorErrorCode = "invalid_request"
NotFound ErrorErrorCode = "not_found"
PayloadTooLarge ErrorErrorCode = "payload_too_large"
RateLimited ErrorErrorCode = "rate_limited"
Unauthorized ErrorErrorCode = "unauthorized"
Unavailable ErrorErrorCode = "unavailable"
UnsupportedMediaType ErrorErrorCode = "unsupported_media_type"
)
// Defines values for HealthStatus.
const (
Ok HealthStatus = "ok"
)
// Defines values for VariantContentType.
const (
VariantContentTypeImagejpeg VariantContentType = "image/jpeg"
VariantContentTypeImagepng VariantContentType = "image/png"
VariantContentTypeImagewebp VariantContentType = "image/webp"
)
// Defines values for VariantName.
const (
VariantNameCrop VariantName = "crop"
VariantNameOptimized VariantName = "optimized"
VariantNameThumbnail VariantName = "thumbnail"
)
// Defines values for DownloadAttachmentParamsVariant.
const (
DownloadAttachmentParamsVariantCrop DownloadAttachmentParamsVariant = "crop"
DownloadAttachmentParamsVariantOptimized DownloadAttachmentParamsVariant = "optimized"
DownloadAttachmentParamsVariantOriginal DownloadAttachmentParamsVariant = "original"
DownloadAttachmentParamsVariantThumbnail DownloadAttachmentParamsVariant = "thumbnail"
)
// Attachment defines model for Attachment.
type Attachment struct {
ChatId openapi_types.UUID `json:"chat_id"`
ContentType AttachmentContentType `json:"content_type"`
CreatedAt time.Time `json:"created_at"`
ErrorCode *string `json:"error_code"`
Filename string `json:"filename"`
Id openapi_types.UUID `json:"id"`
OwnerId openapi_types.UUID `json:"owner_id"`
Sha256 string `json:"sha256"`
SizeBytes int `json:"size_bytes"`
Status AttachmentStatus `json:"status"`
UpdatedAt time.Time `json:"updated_at"`
Variants []Variant `json:"variants"`
}
// AttachmentContentType defines model for Attachment.ContentType.
type AttachmentContentType string
// AttachmentStatus defines model for Attachment.Status.
type AttachmentStatus string
// Chat defines model for Chat.
type Chat struct {
CreatedAt time.Time `json:"created_at"`
Id openapi_types.UUID `json:"id"`
MemberIds []openapi_types.UUID `json:"member_ids"`
Title string `json:"title"`
}
// ChatPage defines model for ChatPage.
type ChatPage struct {
Items []Chat `json:"items"`
NextCursor *string `json:"next_cursor"`
}
// CreateChat defines model for CreateChat.
type CreateChat struct {
MemberIds []openapi_types.UUID `json:"member_ids"`
Title string `json:"title"`
}
// CreateMessage defines model for CreateMessage.
type CreateMessage struct {
AttachmentIds *[]openapi_types.UUID `json:"attachment_ids,omitempty"`
Text *string `json:"text,omitempty"`
}
// CreateUser defines model for CreateUser.
type CreateUser struct {
DisplayName string `json:"display_name"`
Password *string `json:"password,omitempty"`
Username string `json:"username"`
}
// Error defines model for Error.
type Error struct {
Error struct {
Code ErrorErrorCode `json:"code"`
Message string `json:"message"`
RequestId string `json:"request_id"`
} `json:"error"`
}
// ErrorErrorCode defines model for Error.Error.Code.
type ErrorErrorCode string
// Health defines model for Health.
type Health struct {
Status HealthStatus `json:"status"`
}
// HealthStatus defines model for Health.Status.
type HealthStatus string
// Message defines model for Message.
type Message struct {
AttachmentIds []openapi_types.UUID `json:"attachment_ids"`
ChatId openapi_types.UUID `json:"chat_id"`
CreatedAt time.Time `json:"created_at"`
Id openapi_types.UUID `json:"id"`
SenderId openapi_types.UUID `json:"sender_id"`
Text string `json:"text"`
}
// MessagePage defines model for MessagePage.
type MessagePage struct {
Items []Message `json:"items"`
NextCursor *string `json:"next_cursor"`
}
// Session defines model for Session.
type Session struct {
ExpiresAt time.Time `json:"expires_at"`
Token string `json:"token"`
TokenType string `json:"token_type"`
User User `json:"user"`
}
// User defines model for User.
type User struct {
CreatedAt time.Time `json:"created_at"`
DisplayName string `json:"display_name"`
Id openapi_types.UUID `json:"id"`
Username string `json:"username"`
}
// Variant defines model for Variant.
type Variant struct {
ContentType VariantContentType `json:"content_type"`
Height int `json:"height"`
Name VariantName `json:"name"`
Sha256 string `json:"sha256"`
SizeBytes int `json:"size_bytes"`
Width int `json:"width"`
}
// VariantContentType defines model for Variant.ContentType.
type VariantContentType string
// VariantName defines model for Variant.Name.
type VariantName string
// DownloadAttachmentParams defines parameters for DownloadAttachment.
type DownloadAttachmentParams struct {
Variant *DownloadAttachmentParamsVariant `form:"variant,omitempty" json:"variant,omitempty"`
}
// DownloadAttachmentParamsVariant defines parameters for DownloadAttachment.
type DownloadAttachmentParamsVariant string
// ListChatsParams defines parameters for ListChats.
type ListChatsParams struct {
Limit *int `form:"limit,omitempty" json:"limit,omitempty"`
Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"`
}
// UploadAttachmentParams defines parameters for UploadAttachment.
type UploadAttachmentParams struct {
Filename string `form:"filename" json:"filename"`
}
// ListMessagesParams defines parameters for ListMessages.
type ListMessagesParams struct {
Limit *int `form:"limit,omitempty" json:"limit,omitempty"`
Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"`
}
// CreateMessageParams defines parameters for CreateMessage.
type CreateMessageParams struct {
// IdempotencyKey Обязателен с lab3. Область: пользователь + метод + путь + ключ; хранить результат не менее 24 ч. Повтор того же JSON возвращает исходный 201 и то же сообщение, другой JSON — 409.
IdempotencyKey string `json:"Idempotency-Key"`
}
// CreateChatJSONRequestBody defines body for CreateChat for application/json ContentType.
type CreateChatJSONRequestBody = CreateChat
// CreateMessageJSONRequestBody defines body for CreateMessage for application/json ContentType.
type CreateMessageJSONRequestBody = CreateMessage
// RegisterUserJSONRequestBody defines body for RegisterUser for application/json ContentType.
type RegisterUserJSONRequestBody = CreateUser