diff options
Diffstat (limited to 'ios/MullvadRustRuntime')
| -rw-r--r-- | ios/MullvadRustRuntime/MullvadApiResponse.swift | 8 | ||||
| -rw-r--r-- | ios/MullvadRustRuntime/include/mullvad_rust_runtime.h | 20 |
2 files changed, 28 insertions, 0 deletions
diff --git a/ios/MullvadRustRuntime/MullvadApiResponse.swift b/ios/MullvadRustRuntime/MullvadApiResponse.swift index 7836d43971..ddead026b3 100644 --- a/ios/MullvadRustRuntime/MullvadApiResponse.swift +++ b/ios/MullvadRustRuntime/MullvadApiResponse.swift @@ -25,6 +25,14 @@ public class MullvadApiResponse { return Data(UnsafeBufferPointer(start: body, count: Int(response.body_size))) } + public var etag: String? { + return if response.etag == nil { + nil + } else { + String(cString: response.etag) + } + } + public var errorDescription: String? { return if response.error_description == nil { nil diff --git a/ios/MullvadRustRuntime/include/mullvad_rust_runtime.h b/ios/MullvadRustRuntime/include/mullvad_rust_runtime.h index e054de0044..8a199559b5 100644 --- a/ios/MullvadRustRuntime/include/mullvad_rust_runtime.h +++ b/ios/MullvadRustRuntime/include/mullvad_rust_runtime.h @@ -43,6 +43,7 @@ typedef struct SwiftRetryStrategy { typedef struct SwiftMullvadApiResponse { uint8_t *body; uintptr_t body_size; + uint8_t *etag; uint16_t status_code; uint8_t *error_description; uint8_t *server_response_code; @@ -114,6 +115,25 @@ struct SwiftCancelHandle mullvad_api_get_addresses(struct SwiftApiContext api_co struct SwiftRetryStrategy retry_strategy); /** + * # Safety + * + * `api_context` must be pointing to a valid instance of `SwiftApiContext`. A `SwiftApiContext` is created + * by calling `mullvad_api_init_new`. + * + * `completion_cookie` must be pointing to a valid instance of `CompletionCookie`. `CompletionCookie` is + * safe because the pointer in `MullvadApiCompletion` is valid for the lifetime of the process where this + * type is intended to be used. + * + * `etag` must be a pointer to a null terminated string. + * + * This function is not safe to call multiple times with the same `CompletionCookie`. + */ +struct SwiftCancelHandle mullvad_api_get_relays(struct SwiftApiContext api_context, + void *completion_cookie, + struct SwiftRetryStrategy retry_strategy, + const uint8_t *etag); + +/** * Called by the Swift side to signal that a Mullvad API call should be cancelled. * After this call, the cancel token is no longer valid. * |
