merge-api / merge-java-client

The JVM SDK for accessing various Merge Unified APIs
Other
5 stars 5 forks source link

Default value of `timeout` in RequestOptions should be Optional.empty(), not null #45

Closed williamliu52 closed 4 months ago

williamliu52 commented 4 months ago

I'm testing the SDK in my Kotlin project, like so

val result = mergeApiClient.hris().employees().list(
      EmployeesListRequest.builder().build(),
      RequestOptions.builder()
        .accountToken("token-here")
        .build()
    )

When I run this, I encounter the following error

java.lang.NullPointerException: Cannot invoke "java.util.Optional.isPresent()" because the return value of "com.merge.api.core.RequestOptions.getTimeout()" is null
    at com.merge.api.resources.hris.employees.EmployeesClient.list(EmployeesClient.java:183)

I believe that this can be fixed if the default value for timeout in RequestOptions is changed from null to Optional.empty()

dsinghvi commented 4 months ago

@williamliu52 this should be fixed on the latest java sdk. Linking the relevant source as well.

Apologies for the delay!