instela/instela-php-sdk

There is no license information available for the latest version (dev-master) of this package.

Instela API

dev-master 2016-01-04 22:26 UTC

This package is not auto-updated.

Last update: 2024-11-09 20:22:51 UTC


README

Build Status

Instela API makes accessible almost every method used in Instela. With PHP SDK, you can easily access to all API functions in PHP.

Getting Started

  1. Minimum requirements – To run the SDK, your system will need to meet the [minimum requirements][docs-requirements], including having PHP >= 5.5 compiled with the cURL extension and cURL 7.16.2+ compiled with a TLS backend (e.g., NSS or OpenSSL).
  2. Install the SDK – Using [Composer] is the recommended way to install the AWS SDK for PHP. The SDK is available via [Packagist] under the [instela/instela-php-sdk][install-packagist] package.
  3. Using the SDK – Please read this document to learn how to use the API.

Usage

Available API's

MessagesClient

\Instela\SDK\Messages\MessagesClient

This API is used to interact with the Instela Messaging service.

All methods of this API requires a valid OAuth 2.0 access token.

You can create a new instance for this API you can use the default constructor:

use Instela\SDK\Messages;
$client = MessagesClient(array(
 'token' => 'ACCESS_TOKEN'
));

getThreadList

Gets thread list for the authorized user.

MessagesClient::getThreadList( array $args = array() ): \Instela\SDK\Model\ThreadList

Example:

$threadList = $messageClient->getThreadList(array(
    'page' => 1, // Optional, default = 1
    'per_page' => '25' // Optional, default = 1
));

Return Value:

Returns a thread list object

getThread

Gets the thread for the authorized user.

MessagesClient::getThread( array $args = array() ): \Instela\SDK\Model\Thread

Example:

$thread = $messageClient->getThread(array(
    'u1' => 1,  // User Id of the first participant of the message thread
    'u2' => 50, // User Id of the second participant of the message thread
    'page' => 1, // Optional, default = 1
    'per_page' => '25' // Optional, default = 1
));

Return Value:

Returns a thread object.

sendMessage

Sends message from the account of the authorized user.

MessagesClient::sendMessage( array $args = array() ): \Instela\SDK\Model\Message

Example:

$message = $messageClient->sendMessage(array(
    'receiver' => 1,  // User Id of the receiver
    'message' => "test message", // Message body
));

Return Value:

Returns the sent message.

getMessage

Gets message with given id.

MessagesClient::getMessage( array $args = array() ): \Instela\SDK\Model\Message

Example:

$message = $messageClient->getMessage(array(
    'id' => 1,  // Id of the message
));

Return Value:

Returns the found message.