Documentation
¶
Overview ¶
Package flash provides /api/flash/* endpoints.
Index ¶
- type CreateRequest
- type DeleteRequest
- type FeaturedRequest
- type Handler
- func (h *Handler) Create(c *echo.Context) error
- func (h *Handler) Delete(c *echo.Context) error
- func (h *Handler) Featured(c *echo.Context) error
- func (h *Handler) IFlashs(c *echo.Context) error
- func (h *Handler) IFlashsLikes(c *echo.Context) error
- func (h *Handler) Like(c *echo.Context) error
- func (h *Handler) My(c *echo.Context) error
- func (h *Handler) MyLikes(c *echo.Context) error
- func (h *Handler) Search(c *echo.Context) error
- func (h *Handler) SetModLog(m ModLogger)
- func (h *Handler) SetRoleChecker(r RoleChecker)
- func (h *Handler) Show(c *echo.Context) error
- func (h *Handler) Unlike(c *echo.Context) error
- func (h *Handler) Update(c *echo.Context) error
- type LikeRequest
- type ModLogger
- type PaginationRequest
- type RoleChecker
- type SearchRequest
- type ShowRequest
- type UpdateRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateRequest ¶
type CreateRequest struct {
Title *string `json:"title"`
Summary *string `json:"summary"`
Script *string `json:"script"`
Permissions *[]string `json:"permissions"`
Visibility string `json:"visibility"`
}
CreateRequest is the request body for flash/create. summary / permissions は upstream paramDef で required なので pointer で受けて「キー欠如」を検出する (#1548)。空文字 / 空配列は present 扱い (= upstream の required は presence 検査)。
title / script も required だが、本家は空文字列をそのまま保存する。pointer で受けて欠落だけを 400 にする (#3750)。
type DeleteRequest ¶
type DeleteRequest struct {
FlashID string `json:"flashId"`
}
DeleteRequest is the request body for flash/delete.
type FeaturedRequest ¶
FeaturedRequest is the request body for flash/featured. Upstream pages it by offset only; the cursors are not read (#3750).
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles flash-related API endpoints.
func NewHandler ¶
func NewHandler(svc *coreflash.Service, userRepo repository.UserRepository, idGen id.Generator, entityPacker *entity.Packer) *Handler
NewHandler creates a new flash Handler. userRepo / idGen are required by list endpoints to embed the `user` (UserLite) and `createdAt` fields that the upstream Misskey frontend expects when rendering Play (Flash) cards. entityPacker is the Packer this Handler packs entities with (#3794).
func (*Handler) IFlashs ¶
IFlashs handles POST /api/i/flashs, Elythia's alias of flash/my.
本家の flash/my は ID があれば日付を捨てる (makePaginationQuery) が、本家に無い i/flashs は以前の向きごとの組み合わせを残す (#3369)。
func (*Handler) IFlashsLikes ¶
IFlashsLikes handles POST /api/i/flashs/likes, Elythia's alias of flash/my-likes. IFlashs と同じく、以前の向きごとの組み合わせを残す (#3369)。
func (*Handler) My ¶
My handles POST /api/flash/my (own list).
frontend Paginator (cursor mode) は untilId / sinceId を forward する (#493)。
func (*Handler) MyLikes ¶
MyLikes handles POST /api/flash/my-likes.
upstream Misskey TS は `{id, flash: Flash}` を返す (id = flash_like row id, frontend は it.flash で MkPlayPreview を描画)。mk-go は元々 flatten された Flash 配列を返しており frontend が空表示になっていた。
func (*Handler) SetModLog ¶
SetModLog wires the moderation log writer used when a moderator deletes another user's flash (#1548).
func (*Handler) SetRoleChecker ¶
func (h *Handler) SetRoleChecker(r RoleChecker)
SetRoleChecker wires the moderator check used by flash/delete (#1548).
func (*Handler) Show ¶
Show handles POST /api/flash/show.
frontend MkPlay.vue は user / createdAt / isLiked を読んでカード描画 および「いいね」ボタン状態を決めるので、handler 側で embed する。
type LikeRequest ¶
type LikeRequest struct {
FlashID string `json:"flashId"`
}
LikeRequest is the request body for flash/like and flash/unlike.
type ModLogger ¶
type ModLogger interface {
Log(ctx context.Context, moderatorID string, t moderationlog.LogType, info map[string]any)
}
ModLogger records a moderation action. Satisfied by *core/moderationlog.Service. nil 配線時は記録を skip する (#1548)。
type PaginationRequest ¶
type PaginationRequest struct {
Limit *jsnum.Int `json:"limit"`
SinceID string `json:"sinceId"`
UntilID string `json:"untilId"`
SinceDate *jsnum.Int `json:"sinceDate"`
UntilDate *jsnum.Int `json:"untilDate"`
}
PaginationRequest is the shared body for the cursor-paged list endpoints (flash/my, flash/my-likes and their i/flashs aliases).
offset は本家の paramDef に無いので読まない。limit と sinceDate / untilDate は、本家(ajv の integer)と同じく値が整数の小数を受ける (#3750)。
type RoleChecker ¶
RoleChecker reports whether a user is a moderator. Satisfied by *core/role.Service. nil 配線時は全員 non-moderator 扱い (#1548)。
type SearchRequest ¶
type SearchRequest struct {
Query string `json:"query"`
Limit *jsnum.Int `json:"limit"`
SinceID string `json:"sinceId"`
UntilID string `json:"untilId"`
SinceDate *jsnum.Int `json:"sinceDate"`
UntilDate *jsnum.Int `json:"untilDate"`
}
SearchRequest is the request body for flash/search.
type ShowRequest ¶
type ShowRequest struct {
FlashID string `json:"flashId"`
}
ShowRequest is the request body for flash/show.
type UpdateRequest ¶
type UpdateRequest struct {
FlashID string `json:"flashId"`
Title *string `json:"title"`
Summary *string `json:"summary"`
Script *string `json:"script"`
Permissions *[]string `json:"permissions"`
Visibility *string `json:"visibility"`
}
UpdateRequest is the request body for flash/update.