(id: string)
| 100 | } |
| 101 | |
| 102 | removeCredentialById(id: string) { |
| 103 | if (!(id in this.#credentials)) |
| 104 | throw new Error(`Removing unknown API id: ${id}.`); |
| 105 | const assistant = assistantManager.getAssistants().find(a => a.service.api.credential.id == id); |
| 106 | if (assistant) |
| 107 | throw new Error(`Can not remove API credential because assistant "${assistant.service.name}" is using it.`); |
| 108 | const credential = this.#credentials[id]; |
| 109 | delete this.#credentials[id]; |
| 110 | this.onRemoveCredential.emit(credential); |
| 111 | this.saveConfig(); |
| 112 | credential.id = null; |
| 113 | } |
| 114 | |
| 115 | getCredentials() { |
| 116 | return Object.values(this.#credentials); |
no test coverage detected