2017 © Pedro Peláez
 

project buffer-alpaca

image

cloudkserg/buffer-alpaca

  • Friday, January 19, 2018
  • by maketas
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 75 % Grown

The README.md

buffer-php

Buffer API library client for PHP, (*1)

This library is generated by alpaca, (*2)

Installation

Make sure you have composer installed., (*3)

Add the following to your composer.json, (*4)

{
    "require": {
        "cloudkserg/buffer-alpaca": "*"
    }
}

Update your dependencies, (*5)

$ php composer.phar update

This package follows the PSR-0 convention names for its classes, which means you can easily integrate these classes loading in your own autoloader., (*6)

Usage

<?php

// This file is generated by Composer
require_once 'vendor/autoload.php';

// Then we instantiate a client (as shown below)

Build a client

Without any authentication
$client = new Buffer\Client();

// If you need to send options
$client = new Buffer\Client(array(), $options);
Oauth acess token
$client = new Buffer\Client('1a2b3', $options);
Oauth client secret
$auth = array('client_id' => '09a8b7', 'client_secret' => '1a2b3');

$client = new Buffer\Client($auth, $options);

Response information

$response = $client->klass('args')->method('args');

$response->body;
// >>> 'Hello world!'

$response->code;
// >>> 200

$response->headers;
// >>> array('content-type' => 'text/html')
HTML response
$response->body;
// >>> 'The username is pksunkara!'
JSON response
$response->body;
// >>> array('user' => 'pksunkara')

Request body information

RAW request
$body = 'username=pksunkara';
FORM request
$body = array('user' => 'pksunkara');

Client Options

The following options are available while instantiating a client:, (*7)

  • base: Base url for the api
  • api_version: Default version of the api (to be used in url)
  • user_agent: Default user-agent for all requests
  • headers: Default headers for all requests
  • request_type: Default format of the request body
  • response_type: Default format of the response (to be used in url suffix)

Method Options

The following options are available while calling a method of an api:, (*8)

  • api_version: Version of the api (to be used in url)
  • headers: Headers for the request
  • query: Query parameters for the url
  • body: Body of the request
  • request_type: Format of the request body
  • response_type: Format of the response (to be used in url suffix)

Information api

Returns api instance to get auxilary information about Buffer useful when creating your app., (*9)

$info = $client->info();
Services and configuration (GET /info/configuration)

Returns an object with the current configuration that Buffer is using, including supported services, their icons and the varying limits of character and schedules., (*10)

$response = $info->show($options);

Authenticated user api

Returns authenticated user api instance., (*11)

$user = $client->user();
User information (GET /user)

Returns information about the authenticated user., (*12)

$response = $user->show($options);
List of user's social profiles (GET /profiles)

Returns an array of social media profiles connected to the authenticated users account., (*13)

$response = $user->profiles($options);
Create a social update (POST /updates/create)

Create one or more new status updates., (*14)

The following arguments are required:, (*15)

  • text: The status update text.
  • profile_ids: An array of profile id's that the status update should be sent to. Invalid profile_id's will be silently ignored.
$response = $user->createUpdate("This is an example update", array(
    "4eb854340acb04e870000010",
    "4eb9276e0acb04bb81000067"
), $options);

Returns api instance to get information about links shared through Buffer., (*16)

$link = $client->link();

Returns an object with a the numbers of shares a link has had using Buffer., (*17)

The following arguments are required:, (*18)

  • url: URL of the page for which the number of shares is requested.
$response = $link->shares("http://bufferapp.com", $options);

Social profiles api

Returns a social media profile api instance., (*19)

The following arguments are required:, (*20)

  • id: Identifier of a social media profile
$profile = $client->profile("519fc3ca4d5e93901900002f");
Get this social profile (GET /profiles/:id)

Returns details of the single specified social media profile., (*21)

$response = $profile->show($options);
List profile's pending updates (GET /profiles/:id/updates/pending)

Returns an array of updates that are currently in the buffer for an individual social media profile., (*22)

$response = $profile->pending($options);
List profile's sent updates (GET /profiles/:id/updates/sent)

Returns an array of updates that have been sent from the buffer for an individual social media profile., (*23)

$response = $profile->sent($options);
Edit profile's updates order (POST /profiles/:id/updates/reorder)

Edit the order at which statuses for the specified social media profile will be sent out of the buffer., (*24)

The following arguments are required:, (*25)

  • order: An ordered array of status update id's. This can be a partial array in combination with the offset parameter or a full array of every update in the profiles Buffer.
$response = $profile->reorder(array(
    "4eb854340acb04e870000010",
    "4eb9276e0acb04bb81000067",
    "4eb2567e0ade04ba51000001"
), $options);
Shuffle profile's updates (POST /profiles/:id/updates/shuffle)

Randomize the order at which statuses for the specified social media profile will be sent out of the buffer., (*26)

$response = $profile->shuffle($options);

Posting schedules api

Returns scheduling api instance for social media profile., (*27)

The following arguments are required:, (*28)

  • id: Identifier of a social media profile
$schedule = $client->schedule("519fc3ca4d5e93901900002f");
Get profile's posting schedules (GET /profiles/:id/schedules)

Returns details of the posting schedules associated with a social media profile., (*29)

$response = $schedule->list($options);
Update profile's posting schedules (POST /profiles/:id/schedules/update)

Set the posting schedules for the specified social media profile., (*30)

The following arguments are required:, (*31)

  • schedules: Each item in the array is an individual posting schedule which consists of days and times to match the format return by the above method.
$response = $schedule->update(array(
    array(
        'days' => array(
            "mon",
            "tue",
            "thu"
        ),
        'times' => array(
            "12:45",
            "15:30",
            "17:43"
        )
    )
), $options);

Social updates api

Returns a social media update api instance., (*32)

The following arguments are required:, (*33)

  • id: Identifier of a social media update
$update = $client->update("4eb8565e0acb04bb82000004");
Get this social update (GET /updates/:id)

Returns a single social media update., (*34)

$response = $update->show($options);
List interactions of the update (GET /updates/:id/interactions)

Returns the detailed information on individual interactions with the social media update such as favorites, retweets and likes., (*35)

$response = $update->interactions($options);
Edit this update (POST /updates/:id/update)

Edit an existing, individual status update., (*36)

The following arguments are required:, (*37)

  • text: The status update text.
$response = $update->update("This is an edited update", $options);
Share this update (POST /updates/:id/share)

Immediately shares a single pending update and recalculates times for updates remaining in the queue., (*38)

$response = $update->share($options);
Delete this update (POST /updates/:id/destroy)

Permanently delete an existing status update., (*39)

$response = $update->destroy($options);
Move this update to top (POST /updates/:id/move_to_top)

Move an existing status update to the top of the queue and recalculate times for all updates in the queue. Returns the update with its new posting time., (*40)

$response = $update->top($options);

Contributors

Here is a list of [Contributors]((https://github.com/alpaca-api/buffer-php/contributors), (*41)

TODO

License

MIT, (*42)

Bug Reports

Report here., (*43)

Contact

Pavan Kumar Sunkara (pavan.sss1991@gmail.com), (*44)

The Versions

19/01 2018

dev-master

9999999-dev

  Sources   Download

MIT

The Requires