Skip to content

Latest commit

 

History

History
838 lines (760 loc) · 20 KB

user.md

File metadata and controls

838 lines (760 loc) · 20 KB

User


Info

Fetch user info from the server.

  • Endpoint Type: Request -> Response
  • Source: User
  • Target: Server
  • Required Scopes: tachyon.lobby

Request

JSONSchema
{
    "title": "UserInfoRequest",
    "tachyon": {
        "source": "user",
        "target": "server",
        "scopes": ["tachyon.lobby"]
    },
    "type": "object",
    "properties": {
        "type": { "const": "request" },
        "messageId": { "type": "string" },
        "commandId": { "const": "user/info" },
        "data": {
            "title": "UserInfoRequestData",
            "type": "object",
            "properties": {
                "userId": { "$ref": "../../definitions/userId.json" }
            },
            "required": ["userId"]
        }
    },
    "required": ["type", "messageId", "commandId", "data"]
}
Example
{
    "type": "request",
    "messageId": "Lorem nulla sed aute",
    "commandId": "user/info",
    "data": {
        "userId": "351"
    }
}

TypeScript Definition

export type UserId = string;

export interface UserInfoRequest {
    type: "request";
    messageId: string;
    commandId: "user/info";
    data: UserInfoRequestData;
}
export interface UserInfoRequestData {
    userId: UserId;
}

Response

JSONSchema
{
    "title": "UserInfoResponse",
    "tachyon": {
        "source": "server",
        "target": "user",
        "scopes": ["tachyon.lobby"]
    },
    "anyOf": [
        {
            "title": "UserInfoOkResponse",
            "type": "object",
            "properties": {
                "type": { "const": "response" },
                "messageId": { "type": "string" },
                "commandId": { "const": "user/info" },
                "status": { "const": "success" },
                "data": {
                    "$ref": "../../definitions/user.json",
                    "title": "UserInfoOkResponseData"
                }
            },
            "required": ["type", "messageId", "commandId", "status", "data"]
        },
        {
            "title": "UserInfoFailResponse",
            "type": "object",
            "properties": {
                "type": { "const": "response" },
                "messageId": { "type": "string" },
                "commandId": { "const": "user/info" },
                "status": { "const": "failed" },
                "reason": {
                    "enum": [
                        "unknown_user",
                        "internal_error",
                        "unauthorized",
                        "invalid_request",
                        "command_unimplemented"
                    ]
                },
                "details": { "type": "string" }
            },
            "required": ["type", "messageId", "commandId", "status", "reason"]
        }
    ]
}
Example
{
    "type": "response",
    "messageId": "ex pariatur deserunt mollit ad",
    "commandId": "user/info",
    "status": "success",
    "data": {
        "userId": "351",
        "username": "minim laborum magna nostrud",
        "displayName": "nulla",
        "clanId": null,
        "countryCode": "Ut",
        "status": "playing"
    }
}

TypeScript Definition

export type UserId = string;

export interface UserInfoOkResponse {
    type: "response";
    messageId: string;
    commandId: "user/info";
    status: "success";
    data: UserInfoOkResponseData;
}
export interface UserInfoOkResponseData {
    userId: UserId;
    username: string;
    displayName: string;
    clanId: string | null;
    countryCode?: string;
    status: "offline" | "menu" | "playing" | "lobby";
}

Possible Failed Reasons: unknown_user, internal_error, unauthorized, invalid_request, command_unimplemented


Self

Sent by the server to inform the client of its own user state. This event should be sent to a user when they login.

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

Event

JSONSchema
{
    "title": "UserSelfEvent",
    "tachyon": {
        "source": "server",
        "target": "user",
        "scopes": ["tachyon.lobby"]
    },
    "type": "object",
    "properties": {
        "type": { "const": "event" },
        "messageId": { "type": "string" },
        "commandId": { "const": "user/self" },
        "data": {
            "title": "UserSelfEventData",
            "type": "object",
            "properties": {
                "user": { "$ref": "../../definitions/privateUser.json" }
            },
            "required": ["user"]
        }
    },
    "required": ["type", "messageId", "commandId", "data"]
}
Example
{
    "type": "event",
    "messageId": "veniam ut ad cillum quis",
    "commandId": "user/self",
    "data": {
        "user": {
            "userId": "351",
            "username": "dolore magna veniam cillum laboris",
            "displayName": "occaecat nisi veniam cupidatat",
            "clanId": null,
            "countryCode": "sint proident ipsum officia",
            "status": "offline",
            "partyId": null,
            "friendIds": [
                "deserunt",
                "esse sunt anim dolor dolore",
                "tempor"
            ],
            "outgoingFriendRequestIds": [
                "nisi non",
                "laboris aliquip ut",
                "dolor sed incididunt aute id"
            ],
            "incomingFriendRequestIds": [
                "culpa labore Excepteur",
                "dolor voluptate nostrud",
                "ipsum irure quis",
                "voluptate anim"
            ],
            "ignoreIds": [
                "cillum in",
                "Excepteur ad consectetur dolor velit",
                "elit ut ullamco deserunt",
                "dolore",
                "reprehenderit non"
            ],
            "currentBattle": {
                "username": "quis nostrud laboris aute Lorem",
                "password": "aliquip esse labore",
                "ip": "in",
                "port": 97886848.44970703,
                "engine": {
                    "version": "minim nisi nulla tempor"
                },
                "game": {
                    "springName": "ullamco voluptate aliqua labore officia"
                },
                "map": {
                    "springName": "in incididunt enim Ut"
                }
            }
        }
    }
}

TypeScript Definition

export type PrivateUser = {
    userId: UserId;
    username: string;
    displayName: string;
    clanId: string | null;
    countryCode?: string;
    status: "offline" | "menu" | "playing" | "lobby";
} & {
    partyId: string | null;
    friendIds: string[];
    outgoingFriendRequestIds: string[];
    incomingFriendRequestIds: string[];
    ignoreIds: string[];
    currentBattle?: PrivateBattle;
};
export type UserId = string;

export interface UserSelfEvent {
    type: "event";
    messageId: string;
    commandId: "user/self";
    data: UserSelfEventData;
}
export interface UserSelfEventData {
    user: PrivateUser;
}
export interface PrivateBattle {
    username: string;
    password: string;
    ip: string;
    port: number;
    engine: {
        version: string;
    };
    game: {
        springName: string;
    };
    map: {
        springName: string;
    };
}

SubscribeUpdates

Ask the server to send updates about theses users.

  • Endpoint Type: Request -> Response
  • Source: User
  • Target: Server
  • Required Scopes: tachyon.lobby

Request

JSONSchema
{
    "title": "UserSubscribeUpdatesRequest",
    "tachyon": {
        "source": "user",
        "target": "server",
        "scopes": ["tachyon.lobby"]
    },
    "type": "object",
    "properties": {
        "type": { "const": "request" },
        "messageId": { "type": "string" },
        "commandId": { "const": "user/subscribeUpdates" },
        "data": {
            "title": "UserSubscribeUpdatesRequestData",
            "type": "object",
            "properties": {
                "userIds": {
                    "type": "array",
                    "items": {
                        "$id": "userId",
                        "type": "string",
                        "examples": ["351"]
                    },
                    "minItems": 1,
                    "maxItems": 100
                }
            },
            "required": ["userIds"]
        }
    },
    "required": ["type", "messageId", "commandId", "data"]
}
Example
{
    "type": "request",
    "messageId": "aute mollit proident sunt dolore",
    "commandId": "user/subscribeUpdates",
    "data": {
        "userIds": [
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351"
        ]
    }
}

TypeScript Definition

export type UserId = string;

export interface UserSubscribeUpdatesRequest {
    type: "request";
    messageId: string;
    commandId: "user/subscribeUpdates";
    data: UserSubscribeUpdatesRequestData;
}
export interface UserSubscribeUpdatesRequestData {
    userIds: [UserId, ...UserId[]];
}

Response

JSONSchema
{
    "title": "UserSubscribeUpdatesResponse",
    "tachyon": {
        "source": "server",
        "target": "user",
        "scopes": ["tachyon.lobby"]
    },
    "anyOf": [
        {
            "title": "UserSubscribeUpdatesOkResponse",
            "type": "object",
            "properties": {
                "type": { "const": "response" },
                "messageId": { "type": "string" },
                "commandId": { "const": "user/subscribeUpdates" },
                "status": { "const": "success" }
            },
            "required": ["type", "messageId", "commandId", "status"]
        },
        {
            "title": "UserSubscribeUpdatesFailResponse",
            "type": "object",
            "properties": {
                "type": { "const": "response" },
                "messageId": { "type": "string" },
                "commandId": { "const": "user/subscribeUpdates" },
                "status": { "const": "failed" },
                "reason": {
                    "enum": [
                        "subscription_limit_reached",
                        "internal_error",
                        "unauthorized",
                        "invalid_request",
                        "command_unimplemented"
                    ]
                },
                "details": { "type": "string" }
            },
            "required": ["type", "messageId", "commandId", "status", "reason"]
        }
    ]
}
Example
{
    "type": "response",
    "messageId": "ullamco eiusmod cillum Excepteur",
    "commandId": "user/subscribeUpdates",
    "status": "success"
}

TypeScript Definition

export interface UserSubscribeUpdatesOkResponse {
    type: "response";
    messageId: string;
    commandId: "user/subscribeUpdates";
    status: "success";
}

Possible Failed Reasons: subscription_limit_reached, internal_error, unauthorized, invalid_request, command_unimplemented


UnsubscribeUpdates

Ask the server to stop sending user updates for the given set of userId. This should always succeed.

  • Endpoint Type: Request -> Response
  • Source: User
  • Target: Server
  • Required Scopes: tachyon.lobby

Request

JSONSchema
{
    "title": "UserUnsubscribeUpdatesRequest",
    "tachyon": {
        "source": "user",
        "target": "server",
        "scopes": ["tachyon.lobby"]
    },
    "type": "object",
    "properties": {
        "type": { "const": "request" },
        "messageId": { "type": "string" },
        "commandId": { "const": "user/unsubscribeUpdates" },
        "data": {
            "title": "UserUnsubscribeUpdatesRequestData",
            "type": "object",
            "properties": {
                "userIds": {
                    "type": "array",
                    "items": {
                        "$id": "userId",
                        "type": "string",
                        "examples": ["351"]
                    },
                    "minItems": 1,
                    "maxItems": 100
                }
            },
            "required": ["userIds"]
        }
    },
    "required": ["type", "messageId", "commandId", "data"]
}
Example
{
    "type": "request",
    "messageId": "commodo aute eiusmod adipisicing anim",
    "commandId": "user/unsubscribeUpdates",
    "data": {
        "userIds": [
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351",
            "351"
        ]
    }
}

TypeScript Definition

export type UserId = string;

export interface UserUnsubscribeUpdatesRequest {
    type: "request";
    messageId: string;
    commandId: "user/unsubscribeUpdates";
    data: UserUnsubscribeUpdatesRequestData;
}
export interface UserUnsubscribeUpdatesRequestData {
    userIds: [UserId, ...UserId[]];
}

Response

JSONSchema
{
    "title": "UserUnsubscribeUpdatesResponse",
    "tachyon": {
        "source": "server",
        "target": "user",
        "scopes": ["tachyon.lobby"]
    },
    "anyOf": [
        {
            "title": "UserUnsubscribeUpdatesOkResponse",
            "type": "object",
            "properties": {
                "type": { "const": "response" },
                "messageId": { "type": "string" },
                "commandId": { "const": "user/unsubscribeUpdates" },
                "status": { "const": "success" }
            },
            "required": ["type", "messageId", "commandId", "status"]
        },
        {
            "title": "UserUnsubscribeUpdatesFailResponse",
            "type": "object",
            "properties": {
                "type": { "const": "response" },
                "messageId": { "type": "string" },
                "commandId": { "const": "user/unsubscribeUpdates" },
                "status": { "const": "failed" },
                "reason": {
                    "enum": [
                        "internal_error",
                        "unauthorized",
                        "invalid_request",
                        "command_unimplemented"
                    ]
                },
                "details": { "type": "string" }
            },
            "required": ["type", "messageId", "commandId", "status", "reason"]
        }
    ]
}
Example
{
    "type": "response",
    "messageId": "minim adipisicing",
    "commandId": "user/unsubscribeUpdates",
    "status": "success"
}

TypeScript Definition

export interface UserUnsubscribeUpdatesOkResponse {
    type: "response";
    messageId: string;
    commandId: "user/unsubscribeUpdates";
    status: "success";
}

Possible Failed Reasons: internal_error, unauthorized, invalid_request, command_unimplemented


Updated

Sent by the server to inform the client of user state changes. User objects should be full when first sent, then only updates gets sent.

  • 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",
                        "properties": {
                            "userId": { "type": "string", "examples": ["351"] },
                            "username": { "type": "string" },
                            "displayName": { "type": "string" },
                            "clanId": {
                                "anyOf": [
                                    { "type": "string" },
                                    { "type": "null" }
                                ]
                            },
                            "countryCode": { "type": "string" },
                            "status": {
                                "enum": ["offline", "menu", "playing", "lobby"]
                            }
                        }
                    }
                }
            },
            "required": ["users"]
        }
    },
    "required": ["type", "messageId", "commandId", "data"]
}
Example
{
    "type": "event",
    "messageId": "ad",
    "commandId": "user/updated",
    "data": {
        "users": [
            {
                "ince7": true,
                "id_4": -25186110,
                "ullamco_8b_": true,
                "quif2c": "ut non",
                "incididuntabb": true,
                "userId": "351",
                "clanId": null
            },
            {
                "infe4": 51101136.20758057,
                "aliquip64": -10159337.520599365,
                "anim_6": -22766137.12310791,
                "sint7a": true,
                "aliqua_b08": "quis consectetur ea",
                "ut_430": true,
                "do_e6_": false,
                "exercitatione": true,
                "userId": "351",
                "countryCode": "ad eu anim"
            },
            {
                "userId": "351",
                "username": "nulla ex velit in",
                "displayName": "minim in ut nisi sed",
                "clanId": "ex mollit",
                "countryCode": "consectetur sint fugiat sunt"
            },
            {
                "do_c2": true,
                "Ut4a9": -37927055.35888672,
                "voluptatebbf": "ut consequat laborum esse",
                "username": "labore et",
                "clanId": null,
                "countryCode": "Lorem qui"
            },
            {
                "userId": "351",
                "username": "dolor ut Ut cupidatat aliquip",
                "displayName": "amet nostrud irure eiusmod Duis",
                "clanId": "enim officia aute veniam labore",
                "countryCode": "cillum",
                "status": "menu"
            }
        ]
    }
}

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;
        countryCode?: string;
        status?: "offline" | "menu" | "playing" | "lobby";
    }[];
}