O3PO_Buffer
in package
Encapsulates the interface with the external service Buffer.com.
Provides methods to interface with Buffer.com.
Tags
Table of Contents
Methods
- create_update() : bool|WP_Error
- Http post meta data to Buffer.
- get_profile_information() : array<string|int, mixed>|WP_Error
- Get a list of services and profiles that are accessible via a given acces token.
Methods
create_update()
Http post meta data to Buffer.
public
static create_update(string $buffer_url, string $access_token, array<string|int, mixed>|string $profile_ids[, string $text = '' ][, array<string|int, mixed> $media = array() ][, bool $attachment = true ][, bool $shorten = false ][, bool $now = false ][, bool $top = false ][, int $timeout = 15 ]) : bool|WP_Error
Schedule a social media update via Buffer.com's api. For more information see here https://buffer.com/developers/api/updates
Parameters
- $buffer_url : string
-
Url of the Buffer.com api.
- $access_token : string
-
Access token.
- $profile_ids : array<string|int, mixed>|string
-
An array of Buffer profile id’s of an individual id that the status update should be sent to.
- $text : string = ''
-
The status update text.
- $media : array<string|int, mixed> = array()
-
An associative array of media to be attached to the update containing some of the following parameters: link, description, title, picture, photo, thumbnail.
- $attachment : bool = true
-
Whether a link in the text should automatically populate the media parameter if media is empty.
- $shorten : bool = false
-
If shorten is false links within the text will not be automatically shortened, otherwise they will.
- $now : bool = false
-
If now is set, this update will be sent immediately to all profiles instead of being added to the buffer.
- $top : bool = false
-
If top is set, this update will be added to the top of the buffer and will become the next update sent.
- $timeout : int = 15
-
Maximum number of seconds to wait for a response (default 15 seconds).
Tags
Return values
bool|WP_Error —Returns true on success or a WP_Error in case an error occurred.
get_profile_information()
Get a list of services and profiles that are accessible via a given acces token.
public
static get_profile_information(string $buffer_api_url, string $access_token[, int $timeout = 2 ]) : array<string|int, mixed>|WP_Error
Parameters
- $buffer_api_url : string
-
Url of the Buffer.com api.
- $access_token : string
-
Access token.
- $timeout : int = 2
-
Timeout of the request in seconds (default 2 seconds)
Tags
Return values
array<string|int, mixed>|WP_Error —An array of associative array with fields 'srevice' and 'id' containing the service names and corresponding ids.