Skip to main content

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

FieldTypeRequiredDescription
idstringYesUnique guild identifier
slugstringYesURL-friendly identifier for the guild
namestringYesGuild display name
descriptionstringYesGuild description
logostringNoURL to guild logo image
websitestringNoGuild website URL
socialobject[]NoArray of social media links
sizenumberYesCurrent member count
adminIdstringNoUser ID of the guild administrator
createdAtnumberYesCreation timestamp (Unix milliseconds)
updatedAtnumberYesLast update timestamp (Unix milliseconds)

Social Object (GameSocials)

Each social link in the social array has:

FieldTypeDescription
servicestringPlatform: DISCORD, TWITTER, FACEBOOK
usernamestringUsername or handle on the platform

Response Format

Guild DTO is returned by:

  • GET /api/v2/guilds/me
  • GET /api/v2/guilds/public/:id
  • GET /api/v2/guilds/:id
  • GET /api/v2/guilds/slug/:slug
  • GET /api/v2/guilds/admin/:adminId
  • Items in GET /api/v2/guilds/public and GET /api/v2/guilds list 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
}

Next Steps