Skip to content

Commit 2935247

Browse files
4brunux-sheep
andauthored
[swift][client] rename api client to api configuration (#20103)
* [swift][client] rename api client to api configuration * [swift][client] rename api client to api configuration * [swift][client] rename api client to api configuration * [swift][client] rename api client to api configuration * [swift][client] rename api client to api configuration * [swift][client] rename api client to api configuration * Update modules/openapi-generator/src/main/resources/swift6/api.mustache Co-authored-by: Lennard Sprong <[email protected]> * [swift][client] rename api client to api configuration * Update modules/openapi-generator/src/main/resources/swift6/api.mustache Co-authored-by: Lennard Sprong <[email protected]> * Update modules/openapi-generator/src/main/resources/swift6/api.mustache Co-authored-by: Lennard Sprong <[email protected]> * Update modules/openapi-generator/src/main/resources/swift6/api.mustache Co-authored-by: Lennard Sprong <[email protected]> * Update modules/openapi-generator/src/main/resources/swift6/api.mustache Co-authored-by: Lennard Sprong <[email protected]> * Update modules/openapi-generator/src/main/resources/swift6/api.mustache Co-authored-by: Lennard Sprong <[email protected]> * Update modules/openapi-generator/src/main/resources/swift6/api.mustache Co-authored-by: Lennard Sprong <[email protected]> * [swift][client] rename api client to api configuration --------- Co-authored-by: Lennard Sprong <[email protected]>
1 parent 96adf2f commit 2935247

File tree

124 files changed

+4219
-4219
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+4219
-4219
lines changed

docs/faq-generators.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ Here is a working sample that put's together all of this.
492492
- A new configuration, `apiStaticMethod`, allows you to use instance methods instead of class methods for API calls. For more information, check the sample project [apiNonStaticMethod](https://github.com/OpenAPITools/openapi-generator/tree/master/samples/client/petstore/swift6/apiNonStaticMethod).
493493
- The new default response is based on async/await. To revert to the previous behavior, set the `responseAs` flag to `ObjcBlock`.
494494
- The default project structure now follows the SPM (Swift Package Manager) structure. To revert to the old structure, set the `useSPMFileStructure` flag to `false`.
495-
- The former `{{projectName}}API` is now called `OpenAPIClient`.
495+
- The former `{{projectName}}API` is now called `{{projectName}}APIConfiguration`.
496496
- You can now set a request interceptor and retrier by configuring `OpenAPIClient.shared.interceptor`, making authenticated requests easier to manage.
497497

498498
## TypeScript

modules/openapi-generator/src/main/resources/swift6/APIs.mustache

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import Alamofire{{/useAlamofire}}
1515
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{projectName}}API {}
1616
{{/swiftUseApiNamespace}}
1717

18-
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class OpenAPIClient: @unchecked Sendable {
18+
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class {{projectName}}APIConfiguration: @unchecked Sendable {
1919
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var basePath: String{{#useVapor}}
2020
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var customHeaders: HTTPHeaders
2121
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var apiClient: Vapor.Client?
@@ -79,7 +79,7 @@ import Alamofire{{/useAlamofire}}
7979
self.stringResponseSerializer = stringResponseSerializer{{/useAlamofire}}{{/useVapor}}
8080
}
8181

82-
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static let shared = OpenAPIClient()
82+
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static let shared = {{projectName}}APIConfiguration()
8383
}{{^useVapor}}
8484

8585
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class RequestBuilder<T>: @unchecked Sendable {
@@ -90,20 +90,20 @@ import Alamofire{{/useAlamofire}}
9090
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let URLString: String
9191
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let requestTask: RequestTask = RequestTask()
9292
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let requiresAuthentication: Bool
93-
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let openAPIClient: OpenAPIClient
93+
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let apiConfiguration: {{projectName}}APIConfiguration
9494

9595
/// Optional block to obtain a reference to the request's progress instance when available.
9696
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var onProgressReady: ((Progress) -> Void)?
9797

98-
required {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, openAPIClient: OpenAPIClient = OpenAPIClient.shared) {
98+
required {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: {{projectName}}APIConfiguration = {{projectName}}APIConfiguration.shared) {
9999
self.method = method
100100
self.URLString = URLString
101101
self.parameters = parameters
102102
self.headers = headers
103103
self.requiresAuthentication = requiresAuthentication
104-
self.openAPIClient = openAPIClient
104+
self.apiConfiguration = apiConfiguration
105105
106-
addHeaders(openAPIClient.customHeaders)
106+
addHeaders(apiConfiguration.customHeaders)
107107
addCredential()
108108
}
109109

@@ -163,7 +163,7 @@ import Alamofire{{/useAlamofire}}
163163
}
164164

165165
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func addCredential() {
166-
credential = openAPIClient.credential
166+
credential = apiConfiguration.credential
167167
}
168168
}
169169

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"{{baseName}}": {{#isQueryParam}}(wrappedValue: {{/isQueryParam}}{{paramName}}{{^required}}?{{/required}}.encodeToJSON(codableHelper: openAPIClient.codableHelper){{#isQueryParam}}, isExplode: {{isExplode}}){{/isQueryParam}}
1+
"{{baseName}}": {{#isQueryParam}}(wrappedValue: {{/isQueryParam}}{{paramName}}{{^required}}?{{/required}}.encodeToJSON(codableHelper: apiConfiguration.codableHelper){{#isQueryParam}}, isExplode: {{isExplode}}){{/isQueryParam}}

0 commit comments

Comments
 (0)