cliente-digital / pipefy

A Pipefy API wrapper that uplift productivity of newcomers to graphQL tech.
Apache License 2.0
0 stars 0 forks source link

Pipefy Bulk gql #5

Closed iannsp closed 2 months ago

iannsp commented 2 months ago

Make bulk updates.

Pipefy Recomendations:

this feature also increase the result application performance.

The normal mode is execute each gql as soon requested but in this mode they are put in bulks and use the notation:

mutation{
[lineID] : [gql ]
}

Use Case

You need to check for cards in the Pipe that are more than three days overdue and write a comment remember the assignee avbout the task.

$cards = new Clientedigital\Pipefy\Pipe([PipeID])->Cards();

$lastUpdateDate = (new DateTime())->sub(new DateInterval('P3D'));

$filter= new Clientedigital\Pipefy\Filter\Cards();
$filter->by('due_date', '<', $lastUpdateDate );

$cards->filter($filter);

// return the generator.
$cards = $cards->get();

Pipefy::bulkStart();

foreach($cards as $card){
    $cards->update(   
        ($card->get())
            ->addComment('Hi, This card is 3 days late. Please check the task.')
    );
}

Pipefy::bulkEnd(); 

try{
    Pipefy::bulkExecute();  
} catch(\Exception $except){
   $log->info('Some error in bulk mutation');
}
iannsp commented 2 months ago

GraphQL

Bulk

um tipo de GQL // pode ser passado para GraphQL ->Exec(GQLInterface) Somente mutations ocorrem em Bulk.

iannsp commented 2 months ago

capacity became info