Skip to content
This repository has been archived by the owner on Dec 17, 2018. It is now read-only.

Latest commit

 

History

History
31 lines (23 loc) · 1.18 KB

api-test.md

File metadata and controls

31 lines (23 loc) · 1.18 KB

api.test

Tests passing and receiving arguments and errors from the Slack API.

Official documentation https://api.slack.com/methods/api.test
Payload class ApiTestPayload
PayloadResponse class ApiTestPayloadResponse

Usage

$apiClient = new ApiClient('your-slack-token-here');
$payload   = new ApiTestPayload();
$payload->addArgument('foo', 'bar');
// or...
// $payload->setError('your-error-to-test-here');

$response  = $apiClient->send($payload);

if ($response->isOk()) {
    $response->getArgument('foo'); // outputs 'bar'
} else {
    // normally, this would indicate something went wrong
    // but with this method you actually test the errors you pass to them

    echo $response->getError(); // outputs 'your-error-to-test-here'
}