198 lines
5.1 KiB
TypeScript
198 lines
5.1 KiB
TypeScript
import MWSE from "frontend";
|
|
|
|
export class IPPressure
|
|
{
|
|
public mwse : MWSE;
|
|
public APNumber? : number;
|
|
public APShortCode? : string;
|
|
public APIPAddress? : string;
|
|
constructor(mwse : MWSE){
|
|
this.mwse = mwse;
|
|
};
|
|
public async allocAPIPAddress()
|
|
{
|
|
let {status,ip} = await this.mwse.EventPooling.request({
|
|
type: 'alloc/APIPAddress'
|
|
}) as {
|
|
status:"fail"|"success",
|
|
ip?:string
|
|
};
|
|
if(status == 'success')
|
|
{
|
|
this.APIPAddress = ip;
|
|
return ip;
|
|
}else{
|
|
throw new Error("Error Allocated Access Point IP Address");
|
|
}
|
|
}
|
|
public async allocAPNumber()
|
|
{
|
|
let {status,number} = await this.mwse.EventPooling.request({
|
|
type: 'alloc/APNumber'
|
|
}) as {
|
|
status:"fail"|"success",
|
|
number?:number
|
|
};
|
|
if(status == 'success')
|
|
{
|
|
this.APNumber = number;
|
|
return number;
|
|
}else{
|
|
throw new Error("Error Allocated Access Point Number");
|
|
}
|
|
}
|
|
public async allocAPShortCode()
|
|
{
|
|
let {status,code} = await this.mwse.EventPooling.request({
|
|
type: 'alloc/APShortCode'
|
|
}) as {
|
|
status:"fail"|"success",
|
|
code?:string
|
|
};
|
|
if(status == 'success')
|
|
{
|
|
this.APShortCode = code;
|
|
return code;
|
|
}else{
|
|
throw new Error("Error Allocated Access Point Short Code");
|
|
}
|
|
}
|
|
public async reallocAPIPAddress()
|
|
{
|
|
let {status,ip} = await this.mwse.EventPooling.request({
|
|
type: 'realloc/APIPAddress'
|
|
}) as {
|
|
status:"fail"|"success",
|
|
ip?:string
|
|
};
|
|
if(status == 'success')
|
|
{
|
|
this.APIPAddress = ip;
|
|
return ip;
|
|
}else{
|
|
throw new Error("Error Reallocated Access Point IP Address");
|
|
}
|
|
}
|
|
public async reallocAPNumber()
|
|
{
|
|
let {status,number} = await this.mwse.EventPooling.request({
|
|
type: 'realloc/APNumber'
|
|
}) as {
|
|
status:"fail"|"success",
|
|
number?:number
|
|
};
|
|
if(status == 'success')
|
|
{
|
|
this.APNumber = number;
|
|
return number;
|
|
}else{
|
|
throw new Error("Error Reallocated Access Point Number");
|
|
}
|
|
}
|
|
public async reallocAPShortCode()
|
|
{
|
|
let {status,code} = await this.mwse.EventPooling.request({
|
|
type: 'realloc/APShortCode'
|
|
}) as {
|
|
status:"fail"|"success",
|
|
code?:string
|
|
};
|
|
if(status == 'success')
|
|
{
|
|
this.APShortCode = code;
|
|
return code;
|
|
}else{
|
|
throw new Error("Error Reallocated Access Point Short Code");
|
|
}
|
|
}
|
|
public async releaseAPIPAddress()
|
|
{
|
|
let {status} = await this.mwse.EventPooling.request({
|
|
type: 'release/APIPAddress'
|
|
}) as {
|
|
status:"fail"|"success",
|
|
};
|
|
if(status == 'success')
|
|
{
|
|
this.APIPAddress = undefined;
|
|
}else{
|
|
throw new Error("Error release Access Point IP Address");
|
|
}
|
|
}
|
|
public async releaseAPNumber()
|
|
{
|
|
let {status} = await this.mwse.EventPooling.request({
|
|
type: 'release/APNumber'
|
|
}) as {
|
|
status:"fail"|"success",
|
|
};
|
|
if(status == 'success')
|
|
{
|
|
this.APNumber = undefined;
|
|
}else{
|
|
throw new Error("Error release Access Point Number");
|
|
}
|
|
}
|
|
public async releaseAPShortCode()
|
|
{
|
|
let {status} = await this.mwse.EventPooling.request({
|
|
type: 'release/APShortCode'
|
|
}) as {
|
|
status:string
|
|
};
|
|
if(status == 'success')
|
|
{
|
|
this.APShortCode = undefined;
|
|
}else{
|
|
throw new Error("Error release Access Point Short Code");
|
|
}
|
|
}
|
|
public async queryAPIPAddress(ip:string)
|
|
{
|
|
let {status,socket} = await this.mwse.EventPooling.request({
|
|
type: 'whois/APIPAddress',
|
|
whois: ip
|
|
}) as {
|
|
status:"fail"|"success",
|
|
socket?:string
|
|
};
|
|
if(status == "success")
|
|
{
|
|
return socket;
|
|
}else{
|
|
return null;
|
|
}
|
|
}
|
|
public async queryAPNumber(number:number)
|
|
{
|
|
let {status,socket} = await this.mwse.EventPooling.request({
|
|
type: 'whois/APNumber',
|
|
whois: number
|
|
}) as {
|
|
status:"fail"|"success",
|
|
socket?:string
|
|
};
|
|
if(status == "success")
|
|
{
|
|
return socket;
|
|
}else{
|
|
return null;
|
|
}
|
|
}
|
|
public async queryAPShortCode(code:string)
|
|
{
|
|
let {status,socket} = await this.mwse.EventPooling.request({
|
|
type: 'whois/APShortCode',
|
|
whois: code
|
|
}) as {
|
|
status:"fail"|"success",
|
|
socket?:string
|
|
};
|
|
if(status == "success")
|
|
{
|
|
return socket;
|
|
}else{
|
|
return null;
|
|
}
|
|
}
|
|
} |