Guild DTO
Schema for guild data transfer objects used across the Guilds API.
Description
This schema defines the structure of guild objects returned by guild endpoints. It includes complete metadata for guilds including name, description, social links, and member count.
Class Validator Schema
import { Type } from "class-transformer";
import { IsArray, IsNumber, IsOptional, IsString, ValidateNested } from "class-validator";
import { GameSocials } from "../../game/models";
export class GuildDto {
@IsString()
id: string;
@IsString()
slug: string;
@IsString()
name: string;
@IsString()
description: string;
@IsOptional()
@IsString()
logo?: string;
@IsOptional()
@IsString()
website?: string;
@IsArray()
@ValidateNested({ each: true })
@Type(() => GameSocials)
@IsOptional()
social?: GameSocials[];
@IsNumber()
size: number;
createdAt: number;
updatedAt: number;
}
Field Descriptions
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique guild identifier |
slug | string | Yes | URL-friendly identifier for the guild |
name | string | Yes | Guild display name |
description | string | Yes | Guild description |
logo | string | No | URL to guild logo image |
website | string | No | Guild website URL |
social | object[] | No | Array of social media links |
size | number | Yes | Current member count |
adminId | string | No | User ID of the guild administrator |
createdAt | number | Yes | Creation timestamp (Unix milliseconds) |
updatedAt | number | Yes | Last update timestamp (Unix milliseconds) |
Social Object (GameSocials)
Each social link in the social array has:
| Field | Type | Description |
|---|---|---|
service | string | Platform: DISCORD, TWITTER, FACEBOOK |
username | string | Username or handle on the platform |
Response Format
Guild DTO is returned by:
GET /api/v2/guilds/meGET /api/v2/guilds/public/:idGET /api/v2/guilds/:idGET /api/v2/guilds/slug/:slugGET /api/v2/guilds/admin/:adminId- Items in
GET /api/v2/guilds/publicandGET /api/v2/guildslist responses
Example Response
{
"id": "guild-123",
"slug": "elite-gamers",
"name": "Elite Gamers Guild",
"description": "A community for competitive gamers",
"logo": "https://example.com/logo.png",
"website": "https://elitegamers.com",
"social": [
{
"service": "DISCORD",
"username": "elitegamers"
},
{
"service": "TWITTER",
"username": "elitegamers"
}
],
"size": 42,
"adminId": "user-456",
"createdAt": 1672531200000,
"updatedAt": 1704067200000
}