Skip to content

Add a method to get the task endpoint #729

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

Open
tacman opened this issue Mar 6, 2025 · 6 comments
Open

Add a method to get the task endpoint #729

tacman opened this issue Mar 6, 2025 · 6 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@tacman
Copy link

tacman commented Mar 6, 2025

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);
    }
@norkunas
Copy link
Collaborator

norkunas commented Mar 6, 2025

Why $client->getTask(id) isn't enough for you? Or are you referring to that something is missing?

@tacman
Copy link
Author

tacman commented Mar 6, 2025

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.

@norkunas
Copy link
Collaborator

norkunas commented Mar 6, 2025

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.

@tacman
Copy link
Author

tacman commented Mar 6, 2025

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.

@norkunas
Copy link
Collaborator

norkunas commented Mar 6, 2025

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 :)

@curquiza curquiza added the enhancement New feature or request label Mar 19, 2025
@norkunas
Copy link
Collaborator

@tacman see #735

@Strift Strift changed the title add a method to get the task endpoint Add a method to get the task endpoint May 23, 2025
@Strift Strift added the question Further information is requested label May 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants