```swift
struct OTPRequest: Codable {
let mobile, countryCode: String
enum CodingKeys: String, CodingKey {
case mobile
case countryCode = "country_code"
}
}
```
```swift
struct OTPResponse: Codable {
let data: String?
let message: String
}
```
Expected Request
```swift
public func authenticateUser(authRequest: OTPRequest) -> AnyPublisher<OTPResponse, Error> {
client.post("/otp/",encodable: authRequest)
}
```
Error: No 'post' candidates produce the expected contextual result type 'AnyPublisher<OTPResponse, Error>'
Work around solution I am using right know is:
```swift
public func authenticateUser(authRequest: OTPRequest) -> AnyPublisher<OTPResponse, Error> {
client.post("/otp/",params: ["mobile" : authRequest.mobile, "country_code": authRequest.countryCode ])
}
```
Kindly let me know if there is best approach other than this. Responses Appreciated!
@irangareddy I assume you are using the encodable api form the `encodable_post` branch (commit `273fdd2a3135e186a58d282421223ff80bc90f0d`. This has not been merge yet.
I think the encodable api is not (yet) available for `AnyPublisher<T, Error>` only for other types. It should be available via the async await api though
I am going to add the missing AnyPublisher<T, Error> version.
In the meantime, the `async` version should work
```swift
public func authenticateUser(authRequest: OTPRequest) async throws -> OTPResponse {
try await network.post("/otp/",encodable: authRequest)
}
```