@pelican.ts/sdk 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,20 +1,25 @@
1
- import type {ServerClient} from "@/api/client/server";
2
- import type {ServerSubuser, SubuserPermission} from "@/api/client/types/server_subuser";
1
+ import type { ServerClient } from "@/api/client/server"
2
+ import type {
3
+ ServerSubuser,
4
+ SubuserPermission,
5
+ } from "@/api/client/types/server_subuser"
3
6
 
4
7
  export class ServerUser {
5
8
  private readonly client: ServerClient
6
9
 
7
- readonly uuid: string;
8
- readonly username: string;
9
- readonly email: string;
10
- readonly language: string;
11
- readonly image: string;
12
- readonly admin: boolean;
13
- readonly root_admin: boolean;
14
- readonly has2faEnabled: boolean;
15
- readonly createdAt: Date;
16
- private $permissions: SubuserPermission[] | string[];
17
- get permissions() {return this.$permissions}
10
+ readonly uuid: string
11
+ readonly username: string
12
+ readonly email: string
13
+ readonly language: string
14
+ readonly image: string
15
+ readonly admin: boolean
16
+ readonly root_admin: boolean
17
+ readonly has2faEnabled: boolean
18
+ readonly createdAt: Date
19
+ private $permissions: SubuserPermission[] | string[]
20
+ get permissions() {
21
+ return this.$permissions
22
+ }
18
23
 
19
24
  constructor(client: ServerClient, user: ServerSubuser) {
20
25
  this.client = client
@@ -30,13 +35,10 @@ export class ServerUser {
30
35
  this.$permissions = user.permissions
31
36
  }
32
37
 
33
- update = async (
34
- permissions: SubuserPermission[] | string[]
35
- ) => {
38
+ update = async (permissions: SubuserPermission[] | string[]) => {
36
39
  const data = await this.client.users.update(this.uuid, permissions)
37
40
  this.$permissions = data.permissions
38
41
  }
39
42
 
40
43
  delete = async () => this.client.users.delete(this.uuid)
41
-
42
- }
44
+ }
package/src/index.ts CHANGED
@@ -1,8 +1,21 @@
1
- import {PelicanAPIClient} from "@/api";
2
- import {Client as UserClient} from "@/humane/Client";
1
+ import { PelicanAPIClient } from "@/api"
2
+ import { Client as UserClient } from "@/humane/Client"
3
3
 
4
-
5
- export const createPelicanClient = (url: string, token: string, suffix: string = "/api") => {
4
+ export const createPelicanClient = (
5
+ url: string,
6
+ token: string,
7
+ suffix: string = "/api",
8
+ ) => {
6
9
  const client = new PelicanAPIClient(url, token, suffix)
7
10
  return new UserClient(client)
8
- }
11
+ }
12
+
13
+ export {Client} from "@/humane/Client"
14
+ export {Account} from "@/humane/Account"
15
+ export {Server} from "@/humane/Server"
16
+ export {ServerAllocation} from "@/humane/ServerAllocation"
17
+ export {ServerBackup} from "@/humane/ServerBackup"
18
+ export {ServerDatabase} from "@/humane/ServerDatabase"
19
+ export {ServerFile} from "@/humane/ServerFile"
20
+ export {ServerSchedule} from "@/humane/ServerSchedule"
21
+ export {ServerUser} from "@/humane/ServerUser"
@@ -3,12 +3,11 @@ export const SIZES = {
3
3
  KB: 1024,
4
4
  MB: 1024 * 1024,
5
5
  GB: 1024 * 1024 * 1024,
6
- TB: 1024 * 1024 * 1024 * 1024
6
+ TB: 1024 * 1024 * 1024 * 1024,
7
7
  }
8
8
 
9
9
  const sized = (bytes: number, unit: keyof typeof SIZES): number => {
10
10
  return parseInt((bytes / SIZES[unit]).toFixed(3), 10)
11
11
  }
12
12
 
13
-
14
- export default sized
13
+ export default sized