/** * REST API client for Neuwo API. * * This module provides a client for analysis where content is provided directly as text. */ import { Article, GetAiTopicsResponse, SimilarArticle, TrainingTag } from "./models.js"; import type { GetAiTopicsParams, GetSimilarParams, TrainAiTopicsParams, UpdateArticleParams } from "./types.js"; /** * Client for Neuwo REST API endpoints. * * REST endpoints operate over standard HTTP methods and use a REST API token passed as a query parameter. * REST endpoints are designed for server-side integration where content is provided directly as text. * The REST API serves publishers who want to enrich the data before publishing by analysing content. */ export declare class NeuwoRestClient { private static readonly DEFAULT_TIMEOUT; private readonly requestHandler; /** * Initialise the REST API client. * * @param config - Client configuration * @param config.token - REST API authentication token * @param config.baseUrl - Base URL for the API server * @param config.timeout - Request timeout in seconds (default: 60) */ constructor(config: { token: string; baseUrl: string; timeout?: number; }); /** * Retrieve AI-generated tags (raw response). * * Returns the raw HTTP response without parsing. Useful for custom processing or debugging. * * @returns Raw HTTP Response object * @throws {ValueError} If content is invalid * @throws {ValidationError} If parameters are invalid * @throws {AuthenticationError} If token is invalid * @throws {ForbiddenError} If token lacks permissions * @throws {NeuwoAPIError} For other API errors */ getAiTopicsRaw(params: GetAiTopicsParams & { format?: string; }): Promise; /** * Retrieve AI-generated tags and classifications for text content. * * Sends text content to Neuwo's REST API to obtain AI-generated tag classifications * including subject tags, brand safety, marketing categories (IAB taxonomies), and * smart tags. Optionally saves the article in the database if documentId is provided. * * @returns GetAiTopicsResponse object containing tags, brand safety, marketing categories, and smart tags * @throws {ValueError} If content is invalid * @throws {ValidationError} If parameters are invalid * @throws {AuthenticationError} If token is invalid * @throws {ForbiddenError} If token lacks permissions * @throws {NeuwoAPIError} For other API errors */ getAiTopics(params: GetAiTopicsParams): Promise; /** * Find similar articles (raw response). * * Returns the raw HTTP response without parsing. * * @returns Raw HTTP Response object * @throws {ValidationError} If parameters are invalid * @throws {AuthenticationError} If token is invalid * @throws {ForbiddenError} If token lacks permissions * @throws {NeuwoAPIError} For other API errors */ getSimilarRaw(params: GetSimilarParams & { format?: string; }): Promise; /** * Find articles similar to the specified document. * * Returns a list of similar articles with metadata including articleID, headline, * articleURL, imageURL, similarity score, publication date, and publication ID. * * @returns Array of SimilarArticle objects with article metadata and similarity scores * @throws {ValidationError} If parameters are invalid * @throws {AuthenticationError} If token is invalid * @throws {ForbiddenError} If token lacks permissions * @throws {NeuwoAPIError} For other API errors */ getSimilar(params: GetSimilarParams): Promise; /** * Update article fields (raw response). * * Returns the raw HTTP response without parsing. * * @returns Raw HTTP Response object * @throws {ValidationError} If parameters are invalid * @throws {AuthenticationError} If token is invalid * @throws {ForbiddenError} If token lacks permissions * @throws {NeuwoAPIError} For other API errors */ updateArticleRaw(params: UpdateArticleParams & { format?: string; }): Promise; /** * Update article fields in the database. * * This endpoint can only be used with articles that were assigned a documentId * when analysing with getAiTopics(). Only fields provided in the request * will be updated. Returns the updated article with all fields. * * @returns Article object with all updated fields * @throws {ValidationError} If parameters are invalid * @throws {AuthenticationError} If token is invalid * @throws {ForbiddenError} If token lacks permissions * @throws {NeuwoAPIError} For other API errors */ updateArticle(params: UpdateArticleParams): Promise
; /** * Save training tags for an article (raw response). * * Returns the raw HTTP response without parsing. * * @returns Raw HTTP Response object * @throws {ValidationError} If tags array is empty or invalid * @throws {AuthenticationError} If token is invalid * @throws {ForbiddenError} If token lacks permissions * @throws {NeuwoAPIError} For other API errors */ trainAiTopicsRaw(params: TrainAiTopicsParams & { format?: string; }): Promise; /** * Save training tags for an article. * * Saves a list of training tags for an article in the database. * Returns all newly added TrainingTags (tags that weren't already in the database). * If all tags already exist, returns an empty array. * * @returns Array of TrainingTag objects representing newly added tags * @throws {ValidationError} If tags array is empty or invalid * @throws {AuthenticationError} If token is invalid * @throws {ForbiddenError} If token lacks permissions * @throws {NeuwoAPIError} For other API errors */ trainAiTopics(params: TrainAiTopicsParams): Promise; } //# sourceMappingURL=rest-client.d.ts.map