(data: WebServiceData)
| 34 | params?: P; |
| 35 | |
| 36 | static deserialize(data: WebServiceData): WebServiceOptions<WebAPI> { |
| 37 | if (!data || |
| 38 | typeof data != 'object' || |
| 39 | typeof data.name != 'string' || |
| 40 | typeof data.api != 'string') { |
| 41 | throw new Error(`Unknown WebService : ${JSON.stringify(data)}`); |
| 42 | } |
| 43 | const credential = apiManager.getCredentialById(data.api); |
| 44 | const api = apiManager.createAPIForCredential(credential); |
| 45 | const options: WebServiceOptions<WebAPI> = {name: data.name, api}; |
| 46 | if (typeof data.icon == 'string') |
| 47 | options.icon = new Icon({chieURL: data.icon}); |
| 48 | if (typeof data.apiParams == 'object') |
| 49 | options.apiParams = data.apiParams; |
| 50 | if (typeof data.params == 'object') |
| 51 | options.params = data.params; |
| 52 | return options; |
| 53 | } |
| 54 | |
| 55 | constructor(options: WebServiceOptions<T, P>) { |
| 56 | if (!options.name || !options.api) |
nothing calls this directly
no test coverage detected