Skip to content

Data Structures

Tyler Hancock edited this page Nov 15, 2020 · 7 revisions

Data Structures

The Diluv REST API uses a few common data structures across all of our responses. You can learn more about these data structures here.

SlugName

The data structure for a SlugName includes the slug identifier and the display name for another data type. These are used throughout the API to represent various links and relations between different data structures.

Property Type Description
slug String An identifier for the referenced data. It is used in URLs and some API calls.
name String The display name of the game.

Example

{
    "slug": "a-slug-name",
    "name": "The Name of the Slug"
}

Game

The data structure for a Game describes important information about the game itself. It also includes important information about how the Diluv platform can interact with the game.

Property Type Description
url String The official URL for the game. In some cases this may just be the storefront page.
logoURL FormattedImage The display image for the game. These are often available in a variety of formats.
projectTypes ProjectType[] An array of supported project types.
versions GameVersion[] An array of supported game versions.
defaultProjectType String The slug of the default project type. In the site this is used to determine what the first page is when you click on a game.
slug String An identifier for the game that is used in URLs and some API calls.
name String The proper display name for the game.
slug String An identifier for the game that is used in URLs and some API calls.
name String The proper display name for the game.

Game Version Example

{
  "slug": "game-slug",
  "name": "Name of the Game",
  "url": "https://example.com",
  "logoURL": {
    "fallback": {
      "src": "https://cdn.diluv.dev/games/game-slug/logo.png",
      "type": "image/png"
    },
    "sources": [
      {
        "src": "https://cdn.diluv.dev/games/game-slug/logo.webp",
        "type": "image/webp"
      }
    ]
  },
  "projectTypes": [
    {
      "game": {
        "slug": "game-slug",
        "name": "Name of the Game"
      },
      "tags": [
        {
          "slug": "a-tag-slug",
          "name": "Name of Tag Slug"
        }
      ],
      "loaders": [
        {
          "name": "The Loader Name",
          "slug": "loader-slug"
        }
      ],
      "slug": "a-type-slug",
      "name": "Name of Type"
    }
  ],
  "versions": [
    {
      "version": "1.0.4.2",
      "type": "release",
      "released": 1597140826000
    }
  ],
  "defaultProjectType": "a-type-slug"
}

ProjectType

The data structure for a ProjectType defines a supported project type for a given game.

Property Type Description
slug String An identifier for the project type that is used in URLs and some API calls.
name String The display name of the project type.
game SlugName Reference data for the game that this is for.
loaders SlugName[] Reference data for the supported loader formats.
tags SlugName[] Reference data for the supported project tags/categories.

Project Type Example

{
    "slug": "type-slug",
    "name": "The name of the Slug",
    "game": {
        "slug": "game-slug",
        "name": "The Name of the Game"
    },
    "loaders": [
        {
            "slug": "loader-slug",
            "name": "The Slug Name"
        }
    ],
    "tags": [
        {
            "slug": "a-tag-slug",
            "name": "A Tag Name"
        }
    ]
}

GameVersion

The data structure for a GameVersion includes the relevant information about a specific version of a game. This information is only accurate to the degree necessary for our systems to function. For example the release date of a version may be off by a few hours, or even days.

Property Type Description
version String The version string.
type String The type of version this was.
released Long The time the version was released.

Game Version Example

{
    "version": "0.10.12a",
    "type": "alpha",
    "released": 1242511200000
}

FormattedImage

The data structure of FormattedImage describes an image that is available in a variety of formats. These are primarily used to provide different qualities and compression levels depending on the use case.

Property Type Description
fallback ImageSource The image source that should be used if you don't care about the alternatives.
sources ImageSource[] An array of all the available sources for this image.

Formatted Image Example

{
    "fallback": {
        "src": "https://example.com/someimage.png",
        "type": "image/png"
    },
    "sources": [
        {
            "src": "https://example.com/someimage.png",
            "type": "image/png"
        }
    ]
}

ImageSource

The data structure for ImageSource describes an image source.

Property Type Description
src String The direct image source. This will often be a URL but in some cases it may also be base64 encoded.
type String The mime type of the image being served.

Image Source Example

{
    "src": "https://example.com/someimage.png",
    "type": "image/png"
}

Project

The data structure for Project represents a user generated project.

Property Type Description
id Long The internal ID of the project. This is commonly used as a simple way to reference a project.
name String The display name of the project.
slug String The slug identifier for the project. This can sometimes be used to reference the project.
logo String A URL that points to the project's display image / logo.
downloads Long The number of downloads for the project.
createdAt Long The timestamp for when the project was created.
updatedAt Long The timestamp for when the project was last updated.
tags SlugName[] An array of tags that have been applied to the project.
game SlugName Reference info for the game that this project is for.
contributors Contributor[] User data of those who contributed to the project.

Project Example

{
    "id": 1,
    "name": "The Project Name",
    "slug": "project-slug",
    "summary": "A description of the project and what it does.",
    "logo": "https://cdn.diluv.dev/games/game-slug/type-slug/1/logo.png",
    "downloads": 143,
    "createdAt": 1426128779000,
    "updatedAt": 1605260309000,
    "tags": [
        {
            "slug": "tag-slug",
            "name": "The Tag Name"
        }
    ],
    "game": {
        "slug": "game-slug",
        "name": "The Game Name"
    },
    "projectType": {
        "slug": "type-slug",
        "name": "The Type Name"
    },
    "contributors": [
        {
            "role": "owner",
            "userId": 1,
            "username": "username",
            "displayName": "Username",
            "avatarURL": "https://cdn.diluv.dev/users/username/avatar.png",
            "createdAt": 1599804030000
        }
    ]
}

Contributor

The data for a user who has contributed to a specific project.

Property Type Description
role String The role that the user has on the project.
userId Long The internal ID of the user.
username String The username of the user.
avatarURL String The profile image of the user.
createdAt Long The timestamp of when the user created their account.

Contributor Example

{
    "role": "owner",
    "userId": 1,
    "username": "username",
    "displayName": "Username",
    "avatarURL": "https://cdn.diluv.dev/users/username/avatar.png",
    "createdAt": 1599804030000
}

FileInfo

Property Type Description
id Long An internal ID used to reference the file.
name String The display name of the file.
downloadURL String The URL used to download the file.
size Long The byte size of the file.
changelog String The changelog entry for the file.
sha512 String A SHA 512 hash of the file.
downloads Long The download count for this specific file.
releaseType String The release status of the file.
classifier String The type of file being uploaded.
updatedAt Long The timestamp of when the file was last updated.
createdAt Long The timestamp of when the file was created.
dependencies ??? An array of relations with other projects.
gameVersions GameVersion[] An array of game versions that the file is compatible with.
gameSlug String The slug of the game that this project is for.
projectTypeSlug String The type of project that this is.
projectSlug String The slug of the project that owns this file.
uploaderUserId Long The ID of the user who uploaded the file.
uploaderUsername String The username of the user who uploaded the file.
uploaderDisplayName String The display name of the user who uploaded the file.