api: only query emotes by id directly

This commit is contained in:
Branden J Brown 2025-05-06 12:00:38 -04:00
parent 24d2f09767
commit 0adc9ce683
2 changed files with 66 additions and 53 deletions

View File

@ -113,17 +113,9 @@ model EmoteSet {
id: id;
/**
* Emotes in the set.
* This may be a subset of the full set, e.g. for queries that only need
* to show cards.
* IDs of emotes in the set.
*/
emotes: Emote[];
/**
* Actual number of emotes in the set.
* This may be larger than the size of the emotes property.
*/
totalCount: int16;
emotes: id[];
/**
* ID of the user who owns the emote set.
@ -158,8 +150,15 @@ model ConnectedSet {
name: string;
}
/** Requested emote. */
model EmoteResp is Success<Emote>;
/** Requested emotes. */
model EmoteResp
is Success<{
/** Information about emotes that were found. */
found: Emote[];
/** IDs that were not found. */
error?: id[];
}>;
/** Requested user. */
model UserResp is Success<User>;
@ -167,19 +166,20 @@ model UserResp is Success<User>;
/** Requested emote set. */
model SetResp is Success<EmoteSet>;
/** An emote requested by ID is not found. */
model EmoteNotFound is Error<404>;
/** A user requested by ID or connected platform ID is not found. */
model UserNotFound is Error<404>;
/** An emote set requested by ID is not found. */
model SetNotFound is Error<404>;
/** Get emote data by its ID. */
/** Get emote data by IDs. */
@get
@route("/emotes/{emoteID}")
op emote(@path emoteID: id): EmoteResp | EmoteNotFound;
@route("/emotes")
op emote(
@query(#{ name: "id", explode: true })
@maxItems(100)
emoteID: id[],
): EmoteResp;
/**
* Get user data by their Ligmotes ID.

View File

@ -4,44 +4,44 @@ info:
version: 0.0.0
tags: []
paths:
/emotes/{emoteID}:
/emotes:
get:
operationId: Read_emote
description: Get emote data by its ID.
description: Get emote data by IDs.
parameters:
- name: emoteID
in: path
- name: id
in: query
required: true
schema:
type: array
items:
$ref: '#/components/schemas/Models.id'
maxItems: 100
responses:
'200':
description: Requested emote.
description: Requested emotes.
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/Read.Emote'
required:
- data
'404':
description: An emote requested by ID is not found.
content:
application/json:
schema:
type: object
properties:
found:
type: array
items:
$ref: '#/components/schemas/Read.Emote'
description: Information about emotes that were found.
error:
type: string
description: Programmer-oriented error description.
message:
type: string
description: User-oriented error message.
type: array
items:
$ref: '#/components/schemas/Models.id'
description: IDs that were not found.
required:
- error
- message
- found
required:
- data
security:
- {}
/platforms/{platform}/connections/{connectedID}/user:
@ -198,6 +198,24 @@ components:
Emote work attributions.
These may be links to Ligmotes users or to general social media.
Attributions are subject to moderator approval.
Read.ConnectedSet:
type: object
required:
- platform
- connectedID
- name
properties:
platform:
allOf:
- $ref: '#/components/schemas/Models.platform'
description: Platform where the set is connected.
connectedID:
type: string
description: ID of the user on the connected platform.
name:
type: string
description: Name of the user on the connected platform.
description: Active connection between an emote set and an external platform.
Read.Emote:
type: object
required:
@ -284,7 +302,6 @@ components:
required:
- id
- emotes
- totalCount
- ownerID
- ownerName
- name
@ -295,17 +312,8 @@ components:
emotes:
type: array
items:
$ref: '#/components/schemas/Read.Emote'
description: |-
Emotes in the set.
This may be a subset of the full set, e.g. for queries that only need
to show cards.
totalCount:
type: integer
format: int16
description: |-
Actual number of emotes in the set.
This may be larger than the size of the emotes property.
$ref: '#/components/schemas/Models.id'
description: IDs of emotes in the set.
ownerID:
allOf:
- $ref: '#/components/schemas/Models.id'
@ -322,6 +330,11 @@ components:
type: string
format: date-time
description: Time at which the emote set was created.
connections:
type: array
items:
$ref: '#/components/schemas/Read.ConnectedSet'
description: Active connections using the set, if any.
description: Emote set details.
Read.Media:
type: object