apideck-libraries / sdk-php
Requires
- php: ^8.2
- brick/date-time: ^0.7.0
- brick/math: ^0.12.1
- galbar/jsonpath: ^3.0
- guzzlehttp/guzzle: ^7.0
- phpdocumentor/type-resolver: ^1.8
- speakeasy/serializer: ^4.0.0
Requires (Dev)
- laravel/pint: ^1.18.1
- phpstan/phpstan: ^1.12
- phpunit/phpunit: ^10
- rector/rector: ^0.19
- roave/security-advisories: dev-latest
This package is auto-updated.
Last update: 2024-12-13 10:44:48 UTC
README
Developer-friendly & type-safe Php SDK specifically catered to leverage apideck-libraries/sdk-php API.
Important
This SDK is not yet ready for production use. To complete setup please follow the steps outlined in your workspace. Delete this section before > publishing to a package manager.
Summary
Apideck: The Apideck OpenAPI Spec: SDK Optimized
For more information about the API: Apideck Developer Docs
Table of Contents
SDK Installation
The SDK relies on Composer to manage its dependencies.
To install the SDK and add it as a dependency to an existing composer.json
file:
composer require "apideck-libraries/sdk-php"
SDK Example Usage
Example
declare(strict_types=1); require 'vendor/autoload.php'; use Apideck\Unify; use Apideck\Unify\Models\Components; use Apideck\Unify\Models\Operations; $security = '<YOUR_BEARER_TOKEN_HERE>'; $sdk = Unify\Apideck::builder() ->setConsumerId('test-consumer') ->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX') ->setSecurity($security)->build(); $request = new Operations\AccountingTaxRatesAllRequest( serviceId: 'salesforce', filter: new Components\TaxRatesFilter( assets: true, equity: true, expenses: true, liabilities: true, revenue: true, ), passThrough: [ 'search' => 'San Francisco', ], fields: 'id,updated_at', ); $response = $sdk->accounting->taxRates->list( request: $request ); if ($response->getTaxRatesResponse !== null) { // handle response }
Available Resources and Operations
Available methods
accounting
accounting->agedCreditors
- get - Get Aged Creditors
accounting->agedDebtors
- get - Get Aged Debtors
accounting->attachments
- list - List Attachments
- get - Get Attachment
- delete - Delete Attachment
- download - Download Attachment
accounting->balanceSheet
- get - Get BalanceSheet
accounting->billPayments
- list - List Bill Payments
- create - Create Bill Payment
- get - Get Bill Payment
- update - Update Bill Payment
- delete - Delete Bill Payment
accounting->bills
accounting->companyInfo
- get - Get company info
accounting->creditNotes
- list - List Credit Notes
- create - Create Credit Note
- get - Get Credit Note
- update - Update Credit Note
- delete - Delete Credit Note
accounting->customers
- list - List Customers
- create - Create Customer
- get - Get Customer
- update - Update Customer
- delete - Delete Customer
accounting->departments
- list - List Departments
- create - Create Department
- get - Get Department
- update - Update Department
- delete - Delete Department
accounting->expenses
- list - List Expenses
- create - Create Expense
- get - Get Expense
- update - Update Expense
- delete - Delete Expense
accounting->invoiceItems
- list - List Invoice Items
- create - Create Invoice Item
- get - Get Invoice Item
- update - Update Invoice Item
- delete - Delete Invoice Item
accounting->invoices
- list - List Invoices
- create - Create Invoice
- get - Get Invoice
- update - Update Invoice
- delete - Delete Invoice
accounting->journalEntries
- list - List Journal Entries
- create - Create Journal Entry
- get - Get Journal Entry
- update - Update Journal Entry
- delete - Delete Journal Entry
accounting->ledgerAccounts
- list - List Ledger Accounts
- create - Create Ledger Account
- get - Get Ledger Account
- update - Update Ledger Account
- delete - Delete Ledger Account
accounting->locations
- list - List Locations
- create - Create Location
- get - Get Location
- update - Update Location
- delete - Delete Location
accounting->payments
- list - List Payments
- create - Create Payment
- get - Get Payment
- update - Update Payment
- delete - Delete Payment
accounting->profitAndLoss
- get - Get Profit and Loss
accounting->purchaseOrders
- list - List Purchase Orders
- create - Create Purchase Order
- get - Get Purchase Order
- update - Update Purchase Order
- delete - Delete Purchase Order
accounting->subsidiaries
- list - List Subsidiaries
- create - Create Subsidiary
- get - Get Subsidiary
- update - Update Subsidiary
- delete - Delete Subsidiary
accounting->suppliers
- list - List Suppliers
- create - Create Supplier
- get - Get Supplier
- update - Update Supplier
- delete - Delete Supplier
accounting->taxRates
- list - List Tax Rates
- create - Create Tax Rate
- get - Get Tax Rate
- update - Update Tax Rate
- delete - Delete Tax Rate
accounting->trackingCategories
- list - List Tracking Categories
- create - Create Tracking Category
- get - Get Tracking Category
- update - Update Tracking Category
- delete - Delete Tracking Category
ats
ats->applicants
- list - List Applicants
- create - Create Applicant
- get - Get Applicant
- update - Update Applicant
- delete - Delete Applicant
ats->applications
- list - List Applications
- create - Create Application
- get - Get Application
- update - Update Application
- delete - Delete Application
ats->jobs
connector
connector->apiResourceCoverage
- get - Get API Resource Coverage
connector->apiResources
- get - Get API Resource
connector->apis
connector->connectorDocs
- get - Get Connector Doc content
connector->connectorResources
- get - Get Connector Resource
connector->connectors
crm
crm->activities
- list - List activities
- create - Create activity
- get - Get activity
- update - Update activity
- delete - Delete activity
crm->companies
- list - List companies
- create - Create company
- get - Get company
- update - Update company
- delete - Delete company
crm->contacts
- list - List contacts
- create - Create contact
- get - Get contact
- update - Update contact
- delete - Delete contact
crm->leads
crm->notes
crm->opportunities
- list - List opportunities
- create - Create opportunity
- get - Get opportunity
- update - Update opportunity
- delete - Delete opportunity
crm->pipelines
- list - List pipelines
- create - Create pipeline
- get - Get pipeline
- update - Update pipeline
- delete - Delete pipeline
crm->users
ecommerce
ecommerce->customers
ecommerce->orders
ecommerce->products
ecommerce->stores
- get - Get Store
fileStorage
fileStorage->driveGroups
- list - List DriveGroups
- create - Create DriveGroup
- get - Get DriveGroup
- update - Update DriveGroup
- delete - Delete DriveGroup
fileStorage->drives
- list - List Drives
- create - Create Drive
- get - Get Drive
- update - Update Drive
- delete - Delete Drive
fileStorage->files
- list - List Files
- search - Search Files
- get - Get File
- update - Rename or move File
- delete - Delete File
- download - Download File
- export - Export File
fileStorage->folders
- create - Create Folder
- get - Get Folder
- update - Rename or move Folder
- delete - Delete Folder
- copy - Copy Folder
fileStorage->sharedLinks
- list - List SharedLinks
- create - Create Shared Link
- get - Get Shared Link
- update - Update Shared Link
- delete - Delete Shared Link
fileStorage->uploadSessions
- create - Start Upload Session
- get - Get Upload Session
- delete - Abort Upload Session
- finish - Finish Upload Session
hris
hris->companies
- list - List Companies
- create - Create Company
- get - Get Company
- update - Update Company
- delete - Delete Company
hris->departments
- list - List Departments
- create - Create Department
- get - Get Department
- update - Update Department
- delete - Delete Department
hris->employeePayrolls
hris->employees
- list - List Employees
- create - Create Employee
- get - Get Employee
- update - Update Employee
- delete - Delete Employee
hris->employeeSchedules
- list - List Employee Schedules
hris->payrolls
hris->timeOffRequests
- list - List Time Off Requests
- create - Create Time Off Request
- get - Get Time Off Request
- update - Update Time Off Request
- delete - Delete Time Off Request
issueTracking
issueTracking->collections
issueTracking->collectionTags
- list - List Tags
issueTracking->collectionTicketComments
- list - List Comments
- create - Create Comment
- get - Get Comment
- update - Update Comment
- delete - Delete Comment
issueTracking->collectionTickets
- list - List Tickets
- create - Create Ticket
- get - Get Ticket
- update - Update Ticket
- delete - Delete Ticket
issueTracking->collectionUsers
sms
sms->messages
- list - List Messages
- create - Create Message
- get - Get Message
- update - Update Message
- delete - Delete Message
vault
vault->connectionCustomMappings
- list - List connection custom mappings
vault->connections
- list - Get all connections
- get - Get connection
- update - Update connection
- delete - Deletes a connection
- imports - Import connection
- token - Authorize Access Token
vault->connectionSettings
vault->consumerRequestCounts
- list - Consumer request counts
vault->consumers
- create - Create consumer
- list - Get all consumers
- get - Get consumer
- update - Update consumer
- delete - Delete consumer
vault->createCallback
- state - Create Callback State
vault->customFields
- list - Get resource custom fields
vault->customMappings
- list - List custom mappings
vault->logs
- list - Get all consumer request logs
vault->sessions
- create - Create Session
vault->validateConnection
- state - Validate Connection State
webhook
webhook->webhooks
Error Handling
Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception.
By default an API error will raise a Errors\APIException
exception, which has the following properties:
When custom error responses are specified for an operation, the SDK may also throw their associated exception. You can refer to respective Errors tables in SDK docs for more details on possible exception types for each operation. For example, the list
method throws the following exceptions:
Example
declare(strict_types=1); require 'vendor/autoload.php'; use Apideck\Unify; use Apideck\Unify\Models\Components; use Apideck\Unify\Models\Operations; $security = '<YOUR_BEARER_TOKEN_HERE>'; $sdk = Unify\Apideck::builder() ->setConsumerId('test-consumer') ->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX') ->setSecurity($security)->build(); try { $request = new Operations\AccountingTaxRatesAllRequest( serviceId: 'salesforce', filter: new Components\TaxRatesFilter( assets: true, equity: true, expenses: true, liabilities: true, revenue: true, ), passThrough: [ 'search' => 'San Francisco', ], fields: 'id,updated_at', ); $response = $sdk->accounting->taxRates->list( request: $request ); if ($response->getTaxRatesResponse !== null) { // handle response } } catch (Errors\BadRequestResponseThrowable $e) { // handle $e->$container data throw $e; } catch (Errors\UnauthorizedResponseThrowable $e) { // handle $e->$container data throw $e; } catch (Errors\PaymentRequiredResponseThrowable $e) { // handle $e->$container data throw $e; } catch (Errors\NotFoundResponseThrowable $e) { // handle $e->$container data throw $e; } catch (Errors\UnprocessableResponseThrowable $e) { // handle $e->$container data throw $e; } catch (Errors\APIException $e) { // handle default exception throw $e; }
Server Selection
Override Server URL Per-Client
The default server can also be overridden globally using the setServerUrl(string $serverUrl)
builder method when initializing the SDK client instance. For example:
declare(strict_types=1); require 'vendor/autoload.php'; use Apideck\Unify; use Apideck\Unify\Models\Components; use Apideck\Unify\Models\Operations; $security = '<YOUR_BEARER_TOKEN_HERE>'; $sdk = Unify\Apideck::builder() ->setServerURL('https://unify.apideck.com') ->setConsumerId('test-consumer') ->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX') ->setSecurity($security)->build(); $request = new Operations\AccountingTaxRatesAllRequest( serviceId: 'salesforce', filter: new Components\TaxRatesFilter( assets: true, equity: true, expenses: true, liabilities: true, revenue: true, ), passThrough: [ 'search' => 'San Francisco', ], fields: 'id,updated_at', ); $response = $sdk->accounting->taxRates->list( request: $request ); if ($response->getTaxRatesResponse !== null) { // handle response }
Override Server URL Per-Operation
The server URL can also be overridden on a per-operation basis, provided a server list was specified for the operation. For example:
declare(strict_types=1); require 'vendor/autoload.php'; use Apideck\Unify; use Apideck\Unify\Models\Components; use Apideck\Unify\Models\Operations; $security = '<YOUR_BEARER_TOKEN_HERE>'; $sdk = Unify\Apideck::builder() ->setConsumerId('test-consumer') ->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX') ->setSecurity($security)->build(); $request = new Operations\FileStorageUploadSessionsAddRequest( createUploadSessionRequest: new Components\CreateUploadSessionRequest( name: 'Documents', parentFolderId: '1234', driveId: '1234', size: 1810673, passThrough: [ new Components\PassThroughBody( serviceId: '<id>', extendPaths: [ new Components\ExtendPaths( path: '$.nested.property', value: [ 'TaxClassificationRef' => [ 'value' => 'EUC-99990201-V1-00020000', ], ], ), ], ), ], ), serviceId: 'salesforce', ); $response = $sdk->fileStorage->uploadSessions->create( request: $request, 'https://upload.apideck.com' ); if ($response->createUploadSessionResponse !== null) { // handle response }
Development
Maturity
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
Contributions
While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.