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

View File

@ -4,44 +4,44 @@ info:
version: 0.0.0 version: 0.0.0
tags: [] tags: []
paths: paths:
/emotes/{emoteID}: /emotes:
get: get:
operationId: Read_emote operationId: Read_emote
description: Get emote data by its ID. description: Get emote data by IDs.
parameters: parameters:
- name: emoteID - name: id
in: path in: query
required: true required: true
schema: schema:
type: array
items:
$ref: '#/components/schemas/Models.id' $ref: '#/components/schemas/Models.id'
maxItems: 100
responses: responses:
'200': '200':
description: Requested emote. description: Requested emotes.
content: content:
application/json: application/json:
schema: schema:
type: object type: object
properties: properties:
data: data:
$ref: '#/components/schemas/Read.Emote'
required:
- data
'404':
description: An emote requested by ID is not found.
content:
application/json:
schema:
type: object type: object
properties: properties:
found:
type: array
items:
$ref: '#/components/schemas/Read.Emote'
description: Information about emotes that were found.
error: error:
type: string type: array
description: Programmer-oriented error description. items:
message: $ref: '#/components/schemas/Models.id'
type: string description: IDs that were not found.
description: User-oriented error message.
required: required:
- error - found
- message required:
- data
security: security:
- {} - {}
/platforms/{platform}/connections/{connectedID}/user: /platforms/{platform}/connections/{connectedID}/user:
@ -198,6 +198,24 @@ components:
Emote work attributions. Emote work attributions.
These may be links to Ligmotes users or to general social media. These may be links to Ligmotes users or to general social media.
Attributions are subject to moderator approval. 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: Read.Emote:
type: object type: object
required: required:
@ -284,7 +302,6 @@ components:
required: required:
- id - id
- emotes - emotes
- totalCount
- ownerID - ownerID
- ownerName - ownerName
- name - name
@ -295,17 +312,8 @@ components:
emotes: emotes:
type: array type: array
items: items:
$ref: '#/components/schemas/Read.Emote' $ref: '#/components/schemas/Models.id'
description: |- description: IDs of emotes in the set.
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.
ownerID: ownerID:
allOf: allOf:
- $ref: '#/components/schemas/Models.id' - $ref: '#/components/schemas/Models.id'
@ -322,6 +330,11 @@ components:
type: string type: string
format: date-time format: date-time
description: Time at which the emote set was created. 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. description: Emote set details.
Read.Media: Read.Media:
type: object type: object