-
Notifications
You must be signed in to change notification settings - Fork 0
/
memberUpdate.ts
55 lines (48 loc) · 1.36 KB
/
memberUpdate.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { JsonValue } from '../../utils/serialisation/JsonValue.js';
import { NullDeserialiser } from '../../utils/serialisation/NullDeserialiser.js';
import type { PatchRequest } from '../../utils/http.js';
import { Command } from '../Command.js';
import type { EndpointInput } from '../EndpointInput.js';
import type { MemberRole } from './MemberRole.js';
/**
* Input to the {@link MemberUpdateCommand}.
* @category Member update
*/
export interface MemberUpdateInput extends EndpointInput {
/**
* The name of the member, if they're a user.
*
* Set to `null` to remove the name, and convert the member to a bot.
*/
readonly name?: string | null;
/**
* The email address of the member, if they should be allowed to access the API.
*/
readonly email?: string | null;
/**
* The role of the member.
*/
readonly role?: MemberRole;
}
/**
* Command to update a member.
* @category Member update
*/
export class MemberUpdateCommand extends Command<MemberUpdateInput, null, null> {
public responseDeserialiser = new NullDeserialiser();
public getRequest(): PatchRequest {
const body = new JsonValue({
name: this.input.name,
email: this.input.email,
role: this.input.role,
});
return {
body,
path: this.input.endpoint,
method: 'PATCH',
};
}
public getOutput(): null {
return null;
}
}