MCPcopy Create free account
hub / github.com/chieapp/chie / deserialize

Method deserialize

src/model/web-service.ts:36–53  ·  view source on GitHub ↗
(data: WebServiceData)

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 2

getCredentialByIdMethod · 0.80

Tested by

no test coverage detected