Giter Club home page Giter Club logo

crowdin-api-client-ruby's People

Contributors

andrii-bodnar avatar antonm-svitla-sge avatar araujotadeu avatar artem-vavilov avatar cmrd-senya avatar dependabot[bot] avatar erwan avatar halle avatar keshandrr avatar laasem avatar mamantoha avatar mohanthanigaivelan avatar sabarish98 avatar sugan0tech avatar tessi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

crowdin-api-client-ruby's Issues

Fix source file uploading in `v1.7.0`

After updating from v1.6.0 to v1.7.0, JSON files began to upload corrupted.

Issues

  1. #add_file New JSON files are corrupted as their JSON data content has been replaced with the local file path string.
Original file content Uploaded file content
{"data": "Data"} "/path/to/file.json"
  1. #update_or_restore_file Returns error:
{
  "errors" => [
    "error" => {
      "key"    => "storageId",
      "errors" => [
        "code"    => "fileInvalid",
        "message" => "Uploaded file \"file.json\" is invalid and cannot be processed"
      ]
    }
  ]
}

Tasks Settings Templates API support

download_bundle 1.8 response break

We were using version 1.6 of the AI, but when updating it to 1.8, we noticed a compatibility break in the response ( from the release notes, that's expected ). But since I could not find a confirmation of how to use the new response in the docs I am asking here.

Method: download_bundle

Responses
Version 1.6 / 1.7

BUNDLE bundle-XXXXXXX-XXX-XXXXX-XXX-XXXXXXXXX.zip

Version 1.8

{"data"=>{"url"=>"", "expireIn"=>"2024-04-12T13:17:41+00:00"}}

If I understood correctly, the downloaded local file name is the export it with a prefix and the .zip extensions. Something like

bundle-<EXPORT_ID>.zip

Is that correct?

Is there another way to get the local file name?

AI API support

Recently, Crowdin introduced new AI features, including a new set of API endpoints to manage and interact with these AI resources.

The new AI API endpoints should be added to the Crowdin API clients to allow users to programmatically interact with these new features.

References:

Refactor fetch_all feature

Currently, the list of available methods for the fetch_all feature is hardcoded.

It's a bad approach since we need to maintain this list and there is a risk to forget adding some new methods.

We need to refactor this feature and get rid of these hardcoded values. Also, it would be great to somehow validate the passed method (if it supports pagination), or add some graceful exception handling for that.

Auto generated docs

As a Crowdin Ruby API client user, I would like to have online docs to navigate and explore the client resources, methods, parameters, etc.

Examples:

These docs should be generated using GH Actions and deployed to GH Pages. Workflow example: docs.yml

The possible tool for that is rdoc.

Steps:

  • Explore tools to generate docs from code, and choose the best one.
  • Create a config and provide a command to generate the docs.
  • If needed, add additional annotations to the API Client code (ignore some unneeded methods in docs, add some method or parameter descriptions, etc).
  • Set up the GH workflow. @andrii-bodnar can help with that.
  • Set up the GH pages feature for the repo. @andrii-bodnar

Document API resources methods

The Autogenerated online documentation was added in #32. In this PR only the Bundles, Projects, Storage, and Source Files resources were documented.

Example of the method annotation:

https://github.com/crowdin/crowdin-api-client-ruby/blob/main/lib/crowdin-api/api_resources/bundles.rb#L6-L8


We need to add annotations for the rest API resources:


API reference:

Each API resource documentation can be delivered in a separate PR. Also, it's a good idea to join some resources into one PR.

Pagination support

Hello @keshandrr !

I know that you're going to add pagination support to the API client.

What is a current state of it? Have you already started working on it?

We could help and contribute the development of pagination support, in case it can speed things up.

But in order to contribute we should coordinate what and how we build to get an acceptable result.

Add the option to choose between instant file downloading and returning response data

The response from Build Project File Translation contains important etag data, which is not accessible through the #build_project_file_translation method, as it returns only the downloaded file's path.

def fetch_response_data(doc)
if doc['data'].is_a?(Hash) && doc['data']['url'] && doc['data']['url'].include?('response-content-disposition')
download_file(doc['data']['url'])
else
doc
end
end

Global retry configuration

Problem

There is a possibility to configure retry configuration for requests to handle some exceptions:

@crowdin.fetch_all(:list_projects, {}, { request_delay: 2, retries_count: 3, error_messages: ['401'] })

But this retry configuration applies only to the fetch_all methods and not to all the API Client methods.

Narrative

We need to make the retry configuration global so in this case, we'll be able to configure retry options for any request to Crowdin.

Possible solution: move this configuration to the client configuration level and consider these options in each API request to Crowdin

Also, this feature should be better documented in the Readme.

Additional info

Good reference - Crowdin JS API Client Retry Configuration

File translations always download to current working directory

When calling the build_project_file_translation method, the resulting file is downloaded into the current working directory of the process. This is inconvenient for a few reasons:

  1. The filename is determined by the filename in Crowdin, so this runs the risk of overwriting a local file.
  2. There is no way to set a different destination, despite this being possible for other API methods (like the download_* methods).
  3. The only way I can think of to control where the resulting file ends up is to change the working directory with Dir.chdir, which has global effects in the process.

It would be really helpful to be able to pass a destination into the build_project_file_translation method, and other similar methods.

String-based API support

Crowdin has recently released a new type of projects - String-based.

In string-based projects, the focus is on managing translatable content as individual strings rather than source files. In this project type, after uploading source files, Crowdin parses them into source strings. Unlike file-based projects, source files aren’t stored, and the emphasis is on managing the content at the string level. This approach is beneficial when dealing with projects that involve continuous content updates, dynamic content, or where a string-oriented structure is preferred.

As a result, the API differs a bit from the file-based projects. Most of the endpoints are the same, but some endpoints have different parameters or return different responses, some endpoints are not available at all, and some new endpoints are available only for string-based projects.

We should update the API clients to support string-based projects as well.

References:

It has been implemented for the following clients:

Glossaries API updates

We're happy to announce a significant update for Crowdin Glossaries that allows managing the terminology in a more advanced way.

There are a lot of new things and some changes in the Crowdin API.

New APIs:

Updates:

The translationOfTermId is deprecated and the conceptId added in:

Edit Term - new path options

All of these changes should be reflected in this API Client.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.