Skip to content

Commit 0c06356

Browse files
committed
refactor: explicit class props types
1 parent 5041668 commit 0c06356

File tree

6 files changed

+40
-38
lines changed

6 files changed

+40
-38
lines changed

src/structures/application/base.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ import type { Application } from "./application";
1818
*/
1919
export class BaseApplication {
2020
/** The application ID */
21-
id: string;
21+
public readonly id: string;
2222
/** The application display name */
23-
name: string;
23+
public name: string;
2424
/** The application description */
25-
description?: string;
25+
public description?: string;
2626
/** The url to manage the application via web */
27-
url: string;
27+
public url: string;
2828
/** The application total ram */
29-
ram: number;
29+
public ram: number;
3030
/** The application current cluster */
31-
cluster: string;
31+
public cluster: string;
3232
/**
3333
* The application programming language
3434
*
@@ -43,15 +43,16 @@ export class BaseApplication {
4343
* - `dotnet`
4444
* - `static`
4545
*/
46-
language: ApplicationLanguage;
46+
public language: ApplicationLanguage;
47+
4748
/** Cache service for this application */
48-
cache = new ApplicationCacheService();
49+
public readonly cache = new ApplicationCacheService();
4950
/** Files module for this application */
50-
files = new FilesModule(this);
51+
public readonly files = new FilesModule(this);
5152
/** Backup module for this application */
52-
backups = new BackupsModule(this);
53+
public readonly backups = new BackupsModule(this);
5354
/** Deploys module for this application */
54-
deploys = new DeploysModule(this);
55+
public readonly deploys = new DeploysModule(this);
5556

5657
/**
5758
* Represents the base application from the user endpoint

src/structures/application/website.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ import { Application } from "./application";
1010
*/
1111
export class WebsiteApplication extends Application {
1212
/** The application default domain (e.g. example.squareweb.app) */
13-
domain: string;
13+
public domain: string;
1414
/** The custom configured domain (e.g. yoursite.com) */
15-
custom?: string;
15+
public custom?: string;
16+
1617
/** Network module for this application */
17-
network = new NetworkModule(this);
18+
public readonly network = new NetworkModule(this);
1819

1920
/**
2021
* Represents a Square Cloud application

src/structures/backup.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ import type { BaseApplication } from "./application/base";
88
*/
99
export class Backup {
1010
/** Size of the backup in bytes. */
11-
size: number;
11+
public size: number;
1212

1313
/** Date of the last modification of the backup. */
14-
modifiedAt: Date;
14+
public modifiedAt: Date;
1515

1616
/** Date of the last modification of the backup in millisseconds. */
17-
modifiedTimestamp: number;
17+
public modifiedTimestamp: number;
1818

1919
/** AWS access key for the backup. */
20-
key: string;
20+
public readonly key: string;
2121

2222
/** The URL for downloading this backup */
23-
url: string;
23+
public readonly url: string;
2424

2525
/**
2626
* Represents an application backup (snapshot)

src/structures/deploy.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ import type { BaseApplication } from "./application/base";
88
*/
99
export class Deployment {
1010
/** The ID of the deploy. */
11-
id: `git-${string}`;
11+
public readonly id: `git-${string}`;
1212

1313
/** The current state of the deploy. */
14-
state: DeploymentState;
14+
public state: DeploymentState;
1515

1616
/** The date the deploy was created. */
17-
createdAt: Date;
17+
public createdAt: Date;
1818

1919
/** The date the deploy was created in millisseconds. */
20-
createdTimestamp: number;
20+
public createdTimestamp: number;
2121

2222
/**
2323
* Represents an application deployment

src/structures/status.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ import type { SquareCloudAPI } from "..";
1414
*/
1515
export class SimpleApplicationStatus<R extends boolean = boolean> {
1616
/** The application's ID this status came from */
17-
applicationId: string;
17+
public readonly applicationId: string;
1818
/** Usage statuses for this application */
19-
usage: R extends true
19+
public usage: R extends true
2020
? Pick<ApplicationStatusUsage, "cpu" | "ram">
2121
: undefined;
2222
/** Whether the application is running or not */
23-
running: R;
23+
public running: R;
2424

2525
/**
2626
* Represents an application status fetched from status all endpoint
@@ -70,11 +70,11 @@ export class SimpleApplicationStatus<R extends boolean = boolean> {
7070
*/
7171
export class ApplicationStatus {
7272
/** The application's ID this status came from */
73-
applicationId: string;
73+
public readonly applicationId: string;
7474
/** Usage statuses for this application */
75-
usage: ApplicationStatusUsage;
75+
public usage: ApplicationStatusUsage;
7676
/** Whether the application is running or not */
77-
running: boolean;
77+
public running: boolean;
7878
/**
7979
* The status of the application
8080
*
@@ -85,13 +85,13 @@ export class ApplicationStatus {
8585
* - 'restarting'
8686
* - 'deleting'
8787
*/
88-
status: ApplicationStatusType;
88+
public status: ApplicationStatusType;
8989
/** How many requests have been made since the last start up */
90-
requests: number;
90+
public requests: number;
9191
/** For how long the app is running in millisseconds */
92-
uptimeTimestamp?: number;
92+
public uptimeTimestamp?: number;
9393
/** For how long the app is running */
94-
uptime?: Date;
94+
public uptime?: Date;
9595

9696
/**
9797
* Represents an application status

src/structures/user.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ import { Collection } from "./collection";
1111
*/
1212
export class User {
1313
/** The user's id */
14-
id: string;
14+
public readonly id: string;
1515
/** The user's display name */
16-
name: string;
16+
public name: string;
1717
/** The user's current plan */
18-
plan: UserPlan;
18+
public plan: UserPlan;
1919
/** The user's registered email */
20-
email: string;
20+
public email: string;
2121
/** The user's registered applications Collection */
22-
applications: Collection<string, BaseApplication>;
22+
public applications: Collection<string, BaseApplication>;
2323

2424
/**
2525
* Represents a Square Cloud user

0 commit comments

Comments
 (0)