Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Jobs API v3 #69

Open
lhu-smartling opened this issue Sep 1, 2017 · 1 comment
Open

Update to Jobs API v3 #69

lhu-smartling opened this issue Sep 1, 2017 · 1 comment
Assignees

Comments

@lhu-smartling
Copy link

lhu-smartling commented Sep 1, 2017

Currently the sdk integrates with Jobs API v2. Could you update to v3?

DoD:

  • Migrate\implement following endpoints:
    • Create Job
    • Update Job
    • List Jobs
    • Get Job
    • Authorize A Job
    • Add Locale To Job
    • Add File To Job
    • Check Asynchronous Processing Status For Job
  • Some endpoints may handle request async. As result you can receive status code 200 or 202. It's not easy to write multithreaded apps in PHP so i would like to make SDK simple for usage and do all operations synchronously for end-developer. Let me explain by pseudo code
    public function addFileToJobSync($jobId, AddFileToJobParameters $parameters)
    {
        $result = sendRequest('/jobs-api/v3/projects/{projectId}/jobs/{translationJobUid}/file/add', $parameters);
        if ($result == 202) {
          $start_time = time();
          do {
             if ((time() - $start_time) > $tomeout) then
               throw new SmartlingException();
             sleep(5);
             $result = sendRequest('/jobs-api/v3/projects/{projectId}/jobs/{translationJobUid}/processes/{processUid}');
          }
          while $result;
        }
    }
    Of course we block execution of entire application but in general you cannot do anything with job until all async operations are completed.
    Update implementation of following methods and add Sync suffix to method names
    • Add Locale To Job
    • Add File To Job
@dimitrystd
Copy link
Contributor

The original task didn't have any description so i added what make sense for smartling. Everything else can be added by pull requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants