Skip to content

Commit 3c311c6

Browse files
committed
feat: add Shutdown
1 parent c2d83e6 commit 3c311c6

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

src/index.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ export type {
3636
QueryServerStateResponseData,
3737
RenameServerRequest,
3838
RenameServerResponse,
39+
RunCommandRequest,
40+
RunCommandResponse,
41+
RunCommandResponseData,
3942
ServerClaimedErrorResponse,
4043
ServerNotClaimedErrorResponse,
4144
SetAdminPasswordRequest,
@@ -44,10 +47,9 @@ export type {
4447
SetAutoLoadSessionNameResponse,
4548
SetClientPasswordRequest,
4649
SetClientPasswordResponse,
50+
ShutdownRequest,
51+
ShutdownResponse,
4752
VerifyAuthenticationTokenRequest,
4853
VerifyAuthenticationTokenResponse,
4954
WrongPasswordErrorResponse,
50-
RunCommandRequest,
51-
RunCommandResponse,
52-
RunCommandResponseData,
5355
} from "./v1/index.js";

src/v1/Shutdown.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type { ApiRequest } from "./common.js";
2+
import { buildApiRequest } from "./common.js";
3+
4+
export type ShutdownRequest = ApiRequest<"Shutdown">;
5+
6+
export type ShutdownResponse = string;
7+
8+
export const buildShutdown = buildApiRequest<ShutdownRequest, ShutdownResponse>(
9+
"v1",
10+
{
11+
function: "Shutdown",
12+
}
13+
);

src/v1/index.ts

+14
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { buildRunCommand } from "./RunCommand.js";
1212
import { buildSetAdminPassword } from "./SetAdminPassword.js";
1313
import { buildSetAutoLoadSessionName } from "./SetAutoLoadSessionName.js";
1414
import { buildSetClientPassword } from "./SetClientPassword.js";
15+
import { buildShutdown } from "./Shutdown.js";
1516
import { buildVerifyAuthenticationToken } from "./VerifyAuthenticationToken.js";
1617

1718
export function buildV1(options: InternalClientOptions) {
@@ -116,6 +117,18 @@ export function buildV1(options: InternalClientOptions) {
116117
* Requires Admin privileges.
117118
*/
118119
RunCommand: buildRunCommand(options),
120+
/**
121+
* Shuts down the Dedicated Server.
122+
*
123+
* If automatic restart script is setup, this allows restarting the server to apply new settings or update.
124+
*
125+
* Requires Admin privileges.
126+
*
127+
* Shutdowns initiated by remote hosts are logged with their IP and their token.
128+
*
129+
* Function does not return any data on success, and does not take any parameters.
130+
*/
131+
Shutdown: buildShutdown(options),
119132
};
120133
}
121134

@@ -132,6 +145,7 @@ export type * from "./QueryServerState.js";
132145
export type * from "./RenameServer.js";
133146
export type * from "./RunCommand.js";
134147
export type * from "./SetAdminPassword.js";
148+
export type * from "./Shutdown.js";
135149
export type * from "./SetAutoLoadSessionName.js";
136150
export type * from "./SetClientPassword.js";
137151
export type * from "./VerifyAuthenticationToken.js";

0 commit comments

Comments
 (0)