2017 © Pedro Peláez
 

library apple-news-api

Push content to Apple News.

image

chapter-three/apple-news-api

Push content to Apple News.

  • Tuesday, February 14, 2017
  • by chapter-three
  • Repository
  • 20 Watchers
  • 28 Stars
  • 14,577 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 9 Open issues
  • 28 Versions
  • 24 % Grown

The README.md

AppleNewsAPI

Travis CI build status, (*1)

AppleNewsAPI\PublisherAPI is a PHP library that allows you to publish content to Apple News. You can also retrieve and delete articles you’ve already published, and get basic information about your channel and sections., (*2)

AppleNewsAPI\Document is a PHP library that helps construct documents in the Apple News JSON format., (*3)

API Documentation, (*4)

Installation

composer require chapter-three/apple-news-api

or, (*5)

git clone git@github.com:chapter-three/AppleNewsAPI.git
cd AppleNewsAPI
curl -sS https://getcomposer.org/installer | php
./composer.phar install

Document class Quick Start and Examples

use ChapterThree\AppleNewsAPI\Document;
use ChapterThree\AppleNewsAPI\Document\Components\Body;
use ChapterThree\AppleNewsAPI\Document\Layouts\Layout;
use ChapterThree\AppleNewsAPI\Document\Styles\ComponentTextStyle;

$obj = new Document(uniqid(), 'title', 'en', new Layout(7, 1024));
$obj->addComponent(new Body('body text'))
  ->addComponentTextStyle('default', new ComponentTextStyle());

$json = $obj->json();

PublisherAPI class Quick Start and Examples

$api_key_id = "";
$api_key_secret = "";
$endpoint = "https://endpoint_url";

$PublisherAPI = new ChapterThree\AppleNewsAPI\PublisherAPI(
  $api_key_id,
  $api_key_secret,
  $endpoint
);
GET Channel
// Fetches information about a channel.
$response = $PublisherAPI->get('/channels/{channel_id}',
  [
    'channel_id' => CHANNEL_ID
  ]
);
GET Sections
// Fetches a list of all sections for a channel.
$response = $PublisherAPI->get('/channels/{channel_id}/sections',
  [
    'channel_id' => CHANNEL_ID
  ]
);
GET Section
// Fetches information about a single section.
$response = $PublisherAPI->get('/sections/{section_id}',
  [
    'section_id' => SECTION_ID
  ]
);
GET Article
// Fetches an article.
$response = $PublisherAPI->get('/articles/{article_id}',
  [
    'article_id' => ARTICLE_ID
  ]
);
POST Article
// Publishes a new article to a channel.
// $response contains an article ID and revision ID.
$response = $PublisherAPI->post('/channels/{channel_id}/articles',
  [
    'channel_id' => CHANNEL_ID
  ],
  [
    // List of files to POST
    'files' => [], // optional. A list of article assets [uri => path]
    // JSON metadata string
    'metadata' => $metadata, // required
    'json' => '', // required. Apple News Native formatted JSON string.
  ]
);
UPDATE Article
// Metadata information `revision` is required.
$metadata = json_encode([
  'data' => [
    'revision' => REVISION_ID
  ]
]);
// Updates an existing article.
// See $response variable to get a new revision ID.
$response = $PublisherAPI->post('/articles/{article_id}',
  [
    'article_id' => ARTICLE_ID
  ],
  [
    // List of files to POST
    'files' => [], // optional. A list of article assets [uri => path]
    // JSON metadata string
    'metadata' => $metadata, // required
    // Apple News Native formatted JSON string. See examples.
    'json' => '', // required.
  ]
);
DELETE Article
// Deletes an article.
$response = $PublisherAPI->delete('/articles/{article_id}',
  [
    'article_id' => ARTICLE_ID
  ]
);

Contribute

Run Unit Tests

./vendor/bin/phpunit -v --colors=auto --bootstrap vendor/autoload.php tests

To test PublisherAPI GET/POST/DELETE methods use the following pattern:, (*6)

./vendor/bin/phpunit -v --colors=auto --bootstrap vendor/autoload.php
tests/PublisherAPITest.php [API_KEY] [API_SECRET] [ENDPOINT_URL] [METHOD] [ENDPOINT_PATH]

Generate PHPDoc

git clone --branch gh-pages git@github.com:chapter-three/AppleNewsAPI.git ../AppleNewsAPI_phpdoc
./vendor/bin/phpdoc run --title='chapter-three/apple-news-api v'$(cat composer.json | jq -r '.version') -d ./ -i vendor/,tests/ -t ../AppleNewsAPI_phpdoc

The Versions

14/02 2017

dev-master

9999999-dev https://github.com/chapter-three/AppleNewsAPI

Push content to Apple News.

  Sources   Download

MIT

The Requires

 

The Development Requires

api apple push news

15/11 2016

0.3.9

0.3.9.0 https://github.com/chapter-three/AppleNewsAPI

Push content to Apple News.

  Sources   Download

MIT

The Requires

 

The Development Requires

api apple push news

28/10 2015

0.3.8

0.3.8.0 https://github.com/chapter-three/AppleNewsAPI

Push content to Apple News.

  Sources   Download

GPL

The Requires

 

The Development Requires

api apple push news

28/09 2015

0.3.7

0.3.7.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

26/09 2015

0.3.6

0.3.6.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

18/09 2015

0.3.5

0.3.5.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

11/09 2015

0.3.4

0.3.4.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

03/09 2015

0.3.3

0.3.3.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

31/08 2015

0.3.2

0.3.2.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

21/08 2015

0.3.1

0.3.1.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

20/08 2015

0.3.0

0.3.0.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

18/08 2015

0.2.9

0.2.9.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

17/08 2015

0.2.8

0.2.8.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

17/08 2015

0.2.7

0.2.7.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

16/08 2015

0.2.6

0.2.6.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

15/08 2015

0.2.5

0.2.5.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

14/08 2015

0.2.4

0.2.4.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

13/08 2015

0.2.3

0.2.3.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

13/08 2015

0.2.2

0.2.2.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

13/08 2015

0.2.1

0.2.1.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

12/08 2015

0.2.0

0.2.0.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

09/08 2015

0.1.7

0.1.7.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

03/08 2015

0.1.6

0.1.6.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

29/07 2015

0.1.5

0.1.5.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

21/07 2015

0.1.4

0.1.4.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

20/07 2015

0.1.3

0.1.3.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

15/07 2015

0.1.2

0.1.2.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires

15/07 2015

0.1.0

0.1.0.0

Push content to Apple News.

  Sources   Download

The Requires

 

The Development Requires