0

I have two functions that should make a request to the network. The first function should add the command "enable" and the second "disable". But it doesn't work. I think I sent the wrong call, could you help me to fix it? The second function is the same, but with "disable". This is my code:

func unlockCpacBoat(bookingId: Int) -> Promise<Bool> {
        let params: Parameters = ["command": "enable"]
        return getModule(NetworkingService.self).authenticatedRequest(method: .put(ContentType.applicationJson),
                                                                      endoint: "/bookings/\(bookingId)/commands/",
                                                                      parameters: ParametersContainer.dictionary(params))
    }

This is my Model:

{
  "command": [
    "requestHeartbeat"
  ]
}
func authenticatedRequest<T: Codable>(method: RequestMethod, endoint: String, parameters: ParametersContainer) -> Promise<T>
enum ParametersContainer {
    case array([Parameters])
    case dictionary(Parameters)
    case plainText(String)
    case data(Data)
    case multipart([MultipartFormEntry])
    case empty
}
NexusUA
  • 217
  • 1
  • 3
  • 13

0 Answers0