crowdin / crowdin-api-client-java

Java client library for Crowdin API
https://jitpack.io/#crowdin/crowdin-api-client-java
MIT License
65 stars 44 forks source link

Add support for the Notifications API #170

Closed andrii-bodnar closed 1 year ago

andrii-bodnar commented 1 year ago

Crowdin API has a new Notifications API that allows sending notifications to the project and organization members. It would be great to add support for this API in this Crowdin API client.

API reference:

Durdush commented 1 year ago

Hi @andrii-bodnar, Could you please assign me this.

Durdush commented 1 year ago

Hi @andrii-bodnar, Sorry for the delay. Here for sending notification do we have to get the list of all the authenticated users and then send the notification to users?

andrii-bodnar commented 1 year ago

Hi @Durdush, no, we don't need to get a list, we just need to implement methods to call the described Crowdin APIs.

Durdush commented 1 year ago

Hi @andrii-bodnar, here for authenticated users and organisation members url is same, so there my test cases are failing. Is it alright, can you confirm

andrii-bodnar commented 1 year ago

@Durdush could you please provide more details? I don't fully understand what you mean

Durdush commented 1 year ago

For two api, sendNotificationToAuthenticatedUsers and sendNotificationToOrganizationMembers Url is same which is {protocol}://{host}/api/v2/notify So when i am creating testCases it is giving me exception of Duplicate key RequestMock(url=https://testOrganization.api.crowdin.com/api/v2/notify My actual question is why two api's have same URL?

andrii-bodnar commented 1 year ago

@Durdush thanks for the details!

It's ok that these APIs have the same URL since these methods belong to different crowdin editions (crowdin.com, Crowdin Enterprise)

It would be acceptable to have a test for only one API method (sendNotificationToAuthenticatedUsers or sendNotificationToOrganizationMembers)

Durdush commented 1 year ago

Thanks @andrii-bodnar! Still I am facing a small issue, when i am creating a request mock with RequestMock.build method, it is taking my request file as a response file as it doesn't contain the any implementation of this method in which we just pass request file only. Please suggest if there any other way in which i can implement the mock request with request file only.