From f738092e43a44b272e54f83fb6357caee5e43f42 Mon Sep 17 00:00:00 2001 From: Laurent Date: Wed, 24 Sep 2025 15:26:56 +0200 Subject: [PATCH] adds a way for other project to call services on the api --- LeStorage/Services.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/LeStorage/Services.swift b/LeStorage/Services.swift index 8066d67..73a7fd0 100644 --- a/LeStorage/Services.swift +++ b/LeStorage/Services.swift @@ -55,6 +55,15 @@ public class Services { // MARK: - Base + /// Runs a request on the API and returns the appropriate response + /// - Parameters: + /// - path: the path of the service in the api, ie. "create-users/" + /// - method: the HTTP method to call + /// - requiresToken: whether the token must be included in the request + public func run(path: String, method: HTTPMethod, requiresToken: Bool) async throws -> U { + return try await self._runRequest(serviceCall: ServiceCall(path: path, method: method, requiresToken: requiresToken)) + } + /// Runs a request using a configuration object /// - Parameters: /// - serviceConf: A instance of ServiceConf