Instance Method

makeAsyncApiCall(of:endpoint:method:queryParameters:)

Performs a generic GET request to the backend and decodes the response into the specified model.

Declaration

func makeAsyncApiCall<T>(of type: T.Type = T.self, endpoint: String, method: HttpMethod, queryParameters: [String : Any?]? = nil) async throws -> T where T : Decodable

Parameters

type

The type to decode the response into.

endpoint

The API endpoint path.

method

The HTTP method to use (e.g., .get, .post).

queryParameters

Optional query parameters for the request.

Return Value

A decoded model of the specified type.

Discussion