func initialize(environment: KoardEnvironment)
Initializes the API handler with the given environment configuration.
func login(merchantCode: String, merchantPin: String) async throws
Authenticates the merchant using a merchant code and PIN.
func makeAsyncApiCall<T>(of: T.Type, endpoint: String, method: HttpMethod, queryParameters: [String : Any?]?) async throws -> T
Performs a generic GET request to the backend and decodes the response into the specified model.
func makeAsyncApiCall<T, Parameters>(of: T.Type, endpoint: String, method: HttpMethod, queryParameters: [String : Any?]?, bodyParameters: Parameters?) async throws -> T
Performs a generic API request with an optional body and decodes the response.
func refreshTokenIfNeeded() async throws
Refreshes the current access token if it is expired or about to expire.