Extract result type and correct it for getAllFiles

This commit is contained in:
Zoë Hoekstra 2022-08-26 11:31:37 +02:00
parent ceb4a05289
commit 45c15c9953
No known key found for this signature in database
GPG Key ID: F9B7B7D8130F3323

@ -1,14 +1,12 @@
export class RFAMessage {
jsonrpc = "2.0"; // Transmits version of JSON-RPC. Compliance maybe allows some funky interaction with external tools?
public method?: string; // Is defined when it's a request/notification, otherwise undefined
public result?: string | Array<string> | number; // Is defined when it's a response, otherwise undefined
public result?: ResultType; // Is defined when it's a response, otherwise undefined
public params?: FileMetadata; // Optional parameters to method
public error?: string; // Only defined on error
public id?: number; // ID to keep track of request -> response interaction, undefined with notifications, defined with request/response
constructor(
obj: { method?: string; result?: string | Array<string> | number; params?: FileMetadata; error?: string; id?: number } = {},
) {
constructor(obj: { method?: string; result?: ResultType; params?: FileMetadata; error?: string; id?: number } = {}) {
this.method = obj.method;
this.result = obj.result;
this.params = obj.params;
@ -17,6 +15,7 @@ export class RFAMessage {
}
}
type ResultType = string | number | Array<string> | Array<FileContent>;
type FileMetadata = FileData | FileContent | FileLocation | FileServer;
export interface FileData {