-
Notifications
You must be signed in to change notification settings - Fork 1
/
ZoneManager.ts
29 lines (24 loc) · 927 Bytes
/
ZoneManager.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { Manager } from './Manager';
import { ResourceType } from '../api/ResourceType';
import { Zone, ZoneCreateOptions, ZoneEditOptions } from '../structures/Zone';
import { transformChildren, transformMetadataWithArcheType } from '../util/Transformers';
export class ZoneManager extends Manager<ResourceType.Zone> {
type = ResourceType.Zone;
holds = Zone;
public async create(options: ZoneCreateOptions): Promise<string | undefined> {
const identifiers = await this._post({
metadata: transformMetadataWithArcheType(options)!,
children: transformChildren(options.children)!,
});
return identifiers?.[0]?.rid;
}
public async edit(id: string, options: ZoneEditOptions): Promise<void> {
await this._put(id, {
metadata: transformMetadataWithArcheType(options),
children: transformChildren(options.children),
});
}
public async delete(id: string): Promise<void> {
await this._delete(id);
}
}