File tree 2 files changed +23
-0
lines changed
CoreMI/Intramodular/Service
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -32,4 +32,5 @@ extension _MIServiceTypeIdentifier {
32
32
public static let _OpenAI = _MIServiceTypeIdentifier ( rawValue: " vodih-vakam-hiduz-tosob " )
33
33
public static let _Perplexity = _MIServiceTypeIdentifier ( rawValue: " dohug-muboz-bopuz-kasar " )
34
34
public static let _Replicate = _MIServiceTypeIdentifier ( rawValue: " dovon-vatig-posov-luvis " )
35
+ public static let _ElevenLabs = _MIServiceTypeIdentifier ( rawValue: " jatap-jogaz-ritiz-vibok " )
35
36
}
Original file line number Diff line number Diff line change @@ -9,7 +9,11 @@ import NetworkKit
9
9
10
10
11
11
extension ElevenLabs {
12
+ @RuntimeDiscoverable
12
13
public final class Client : ObservableObject {
14
+ public static var persistentTypeRepresentation : some IdentityRepresentation {
15
+ _MIServiceTypeIdentifier. _ElevenLabs
16
+ }
13
17
14
18
public struct Configuration {
15
19
public var apiKey : String ?
@@ -32,6 +36,24 @@ extension ElevenLabs {
32
36
}
33
37
}
34
38
39
+ extension ElevenLabs . Client : _MIService {
40
+ public convenience init (
41
+ account: ( any _MIServiceAccount ) ?
42
+ ) async throws {
43
+ let account = try account. unwrap ( )
44
+
45
+ guard account. serviceIdentifier == _MIServiceTypeIdentifier. _ElevenLabs else {
46
+ throw _MIServiceError. serviceTypeIncompatible ( account. serviceIdentifier)
47
+ }
48
+
49
+ guard let credential = account. credential as? _MIServiceAPIKeyCredential else {
50
+ throw _MIServiceError. invalidCredentials ( account. credential)
51
+ }
52
+
53
+ self . init ( apiKey: credential. apiKey)
54
+ }
55
+ }
56
+
35
57
extension ElevenLabs . Client {
36
58
public func availableVoices( ) async throws -> [ ElevenLabs . Voice ] {
37
59
let request = HTTPRequest ( url: URL ( string: " \( apiSpecification) /v1/voices " ) !)
You can’t perform that action at this time.
0 commit comments