Documentation
¶
Overview ¶
Package api defines the HTTP request and response types for the backend REST API.
These types serve as the shared contract between the backend (which serializes them) and the frontend apiclient (which deserializes them). All types are JSON-encoded.
Design rules ¶
A type belongs here only if it adds value over the domain types in shared/domain:
Request DTOs always belong here — they carry JSON tags, validation rules, and field shapes that differ from domain creation types.
Response types belong here when they combine or reshape domain data: BoardListResponse wraps a slice (JSON requires an object, not a bare array), LoginResponse adds an access token, CreateMessageResponse pairs an ID with its page number, BlacklistResponse and InviteListResponse add pagination.
Pure domain wrappers that add no fields are omitted — the handler returns the domain type directly, and the apiclient decodes into it directly.
Cross-cutting concern ¶
Because both services compile against shared/domain, this package does not provide a versioning boundary between them. If the services were ever split into independently deployed binaries with external clients, response wrappers should be reintroduced to decouple the API contract from internal domain evolution.
Index ¶
- type BlacklistResponse
- type BlacklistUserRequest
- type BoardListResponse
- type CheckConfirmationCodeRequest
- type CreateBoardRequest
- type CreateMessageRequest
- type CreateMessageResponse
- type CreateThreadRequest
- type InviteListResponse
- type LoginRequest
- type LoginResponse
- type RegisterRequest
- type UserActivityResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlacklistResponse ¶
type BlacklistResponse struct {
Users []domain.BlacklistEntry `json:"users"`
Page int `json:"page"`
}
type BlacklistUserRequest ¶
type BlacklistUserRequest struct {
Reason string `json:"reason"`
}
type BoardListResponse ¶
type BoardListResponse struct {
Boards []domain.BoardMetadata `json:"boards"`
}
BoardListResponse wraps a list of boards
type CreateBoardRequest ¶
type CreateMessageRequest ¶
type CreateMessageResponse ¶
type CreateMessageResponse struct {
Id int64 `json:"id"`
Page int `json:"page"` // Page number where the message appears
}
CreateMessageResponse returns the ID of the created message and its page
type CreateThreadRequest ¶
type CreateThreadRequest struct {
Title string `json:"title" validate:"required"`
IsPinned bool `json:"is_pinned,omitempty"`
OpMessage CreateMessageRequest `json:"op_message"`
}
type InviteListResponse ¶ added in v0.1.1
type InviteListResponse struct {
Invites []domain.InviteCode `json:"invites"`
Page int `json:"page"`
}
type LoginRequest ¶
type LoginResponse ¶
type RegisterRequest ¶
type UserActivityResponse ¶
UserActivityResponse contains user's recent messages Messages are FULLY enriched (Author, Attachments, Replies)