Skip to content

Latest commit

 

History

History
209 lines (197 loc) · 7.17 KB

user.md

File metadata and controls

209 lines (197 loc) · 7.17 KB

User


Updated

Sent by the server to inform the client when subscribed users get updated in some way. The root object of each array element in users are partial, meaning only the elements present have changed, and anything missing is assumed to be unchanged. This event should be sent to a user when they login to inform them about their own user data.

  • Endpoint Type: Event
  • Source: Server
  • Target: User
  • Required Scopes: tachyon.lobby

Event

JSONSchema
{
    "title": "UserUpdatedEvent",
    "tachyon": {
        "source": "server",
        "target": "user",
        "scopes": ["tachyon.lobby"]
    },
    "type": "object",
    "properties": {
        "type": { "const": "event" },
        "messageId": { "type": "string" },
        "commandId": { "const": "user/updated" },
        "data": {
            "title": "UserUpdatedEventData",
            "type": "object",
            "properties": {
                "users": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "allOf": [
                            {
                                "type": "object",
                                "properties": {
                                    "userId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "examples": [
                                            "f47a7e1e-4b2f-4d3d-3f3c-1f0f0e4b7e1e"
                                        ]
                                    },
                                    "username": { "type": "string" },
                                    "displayName": { "type": "string" },
                                    "clanId": {
                                        "anyOf": [
                                            { "type": "string" },
                                            { "type": "null" }
                                        ]
                                    },
                                    "partyId": {
                                        "anyOf": [
                                            { "type": "string" },
                                            { "type": "null" }
                                        ]
                                    },
                                    "scopes": {
                                        "type": "array",
                                        "items": { "type": "string" }
                                    },
                                    "countryCode": { "type": "string" },
                                    "status": {
                                        "enum": [
                                            "offline",
                                            "menu",
                                            "playing",
                                            "lobby"
                                        ]
                                    }
                                }
                            },
                            {
                                "type": "object",
                                "properties": {
                                    "friendIds": {
                                        "type": "array",
                                        "items": { "type": "string" }
                                    },
                                    "outgoingFriendRequestIds": {
                                        "type": "array",
                                        "items": { "type": "string" }
                                    },
                                    "incomingFriendRequestIds": {
                                        "type": "array",
                                        "items": { "type": "string" }
                                    },
                                    "ignoreIds": {
                                        "type": "array",
                                        "items": { "type": "string" }
                                    }
                                }
                            }
                        ]
                    }
                }
            },
            "required": ["users"]
        }
    },
    "required": ["type", "messageId", "commandId", "data"]
}
Example
{
    "type": "event",
    "messageId": "occaecat Lorem in",
    "commandId": "user/updated",
    "data": {
        "users": [
            {
                "occaecatff": -19999999.999999955,
                "userId": "f47a7e1e-4b2f-4d3d-3f3c-1f0f0e4b7e1e",
                "username": "occaecat Lorem in",
                "scopes": [
                    "occaecat Lorem in",
                    "occaecat Lorem in",
                    "occaecat Lorem in"
                ],
                "countryCode": "occaecat Lorem in",
                "status": "menu",
                "outgoingFriendRequestIds": [
                    "occaecat Lorem in",
                    "occaecat Lorem in",
                    "occaecat Lorem in"
                ]
            },
            {
                "occaecatff": -19999999.999999955,
                "userId": "f47a7e1e-4b2f-4d3d-3f3c-1f0f0e4b7e1e",
                "username": "occaecat Lorem in",
                "scopes": [
                    "occaecat Lorem in",
                    "occaecat Lorem in",
                    "occaecat Lorem in"
                ],
                "countryCode": "occaecat Lorem in",
                "status": "menu",
                "outgoingFriendRequestIds": [
                    "occaecat Lorem in",
                    "occaecat Lorem in",
                    "occaecat Lorem in"
                ]
            },
            {
                "occaecatff": -19999999.999999955,
                "userId": "f47a7e1e-4b2f-4d3d-3f3c-1f0f0e4b7e1e",
                "username": "occaecat Lorem in",
                "scopes": [
                    "occaecat Lorem in",
                    "occaecat Lorem in",
                    "occaecat Lorem in"
                ],
                "countryCode": "occaecat Lorem in",
                "status": "menu",
                "outgoingFriendRequestIds": [
                    "occaecat Lorem in",
                    "occaecat Lorem in",
                    "occaecat Lorem in"
                ]
            }
        ]
    }
}

TypeScript Definition

export interface UserUpdatedEvent {
    type: "event";
    messageId: string;
    commandId: "user/updated";
    data: UserUpdatedEventData;
}
export interface UserUpdatedEventData {
    users: ({
        userId?: string;
        username?: string;
        displayName?: string;
        clanId?: string | null;
        partyId?: string | null;
        scopes?: string[];
        countryCode?: string;
        status?: "offline" | "menu" | "playing" | "lobby";
    } & {
        friendIds?: string[];
        outgoingFriendRequestIds?: string[];
        incomingFriendRequestIds?: string[];
        ignoreIds?: string[];
    })[];
}