Skip to content

Latest commit

 

History

History
464 lines (366 loc) · 16 KB

File metadata and controls

464 lines (366 loc) · 16 KB

HackerNewsApi

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

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

HackerNewsItemsIdGet200Response hackerNewsItemsIdGet(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

// Import classes:
import com.unifapi.sdk.ApiClient;
import com.unifapi.sdk.ApiException;
import com.unifapi.sdk.Configuration;
import com.unifapi.sdk.auth.*;
import com.unifapi.sdk.models.*;
import com.unifapi.sdk.api.HackerNewsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.unifapi.com");
    
    // Configure HTTP bearer authorization: bearerAuth
    HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
    bearerAuth.setBearerToken("BEARER TOKEN");

    HackerNewsApi apiInstance = new HackerNewsApi(defaultClient);
    Integer id = 56; // Integer | Hacker News item id.
    try {
      HackerNewsItemsIdGet200Response result = apiInstance.hackerNewsItemsIdGet(id);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling HackerNewsApi#hackerNewsItemsIdGet");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
id Integer 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 -

hackerNewsMaxItemGet

HackerNewsMaxItemGet200Response hackerNewsMaxItemGet()

Get largest Hacker News item ID

Returns the current largest Hacker News item id.

Example

// Import classes:
import com.unifapi.sdk.ApiClient;
import com.unifapi.sdk.ApiException;
import com.unifapi.sdk.Configuration;
import com.unifapi.sdk.auth.*;
import com.unifapi.sdk.models.*;
import com.unifapi.sdk.api.HackerNewsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.unifapi.com");
    
    // Configure HTTP bearer authorization: bearerAuth
    HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
    bearerAuth.setBearerToken("BEARER TOKEN");

    HackerNewsApi apiInstance = new HackerNewsApi(defaultClient);
    try {
      HackerNewsMaxItemGet200Response result = apiInstance.hackerNewsMaxItemGet();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling HackerNewsApi#hackerNewsMaxItemGet");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

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 -

hackerNewsStoriesFeedGet

HackerNewsStoriesFeedGet200Response hackerNewsStoriesFeedGet(feed, cursor, 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

// Import classes:
import com.unifapi.sdk.ApiClient;
import com.unifapi.sdk.ApiException;
import com.unifapi.sdk.Configuration;
import com.unifapi.sdk.auth.*;
import com.unifapi.sdk.models.*;
import com.unifapi.sdk.api.HackerNewsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.unifapi.com");
    
    // Configure HTTP bearer authorization: bearerAuth
    HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
    bearerAuth.setBearerToken("BEARER TOKEN");

    HackerNewsApi apiInstance = new HackerNewsApi(defaultClient);
    HackerNewsStoryFeed feed = HackerNewsStoryFeed.fromValue("top"); // HackerNewsStoryFeed | Story feed: top, new, best, ask, show, or jobs.
    String cursor = "cursor_example"; // String | Zero-based offset cursor returned as `next_cursor`.
    Integer limit = 100; // Integer | 
    try {
      HackerNewsStoriesFeedGet200Response result = apiInstance.hackerNewsStoriesFeedGet(feed, cursor, limit);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling HackerNewsApi#hackerNewsStoriesFeedGet");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
feed HackerNewsStoryFeed Story feed: top, new, best, ask, show, or jobs. [enum: top, new, best, ask, show, jobs]
cursor String Zero-based offset cursor returned as `next_cursor`. [optional]
limit Integer [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 -

hackerNewsStoriesFeedItemsGet

HackerNewsStoriesFeedItemsGet200Response hackerNewsStoriesFeedItemsGet(feed, cursor, 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

// Import classes:
import com.unifapi.sdk.ApiClient;
import com.unifapi.sdk.ApiException;
import com.unifapi.sdk.Configuration;
import com.unifapi.sdk.auth.*;
import com.unifapi.sdk.models.*;
import com.unifapi.sdk.api.HackerNewsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.unifapi.com");
    
    // Configure HTTP bearer authorization: bearerAuth
    HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
    bearerAuth.setBearerToken("BEARER TOKEN");

    HackerNewsApi apiInstance = new HackerNewsApi(defaultClient);
    HackerNewsStoryFeed feed = HackerNewsStoryFeed.fromValue("top"); // HackerNewsStoryFeed | Story feed: top, new, best, ask, show, or jobs.
    String cursor = "cursor_example"; // String | Zero-based offset cursor returned as `next_cursor`.
    Integer limit = 20; // Integer | 
    try {
      HackerNewsStoriesFeedItemsGet200Response result = apiInstance.hackerNewsStoriesFeedItemsGet(feed, cursor, limit);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling HackerNewsApi#hackerNewsStoriesFeedItemsGet");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
feed HackerNewsStoryFeed Story feed: top, new, best, ask, show, or jobs. [enum: top, new, best, ask, show, jobs]
cursor String Zero-based offset cursor returned as `next_cursor`. [optional]
limit Integer [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 -

hackerNewsUpdatesGet

HackerNewsUpdatesGet200Response hackerNewsUpdatesGet()

Get changed Hacker News items and profiles

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

Example

// Import classes:
import com.unifapi.sdk.ApiClient;
import com.unifapi.sdk.ApiException;
import com.unifapi.sdk.Configuration;
import com.unifapi.sdk.auth.*;
import com.unifapi.sdk.models.*;
import com.unifapi.sdk.api.HackerNewsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.unifapi.com");
    
    // Configure HTTP bearer authorization: bearerAuth
    HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
    bearerAuth.setBearerToken("BEARER TOKEN");

    HackerNewsApi apiInstance = new HackerNewsApi(defaultClient);
    try {
      HackerNewsUpdatesGet200Response result = apiInstance.hackerNewsUpdatesGet();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling HackerNewsApi#hackerNewsUpdatesGet");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

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 -

hackerNewsUsersIdGet

HackerNewsUsersIdGet200Response hackerNewsUsersIdGet(id)

Get Hacker News user by ID

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

Example

// Import classes:
import com.unifapi.sdk.ApiClient;
import com.unifapi.sdk.ApiException;
import com.unifapi.sdk.Configuration;
import com.unifapi.sdk.auth.*;
import com.unifapi.sdk.models.*;
import com.unifapi.sdk.api.HackerNewsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.unifapi.com");
    
    // Configure HTTP bearer authorization: bearerAuth
    HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
    bearerAuth.setBearerToken("BEARER TOKEN");

    HackerNewsApi apiInstance = new HackerNewsApi(defaultClient);
    String id = "id_example"; // String | Case-sensitive Hacker News username.
    try {
      HackerNewsUsersIdGet200Response result = apiInstance.hackerNewsUsersIdGet(id);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling HackerNewsApi#hackerNewsUsersIdGet");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
id String 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 -