Skip to content

Commit 6e42e39

Browse files
committed
rename tag props to name
1 parent 9adbbfe commit 6e42e39

File tree

10 files changed

+23
-21
lines changed

10 files changed

+23
-21
lines changed

.changeset/tidy-cheetahs-brake.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@squarecloud/api": minor
3+
---
4+
5+
Rename all `tag` properties (user and application) to `name` as API deprecated them.

package-lock.json

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
"node": ">=18.0.0"
1717
},
1818
"dependencies": {
19-
"@squarecloud/api-types": "^0.2.3",
2019
"form-data": "^4.0.0",
2120
"zod": "^3.22.4"
2221
},
2322
"devDependencies": {
2423
"@biomejs/biome": "^1.5.3",
2524
"@changesets/cli": "^2.27.1",
25+
"@squarecloud/api-types": "^0.2.4",
2626
"@types/node": "^20.11.16",
2727
"husky": "^9.0.10",
2828
"ts-node": "^10.9.2",

src/assertions/application.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ const applicationSchema = z
1010
cluster: z.string(),
1111
ram: z.number(),
1212
language: z.nativeEnum(ApplicationLanguage),
13-
isWebsite: z.boolean(),
1413
})
1514
.passthrough();
1615

1716
const websiteApplicationSchema = applicationSchema
1817
.extend({
19-
isWebsite: z.literal(true),
2018
domain: z.string(),
2119
custom: z.string().nullable().optional(),
2220
})

src/assertions/user.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { handleAPIObjectAssertion } from "./common";
55
const userSchema = z
66
.object({
77
id: z.string(),
8-
tag: z.string(),
8+
name: z.string(),
99
email: z.string(),
1010
plan: z.object({
1111
name: z.nativeEnum(UserPlanName),
@@ -22,12 +22,11 @@ const userSchema = z
2222
const userApplicationSchema = z
2323
.object({
2424
id: z.string(),
25-
tag: z.string(),
25+
name: z.string(),
2626
desc: z.string().optional(),
2727
ram: z.number(),
2828
lang: z.nativeEnum(ApplicationLanguage),
2929
cluster: z.string(),
30-
isWebsite: z.boolean(),
3130
})
3231
.passthrough();
3332

src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ export class SquareCloudAPI extends TypedEventEmitter<ClientEvents> {
2525
/**
2626
* Creates an API instance
2727
*
28-
* @param apiKey - Your API Token (generate at [Square Cloud Dashboard](https://squarecloud.app/dashboard))
29-
* @param options.experimental - Whether to enable experimental features
28+
* @param apiKey - Your API Token (request at [Square Cloud Dashboard](https://squarecloud.app/dashboard))
3029
*/
3130
constructor(apiKey: string) {
3231
super();

src/structures/application/application.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class Application extends BaseApplication {
5656
data: APIApplication,
5757
) {
5858
assertApplication(data);
59-
super(client, { ...data, tag: data.name, lang: data.language });
59+
super(client, { ...data, lang: data.language });
6060

6161
const { id, name, desc, cluster, ram, language } = data;
6262

src/structures/application/base.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ export class BaseApplication {
4242
public readonly client: SquareCloudAPI,
4343
data: APIUserApplication,
4444
) {
45-
const { id, tag, desc, ram, lang, cluster, isWebsite } = data;
45+
const { id, name, desc, ram, lang, cluster } = data;
4646

4747
this.id = id;
48-
this.name = tag;
48+
this.name = name;
4949
this.description = desc;
5050
this.ram = ram;
5151
this.language = lang;
@@ -56,7 +56,7 @@ export class BaseApplication {
5656
async fetch(): Promise<Application> {
5757
const data = await this.client.api.application("", this.id);
5858

59-
if (data.response.isWebsite) {
59+
if ("domain" in data.response && data.response.domain) {
6060
return new WebsiteApplication(
6161
this.client,
6262
data.response as APIWebsiteApplication,

src/structures/collection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ export class Collection<K, V> extends Map<K, V> {
194194
* @param thisArg - Value to use as `this` when executing function
195195
* @example
196196
* ```ts
197-
* collection.map(user => user.tag);
197+
* collection.map(user => user.name);
198198
* ```
199199
*/
200200
public map<T>(fn: (value: V, key: K, collection: this) => T): T[];

src/structures/user.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import { BaseApplication, Collection, SquareCloudAPI } from "..";
1313
export class User {
1414
/** The user's id */
1515
id: string;
16-
/** The user's Discord tag */
17-
tag: string;
16+
/** The user's display name */
17+
name: string;
1818
/** The user's current plan */
1919
plan: UserPlan;
2020
/** The user's registered email */
@@ -26,11 +26,11 @@ export class User {
2626
assertUserInfo(data);
2727

2828
const { user, applications } = data;
29-
const { id, tag, plan, email } = user;
29+
const { id, name, plan, email } = user;
3030
const { duration } = plan;
3131

3232
this.id = id;
33-
this.tag = tag;
33+
this.name = name;
3434
this.email = email;
3535
this.plan = {
3636
...plan,

0 commit comments

Comments
 (0)