AdobeDocs / cis-photoshop-api-docs

https://developer.adobe.com/photoshop/photoshop-api-docs/
https://developer.adobe.com/photoshop/photoshop-api-docs/
Apache License 2.0
16 stars 27 forks source link

How to send a response when processing is complete #156

Open velara3 opened 6 months ago

velara3 commented 6 months ago

After reading through the examples it looks like the way to use the api is to:

  1. make a call
  2. get an id back from the call
  3. poll using that id until the status of job is complete

That's according to some of the example code and documentation here.

Over the last few years the trend has been to start using the await behavior and not proceed in the code block until thee final response is returned from the call.

Is the polling behavior part of all the api or is it possible to make a call to the API and some how tell it to not send a response until everything is complete?

Expected Behaviour

      var psdURL = "...";
      var documentManifestURL = "https://image.adobe.io/pie/psdService/documentManifest";
      var documentManifest = await client.getDocumentManifest(psdURL);
      console.log(documentManifest);

Actual Behaviour

      // pseudo code
      var psdURL = "...";
      var documentManifestURL = "https://image.adobe.io/pie/psdService/documentManifest";
      var results = await client.getDocumentManifest(psdURL);
      var jobID = results.href;
      // complicated polling code 
      // console.log(documentManifest);

Also, it may be that the sdk supports this now. I'm still reading through the documentation but much of the example code shows polling.

velara3 commented 6 months ago

So far, in my limited tests, it seems that the AIO library waits to send a response until the outputs are complete. This is the desired behavior. If the AIO library does this already then the solution to this issue is to use that library.