Skip to content

Latest commit

 

History

History
375 lines (252 loc) · 11.2 KB

File metadata and controls

375 lines (252 loc) · 11.2 KB

Unifapi\Sdk\HackerNewsApi

All URIs are relative to https://api.unifapi.com, except if the operation defines another base path.

Method HTTP request Description
hackerNewsItemsIdGet() GET /hacker-news/items/{id} Get Hacker News item by ID
hackerNewsMaxItemGet() GET /hacker-news/max-item Get largest Hacker News item ID
hackerNewsStoriesFeedGet() GET /hacker-news/stories/{feed} List Hacker News story IDs
hackerNewsStoriesFeedItemsGet() GET /hacker-news/stories/{feed}/items List Hacker News story items
hackerNewsUpdatesGet() GET /hacker-news/updates Get changed Hacker News items and profiles
hackerNewsUsersIdGet() GET /hacker-news/users/{id} Get Hacker News user by ID

hackerNewsItemsIdGet()

hackerNewsItemsIdGet($id): \Unifapi\\Sdk\Model\HackerNewsItemsIdGet200Response

Get Hacker News item by ID

Fetch a single Hacker News item. Stories, comments, jobs, polls, and poll options share the same item shape.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: bearerAuth
$config = Unifapi\\Sdk\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Unifapi\\Sdk\Api\HackerNewsApi(
    // 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 GuzzleHttp\Client(),
    $config
);
$id = 56; // int | Hacker News item id.

try {
    $result = $apiInstance->hackerNewsItemsIdGet($id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling HackerNewsApi->hackerNewsItemsIdGet: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
id int Hacker News item id.

Return type

\Unifapi\Sdk\Model\HackerNewsItemsIdGet200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

hackerNewsMaxItemGet()

hackerNewsMaxItemGet(): \Unifapi\\Sdk\Model\HackerNewsMaxItemGet200Response

Get largest Hacker News item ID

Returns the current largest Hacker News item id.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: bearerAuth
$config = Unifapi\\Sdk\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Unifapi\\Sdk\Api\HackerNewsApi(
    // 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 GuzzleHttp\Client(),
    $config
);

try {
    $result = $apiInstance->hackerNewsMaxItemGet();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling HackerNewsApi->hackerNewsMaxItemGet: ', $e->getMessage(), PHP_EOL;
}

Parameters

This endpoint does not need any parameter.

Return type

\Unifapi\Sdk\Model\HackerNewsMaxItemGet200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

hackerNewsStoriesFeedGet()

hackerNewsStoriesFeedGet($feed, $cursor, $limit): \Unifapi\\Sdk\Model\HackerNewsStoriesFeedGet200Response

List Hacker News story IDs

List Hacker News story ids from a named feed. Use /hacker-news/items/{id} to fetch item details.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: bearerAuth
$config = Unifapi\\Sdk\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Unifapi\\Sdk\Api\HackerNewsApi(
    // 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 GuzzleHttp\Client(),
    $config
);
$feed = new \Unifapi\\Sdk\Model\\Unifapi\\Sdk\Model\HackerNewsStoryFeed(); // \Unifapi\\Sdk\Model\HackerNewsStoryFeed | Story feed: top, new, best, ask, show, or jobs.
$cursor = 'cursor_example'; // string | Zero-based offset cursor returned as `next_cursor`.
$limit = 100; // int

try {
    $result = $apiInstance->hackerNewsStoriesFeedGet($feed, $cursor, $limit);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling HackerNewsApi->hackerNewsStoriesFeedGet: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
feed \Unifapi\Sdk\Model\HackerNewsStoryFeed Story feed: top, new, best, ask, show, or jobs.
cursor string Zero-based offset cursor returned as `next_cursor`. [optional]
limit int [optional] [default to 100]

Return type

\Unifapi\Sdk\Model\HackerNewsStoriesFeedGet200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

hackerNewsStoriesFeedItemsGet()

hackerNewsStoriesFeedItemsGet($feed, $cursor, $limit): \Unifapi\\Sdk\Model\HackerNewsStoriesFeedItemsGet200Response

List Hacker News story items

Fetch item details from a named Hacker News story feed in one operation. Use this when an agent needs readable story titles, URLs, scores, authors, or comment counts.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: bearerAuth
$config = Unifapi\\Sdk\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Unifapi\\Sdk\Api\HackerNewsApi(
    // 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 GuzzleHttp\Client(),
    $config
);
$feed = new \Unifapi\\Sdk\Model\\Unifapi\\Sdk\Model\HackerNewsStoryFeed(); // \Unifapi\\Sdk\Model\HackerNewsStoryFeed | Story feed: top, new, best, ask, show, or jobs.
$cursor = 'cursor_example'; // string | Zero-based offset cursor returned as `next_cursor`.
$limit = 20; // int

try {
    $result = $apiInstance->hackerNewsStoriesFeedItemsGet($feed, $cursor, $limit);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling HackerNewsApi->hackerNewsStoriesFeedItemsGet: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
feed \Unifapi\Sdk\Model\HackerNewsStoryFeed Story feed: top, new, best, ask, show, or jobs.
cursor string Zero-based offset cursor returned as `next_cursor`. [optional]
limit int [optional] [default to 20]

Return type

\Unifapi\Sdk\Model\HackerNewsStoriesFeedItemsGet200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

hackerNewsUpdatesGet()

hackerNewsUpdatesGet(): \Unifapi\\Sdk\Model\HackerNewsUpdatesGet200Response

Get changed Hacker News items and profiles

Returns recently changed Hacker News item ids and user profile ids.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: bearerAuth
$config = Unifapi\\Sdk\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Unifapi\\Sdk\Api\HackerNewsApi(
    // 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 GuzzleHttp\Client(),
    $config
);

try {
    $result = $apiInstance->hackerNewsUpdatesGet();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling HackerNewsApi->hackerNewsUpdatesGet: ', $e->getMessage(), PHP_EOL;
}

Parameters

This endpoint does not need any parameter.

Return type

\Unifapi\Sdk\Model\HackerNewsUpdatesGet200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

hackerNewsUsersIdGet()

hackerNewsUsersIdGet($id): \Unifapi\\Sdk\Model\HackerNewsUsersIdGet200Response

Get Hacker News user by ID

Fetch a public Hacker News user profile by case-sensitive username.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: bearerAuth
$config = Unifapi\\Sdk\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Unifapi\\Sdk\Api\HackerNewsApi(
    // 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 GuzzleHttp\Client(),
    $config
);
$id = 'id_example'; // string | Case-sensitive Hacker News username.

try {
    $result = $apiInstance->hackerNewsUsersIdGet($id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling HackerNewsApi->hackerNewsUsersIdGet: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
id string Case-sensitive Hacker News username.

Return type

\Unifapi\Sdk\Model\HackerNewsUsersIdGet200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]