Skip to content

Commit bc8cc55

Browse files
committed
refactor(stats): remove response validation
1 parent cc4bf7a commit bc8cc55

File tree

5 files changed

+25
-33
lines changed

5 files changed

+25
-33
lines changed

src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { APIManager } from "./managers/api";
22
import { ObjectsManager } from "./managers/objects";
33
import type { StatsResponse } from "./types/stats";
4-
import { assertStatsResponse } from "./validation/assertions/stats";
54

65
export class SquareCloudBlob {
76
public static apiInfo = {
@@ -18,7 +17,7 @@ export class SquareCloudBlob {
1817

1918
async stats() {
2019
const { response } = await this.api.request<StatsResponse>("account/stats");
21-
return assertStatsResponse(response);
20+
return response;
2221
}
2322
}
2423

src/types/object.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
export type BlobObjectData = {
1+
export interface BlobObjectData {
22
idOrUrl: string;
33
size: number;
44
expiresAt?: Date;
55
createdAt?: Date;
6-
};
6+
}

src/types/stats.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
1-
import type { z } from "zod";
2-
import type { statsResponseSchema } from "../validation/schemas/stats";
3-
4-
export type StatsResponse = z.infer<typeof statsResponseSchema>;
1+
export interface StatsResponse {
2+
usage: {
3+
/** The total number of objects in your account. */
4+
objects: number;
5+
/** The total size of all objects in your account, in bytes. */
6+
storage: number;
7+
};
8+
plan: {
9+
/** The total storage size included on the plan, in bytes. */
10+
included: number;
11+
};
12+
billing: {
13+
/** The extra space used, in bytes. */
14+
extraStorage: number;
15+
/** The total price of storage for all objects in your account, in BRL. */
16+
storagePrice: number;
17+
/** The total price of objects in your account, in BRL. */
18+
objectsPrice: number;
19+
/** The total estimate of all objects, storage and extra storage in your account, in BRL. */
20+
totalEstimate: number;
21+
};
22+
}

src/validation/assertions/stats.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/validation/schemas/stats.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)