Navigation Menu

Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.

messente/messente-phonebook-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Messente Phonebook API

PhonebookApi - PHP client for Messente Phonebook API

Requirements

PHP 5.5 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/messente/messente-phonebook-php.git"
    }
  ],
  "require": {
    "messente/messente-phonebook-php": "*@master"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/vendor/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');
use Messente\Phonebook\Configuration;
use Messente\Phonebook\Api\BlacklistApi;
use GuzzleHttp\Client;

// Configure HTTP basic authorization: basicAuth
$config = Configuration::getDefaultConfiguration()
    ->setUsername('YOUR_MESSENTE_API_USERNAME')
    ->setPassword('YOUR_MESSENTE_API_PASSWORD');

$apiInstance = new BlacklistApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new Client(),
    $config
);

try {
    $response = $apiInstance->fetchBlacklist();
    echo $response;
} catch (Exception $e) {
    echo 'Exception when calling fetchBlacklist: ', $e->getMessage(), PHP_EOL;
}

// try {
//     $apiInstance->addToBlacklist(['phoneNumber' => '+37255555555']);
// } catch (Exception $e) {
//     echo 'Exception when calling addToBlacklist: ', $e->getMessage(), PHP_EOL;
// }

// try {
//     $apiInstance->isBlacklisted('+37255555555');
// } catch (Exception $e) {
//     echo 'Exception when calling isBlacklisted: ', $e->getMessage(), PHP_EOL;
// }


// try {
//     $apiInstance->removeFromBlacklist('+37255555555');
// } catch (Exception $e) {
//     echo 'Exception when calling removeFromBlacklist: ', $e->getMessage(), PHP_EOL;
// }
?>

Documentation for API Endpoints

All URIs are relative to https://api.messente.com/v1

Class Method HTTP request
BlacklistApi addToBlacklist POST /phonebook/blacklist
BlacklistApi fetchBlacklist GET /phonebook/blacklist
BlacklistApi isBlacklisted GET /phonebook/blacklist/{phone_number}
BlacklistApi removeFromBlacklist DELETE /phonebook/blacklist/{phone_number}

Documentation For Models

Documentation For Authorization

basicAuth

  • Type: HTTP basic authentication

Author

messente@messente.com