PHP code example of marciodojr / autentique

1. Go to this page and download the library: Download marciodojr/autentique library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

marciodojr / autentique example snippets



use Mdojr\Autentique\Autentique;
use Mdojr\Autentique\Endpoint;
use GuzzleHttp\Client;

$client = new Client([
    'base_uri' => Endpoint::PRODUCTION,
    'headers' => [
        'X-Autntiq-Api' => $productionToken
    ]
]);

$autentique = new Autentique($client);

// Manipulação de conta
$acc = $autentique->account();
// Manipulação de Documentos
$doc = $autentique->document();
// Manipulação de Assinaturas
$sign = $autentique->signature();
// Manipulação de Pastas
$folder = $autentique->folder();


$result = $acc->info();

$page = 1;
$count = 60;
$s = ''; // opcional
$result = $doc->listNotInFolder($page, $count, $s);

$uuid = '9ab23456325c40c2a5023051cf4bbf0e' // uuid do documento
$result = $doc->retrieve($uuid);

$page = 1;
$count = 60;
$s = ''; // opcional
$doc->listReceivedNotInFolder($page, $count, $s);

$page = 1;
$count = 60;
$s = ''; // opcional
$doc->listOnlySent($page, $count, $s);

$nome = 'Contrato de aluguel';
$partes = [
    [
        'email' => '[email protected]',
        'funcao' => 'assinar'
    ]
];
$arquivo = fopen('meu_arquivo.txt', 'r');
$rejeitavel = false;
$mensagem = 'Mensagem qualquer'; // opcional
$lembreteAssinatura = false; // opcional
$lembreteVencimento = true; // opcional
$frequencia = 'semanal'; // ou 'diario' opcional
$diasVencimento = 7; // opcional
$dataVencimento = '2018-09-10'; // opcional
$qrCode = 'B';  // opctional

$doc->create(
    $nome,
    $partes,
    $arquivo,
    $rejeitavel,
    $mensagem,
    $lembreteAssinatura,
    $lembreteVencimento,
    $frequencia,
    $diasVencimento,
    $dataVencimento,
    $qrCode
);

$uuid = '9ab23456325c40c2a5023051cf4bbf0e'; // uuid do documento
$doc->resendNotSignedOrRejected($uuid);

$uuid = '9ab23456325c40c2a5023051cf4bbf0e'; // uuid do documento
$result = $doc->deleteDocument($uuid);

$token = 'bf0e456325c40c2a5023051cf4';
$result = $sign->retrieve($token);

$token = 'bf0e456325c40c2a5023051cf4';
$result = $sign->accept($token);

$token = 'bf0e456325c40c2a5023051cf4';
$motivo = 'Não estou de acordo com os termos';
$result = $sign->reject($token, $motivo);

$s = ''; // opcional
$result = $folder->list($s);

$uuid = '456325c40c2a5023051cf456325c40';
$result = $folder->retrieve($uuid);

$uuid = '456325c40c2a5023051cf456325c40';
$s = '' // opcional
$result = $folder->listDocuments($uuid, $s);

$nome = 'Pasta XYZ';
$result = $folder->create($nome);

$folderUuid = '456325c40c2a5023051cf456325c40';
$docSignUuids = [
    '456325c40c2a5023051cf56656325c40',
    '456325c40c2a502345451cf456325c40',
    '456325c40c2a502305ffsdf456325c40'
]; // token de assinaturas de documentos
$result = $folder->moveDocumentsTo($folderUuid, $docSignUuids);

$uuid = '456325c40c2a5023051cf456325c40';
$nome = 'Outro nome';
$result = $folder->update($uuid, $nome);

$uuid = '456325c40c2a5023051cf456325c40';
$result = $folder->deleteFolder($uuid);