oscar-team/sproom

php sdk for sproom

v1.0.5 2024-03-05 10:10 UTC

This package is auto-updated.

Last update: 2024-11-05 11:39:30 UTC


README

This is a PHP library for integrating Sproom apis

Installation

Use the package manager composer to install.

composer require oscar-team/sproom

Usage

require __DIR__ . '/vendor/autoload.php';

$client = new \OscarTeam\Sproom\SproomClient(token: 'token', environment: 'test');

Note: Please refer to offical documentation to check the paramets for the api's.

ChildCompany Apis

// Get the list of child companies
$client->childCompanies()->list();

// Create new child company
$client->childCompanies()->create($requestData);

// Delete child company
$client->childCompanies()->delete($childCompanyId);

// Enroll child company
$client->childCompanies()->enroll($requestData);

// Get child company
$client->childCompanies()->get($childCompanyId);

// Get child company token
$client->childCompanies()->getToken($childCompanyId);

Company Apis

// Search for a company in sproom
$client->childCompanies()->search('DK:CVR:1234');

Document Apis

// List all the documents
$client->documents()->list();

// Send document to sproom
$client->documents()->send($filePath);

// Update already sent document
$client->documents()->update($documentId, []);

// Get sent document format
$client->documents()->getFormat($documentId, $format);

// Set response for the document
$client->documents()->setResponse($documentId, []);

// Get response for the document
$client->documents()->getResponse($documentId);

// Set state of the document
$client->documents()->setState($documentId, []);

// Get state of the document
$client->documents()->getState($documentId);

PeppolParticipantVerificarion Apis

// List all the verifications
$client->peppolParticipantVerifications()->list();

// Initiate the verification
$client->peppolParticipantVerifications()->initiate([]);

// Get the verification
$client->peppolParticipantVerifications()->get($verificationId);

// Revoke the verification
$client->peppolParticipantVerifications()->revoke($verificationId);

// Download the verification document
$client->peppolParticipantVerifications()->downloadDocument($verificationId, []);

// Preview the verification document
$client->peppolParticipantVerifications()->previewDocument([]);

Recipients Apis

// Check if the recipients can reveie the document
$client->recipients()->check('DK:CVR:123');

// Bulk check
$client->recipients()->bulkCheck([
  'DK:CVR:123'
]);

Webhook Apis

// List all the webhooks
$client->webhooks()->list();

// Create new webhook
$client->webhooks()->create($requestData);

// Delete webhook
$client->webhooks()->delete($webhookId);

// Update webhook
$client->webhooks()->update($requestData);

// Get webhook
$client->webhooks()->get($webhookId);

// Test webhook
$client->webhooks()->test($webhookId);

Response:

All the apis will return the Saloon response class use Saloon\Http\Response;. Please refer to the offical documentation of saloon for more details.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT