mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-07 17:08:48 +00:00
We now use the master branch of codebird
This commit is contained in:
parent
2e776253e0
commit
20ed3495b2
25 changed files with 992 additions and 1464 deletions
46
twitter/vendor/jublonet/codebird-php/README.md
vendored
46
twitter/vendor/jublonet/codebird-php/README.md
vendored
|
@ -1,8 +1,8 @@
|
|||
codebird-php
|
||||
============
|
||||
*Easy access to the Twitter REST API, Collections API, Streaming API, TON (Object Nest) API and Twitter Ads API — all from one PHP library.*
|
||||
*Easy access to the Twitter REST API, Direct Messages API, Account Activity API, TON (Object Nest) API and Twitter Ads API — all from one PHP library.*
|
||||
|
||||
Copyright (C) 2010-2016 Jublo Solutions <support@jublo.net>
|
||||
Copyright (C) 2010-2018 Jublo Limited <support@jublo.net>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,12 +17,13 @@ GNU General Public License for more details.
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
[](https://www.codacy.com/app/jublonet/codebird-php?utm_source=github.com&utm_medium=referral&utm_content=jublonet/codebird-php&utm_campaign=badger)
|
||||
[](https://coveralls.io/github/jublonet/codebird-php?branch=develop)
|
||||
[](https://travis-ci.org/jublonet/codebird-php/branches)
|
||||
|
||||
### Requirements
|
||||
|
||||
- PHP 5.5.0 or higher
|
||||
- PHP 7.1.0 or higher
|
||||
- OpenSSL extension
|
||||
|
||||
|
||||
|
@ -131,6 +132,13 @@ In this case, you don't need to set the consumer key and secret.
|
|||
For sending an API request with app-only auth, see the ‘Usage examples’ section.
|
||||
|
||||
|
||||
### A word on your callback URL
|
||||
|
||||
Twitter is very restrictive about which URLs may be used for your callback URL.
|
||||
For example, even the presence of the ‘www’ subdomain must match with the domain
|
||||
that you specified in the settings of your app at https://developer.twitter.com/en/apps.
|
||||
|
||||
|
||||
Mapping API methods to Codebird function calls
|
||||
----------------------------------------------
|
||||
|
||||
|
@ -240,7 +248,7 @@ The library returns the response HTTP status code, so you can detect rate limits
|
|||
I suggest you to check if the ```$reply->httpstatus``` property is ```400```
|
||||
and check with the Twitter API to find out if you are currently being
|
||||
rate-limited.
|
||||
See the [Rate Limiting FAQ](https://dev.twitter.com/rest/public/rate-limiting)
|
||||
See the [Rate Limiting FAQ](https://developer.twitter.com/en/docs/basics/rate-limiting)
|
||||
for more information.
|
||||
|
||||
Unless your return format is JSON, you will receive rate-limiting details
|
||||
|
@ -325,7 +333,7 @@ print_r($reply);
|
|||
Here is a [sample Tweet](https://twitter.com/LarryMcTweet/status/475276535386365952)
|
||||
sent with the code above.
|
||||
|
||||
More [documentation for uploading media](https://dev.twitter.com/rest/public/uploading-media) is available on the Twitter Developer site.
|
||||
More [documentation for uploading media](https://developer.twitter.com/en/docs/media/upload-media/overview) is available on the Twitter Developer site.
|
||||
|
||||
### Remote files
|
||||
|
||||
|
@ -404,6 +412,9 @@ if ($reply->httpstatus < 200 || $reply->httpstatus > 299) {
|
|||
die();
|
||||
}
|
||||
|
||||
// if you have a field `processing_info` in the reply,
|
||||
// use the STATUS command to check if the video has finished processing.
|
||||
|
||||
// Now use the media_id in a Tweet
|
||||
$reply = $cb->statuses_update([
|
||||
'status' => 'Twitter now accepts video uploads.',
|
||||
|
@ -412,7 +423,7 @@ $reply = $cb->statuses_update([
|
|||
|
||||
```
|
||||
|
||||
**Find more information about [accepted video formats](https://dev.twitter.com/rest/public/uploading-media#videorecs) in the Twitter Developer docs.**
|
||||
**Find more information about [accepted media formats](https://developer.twitter.com/en/docs/media/upload-media/uploading-media/media-best-practices) in the Twitter Developer docs.**
|
||||
|
||||
:warning: When uploading a video in multiple chunks, you may run into an error `The validation of media ids failed.` even though the `media_id` is correct. This is known. Please check back in the [Twitter community forums](https://twittercommunity.com/tags/video).
|
||||
|
||||
|
@ -469,18 +480,22 @@ $cb->setStreamingCallback('some_callback');
|
|||
$GLOBALS['time_start'] = time();
|
||||
|
||||
// Second, start consuming the stream:
|
||||
$reply = $cb->user();
|
||||
$reply = $cb->statuses_filter();
|
||||
|
||||
// See the *Mapping API methods to Codebird function calls* section for method names.
|
||||
// $reply = $cb->statuses_filter('track=Windows');
|
||||
```
|
||||
|
||||
Find more information on the [Streaming API](https://dev.twitter.com/streaming/overview)
|
||||
You should be able to set a timeout for the streaming API using `setTimeout`.
|
||||
In addition, your callback will receive empty messages if no events occur,
|
||||
and you should make your function `return true;` in order to cancel the stream.
|
||||
|
||||
Find more information on the [Streaming API](https://developer.twitter.com/en/docs/tweets/filter-realtime/overview)
|
||||
in the developer documentation website.
|
||||
|
||||
|
||||
Twitter Collections API
|
||||
-----------------------
|
||||
Twitter Collections, Direct Messages and Account Activity APIs
|
||||
--------------------------------------------------------------
|
||||
|
||||
Collections are a type of timeline that you control and can be hand curated
|
||||
and/or programmed using an API.
|
||||
|
@ -490,12 +505,13 @@ often they will be decomposed, efficient objects with information about users,
|
|||
Tweets, and timelines grouped, simplified, and stripped of unnecessary repetition.
|
||||
|
||||
Never care about the OAuth signing specialities and the JSON POST body
|
||||
for POST collections/entries/curate.json. Codebird takes off the work for you
|
||||
for POST and PUT calls to these special APIs. Codebird takes off the work for you
|
||||
and will always send the correct Content-Type automatically.
|
||||
|
||||
Find out more about the [Collections API](https://dev.twitter.com/rest/collections/about) in the Twitter API docs.
|
||||
Find out more about the [Collections API](https://developer.twitter.com/en/docs/tweets/curate-a-collection/overview/about_collections) in the Twitter API docs.
|
||||
More information on the [Direct Messages API](https://developer.twitter.com/en/docs/direct-messages/api-features) and the [Account Activity API](https://developer.twitter.com/en/docs/accounts-and-users/subscribe-account-activity/overview) is available there as well.
|
||||
|
||||
Here’s a sample for adding a Tweet using that API method:
|
||||
Here’s a sample for adding a Tweet using the Collections API:
|
||||
|
||||
```php
|
||||
$reply = $cb->collections_entries_curate([
|
||||
|
@ -511,7 +527,7 @@ var_dump($reply);
|
|||
TON (Twitter Object Nest) API
|
||||
-----------------------------
|
||||
|
||||
The [TON (Twitter Object Nest) API](https://dev.twitter.com/rest/ton) allows implementers to upload media and various assets to Twitter.
|
||||
The [TON (Twitter Object Nest) API](https://developer.twitter.com/en/docs/ads/audiences/overview/ton-upload.html) allows implementers to upload media and various assets to Twitter.
|
||||
The TON API supports non-resumable and resumable upload methods based on the size of the file.
|
||||
For files less than 64MB, non-resumable may be used. For files greater than or equal to 64MB,
|
||||
resumable must be used. Resumable uploads require chunk sizes of less than 64MB.
|
||||
|
@ -597,7 +613,7 @@ fclose($fp);
|
|||
Twitter Ads API
|
||||
---------------
|
||||
|
||||
The [Twitter Ads API](https://dev.twitter.com/ads/overview) allows partners to
|
||||
The [Twitter Ads API](https://developer.twitter.com/en/docs/ads/general/overview) allows partners to
|
||||
integrate with the Twitter advertising platform in their own advertising solutions.
|
||||
Selected partners have the ability to create custom tools to manage and execute
|
||||
Twitter Ad campaigns.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue