Skip to content

Latest commit

 

History

History
532 lines (380 loc) · 17.9 KB

File metadata and controls

532 lines (380 loc) · 17.9 KB

unifapi.HackerNewsApi

All URIs are relative to https://api.unifapi.com

Method HTTP request Description
hacker_news_items_id_get GET /hacker-news/items/{id} Get Hacker News item by ID
hacker_news_max_item_get GET /hacker-news/max-item Get largest Hacker News item ID
hacker_news_stories_feed_get GET /hacker-news/stories/{feed} List Hacker News story IDs
hacker_news_stories_feed_items_get GET /hacker-news/stories/{feed}/items List Hacker News story items
hacker_news_updates_get GET /hacker-news/updates Get changed Hacker News items and profiles
hacker_news_users_id_get GET /hacker-news/users/{id} Get Hacker News user by ID

hacker_news_items_id_get

HackerNewsItemsIdGet200Response hacker_news_items_id_get(id)

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

  • Bearer Authentication (bearerAuth):
import unifapi
from unifapi.models.hacker_news_items_id_get200_response import HackerNewsItemsIdGet200Response
from unifapi.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.unifapi.com
# See configuration.py for a list of all supported configuration parameters.
configuration = unifapi.Configuration(
    host = "https://api.unifapi.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: bearerAuth
configuration = unifapi.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with unifapi.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = unifapi.HackerNewsApi(api_client)
    id = 56 # int | Hacker News item id.

    try:
        # Get Hacker News item by ID
        api_response = api_instance.hacker_news_items_id_get(id)
        print("The response of HackerNewsApi->hacker_news_items_id_get:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling HackerNewsApi->hacker_news_items_id_get: %s\n" % e)

Parameters

Name Type Description Notes
id int Hacker News item id.

Return type

HackerNewsItemsIdGet200Response

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 OK -
400 Validation or invalid-id error -
401 Missing, invalid, disabled, revoked, or expired UnifAPI API key -
402 Insufficient workspace credits -
404 Resource not found -
429 Rate limited -
500 Internal error -
502 Source error -
503 Source unavailable -

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

hacker_news_max_item_get

HackerNewsMaxItemGet200Response hacker_news_max_item_get()

Get largest Hacker News item ID

Returns the current largest Hacker News item id.

Example

  • Bearer Authentication (bearerAuth):
import unifapi
from unifapi.models.hacker_news_max_item_get200_response import HackerNewsMaxItemGet200Response
from unifapi.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.unifapi.com
# See configuration.py for a list of all supported configuration parameters.
configuration = unifapi.Configuration(
    host = "https://api.unifapi.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: bearerAuth
configuration = unifapi.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with unifapi.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = unifapi.HackerNewsApi(api_client)

    try:
        # Get largest Hacker News item ID
        api_response = api_instance.hacker_news_max_item_get()
        print("The response of HackerNewsApi->hacker_news_max_item_get:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling HackerNewsApi->hacker_news_max_item_get: %s\n" % e)

Parameters

This endpoint does not need any parameter.

Return type

HackerNewsMaxItemGet200Response

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 OK -
400 Validation or invalid-id error -
401 Missing, invalid, disabled, revoked, or expired UnifAPI API key -
402 Insufficient workspace credits -
404 Resource not found -
429 Rate limited -
500 Internal error -
502 Source error -
503 Source unavailable -

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

hacker_news_stories_feed_get

HackerNewsStoriesFeedGet200Response hacker_news_stories_feed_get(feed, cursor=cursor, limit=limit)

List Hacker News story IDs

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

Example

  • Bearer Authentication (bearerAuth):
import unifapi
from unifapi.models.hacker_news_stories_feed_get200_response import HackerNewsStoriesFeedGet200Response
from unifapi.models.hacker_news_story_feed import HackerNewsStoryFeed
from unifapi.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.unifapi.com
# See configuration.py for a list of all supported configuration parameters.
configuration = unifapi.Configuration(
    host = "https://api.unifapi.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: bearerAuth
configuration = unifapi.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with unifapi.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = unifapi.HackerNewsApi(api_client)
    feed = unifapi.HackerNewsStoryFeed() # HackerNewsStoryFeed | Story feed: top, new, best, ask, show, or jobs.
    cursor = 'cursor_example' # str | Zero-based offset cursor returned as `next_cursor`. (optional)
    limit = 100 # int |  (optional) (default to 100)

    try:
        # List Hacker News story IDs
        api_response = api_instance.hacker_news_stories_feed_get(feed, cursor=cursor, limit=limit)
        print("The response of HackerNewsApi->hacker_news_stories_feed_get:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling HackerNewsApi->hacker_news_stories_feed_get: %s\n" % e)

Parameters

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

Return type

HackerNewsStoriesFeedGet200Response

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 OK -
400 Validation or invalid-id error -
401 Missing, invalid, disabled, revoked, or expired UnifAPI API key -
402 Insufficient workspace credits -
404 Resource not found -
429 Rate limited -
500 Internal error -
502 Source error -
503 Source unavailable -

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

hacker_news_stories_feed_items_get

HackerNewsStoriesFeedItemsGet200Response hacker_news_stories_feed_items_get(feed, cursor=cursor, limit=limit)

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

  • Bearer Authentication (bearerAuth):
import unifapi
from unifapi.models.hacker_news_stories_feed_items_get200_response import HackerNewsStoriesFeedItemsGet200Response
from unifapi.models.hacker_news_story_feed import HackerNewsStoryFeed
from unifapi.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.unifapi.com
# See configuration.py for a list of all supported configuration parameters.
configuration = unifapi.Configuration(
    host = "https://api.unifapi.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: bearerAuth
configuration = unifapi.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with unifapi.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = unifapi.HackerNewsApi(api_client)
    feed = unifapi.HackerNewsStoryFeed() # HackerNewsStoryFeed | Story feed: top, new, best, ask, show, or jobs.
    cursor = 'cursor_example' # str | Zero-based offset cursor returned as `next_cursor`. (optional)
    limit = 20 # int |  (optional) (default to 20)

    try:
        # List Hacker News story items
        api_response = api_instance.hacker_news_stories_feed_items_get(feed, cursor=cursor, limit=limit)
        print("The response of HackerNewsApi->hacker_news_stories_feed_items_get:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling HackerNewsApi->hacker_news_stories_feed_items_get: %s\n" % e)

Parameters

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

Return type

HackerNewsStoriesFeedItemsGet200Response

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 OK -
400 Validation or invalid-id error -
401 Missing, invalid, disabled, revoked, or expired UnifAPI API key -
402 Insufficient workspace credits -
404 Resource not found -
429 Rate limited -
500 Internal error -
502 Source error -
503 Source unavailable -

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

hacker_news_updates_get

HackerNewsUpdatesGet200Response hacker_news_updates_get()

Get changed Hacker News items and profiles

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

Example

  • Bearer Authentication (bearerAuth):
import unifapi
from unifapi.models.hacker_news_updates_get200_response import HackerNewsUpdatesGet200Response
from unifapi.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.unifapi.com
# See configuration.py for a list of all supported configuration parameters.
configuration = unifapi.Configuration(
    host = "https://api.unifapi.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: bearerAuth
configuration = unifapi.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with unifapi.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = unifapi.HackerNewsApi(api_client)

    try:
        # Get changed Hacker News items and profiles
        api_response = api_instance.hacker_news_updates_get()
        print("The response of HackerNewsApi->hacker_news_updates_get:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling HackerNewsApi->hacker_news_updates_get: %s\n" % e)

Parameters

This endpoint does not need any parameter.

Return type

HackerNewsUpdatesGet200Response

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 OK -
400 Validation or invalid-id error -
401 Missing, invalid, disabled, revoked, or expired UnifAPI API key -
402 Insufficient workspace credits -
404 Resource not found -
429 Rate limited -
500 Internal error -
502 Source error -
503 Source unavailable -

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

hacker_news_users_id_get

HackerNewsUsersIdGet200Response hacker_news_users_id_get(id)

Get Hacker News user by ID

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

Example

  • Bearer Authentication (bearerAuth):
import unifapi
from unifapi.models.hacker_news_users_id_get200_response import HackerNewsUsersIdGet200Response
from unifapi.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.unifapi.com
# See configuration.py for a list of all supported configuration parameters.
configuration = unifapi.Configuration(
    host = "https://api.unifapi.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: bearerAuth
configuration = unifapi.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with unifapi.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = unifapi.HackerNewsApi(api_client)
    id = 'id_example' # str | Case-sensitive Hacker News username.

    try:
        # Get Hacker News user by ID
        api_response = api_instance.hacker_news_users_id_get(id)
        print("The response of HackerNewsApi->hacker_news_users_id_get:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling HackerNewsApi->hacker_news_users_id_get: %s\n" % e)

Parameters

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

Return type

HackerNewsUsersIdGet200Response

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 OK -
400 Validation or invalid-id error -
401 Missing, invalid, disabled, revoked, or expired UnifAPI API key -
402 Insufficient workspace credits -
404 Resource not found -
429 Rate limited -
500 Internal error -
502 Source error -
503 Source unavailable -

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