Skip to content

Update to Jobs API v3 #69

Open
Open

Description

@lhu-smartling

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

Activity

  1. dimitrystd commented on Sep 7, 2017

    @dimitrystd
    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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions