You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
Currently all enqueued tasks are returned as an array without defined structure, so basically we cannot be sure that is safe to access any data from it.
As I've seen structure can differ per task status, but I could be mistaken.
This idea came up to my mind after I've seen https://github.com/meilisearch/meilisearch-js/blob/main/src/enqueued-task.ts
Basic example
class EnqueuedTask implements \ArrayAccess
{
privateint$taskUid;
privatestring indexUid;
privatestring$status; // 'succeeded'|'processing'|'failed'|'enqueued'|'canceled'; // this could be class constants and later migrated to enums after bumping up php requirement to 8+privatestring$type; // ...privateDateTimeImmutable$enqueuedAt;
}
This could act as a base, and if response data is really different per task status, then we could extend this object into many ones with more additional information. another approach of course would be just add all data to EnqueuedTask and for consumers to check status before accessing it
To break things less the returned lets say EnqueuedTask object could implement the ArrayAccess interface so array access would still work, it would just break things if someone has extended any of Endpoint classes.
The text was updated successfully, but these errors were encountered:
Description
Currently all enqueued tasks are returned as an array without defined structure, so basically we cannot be sure that is safe to access any data from it.
As I've seen structure can differ per task status, but I could be mistaken.
This idea came up to my mind after I've seen https://github.com/meilisearch/meilisearch-js/blob/main/src/enqueued-task.ts
Basic example
This could act as a base, and if response data is really different per task status, then we could extend this object into many ones with more additional information. another approach of course would be just add all data to
EnqueuedTask
and for consumers to check status before accessing itOther
This is related to #573
To break things less the returned lets say
EnqueuedTask
object could implement theArrayAccess
interface so array access would still work, it would just break things if someone has extended any of Endpoint classes.The text was updated successfully, but these errors were encountered: