The type to decode the response into.
Instance Method
makeAsyncApiCall(of:endpoint:method:queryParameters:bodyParameters:)
Performs a generic API request with an optional body and decodes the response.
Declaration
func makeAsyncApiCall<T, Parameters>(of type: T.Type = T.self, endpoint: String, method: HttpMethod, queryParameters: [String : Any?]? = nil, bodyParameters: Parameters?) async throws -> T where T : Decodable, Parameters : Encodable
Parameters
type
-
endpoint
-
The API endpoint path.
method
-
The HTTP method to use.
queryParameters
-
Optional query parameters.
bodyParameters
-
Optional request body to be encoded and sent.
Return Value
A decoded model of the specified type.