Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rapideinternet/hellohi.apiclient.php
PHP Client for the MKA API
https://github.com/rapideinternet/hellohi.apiclient.php
Last synced: 5 days ago
JSON representation
PHP Client for the MKA API
- Host: GitHub
- URL: https://github.com/rapideinternet/hellohi.apiclient.php
- Owner: rapideinternet
- Created: 2018-02-26T13:35:34.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T11:59:50.000Z (about 1 year ago)
- Last Synced: 2023-12-15T12:56:02.925Z (about 1 year ago)
- Language: PHP
- Size: 51.8 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# hellohi.apiclient
PHP Client for the HelloHi API. This documentation uses the threads endpoint as example. For a a list of available endpionts, please refer to the client documentation. ##url-here-please##.## Setup
```
require_once __DIR__ . '/vendor/autoload.php';use ApiClient\Client;
use ApiClient\Model;Client::init(
"https://api.staging.hellohi.nl/v1/oauth/token",
"https://api.staging.hellohi.nl/v1",
"your-oauth-client-id",
"your-oauth-your-secret",
"[email protected]",
"your-password",
"your-tenant-id"
);
```## get threads with creator includes
```$threads = Model::all('threads', ['creator']);```## get all threads magic with creator includes
```$threads = Model::threads(['creator']);```## find a thread by id static
```$thread = Model::byId('threads', "mjkvxl5qmwza68b9");```## get thread items magic
```$thread->all('items');```## get thread_items magic
```$thread->items; //$thread->items();```## find a thread_item by id
```$thread->byId('items', "mn9vlbrl4w8zjoqx");```## get thread_items with includes
```$items = $thread->items(['participant', 'participant.person']);```
## create a thread
```
$thread->create('threads', [
'subject' => 'Rapportage',
'company_id' => 'kyd9nprax5lajbv3',
'participants' => [
[
'person_id' => '8bkgjnrmdrz63pvd',
'customer_id' => 'kyd9nprax5lajbv3',
'is_admin' => 0
]
],
'dossier_item_groups' => [
[
'dossier_item_group_template_id' => '8bkgjnrmdrz63pvd',
'year' => 2017,
'period' => 'q2'
]
],
'message' => 'branker'
]);
```## update a thread
```
$thread = Model::byId('threads', "kyd9nprax5lajbv3");
$thread->update([
'subject' => 'Some subject'
]);
```## update a thread message with endpoint override
Sometimes it is necessary to override endpoints when using polymorphic relations. For example. Thread messages are fetched using their polymorphic master class 'item' trough /threads/{id}/items, but updated using their own endpoint /threads/{id}/messages.```
$thread->all('items')[0]
->setEndpoint('messages')
->update(['message' => 'Different message']);
```## delete a thread
```$thread->delete();```