@zikeji/hypixel
Version:
With IntelliSense support & test coverage, this is an unopinionated async/await API wrapper for Hypixel's Public API. It is developed in TypeScript complete with documentation, typed interfaces for all API responses, built-in rate-limit handling, flexible
54 lines (51 loc) • 1.35 kB
text/typescript
import { Method } from "../../util/Method";
import { getResultObject, ResultObject } from "../../util/ResultObject";
import type {
ResourcesVanityCompanionsResponse,
ResourcesVanityPetsResponse,
} from "../../types/AugmentedTypes";
/**
* @example
* ```typescript
* const bingo = await client.resources.vanity.companions();
* ```
* @category Client
*/
export class VanityResources extends Method {
/**
* Retrieve a list of vanity companions.
* @example
* ```typescript
* const companions = await client.resources.vanity.companions();
* ```
* @category API
*/
public async companions(): Promise<
ResultObject<ResourcesVanityCompanionsResponse, ["success", "lastUpdated"]>
> {
return getResultObject(
await this.client.call<ResourcesVanityCompanionsResponse>(
"resources/vanity/companions"
),
["success", "lastUpdated"]
);
}
/**
* Retrieve a list of vanity pets.
* @example
* ```typescript
* const pets = await client.resources.vanity.pets();
* ```
* @category API
*/
public async pets(): Promise<
ResultObject<ResourcesVanityPetsResponse, ["success", "lastUpdated"]>
> {
return getResultObject(
await this.client.call<ResourcesVanityPetsResponse>(
"resources/vanity/pets"
),
["success", "lastUpdated"]
);
}
}