mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
chore: update bindings and use typed params for outbound gateway API
This commit is contained in:
@@ -191,10 +191,9 @@ export abstract class ApiService {
|
||||
|
||||
abstract setDefaultOutbound(params: { gateway: string | null }): Promise<null>
|
||||
|
||||
abstract setServiceOutbound(params: {
|
||||
packageId: string
|
||||
gateway: string | null
|
||||
}): Promise<null>
|
||||
abstract setServiceOutbound(
|
||||
params: T.SetOutboundGatewayParams,
|
||||
): Promise<null>
|
||||
|
||||
// ** domains **
|
||||
|
||||
|
||||
@@ -276,9 +276,7 @@ export class LiveApiService extends ApiService {
|
||||
})
|
||||
}
|
||||
|
||||
async checkPort(
|
||||
params: T.CheckPortParams,
|
||||
): Promise<T.CheckPortRes> {
|
||||
async checkPort(params: T.CheckPortParams): Promise<T.CheckPortRes> {
|
||||
return this.rpcRequest({
|
||||
method: 'net.gateway.check-port',
|
||||
params,
|
||||
@@ -369,17 +367,14 @@ export class LiveApiService extends ApiService {
|
||||
return this.rpcRequest({ method: 'net.tunnel.remove', params })
|
||||
}
|
||||
|
||||
async setDefaultOutbound(params: { gateway: string | null }): Promise<null> {
|
||||
async setDefaultOutbound(params: T.SetDefaultOutboundParams): Promise<null> {
|
||||
return this.rpcRequest({
|
||||
method: 'net.gateway.set-default-outbound',
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
||||
async setServiceOutbound(params: {
|
||||
packageId: string
|
||||
gateway: string | null
|
||||
}): Promise<null> {
|
||||
async setServiceOutbound(params: T.SetOutboundGatewayParams): Promise<null> {
|
||||
return this.rpcRequest({ method: 'package.set-outbound-gateway', params })
|
||||
}
|
||||
|
||||
|
||||
@@ -662,15 +662,14 @@ export class MockApiService extends ApiService {
|
||||
return null
|
||||
}
|
||||
|
||||
async setServiceOutbound(params: {
|
||||
packageId: string
|
||||
gateway: string | null
|
||||
}): Promise<null> {
|
||||
async setServiceOutbound(
|
||||
params: T.SetOutboundGatewayParams,
|
||||
): Promise<null> {
|
||||
await pauseFor(2000)
|
||||
const patch = [
|
||||
{
|
||||
op: PatchOp.REPLACE,
|
||||
path: `/packageData/${params.packageId}/outboundGateway`,
|
||||
path: `/packageData/${params.package}/outboundGateway`,
|
||||
value: params.gateway,
|
||||
},
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user