🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

royale-api-types

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

royale-api-types

Types for the Clash Royale API

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

Royale API Types

Type definitions for the Royale API

Installation

You can install this package using a package manager like npm:

npm install royale-api-types

Note: This package is based on the latest Node.js LTS version. It may work with older versions, but it is not guaranteed.

Description

This package provides type definitions for the Royale API for use with TypeScript. It also includes all routes from the API that can be used in JavaScript.

Usage

All types from the API are exported as API*:

import type { APIPlayer } from "royale-api-types";

const player: APIPlayer = {
	tag: "#22RJCYLUY",
	name: "D Trombett",
	// ...
};
import type { APIItem } from "royale-api-types";

// Type '{ name: string; id: number; }' is missing the following properties from type 'APIItem': iconUrls, maxLevel
const card: APIItem = {
	name: "Giant",
	id: 1,
};

You can also use the Routes interface to access the routes.

Note: Tags should be encoded when sending a request to the API.

import { Routes } from "royale-api-types";

console.log(Routes.Clans()); // "/clans"
console.log(Routes.Clan("#L2Y2L2PC")); // "/clans/#L2Y2L2PC"

Types are documented by Clash Royale's API documentation. We do our best to keep the types up to date, but we would appreciate any contributions.

This content is not affiliated with, endorsed, sponsored, or specifically approved by Supercell and Supercell is not responsible for it. For more information see Supercell’s Fan Content Policy.

Keywords

nodejs

FAQs

Package last updated on 26 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts