mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-18 23:33:12 +09:00
Add ConfigSet requests
This commit is contained in:
6 files changed
+148
-6
No files matched your search
@@ -37,6 +37,28 @@ export class ControllerConfigGetRequest {
|
||||
static Response = plainJson(ControllerConfig.jsonSchema);
|
||||
}
|
||||
|
||||
export class ControllerConfigSetRequest {
|
||||
declare ["constructor"]: typeof ControllerConfigSetRequest;
|
||||
static type = "request" as const;
|
||||
static src = "control" as const;
|
||||
static dst = "controller" as const;
|
||||
static permission = "core.controller.update_config" as const;
|
||||
|
||||
constructor(
|
||||
public fields: Record<string, string | Record<string, string>>,
|
||||
) { }
|
||||
|
||||
static jsonSchema = Type.Object({
|
||||
"fields": Type.Record(Type.String(), Type.Union([
|
||||
Type.String(), Type.Record(Type.String(), Type.String()),
|
||||
])),
|
||||
});
|
||||
|
||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
||||
return new this(json.fields);
|
||||
}
|
||||
}
|
||||
|
||||
export class ControllerConfigSetFieldRequest {
|
||||
declare ["constructor"]: typeof ControllerConfigSetFieldRequest;
|
||||
static type = "request" as const;
|
||||
|
||||
@@ -37,6 +37,28 @@ export class HostConfigGetRequest {
|
||||
static Response = plainJson(HostConfig.jsonSchema);
|
||||
}
|
||||
|
||||
export class HostConfigSetRequest {
|
||||
declare ["constructor"]: typeof HostConfigSetRequest;
|
||||
static type = "request" as const;
|
||||
static src = ["control", "controller"] as const;
|
||||
static dst = "host" as const;
|
||||
static permission = "core.host.update_config" as const;
|
||||
|
||||
constructor(
|
||||
public fields: Record<string, string | Record<string, string>>,
|
||||
) { }
|
||||
|
||||
static jsonSchema = Type.Object({
|
||||
"fields": Type.Record(Type.String(), Type.Union([
|
||||
Type.String(), Type.Record(Type.String(), Type.String()),
|
||||
])),
|
||||
});
|
||||
|
||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
||||
return new this(json.fields);
|
||||
}
|
||||
}
|
||||
|
||||
export class HostConfigSetFieldRequest {
|
||||
declare ["constructor"]: typeof HostConfigSetFieldRequest;
|
||||
static type = "request" as const;
|
||||
|
||||
@@ -102,6 +102,30 @@ export class InstanceConfigGetRequest {
|
||||
}
|
||||
}
|
||||
|
||||
export class InstanceConfigSetRequest {
|
||||
declare ["constructor"]: typeof InstanceConfigSetRequest;
|
||||
static type = "request" as const;
|
||||
static src = "control" as const;
|
||||
static dst = "controller" as const;
|
||||
static permission = "core.instance.update_config" as const;
|
||||
|
||||
constructor(
|
||||
public instanceId: number,
|
||||
public fields: Record<string, string | Record<string, string>>,
|
||||
) { }
|
||||
|
||||
static jsonSchema = Type.Object({
|
||||
"instanceId": Type.Integer(),
|
||||
"fields": Type.Record(Type.String(), Type.Union([
|
||||
Type.String(), Type.Record(Type.String(), Type.String()),
|
||||
])),
|
||||
});
|
||||
|
||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
||||
return new this(json.instanceId, json.fields);
|
||||
}
|
||||
}
|
||||
|
||||
export class InstanceConfigSetFieldRequest {
|
||||
declare ["constructor"]: typeof InstanceConfigSetFieldRequest;
|
||||
static type = "request" as const;
|
||||
|
||||
Reference in new issue
Block a user