Skip to content

Commit

Permalink
Merge pull request #44 from signnow/embedded-invite-updates
Browse files Browse the repository at this point in the history
Embedded invite updates
  • Loading branch information
JiSoft authored Dec 15, 2023
2 parents a0e0311 + afebf03 commit 334ccd4
Show file tree
Hide file tree
Showing 49 changed files with 443 additions and 82 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v2.2.9] - 2023-12-11
### Added
- New fields for Embedded Invites
- Possibility to send custom User-Agent header

## [v2.2.8] - 2023-09-18
### Added
- Endpoints for uploading and getting user's initials
Expand Down
10 changes: 5 additions & 5 deletions sandbox/execute.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@
$document = new Document(
$auth->bearerByPassword(BASIC_TOKEN, USER, PASSWORD)
);

// 1. Upload a doc
$documentEntity = $document->upload(dirname(__DIR__) . '/tests/_data/blank.pdf');
echo 'Uploaded the document: ', $documentEntity->getId(), PHP_EOL, PHP_EOL;

usleep(500);

// 2. Get the doc
$params = (new GetDocumentRequestParams())
->setExclude(
Expand All @@ -68,13 +68,13 @@
echo 'Given document name: ', $documentEntity->getDocumentName(), PHP_EOL, PHP_EOL;

sleep(2);

// 3. Create download link
$link = $document->createDownloadLink($documentEntity->getId());
echo 'Download link: ', $link->getLink(), PHP_EOL, PHP_EOL;

sleep(2);

// 4. Download the doc
$path = DOWNLOADED_DIRECTORY_PATH . '/sign_now_downloaded_document.pdf';
$params = (new DocumentDownloadLinkParams())
Expand All @@ -88,7 +88,7 @@
echo 'Downloaded the document in ', $path, PHP_EOL, PHP_EOL;

sleep(2);

// 5. Delete the doc
$document->delete($documentEntity->getId());
echo 'Deleted the document ', $documentEntity->getId(), PHP_EOL, PHP_EOL;
Expand Down
2 changes: 1 addition & 1 deletion src/Action/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use SignNow\Api\Entity\Document\Upload as DocumentUpload;
use SignNow\Api\Entity\Document\FieldExtract as DocumentUploadFieldExtract;
use SignNow\Rest\Entity\Binary;
use SignNow\Rest\EntityManager;
use SignNow\Api\Service\EntityManager\EntityManager;
use SignNow\Rest\EntityManager\Exception\EntityManagerException;
use SignNow\Rest\Http\Request;
use SplFileInfo;
Expand Down
2 changes: 1 addition & 1 deletion src/Action/DocumentGroup/DocumentGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use ReflectionException;
use SignNow\Api\Entity\DocumentGroup\CreateDocumentGroup;
use SignNow\Api\Entity\DocumentGroup\DocumentGroup as DocumentGroupEntity;
use SignNow\Rest\EntityManager;
use SignNow\Api\Service\EntityManager\EntityManager;
use SignNow\Rest\EntityManager\Exception\EntityManagerException;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Action/DocumentGroup/GroupInvite.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use SignNow\Api\Entity\DocumentGroup\GroupInvite\GroupInvite as GroupInviteEntity;
use SignNow\Api\Entity\DocumentGroup\GroupInvite\ResponseGroupInvite;
use SignNow\Api\Entity\Status;
use SignNow\Rest\EntityManager;
use SignNow\Api\Service\EntityManager\EntityManager;
use SignNow\Rest\EntityManager\Exception\EntityManagerException;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Action/EmbeddedDocumentGroup/EmbeddedGroupInvite.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use SignNow\Api\Entity\Embedded\GroupInvite\DeleteEmbeddedInvites;
use SignNow\Api\Entity\Embedded\GroupInvite\EmbeddedInvites;
use SignNow\Api\Entity\Embedded\GroupInvite\SigningLinkResponse;
use SignNow\Rest\EntityManager;
use SignNow\Api\Service\EntityManager\EntityManager;
use SignNow\Rest\EntityManager\Exception\EntityManagerException;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Action/EmbeddedInvite.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
use SignNow\Api\Entity\Embedded\Invite\EmbeddedInvites;
use SignNow\Api\Entity\Embedded\SigningLink\CreateSigningLink;
use SignNow\Api\Entity\Embedded\SigningLink\SigningLink;
use SignNow\Api\Service\EntityManager\EntityManager;
use SignNow\Api\Service\OAuth\AuthMethod\AuthMethodInterface;
use SignNow\Api\Service\OAuth\AuthMethod\Method\None;
use SignNow\Rest\EntityManager;
use SignNow\Rest\EntityManager\Exception\EntityManagerException;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@

use ReflectionException;
use SignNow\Api\Action\Data\EventSubscription\V2\ActionsList;
use SignNow\Api\Entity\EventSubscription\V2\EventCollection;
use SignNow\Api\Entity\EventSubscription\V2\CreateEventSubscription;
use SignNow\Api\Entity\EventSubscription\V2\DeleteEventSubscription;
use SignNow\Api\Entity\EventSubscription\V2\EventCollection;
use SignNow\Api\Entity\EventSubscription\V2\GetEventSubscriptions;
use SignNow\Api\Entity\EventSubscription\V2\UpdateEventSubscription;
use SignNow\Rest\EntityManager;
use SignNow\Api\Service\EntityManager\EntityManager;
use SignNow\Rest\EntityManager\Exception\EntityManagerException;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use SignNow\Api\Action\Data\EventSubscription\V2\ActionsList;
use SignNow\Api\Entity\EventSubscription\V2\CreateEventSubscription;
use SignNow\Api\Entity\EventSubscription\V2\DeleteEventSubscription;
use SignNow\Rest\EntityManager;
use SignNow\Api\Service\EntityManager\EntityManager;
use SignNow\Rest\EntityManager\Exception\EntityManagerException;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Action/FillSmartFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use ReflectionException;
use SignNow\Api\Entity\Document\SmartField\SmartField;
use SignNow\Api\Entity\Document\SmartField\SmartFieldResponse;
use SignNow\Rest\EntityManager;
use SignNow\Api\Service\EntityManager\EntityManager;
use SignNow\Rest\EntityManager\Exception\EntityManagerException;
use SignNow\Rest\Http\Request;

Expand Down
2 changes: 1 addition & 1 deletion src/Action/Invite/FieldInvite.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use SignNow\Api\Entity\FreeForm\InviteResponse as FreeFormResponse;
use SignNow\Api\Entity\Invite\SigningLinkResponse;
use SignNow\Api\Entity\Invite\SigningLink;
use SignNow\Rest\EntityManager;
use SignNow\Api\Service\EntityManager\EntityManager;
use SignNow\Rest\EntityManager\Exception\EntityManagerException;
use SignNow\Rest\Http\Request;

Expand Down
2 changes: 1 addition & 1 deletion src/Action/MoveDocumentAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use ReflectionException;
use SignNow\Api\Entity\Document\MoveDocument\MoveDocument;
use SignNow\Api\Entity\Document\MoveDocument\MoveDocumentResponse;
use SignNow\Rest\EntityManager;
use SignNow\Api\Service\EntityManager\EntityManager;
use SignNow\Rest\EntityManager\Exception\EntityManagerException;
use SignNow\Rest\Http\Request;

Expand Down
16 changes: 12 additions & 4 deletions src/Action/OAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
namespace SignNow\Api\Action;

use ReflectionException;
use SignNow\Api\Service\EntityManager\EntityManager;
use SignNow\Api\Entity\Auth\Token;
use SignNow\Api\Entity\Auth\TokenRequestPassword;
use SignNow\Api\Service\Factory\EntityManagerFactory;
use SignNow\Api\Service\Factories\TokenFactory;
use SignNow\Rest\EntityManager;
use SignNow\Rest\EntityManager\Exception\EntityManagerException;

/**
Expand All @@ -26,12 +26,18 @@ class OAuth
*/
private $host;

/**
* @var null|string
*/
private $clientName;

/**
* @param string $host
*/
public function __construct(string $host)
public function __construct(string $host, ?string $clientName = null)
{
$this->host = $host;
$this->clientName = $clientName;
}

/**
Expand All @@ -43,7 +49,8 @@ public function basicAuthorization(string $basicToken): EntityManager
{
return (new EntityManagerFactory())->create(
$this->host,
(new TokenFactory())->basicToken($basicToken)
(new TokenFactory())->basicToken($basicToken),
$this->clientName
);
}

Expand All @@ -56,7 +63,8 @@ public function bearerAuthorization(string $bearerToken): EntityManager
{
return (new EntityManagerFactory())->create(
$this->host,
(new TokenFactory())->bearerToken($bearerToken)
(new TokenFactory())->bearerToken($bearerToken),
$this->clientName
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Action/PrefillTextFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use ReflectionException;
use SignNow\Api\Entity\Document\PrefillText\PrefillTextField;
use SignNow\Rest\EntityManager;
use SignNow\Api\Service\EntityManager\EntityManager;
use SignNow\Rest\EntityManager\Exception\EntityManagerException;
use SignNow\Rest\Http\Request;

Expand Down
2 changes: 1 addition & 1 deletion src/Action/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use SignNow\Api\Entity\Document\Document as DocumentEntity;
use SignNow\Api\Entity\Template\Copy as TemplateCopyEntity;
use SignNow\Api\Entity\Template\Template as TemplateEntity;
use SignNow\Rest\EntityManager;
use SignNow\Api\Service\EntityManager\EntityManager;
use SignNow\Rest\EntityManager\Exception\EntityManagerException;

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Action/User/Initial.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use ReflectionException;
use SignNow\Api\Entity\User\Initial as UserInitialEntity;
use SignNow\Api\Entity\User\ImageResponse;
use SignNow\Rest\EntityManager;
use SignNow\Api\Service\EntityManager\EntityManager;
use SignNow\Rest\EntityManager\Exception\EntityManagerException;
use SignNow\Rest\Http\Request;

Expand Down Expand Up @@ -42,7 +42,7 @@ public function __construct(EntityManager $entityManager)
public function upload(string $base64ImageData): ImageResponse
{
$this->entityManager->setUpdateHttpMethod(Request::METHOD_PUT);

return $this->entityManager->update(
new UserInitialEntity($base64ImageData)
);
Expand Down
4 changes: 2 additions & 2 deletions src/Action/User/Signature.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use ReflectionException;
use SignNow\Api\Entity\User\Signature as UserSignatureEntity;
use SignNow\Api\Entity\User\ImageResponse;
use SignNow\Rest\EntityManager;
use SignNow\Api\Service\EntityManager\EntityManager;
use SignNow\Rest\EntityManager\Exception\EntityManagerException;
use SignNow\Rest\Http\Request;

Expand Down Expand Up @@ -42,7 +42,7 @@ public function __construct(EntityManager $entityManager)
public function upload(string $base64ImageData): ImageResponse
{
$this->entityManager->setUpdateHttpMethod(Request::METHOD_PUT);

return $this->entityManager->update(
new UserSignatureEntity($base64ImageData)
);
Expand Down
Loading

0 comments on commit 334ccd4

Please sign in to comment.