-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pull request #5: Feature/MDAPI-72 swift migrate to graal sdk v1.1.21
Merge in MDAPI/dxfeed-graal-swift-api from feature/MDAPI-72-swift-migrate-to-graal-sdk-v1.1.21 to main Squashed commit of the following: commit 3397d6e900d023abc4a49da0cfb081d6cd9e8e5b Author: Aleksey Kosylo <[email protected]> Date: Tue Jul 23 13:40:35 2024 +0200 [MDAPI-72] use millis instead of DXTimePeriod commit 5772ecc0ac8c140e087e73ea2e4c540218f12625 Author: Aleksey Kosylo <[email protected]> Date: Wed Jul 17 13:19:29 2024 +0200 fix typo commit ece9526915650a058801f4bceaa5ef43b1531200 Author: Aleksey Kosylo <[email protected]> Date: Mon Jul 15 12:02:55 2024 +0200 [MDAPI-72] add test for ProfileReader commit 603e281753eceacfe444b89b1886d66436c624f1 Author: Aleksey Kosylo <[email protected]> Date: Mon Jul 15 10:04:29 2024 +0200 [MDAPI-72] fix warnings commit 3dc04fee033d014de205f265a33a2959a057caab Author: Aleksey Kosylo <[email protected]> Date: Mon Jul 15 09:47:52 2024 +0200 [MDAPI-72] add InstrumentProfileReader read with token commit e914f5cd2804959f5349d12f93866dbfbb28e6a9 Author: Aleksey Kosylo <[email protected]> Date: Fri Jul 12 16:15:47 2024 +0200 [MDAPI-72] add AuthToken commit 348a7f2f37b8794b7593be90e6d785f9c940e5d2 Author: Aleksey Kosylo <[email protected]> Date: Fri Jul 12 15:04:24 2024 +0200 [MDAPI-72] add aggregation period and batch limit commit dca5fb0a20ad2bda8c764955224f611b6d4af9cc Author: Aleksey Kosylo <[email protected]> Date: Fri Jul 12 13:26:33 2024 +0200 [MDAPI-72] add new sources
- Loading branch information
Showing
16 changed files
with
524 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
// | ||
// | ||
// Copyright (C) 2024 Devexperts LLC. All rights reserved. | ||
// This Source Code Form is subject to the terms of the Mozilla License, v. 2.0. | ||
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
// | ||
|
||
import Foundation | ||
@_implementationOnly import graal_api | ||
|
||
class NativeAuthToken: NativeBox<dxfg_auth_token_t> { | ||
deinit { | ||
let thread = currentThread() | ||
_ = try? ErrorCheck.nativeCall(thread, dxfg_JavaObjectHandler_release(thread, &(native.pointee.handler))) | ||
} | ||
|
||
static func valueOf(_ value: String) throws -> NativeAuthToken { | ||
let thread = currentThread() | ||
let native = try ErrorCheck.nativeCall(thread, dxfg_AuthToken_valueOf(thread, value.toCStringRef())).value() | ||
return NativeAuthToken(native: native) | ||
} | ||
|
||
static func createBasicToken(_ userPassword: String) throws -> NativeAuthToken { | ||
let thread = currentThread() | ||
let native = try ErrorCheck.nativeCall(thread, | ||
dxfg_AuthToken_createBasicToken(thread, | ||
userPassword.toCStringRef())).value() | ||
return NativeAuthToken(native: native) | ||
} | ||
|
||
static func createBasicToken(_ user: String, _ password: String) throws -> NativeAuthToken { | ||
let thread = currentThread() | ||
let native = try ErrorCheck.nativeCall(thread, | ||
dxfg_AuthToken_createBasicToken2(thread, | ||
user.toCStringRef(), | ||
password.toCStringRef())).value() | ||
return NativeAuthToken(native: native) | ||
} | ||
|
||
static func createBasicToken(_ user: String, _ password: String) throws -> NativeAuthToken? { | ||
let thread = currentThread() | ||
if let native = try ErrorCheck.nativeCall(thread, | ||
dxfg_AuthToken_createBasicTokenOrNull(thread, | ||
user.toCStringRef(), | ||
password.toCStringRef())) { | ||
return NativeAuthToken(native: native) | ||
} | ||
return nil | ||
} | ||
|
||
static func createBearerToken(_ token: String) throws -> NativeAuthToken { | ||
let thread = currentThread() | ||
let native = try ErrorCheck.nativeCall(thread, dxfg_AuthToken_createBearerToken(thread, | ||
token.toCStringRef())).value() | ||
return NativeAuthToken(native: native) | ||
} | ||
|
||
static func createBearerToken(_ token: String) throws -> NativeAuthToken? { | ||
let thread = currentThread() | ||
if let native = try ErrorCheck.nativeCall(thread, | ||
dxfg_AuthToken_createBearerTokenOrNull(thread, | ||
token.toCStringRef())) { | ||
return NativeAuthToken(native: native) | ||
} | ||
return nil | ||
} | ||
|
||
static func createCustomToken(_ scheme: String, _ value: String) throws -> NativeAuthToken { | ||
let thread = currentThread() | ||
let native = try ErrorCheck.nativeCall(thread, dxfg_AuthToken_createCustomToken(thread, | ||
scheme.toCStringRef(), | ||
value.toCStringRef())).value() | ||
return NativeAuthToken(native: native) | ||
} | ||
|
||
lazy var user: String? = { | ||
let thread = currentThread() | ||
let nativeValue = try? ErrorCheck.nativeCall(thread, dxfg_AuthToken_getUser(thread, native)) | ||
return String(nullable: nativeValue) | ||
}() | ||
|
||
lazy var password: String? = { | ||
let thread = currentThread() | ||
let nativeValue = try? ErrorCheck.nativeCall(thread, dxfg_AuthToken_getPassword(thread, native)) | ||
return String(nullable: nativeValue) | ||
}() | ||
|
||
lazy var httpAuthorization: String? = { | ||
let thread = currentThread() | ||
let nativeValue = try? ErrorCheck.nativeCall(thread, dxfg_AuthToken_getHttpAuthorization(thread, native)) | ||
return String(nullable: nativeValue) | ||
}() | ||
|
||
lazy var scheme: String? = { | ||
let thread = currentThread() | ||
let nativeValue = try? ErrorCheck.nativeCall(thread, dxfg_AuthToken_getScheme(thread, native)) | ||
return String(nullable: nativeValue) | ||
}() | ||
|
||
lazy var value: String? = { | ||
let thread = currentThread() | ||
let nativeValue = try? ErrorCheck.nativeCall(thread, dxfg_AuthToken_getValue(thread, native)) | ||
return String(nullable: nativeValue) | ||
}() | ||
} |
Oops, something went wrong.