Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3a9c0c4

Browse files
update
1 parent 9c31c11 commit 3a9c0c4

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

‎Sources/openai-async-image-swiftui/net/OpenAIImageEndpoint.swift‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,18 @@ public struct OpenAIImageEndpoint: IOpenAIImageEndpoint{
1919
/// Http method
2020
public static var httpMethod = "POST"
2121

22+
23+
/// Path to the point
24+
public static var path = "/v1/images/generations"
25+
2226
/// - Parameter apiKey: Api key for access
2327
/// - Returns: Endpoint
2428
static public func get(with apiKey: String) -> Self{
25-
.init(urlString: Self.urlString, httpMethod: Self.httpMethod, apiKey: apiKey)
29+
.init(
30+
urlString: Self.urlString,
31+
httpMethod: Self.httpMethod,
32+
apiKey: apiKey,
33+
path: Self.path)
2634
}
2735

2836
// MARK: - Config
@@ -36,17 +44,22 @@ public struct OpenAIImageEndpoint: IOpenAIImageEndpoint{
3644

3745
/// Api key for access
3846
public let apiKey : String
47+
48+
/// Path to the point
49+
public let path : String
3950

4051
// MARK: - Life circle
4152

4253
/// - Parameters:
4354
/// - urlString: Base url to OpenAPI image resource
4455
/// - httpMethod: Http method
4556
/// - apiKey: Api key for access
46-
public init(urlString: String, httpMethod: String, apiKey: String) {
57+
/// - path: Path to the point
58+
public init(urlString: String, httpMethod: String, apiKey: String, path: String) {
4759
self.urlString = urlString
4860
self.httpMethod = httpMethod
4961
self.apiKey = apiKey
62+
self.path = path
5063
}
5164

5265

‎Sources/openai-async-image-swiftui/protocol/IOpenAIImageEndpoint.swift‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// File.swift
2+
// IOpenAIImageEndpoint.swift
33
//
44
//
55
// Created by Igor on 28.02.2023.
@@ -20,4 +20,6 @@ public protocol IOpenAIImageEndpoint{
2020
/// Api key for access
2121
var apiKey : String { get }
2222

23+
/// Path to the point
24+
var path : String { get }
2325
}

‎Sources/openai-async-image-swiftui/viewModel/OpenAIDefaultLoader.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public final class OpenAIDefaultLoader : IOpenAILoader{
5252
let body = Input(prompt: prompt, size: size, response_format: .b64)
5353

5454
let headers = ["Authorization": "Bearer \(endpoint.apiKey)"]
55-
let path = "/v1/images/generations"
55+
let path = endpoint.path
5656

5757
guard let client = client else{
5858
throw AsyncImageErrors.clientIsNotDefined

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /