Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions templates/php/src/Services/Service.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class {{ service.name | caseUcfirst }} extends Service
* @param {{ parameter.type | typeName }}${{ parameter.name | caseCamel | escapeKeyword }}
{% endfor %}
* @throws {{spec.title | caseUcfirst}}Exception
* @return {% if (method.type == 'location') or (method.method | caseUpper == 'DELETE') %}string{% else %}array{% endif %}
* @return {% if method.type == 'location' %}string{% else %}array{% endif %}

*/
public function {{ method.name | caseCamel }}({% for parameter in method.parameters.all %}{{ parameter.type | typeName }}${{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required %} = null{% endif %}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, callable $onProgress = null{% endif %}): {% if (method.type == 'location') or (method.method | caseUpper == 'DELETE') %}string{% else %}array{% endif %}
public function {{ method.name | caseCamel }}({% for parameter in method.parameters.all %}{{ parameter.type | typeName }}${{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required %} = null{% endif %}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, callable $onProgress = null{% endif %}): {% if method.type == 'location' %}string{% else %}array{% endif %}

{
{% for parameter in method.parameters.all %}
Expand Down
3 changes: 3 additions & 0 deletions templates/swift/Sources/Client.swift.twig
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ open class Client {

open var config: [String: String] = [:]

open var selfSigned: Bool = false

open var http: HTTPClient

private static let boundaryChars =
Expand Down Expand Up @@ -119,6 +121,7 @@ open class Client {
/// @return Client
///
open func setSelfSigned(_ status: Bool = true) -> Client {
self.selfSigned = status
try! http.syncShutdown()
http = Client.createHTTP(selfSigned: status)
return self
Expand Down
2 changes: 1 addition & 1 deletion templates/swift/Sources/Services/Realtime.swift.twig
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ open class Realtime : Service {
reconnect = false
closeSocket()
} else {
socketClient = WebSocketClient(url, delegate: self)!
socketClient = WebSocketClient(url, tlsEnabled: !client.selfSigned, delegate: self)!
}

try! socketClient?.connect()
Expand Down
8 changes: 4 additions & 4 deletions templates/swift/Sources/WebSockets/WebSocketClient.swift.twig
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public class WebSocketClient {
frameKey: String,
headers: HTTPHeaders = HTTPHeaders(),
maxFrameSize: Int = 14,
tlsEnabled: Bool = false,
tlsEnabled: Bool = true,
delegate: WebSocketClientDelegate? = nil
) {
self.host = host
Expand All @@ -193,19 +193,19 @@ public class WebSocketClient {
/// - delegate: Delegate to handle message and error callbacks.
public init?(
_ url: String,
tlsEnabled: Bool = true,
headers: HTTPHeaders = HTTPHeaders(),
delegate: WebSocketClientDelegate? = nil
) {
let rawUrl = URL(string: url)
let hasTLS = rawUrl?.scheme == "wss" || rawUrl?.scheme == "https"
self.frameKey = "tergregfgbsfdgfdsfgdbv=="
self.host = rawUrl?.host ?? "localhost"
self.port = rawUrl?.port ?? (hasTLS ? 443 : 80)
self.port = rawUrl?.port ?? (tlsEnabled ? 443 : 80)
self.uri = rawUrl?.path ?? "/"
self.query = rawUrl?.query ?? ""
self.headers = headers
self.maxFrameSize = 24
self.tlsEnabled = hasTLS
self.tlsEnabled = tlsEnabled
self.delegate = delegate
}

Expand Down