crowdin / crowdin-api-client-dotnet

.NET client library for Crowdin API
https://www.nuget.org/packages/Crowdin.Api/
MIT License
53 stars 26 forks source link

Applications API support #197

Closed andrii-bodnar closed 10 months ago

andrii-bodnar commented 11 months ago

Crowdin has recently added new endpoints for managing custom applications. Support for these endpoints is missing in this Crowdin API client.

We need to add support for the following endpoints:

Riju-bak commented 11 months ago

@andrii-bodnar Can I take this up?

andrii-bodnar commented 11 months ago

@Riju-bak sure, thanks a lot! 🚀

Riju-bak commented 10 months ago

The reference doesn't mention what fields the response data must contain. Also, it isn't clear what the acceptable string values of applicationIdentifier and path must be.

andrii-bodnar commented 10 months ago

@Riju-bak application - is a type of web application hosted on a separate domain that can be installed in Crowdin like a plugin.

Each application has its own identifier (applicationIdentifier) - it can be any string identifier. It is defined by the application itself. path is an endpoint implemented in the app.

For example - we have a Video Preview app that defines its own API - https://video-preview.awesome-crowdin.com/manifest.json. In this case - the identifier would be preview-video and path - /configure.

The data in this API can be any JSON object. Each application defines what payload it accepts for its endpoints.

Riju-bak commented 10 months ago

@andrii-bodnar @innomaxx Since each application defines what payload (body) it accepts, to Edit Application Data in crowdin-api-client-dotnet it must accept a patch request with a body of type object to make it generic.

However, note that the SendPatchRequestMethod inside CrowdinApiClient.cs requires the body to be of type IEnumerable<PatchEntry>. This won't work for all applications.

Of course we can just change the body type to object, but before doing that, could either of you confirm whether or not it won't break the client's ability to send PATCH requests. I don't know if there's some internal aspect of the code-base that requires using IEnumerable<PatchEntry> over object.

innomaxx commented 10 months ago

@Riju-bak we can add extra overload for method SendPatchRequest (or create entirely new method like SendRawPatchRequest) that accepts raw System.Object as parameter instead of collection of patches. We use the same approach with method SendDeleteRequest_FullResult

In future this solution can be modified or replaced by something better since it's not a part of public API

Riju-bak commented 10 months ago

@innomaxx Got it. In that case I'll add an extra overloaded SendPatchRequest method for now.

Riju-bak commented 10 months ago

@andrii-bodnar PR is now ready to review