Add a method to get the task endpoint
There is a method in the client index that returns the index endpoint.
I would like a similar method for the task endpoint, although I'd prefer that the method name be more explicit. But I'd be okay with just having access to it.
$taskApi = $client->getTasksEndpoint();
$taskApi->get($taskUid);
In short, I'd like a way to access Tasks in the HandlesTasks trait.
protected Tasks $tasks; /* access this from the application */
public function getTask($uid): array
{
return $this->tasks->get($uid);
}
Why $client->getTask(id) isn't enough for you? Or are you referring to that something is missing?
Because all of the calls are quite verbose and come from the client object. It would be clearer for me to know which API endpoint I'm calling. I don't think anything is missing, so mostly DX.
I'm refactoring all my code that to use $client->index() instead of $client->getIndex(), which had caused me all sorts of chicken-and-egg grief. I'm also monitoring tasks much closer, so with access to the tasks object there would be less code completion than with the client object.
Yeah, i agree that there are way too much methods on a single client :) but given getTask method to me it's clear that you are calling tasks endpoint :)
I remember sometime ago that I suggested a similar way to split things, but still somebody must have some time to come up with a PR.
well, yes, for an expert it's clear. For a newcomer to the library, it's less clear.
A HUGE thing that would help is if a Task object were returned instead of simply array.
well, yes, for an expert it's clear. For a newcomer to the library, it's less clear.
A HUGE thing that would help is if a Task object were returned instead of simply
array.
#703 :)
@tacman see #735