@klippa/dochorizon-sdk
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -9,12 +9,50 @@ import { FinancialService } from "./src/ApiCommunicationsWrapper/Services/Capturing/Financial/Financial.service"; | ||
declare namespace DocHorizon { | ||
/** | ||
* Auth Service | ||
* @namespace | ||
*/ | ||
const Auth: typeof AuthService; | ||
/** | ||
* Financial Service | ||
* @namespace | ||
*/ | ||
const Financial: typeof FinancialService; | ||
/** | ||
* Generic Service | ||
* @namespace | ||
*/ | ||
const Generic: typeof GenericService; | ||
/** | ||
* Prompt Service | ||
* @namespace | ||
*/ | ||
const Prompt: typeof PromptBuilderService; | ||
/** | ||
* Capturing Service | ||
* @namespace | ||
*/ | ||
const Capturing: typeof CapturingService; | ||
/** | ||
* DocumentToolkit Service | ||
* @namespace | ||
*/ | ||
const DocumentToolkit: typeof DocumentToolkitService; | ||
/** | ||
* Storage Service | ||
* @namespace | ||
*/ | ||
const Storage: typeof StorageService; | ||
/** | ||
* Authenticate the API with an API key | ||
* | ||
* @param apikey - the API key to authenticate with | ||
*/ | ||
function authenticate(apikey: string): void; | ||
/** | ||
* Unauthenticate by removing the API key | ||
* this will render the user unable to do any API requests | ||
* and will permanently remove the api key string from any vars/services | ||
*/ | ||
function unAuthenticate(): void; | ||
} | ||
export { DocHorizon }; |
@@ -14,12 +14,44 @@ "use strict"; | ||
(function (DocHorizon) { | ||
/** | ||
* Auth Service | ||
* @namespace | ||
*/ | ||
DocHorizon.Auth = Auth_service_1.AuthService; | ||
/** | ||
* Financial Service | ||
* @namespace | ||
*/ | ||
DocHorizon.Financial = Financial_service_1.FinancialService; | ||
/** | ||
* Generic Service | ||
* @namespace | ||
*/ | ||
DocHorizon.Generic = Generic_service_1.GenericService; | ||
/** | ||
* Prompt Service | ||
* @namespace | ||
*/ | ||
DocHorizon.Prompt = PromptBuilder_service_1.PromptBuilderService; | ||
//export const Model = ModelBuilderService; | ||
//export const Cia = CIAService; | ||
/** | ||
* Capturing Service | ||
* @namespace | ||
*/ | ||
DocHorizon.Capturing = Capturing_service_1.CapturingService; | ||
/** | ||
* DocumentToolkit Service | ||
* @namespace | ||
*/ | ||
DocHorizon.DocumentToolkit = DocumentToolkit_service_1.DocumentToolkitService; | ||
/** | ||
* Storage Service | ||
* @namespace | ||
*/ | ||
DocHorizon.Storage = Storage_service_1.StorageService; | ||
//Authenticate the API Functionalities with an api key | ||
/** | ||
* Authenticate the API with an API key | ||
* | ||
* @param apikey - the API key to authenticate with | ||
*/ | ||
function authenticate(apikey) { | ||
@@ -29,3 +61,7 @@ APIFunctions_1.APIFunctionalities.initAPI(apikey); | ||
DocHorizon.authenticate = authenticate; | ||
//Remove the API key and unauthenticate | ||
/** | ||
* Unauthenticate by removing the API key | ||
* this will render the user unable to do any API requests | ||
* and will permanently remove the api key string from any vars/services | ||
*/ | ||
function unAuthenticate() { | ||
@@ -32,0 +68,0 @@ APIFunctions_1.APIFunctionalities.initAPI(""); |
import { DocHorizonResponse, RequestProperties } from "../Types/ApiTypes"; | ||
/** | ||
* API functionalities namespace | ||
* | ||
* exposing all the general API functionalities such as authentication | ||
*/ | ||
export declare namespace APIFunctionalities { | ||
/** | ||
* Initialize the API with an API key | ||
* @param apikey - the api key to authenticate with | ||
*/ | ||
function initAPI(apikey: string): void; | ||
@@ -4,0 +13,0 @@ function request(requestProperties: RequestProperties): Promise<DocHorizonResponse>; |
@@ -19,5 +19,14 @@ "use strict"; | ||
const fs_1 = __importDefault(require("fs")); | ||
/** | ||
* API functionalities namespace | ||
* | ||
* exposing all the general API functionalities such as authentication | ||
*/ | ||
var APIFunctionalities; | ||
(function (APIFunctionalities) { | ||
let key = ""; | ||
/** | ||
* Initialize the API with an API key | ||
* @param apikey - the api key to authenticate with | ||
*/ | ||
function initAPI(apikey) { | ||
@@ -24,0 +33,0 @@ key = apikey; |
import { DocHorizonResponse } from "../../Types/ApiTypes"; | ||
/** | ||
* AuthService | ||
*/ | ||
export declare namespace AuthService { | ||
/** | ||
* Obtain information about the used api key | ||
* | ||
* @returns a DocHorizonResponse object containing found information on the used api key | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getApiKeyInfo(): Promise<DocHorizonResponse>; | ||
} |
@@ -14,2 +14,5 @@ "use strict"; | ||
const APIFunctions_1 = require("../APIFunctions"); | ||
/** | ||
* AuthService | ||
*/ | ||
var AuthService; | ||
@@ -20,3 +23,8 @@ (function (AuthService) { | ||
}; | ||
//Obtain information about the provided Api key | ||
/** | ||
* Obtain information about the used api key | ||
* | ||
* @returns a DocHorizonResponse object containing found information on the used api key | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getApiKeyInfo() { | ||
@@ -23,0 +31,0 @@ return __awaiter(this, void 0, void 0, function* () { |
import { DocHorizonResponse } from "../../Types/ApiTypes"; | ||
import { AsyncJobCreationResult, AsyncStatus, GetOrDeleteProps, PostProps } from "./Async.types"; | ||
/** | ||
* Async Service | ||
* | ||
*/ | ||
export declare namespace AsyncService { | ||
@@ -4,0 +8,0 @@ function parseAsync(postProps: PostProps): Promise<DocHorizonResponse>; |
@@ -17,2 +17,6 @@ "use strict"; | ||
const JSONBodyBuilder_1 = require("../../JSONBodyBuilder"); | ||
/** | ||
* Async Service | ||
* | ||
*/ | ||
var AsyncService; | ||
@@ -19,0 +23,0 @@ (function (AsyncService) { |
import { Endpoint } from "../../Types/ApiTypes"; | ||
import { DocHorizonDocument, Options } from "../../Types/UserOptionsTypes"; | ||
import { AdditionalBodyData } from "../../Types/AdditionalBodyData"; | ||
/** | ||
* Object needed to configure authentication in the form of type authorization header | ||
* | ||
* @property token - string containing the token | ||
* @property type - string containing the token type | ||
* | ||
* @interface | ||
*/ | ||
type Authorization_header = { | ||
@@ -8,2 +16,10 @@ token: string; | ||
}; | ||
/** | ||
* Object needed to configure basic authorization for webhooks | ||
* | ||
* @property username - string containing the username | ||
* @property password - string containing the password | ||
* | ||
* @interface | ||
*/ | ||
type Basic_auth = { | ||
@@ -13,2 +29,10 @@ username: string; | ||
}; | ||
/** | ||
* Object containing a custom header item to be added to a webhook request | ||
* | ||
* @property header_key - string containing the custom header key | ||
* @property header_value - string containing the custom header value | ||
* | ||
* @interface | ||
*/ | ||
type CustomHeaderItem = { | ||
@@ -18,3 +42,24 @@ header_key: string; | ||
}; | ||
/** | ||
* Which asynchronous webhook type you would like to set up, of which the following two are | ||
* valid options | ||
*/ | ||
type AsyncType = "on_finish" | "on_status_update"; | ||
/** | ||
* Object needed to configure webhooks for async requests | ||
* | ||
* @property auth - configure authentication in the form of either Authorization Header or Basic | ||
* Authorization | ||
* @see {@link Authorization_header} | ||
* @see {@link Basic_auth} | ||
* | ||
* @property custom_headers - An object containing any custom headers to send | ||
* @see {@link CustomHeaderItem} | ||
* | ||
* @property types - a list of strings/string indicating "on_status_update" or "on_finish" or | ||
* both | ||
* @property url - a string containin the url of the endpoint to communicate with | ||
* | ||
* @interface | ||
*/ | ||
type Webhook = { | ||
@@ -26,2 +71,10 @@ auth?: Authorization_header | Basic_auth; | ||
}; | ||
/** | ||
* Extra options that can be applied to asynchronous requests | ||
* | ||
* @property hitl - string indicating which hitl configuration to use | ||
* @property webhook - Webhook object to configure webhooks | ||
* | ||
* @interface | ||
*/ | ||
type AsyncOptions = { | ||
@@ -31,2 +84,13 @@ hitl?: string; | ||
}; | ||
/** | ||
* Results type containing a list of jobs found and a paging_data object containing information | ||
* about the search results | ||
* | ||
* @property jobs - List of jobs | ||
* @see {@link Job} | ||
* | ||
* @property paging_data - Object containing information about search results | ||
* | ||
* @interface | ||
*/ | ||
type AsyncJobList = { | ||
@@ -36,2 +100,13 @@ jobs: Job[]; | ||
}; | ||
/** | ||
* Definition of a found job | ||
* | ||
* @property create_time - when the job was created | ||
* @property job_id - the id of the job | ||
* @property status - the status of the job | ||
* @see {@link AsyncStatus} | ||
* | ||
* @interface | ||
* | ||
*/ | ||
type Job = { | ||
@@ -42,2 +117,6 @@ create_time: string; | ||
}; | ||
/** | ||
* The available async statusses to use for filtering | ||
* | ||
*/ | ||
type AsyncStatus = "done" | "error" | "closed" | "rejected" | "in_queue" | "processing" | "hitl"; | ||
@@ -62,4 +141,11 @@ declare const isAsyncOption: (options: object) => options is AsyncOptions; | ||
}; | ||
/** | ||
* The results from an async post request | ||
* | ||
* @property job_id - a string containing the created job id | ||
* | ||
* @interface | ||
*/ | ||
type AsyncPostResult = { | ||
job_id: string; | ||
}; |
@@ -5,14 +5,91 @@ import { DocHorizonResponse } from "../../../Types/ApiTypes"; | ||
import { AsyncStatus } from "../Async.types"; | ||
/** | ||
* Financial Service | ||
* | ||
* @namespace | ||
*/ | ||
export declare namespace FinancialService { | ||
/** | ||
* function that returns the created financial presets for the provided API key | ||
* | ||
* @returns a DocHorizonResponse containing found presets for the provided api key | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getPresets(): Promise<DocHorizonResponse>; | ||
/** | ||
* function that returns a lis the created financial presets for the provided API key | ||
* | ||
* @returns a list of found preset strings for the provided API key | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getPresetList(): Promise<string[]>; | ||
/** | ||
* function that returns the enabled components from a given preset | ||
* @param preset - string indicating which preset to get enabled components from | ||
* @returns list of enabled components for the preset | ||
*/ | ||
function getEnabledComponentsFromPreset(preset: string): Promise<string[]>; | ||
/** | ||
* Capture data from a document using the financial model | ||
* | ||
* @param src - either a string indicating a document, or a DocHorizonDocument | ||
* @see {@link DocHorizonDocument} | ||
* @param options - an object containing any financial options to send with the request | ||
* @see {@link FinancialOptions} | ||
* | ||
* @returns a DocHorizonResponse containing the results from the financial document capturer | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function capture(src: string | string[] | DocHorizonDocument | DocHorizonDocument[], options?: FinancialOptions): Promise<DocHorizonResponse>; | ||
/** | ||
* Capture data from a financial document asynchronously | ||
* @param src - either a string indicating a document, or a DocHorizonDocument | ||
* @see {@link DocHorizonDocument} | ||
* @param options - an object containing any financial async options to send with the request | ||
* @see {@link FinancialAsyncOptions} | ||
*/ | ||
function captureAsync(src: string | string[] | DocHorizonDocument | DocHorizonDocument[], options?: FinancialAsyncOptions): Promise<DocHorizonResponse>; | ||
/** | ||
* Get the status of a financial async job | ||
* @param job_id - The job id of which you want to get the status | ||
* @returns a DocHorizonResponse containing status information regarding the provided status | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getAsyncStatus(job_id: string): Promise<DocHorizonResponse>; | ||
/** | ||
* Get all existing financial async jobs for the used API key | ||
* | ||
* @returns a DocHorizonResponse containing all found financial async jobs | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getAsyncJobs(): Promise<DocHorizonResponse>; | ||
/** | ||
* Get a list of all existing financial async jobs for the used API key | ||
* | ||
* @param status - an optional status to filter the results on | ||
* @see {@link AsyncStatus} for the available statusses | ||
* @returns a list containing all found financial async job ids | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getListOfJobIds(status?: AsyncStatus): Promise<string[]>; | ||
/** | ||
* Remove a financial async job | ||
* @param job_id - the id of the job to delete | ||
* @returns a DocHorizonResponse containing information about the deletion | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function removeAsyncJob(job_id: string): Promise<DocHorizonResponse>; | ||
/** | ||
* Get logs of a financial async job | ||
* @param job_id - The job id of which you want to obtain logs | ||
* @returns DocHorizonResponse data containing found logs for the provided job id | ||
*/ | ||
function getLogsOfAsyncJob(job_id: string): Promise<DocHorizonResponse>; | ||
/** | ||
* Get results of a financial async job | ||
* @param job_id - The id of the job which you want to get the results from | ||
* @returns a DocHorizonResponse containing results from the financial capturer | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getResultsOfAsyncJob(job_id: string): Promise<DocHorizonResponse>; | ||
} |
@@ -17,2 +17,7 @@ "use strict"; | ||
const Async_service_1 = require("../Async.service"); | ||
/** | ||
* Financial Service | ||
* | ||
* @namespace | ||
*/ | ||
var FinancialService; | ||
@@ -59,3 +64,8 @@ (function (FinancialService) { | ||
} | ||
//Get available presets for the provided Api key | ||
/** | ||
* function that returns the created financial presets for the provided API key | ||
* | ||
* @returns a DocHorizonResponse containing found presets for the provided api key | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getPresets() { | ||
@@ -71,3 +81,8 @@ return __awaiter(this, void 0, void 0, function* () { | ||
FinancialService.getPresets = getPresets; | ||
//Get a list of available presets for the provided Api key | ||
/** | ||
* function that returns a lis the created financial presets for the provided API key | ||
* | ||
* @returns a list of found preset strings for the provided API key | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getPresetList() { | ||
@@ -85,3 +100,7 @@ return __awaiter(this, void 0, void 0, function* () { | ||
FinancialService.getPresetList = getPresetList; | ||
//Get a list of enabled components from the provided preset | ||
/** | ||
* function that returns the enabled components from a given preset | ||
* @param preset - string indicating which preset to get enabled components from | ||
* @returns list of enabled components for the preset | ||
*/ | ||
function getEnabledComponentsFromPreset(preset) { | ||
@@ -104,3 +123,13 @@ return __awaiter(this, void 0, void 0, function* () { | ||
FinancialService.getEnabledComponentsFromPreset = getEnabledComponentsFromPreset; | ||
//Capture data from a financial document | ||
/** | ||
* Capture data from a document using the financial model | ||
* | ||
* @param src - either a string indicating a document, or a DocHorizonDocument | ||
* @see {@link DocHorizonDocument} | ||
* @param options - an object containing any financial options to send with the request | ||
* @see {@link FinancialOptions} | ||
* | ||
* @returns a DocHorizonResponse containing the results from the financial document capturer | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function capture(src, options) { | ||
@@ -123,3 +152,9 @@ return __awaiter(this, void 0, void 0, function* () { | ||
FinancialService.capture = capture; | ||
//Capture data from a financial document asynchronously | ||
/** | ||
* Capture data from a financial document asynchronously | ||
* @param src - either a string indicating a document, or a DocHorizonDocument | ||
* @see {@link DocHorizonDocument} | ||
* @param options - an object containing any financial async options to send with the request | ||
* @see {@link FinancialAsyncOptions} | ||
*/ | ||
function captureAsync(src, options) { | ||
@@ -144,3 +179,8 @@ return __awaiter(this, void 0, void 0, function* () { | ||
FinancialService.captureAsync = captureAsync; | ||
//Get the status of a financial async job | ||
/** | ||
* Get the status of a financial async job | ||
* @param job_id - The job id of which you want to get the status | ||
* @returns a DocHorizonResponse containing status information regarding the provided status | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getAsyncStatus(job_id) { | ||
@@ -159,3 +199,8 @@ return __awaiter(this, void 0, void 0, function* () { | ||
FinancialService.getAsyncStatus = getAsyncStatus; | ||
//Get all available financial async jobs | ||
/** | ||
* Get all existing financial async jobs for the used API key | ||
* | ||
* @returns a DocHorizonResponse containing all found financial async jobs | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getAsyncJobs() { | ||
@@ -173,3 +218,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
FinancialService.getAsyncJobs = getAsyncJobs; | ||
//Get a list of available financial async jobs | ||
/** | ||
* Get a list of all existing financial async jobs for the used API key | ||
* | ||
* @param status - an optional status to filter the results on | ||
* @see {@link AsyncStatus} for the available statusses | ||
* @returns a list containing all found financial async job ids | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getListOfJobIds(status) { | ||
@@ -182,3 +234,8 @@ return __awaiter(this, void 0, void 0, function* () { | ||
FinancialService.getListOfJobIds = getListOfJobIds; | ||
//Remove a financial async job | ||
/** | ||
* Remove a financial async job | ||
* @param job_id - the id of the job to delete | ||
* @returns a DocHorizonResponse containing information about the deletion | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function removeAsyncJob(job_id) { | ||
@@ -197,3 +254,7 @@ return __awaiter(this, void 0, void 0, function* () { | ||
FinancialService.removeAsyncJob = removeAsyncJob; | ||
//Get logs of a financial async job | ||
/** | ||
* Get logs of a financial async job | ||
* @param job_id - The job id of which you want to obtain logs | ||
* @returns DocHorizonResponse data containing found logs for the provided job id | ||
*/ | ||
function getLogsOfAsyncJob(job_id) { | ||
@@ -212,3 +273,8 @@ return __awaiter(this, void 0, void 0, function* () { | ||
FinancialService.getLogsOfAsyncJob = getLogsOfAsyncJob; | ||
//Get results of a financial async job | ||
/** | ||
* Get results of a financial async job | ||
* @param job_id - The id of the job which you want to get the results from | ||
* @returns a DocHorizonResponse containing results from the financial capturer | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getResultsOfAsyncJob(job_id) { | ||
@@ -215,0 +281,0 @@ return __awaiter(this, void 0, void 0, function* () { |
import { AsyncOptions } from "../Async.types"; | ||
type keyword_matching_regex = string; | ||
type keyword_matching_keywords = string[]; | ||
/** | ||
* object to configure keyword matching for an api call | ||
* | ||
* @property id - string to identify the keyword matching rule | ||
* @property keywords - either a list of keywords or a string indicating a regex to use to look | ||
* for keywords | ||
* | ||
* @interface | ||
*/ | ||
type keyword_matching = { | ||
@@ -8,2 +17,11 @@ id: string; | ||
}; | ||
/** | ||
* Object used to configure a merchant/customer relation type | ||
* | ||
* @property fallback_id - id of a relation to use as a fallback | ||
* @property force_id - id of a relation to use no matter what | ||
* @property groups - a list of groups that this assignments belong to | ||
* | ||
* @interface | ||
*/ | ||
type Assignment = { | ||
@@ -14,2 +32,13 @@ fallback_id?: string; | ||
}; | ||
/** | ||
* type to determine the difference between customer and merchant data | ||
* | ||
* @property customer - customer assignment object | ||
* @see {@link Assignment} | ||
* | ||
* @property merchant - merchant assignment object | ||
* @see {@link Assignment} | ||
* | ||
* @interface | ||
*/ | ||
type Assignments = { | ||
@@ -19,2 +48,23 @@ customer: Assignment; | ||
}; | ||
/** | ||
* Type containing fields to use to search for relation | ||
* the id and groups field are required | ||
* | ||
* @property id - string to identify the relation | ||
* @proeprty groups - list of strings to apply this Relation data to | ||
* @property bank_account_number | ||
* @property city | ||
* @property coc_number | ||
* @property country | ||
* @property email | ||
* @property name | ||
* @property phone | ||
* @property street_name | ||
* @property street_number | ||
* @property vat_number | ||
* @property website | ||
* @property zipcode | ||
* | ||
* @interface | ||
*/ | ||
type Relation = { | ||
@@ -36,2 +86,15 @@ id: string; | ||
}; | ||
/** | ||
* Type of data to send if relation matching is required in a request | ||
* | ||
* @property assignments - Assignments object to determine what is considered a customer and | ||
* what is considered a merchant | ||
* @see {@link Assignments} | ||
* | ||
* @property relations - A list of relation objects, each containing information about the | ||
* relation(s) to match | ||
* @see {@link Relation} | ||
* | ||
* @interface | ||
*/ | ||
type RelationMatching = { | ||
@@ -41,2 +104,13 @@ assignments: Assignments; | ||
}; | ||
/** | ||
* object containing any options to send to the financial endpoint | ||
* | ||
* @property preset - string indicating which preset to use | ||
* @property keyword_matching - list of keyword matching objects to configure keyword_matching | ||
* @see {@link keyword_matching} | ||
* @property relation_matching - a relation matching object to configure relation_matching | ||
* @see {@link RelationMatching} | ||
* | ||
* @interface | ||
*/ | ||
type FinancialOptions = { | ||
@@ -47,2 +121,9 @@ preset?: string; | ||
}; | ||
/** | ||
* Financial Async Options is a combination of Financial Options and Async Options | ||
* @see {@link FinancialOptions} | ||
* @see {@link AsyncOptions} | ||
* | ||
* @interface | ||
*/ | ||
type FinancialAsyncOptions = FinancialOptions & AsyncOptions; | ||
@@ -60,2 +141,12 @@ type Configuration = { | ||
}; | ||
/** | ||
* The results obtained from the financial presets endpoint | ||
* @property components - a list of components found for the given preset | ||
* @see {@link FinancialPresetComponent} | ||
* | ||
* @property name - name of the found preset | ||
* @property slug - slug of the found preset | ||
* | ||
* @interface | ||
*/ | ||
export type FinancialPresetsResult = { | ||
@@ -66,2 +157,10 @@ components: FinancialPresetComponent[]; | ||
}; | ||
/** | ||
* Object depicting a financial preset component | ||
* | ||
* @property name - name of the component | ||
* @property options - object containing a field whether the component is enabled | ||
* | ||
* @interface | ||
*/ | ||
export type FinancialPresetComponent = { | ||
@@ -68,0 +167,0 @@ name: string; |
@@ -5,12 +5,87 @@ import { DocHorizonDocument } from "../../../Types/UserOptionsTypes"; | ||
import { AsyncOptions, AsyncStatus } from "../Async.types"; | ||
/** | ||
* Generic Service | ||
* | ||
*/ | ||
export declare namespace GenericService { | ||
/** | ||
* Capture data from a document using the 'generic model' | ||
* | ||
* @param src - either a string indicating a document, or a DocHorizonDocument | ||
* @see {@link DocHorizonDocument} | ||
* | ||
* @returns a DocHorizonResponse containing the results from the generic document capturer | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function capture(src: string | string[] | DocHorizonDocument | DocHorizonDocument[]): Promise<DocHorizonResponse>; | ||
/** | ||
* Capture data from a document using the 'generic model' and get results back as an XLSX sheet | ||
* | ||
* @param src - either a string indicating a document, or a DocHorizonDocument | ||
* @see {@link DocHorizonDocument} | ||
* | ||
* @param options - an object containing a field called 'output_target' which indicates | ||
* whether to output the results as a 'Base64' string, or a DocHorizonStorage id | ||
* @see {@link GenericXlsxOptions} | ||
* | ||
* @returns a DocHorizonResponse containing the results from the generic document capturer | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function captureXlsx(src: string | string[] | DocHorizonDocument | DocHorizonDocument[], options?: GenericXlsxOptions): Promise<DocHorizonResponse>; | ||
/** | ||
* Capture data from a document using the 'generic model' asynchronously | ||
* | ||
* @param src - either a string indicating a document, or a DocHorizonDocument | ||
* @see {@link DocHorizonDocument} | ||
* | ||
* @param options - an object containing all asynchronous options, except for Hitl | ||
* @see {@link AsyncOptions} | ||
* | ||
* @returns a DocHorizonResponse containing the results from the async generic document capturer | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function captureAsync(src: string | string[] | DocHorizonDocument | DocHorizonDocument[], options?: Omit<AsyncOptions, "hitl">): Promise<DocHorizonResponse>; | ||
/** | ||
* Get the status of a generic async job | ||
* @param job_id - The job id of which you want to get the status | ||
* @returns a DocHorizonResponse containing status information regarding the provided status | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getAsyncStatus(job_id: string): Promise<DocHorizonResponse>; | ||
/** | ||
* Get all existing generic async jobs for the used API key | ||
* | ||
* @returns a DocHorizonResponse containing all found generic async jobs | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getAsyncJobs(): Promise<DocHorizonResponse>; | ||
/** | ||
* Get a list of all existing generic async jobs for the used API key | ||
* | ||
* @param status - an optional status to filter the results on | ||
* @see {@link AsyncStatus} for the available statusses | ||
* @returns a list containing all found generic async job ids | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getListOfJobIds(status?: AsyncStatus): Promise<string[]>; | ||
/** | ||
* Remove a generic async job | ||
* @param job_id - the id of the job to delete | ||
* @returns a DocHorizonResponse containing information about the deletion | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function removeAsyncJob(job_id: string): Promise<DocHorizonResponse>; | ||
/** | ||
* Get logs of a generic async job | ||
* @param job_id - The job id of which you want to obtain logs | ||
* @returns DocHorizonResponse data containing found logs for the provided job id | ||
*/ | ||
function getLogsOfAsyncJob(job_id: string): Promise<DocHorizonResponse>; | ||
/** | ||
* Get results of a generic async job | ||
* @param job_id - The id of the job which you want to get the results from | ||
* @returns a DocHorizonResponse containing results from the generic capturer | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getResultsOfAsyncJob(job_id: string): Promise<DocHorizonResponse>; | ||
} |
@@ -17,2 +17,6 @@ "use strict"; | ||
const Async_service_1 = require("../Async.service"); | ||
/** | ||
* Generic Service | ||
* | ||
*/ | ||
var GenericService; | ||
@@ -29,3 +33,11 @@ (function (GenericService) { | ||
}; | ||
//Capture data from a generic document | ||
/** | ||
* Capture data from a document using the 'generic model' | ||
* | ||
* @param src - either a string indicating a document, or a DocHorizonDocument | ||
* @see {@link DocHorizonDocument} | ||
* | ||
* @returns a DocHorizonResponse containing the results from the generic document capturer | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function capture(src) { | ||
@@ -46,3 +58,15 @@ return __awaiter(this, void 0, void 0, function* () { | ||
GenericService.capture = capture; | ||
//Capture data from a generic document and get the results back as an XLSX | ||
/** | ||
* Capture data from a document using the 'generic model' and get results back as an XLSX sheet | ||
* | ||
* @param src - either a string indicating a document, or a DocHorizonDocument | ||
* @see {@link DocHorizonDocument} | ||
* | ||
* @param options - an object containing a field called 'output_target' which indicates | ||
* whether to output the results as a 'Base64' string, or a DocHorizonStorage id | ||
* @see {@link GenericXlsxOptions} | ||
* | ||
* @returns a DocHorizonResponse containing the results from the generic document capturer | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function captureXlsx(src, options) { | ||
@@ -65,3 +89,14 @@ return __awaiter(this, void 0, void 0, function* () { | ||
GenericService.captureXlsx = captureXlsx; | ||
//Capture data from a generic document asynchronously | ||
/** | ||
* Capture data from a document using the 'generic model' asynchronously | ||
* | ||
* @param src - either a string indicating a document, or a DocHorizonDocument | ||
* @see {@link DocHorizonDocument} | ||
* | ||
* @param options - an object containing all asynchronous options, except for Hitl | ||
* @see {@link AsyncOptions} | ||
* | ||
* @returns a DocHorizonResponse containing the results from the async generic document capturer | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function captureAsync(src, options) { | ||
@@ -83,3 +118,8 @@ return __awaiter(this, void 0, void 0, function* () { | ||
GenericService.captureAsync = captureAsync; | ||
//Get the status of a generic async job | ||
/** | ||
* Get the status of a generic async job | ||
* @param job_id - The job id of which you want to get the status | ||
* @returns a DocHorizonResponse containing status information regarding the provided status | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getAsyncStatus(job_id) { | ||
@@ -98,3 +138,8 @@ return __awaiter(this, void 0, void 0, function* () { | ||
GenericService.getAsyncStatus = getAsyncStatus; | ||
//Get all available generic async jobs | ||
/** | ||
* Get all existing generic async jobs for the used API key | ||
* | ||
* @returns a DocHorizonResponse containing all found generic async jobs | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getAsyncJobs() { | ||
@@ -112,3 +157,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
GenericService.getAsyncJobs = getAsyncJobs; | ||
//Get a list of available generic async jobs | ||
/** | ||
* Get a list of all existing generic async jobs for the used API key | ||
* | ||
* @param status - an optional status to filter the results on | ||
* @see {@link AsyncStatus} for the available statusses | ||
* @returns a list containing all found generic async job ids | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getListOfJobIds(status) { | ||
@@ -121,3 +173,8 @@ return __awaiter(this, void 0, void 0, function* () { | ||
GenericService.getListOfJobIds = getListOfJobIds; | ||
//Remove a generic async job | ||
/** | ||
* Remove a generic async job | ||
* @param job_id - the id of the job to delete | ||
* @returns a DocHorizonResponse containing information about the deletion | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function removeAsyncJob(job_id) { | ||
@@ -136,3 +193,7 @@ return __awaiter(this, void 0, void 0, function* () { | ||
GenericService.removeAsyncJob = removeAsyncJob; | ||
//Get logs of a generic async job | ||
/** | ||
* Get logs of a generic async job | ||
* @param job_id - The job id of which you want to obtain logs | ||
* @returns DocHorizonResponse data containing found logs for the provided job id | ||
*/ | ||
function getLogsOfAsyncJob(job_id) { | ||
@@ -151,3 +212,8 @@ return __awaiter(this, void 0, void 0, function* () { | ||
GenericService.getLogsOfAsyncJob = getLogsOfAsyncJob; | ||
//Get results of a generic async job | ||
/** | ||
* Get results of a generic async job | ||
* @param job_id - The id of the job which you want to get the results from | ||
* @returns a DocHorizonResponse containing results from the generic capturer | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getResultsOfAsyncJob(job_id) { | ||
@@ -154,0 +220,0 @@ return __awaiter(this, void 0, void 0, function* () { |
import { AsyncOptions } from "../Async.types"; | ||
/** | ||
* Object to indicate how to output the generic capturer results | ||
* | ||
* @property output_target - "Base64" or "StorageAPI" | ||
* | ||
* @interface | ||
*/ | ||
export type GenericXlsxOptions = { | ||
@@ -3,0 +10,0 @@ output_target: "Base64" | "StorageAPI"; |
import { DocHorizonDocument } from "../../../Types/UserOptionsTypes"; | ||
import { DocHorizonResponse } from "../../../Types/ApiTypes"; | ||
import { AsyncOptions, AsyncStatus } from "../Async.types"; | ||
/** | ||
* Model Builder Service | ||
* | ||
*/ | ||
export declare namespace ModelBuilderService { | ||
/** | ||
* Capture data from a document using a model created with the DocHorizon Model Builder | ||
* @param src - either a string indicating a document, or a DocHorizonDocument | ||
* @see {@link DocHorizonDocument} | ||
* @param slug - the slug of the model configuration you want to use | ||
* @param version - the version of the model you want to use | ||
* | ||
* @returns a DocHorizonResponse containing the results from the financial document capturer | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function capture(src: string | string[] | DocHorizonDocument | DocHorizonDocument[], slug: string, version?: number): Promise<DocHorizonResponse>; | ||
/** | ||
* Get all available models for the used API key | ||
* | ||
* @returns a DocHorizonResponse containing all found models for the used API key | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getModels(): Promise<DocHorizonResponse>; | ||
/** | ||
* Get the JSON schema of a model | ||
* @param slug - the slug of the model you want to get the JSON schema of | ||
* | ||
* @returns a DocHorizonResponse containing the JSON schema of a provided model | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getJsonSchema(slug: string): Promise<DocHorizonResponse>; | ||
/** | ||
* Capture data from a document using a model created with the DocHorizon Model Builder | ||
* asynchronously | ||
* @param src - either a string indicating a document, or a DocHorizonDocument | ||
* @see {@link DocHorizonDocument} | ||
* @param slug - the slug of the model configuration you want to use | ||
* @param version - the version of the model you want to use | ||
* @param options - an object containing any asynchronous options you want to apply to the API | ||
* call | ||
* @see {@link AsyncOptions} | ||
* | ||
* @returns a DocHorizonResponse containing the results from the financial document capturer | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function captureAsync(src: string | string[] | DocHorizonDocument | DocHorizonDocument[], slug: string, options?: AsyncOptions, version?: number): Promise<DocHorizonResponse>; | ||
/** | ||
* Get the status of a model builder async job | ||
* @param slug - the slug of model that was used in the job you wish to know the status of | ||
* @param job_id - the id of the job you wish to know the status of | ||
* | ||
* @returns a DocHorizonResponse containing status information about the found model builder job | ||
*/ | ||
function getAsyncStatus(slug: string, job_id: string): Promise<DocHorizonResponse>; | ||
/** | ||
* Get all available model builder async jobs for a particular model | ||
* @param slug - the slug of the model you wish to get all async jobs from | ||
* | ||
* @returns a DocHorizonResponse containing all found async jobs for a particular model | ||
*/ | ||
function getAsyncJobs(slug: string): Promise<DocHorizonResponse>; | ||
/** | ||
* Get a list of all available model builder async jobs for a particular model | ||
* @param slug - the slug of the model you wish to get all async jobs from | ||
* @param status - optionally, provide an AsyncStatus to filter the results on | ||
* @see {@link AsyncStatus} for available statusses | ||
* @returns a list containing all found async job ids for a particular model | ||
*/ | ||
function getListOfJobIds(slug: string, status?: AsyncStatus): Promise<string[]>; | ||
/** | ||
* Remove a model builder async job | ||
* @param slug - the slug of the model you wish to delete | ||
* @param job_id - the job_id of the async job you wish to delete | ||
* | ||
* @returns a DocHorizonResponse containing deletion information | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function removeAsyncJob(slug: string, job_id: string): Promise<DocHorizonResponse>; | ||
/** | ||
* Get logs for a model builder async job | ||
* @param slug - the slug of the model used | ||
* @param job_id - the job id you wish to obtain logs from | ||
* | ||
* @returns a DocHorizonResponse containing any found logs for the provided slug and job id | ||
*/ | ||
function getLogsOfAsyncJob(slug: string, job_id: string): Promise<DocHorizonResponse>; | ||
/** | ||
* Get the results of a model builder async job | ||
* @param slug - the slug of the used model builder model | ||
* @param job_id - the id of the job you wish to get the results off | ||
* | ||
* @returns a DocHorizonResponse containing the results from the model builder capturer | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getResultsOfAsyncJob(slug: string, job_id: string): Promise<DocHorizonResponse>; | ||
/** | ||
* Get a list of all available model builder configurations for the used API key | ||
* | ||
* @returns a list of available models | ||
*/ | ||
function getModelsList(): Promise<string[]>; | ||
} |
@@ -17,2 +17,6 @@ "use strict"; | ||
const Async_service_1 = require("../Async.service"); | ||
/** | ||
* Model Builder Service | ||
* | ||
*/ | ||
var ModelBuilderService; | ||
@@ -31,3 +35,12 @@ (function (ModelBuilderService) { | ||
}; | ||
//Capture data from a document using a specific model | ||
/** | ||
* Capture data from a document using a model created with the DocHorizon Model Builder | ||
* @param src - either a string indicating a document, or a DocHorizonDocument | ||
* @see {@link DocHorizonDocument} | ||
* @param slug - the slug of the model configuration you want to use | ||
* @param version - the version of the model you want to use | ||
* | ||
* @returns a DocHorizonResponse containing the results from the financial document capturer | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function capture(src, slug, version) { | ||
@@ -56,3 +69,8 @@ return __awaiter(this, void 0, void 0, function* () { | ||
ModelBuilderService.capture = capture; | ||
//Get all available models | ||
/** | ||
* Get all available models for the used API key | ||
* | ||
* @returns a DocHorizonResponse containing all found models for the used API key | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getModels() { | ||
@@ -68,3 +86,9 @@ return __awaiter(this, void 0, void 0, function* () { | ||
ModelBuilderService.getModels = getModels; | ||
//Get the Json schema of a model | ||
/** | ||
* Get the JSON schema of a model | ||
* @param slug - the slug of the model you want to get the JSON schema of | ||
* | ||
* @returns a DocHorizonResponse containing the JSON schema of a provided model | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getJsonSchema(slug) { | ||
@@ -83,3 +107,16 @@ return __awaiter(this, void 0, void 0, function* () { | ||
ModelBuilderService.getJsonSchema = getJsonSchema; | ||
//Capture data from a document using a specific model asynchronously | ||
/** | ||
* Capture data from a document using a model created with the DocHorizon Model Builder | ||
* asynchronously | ||
* @param src - either a string indicating a document, or a DocHorizonDocument | ||
* @see {@link DocHorizonDocument} | ||
* @param slug - the slug of the model configuration you want to use | ||
* @param version - the version of the model you want to use | ||
* @param options - an object containing any asynchronous options you want to apply to the API | ||
* call | ||
* @see {@link AsyncOptions} | ||
* | ||
* @returns a DocHorizonResponse containing the results from the financial document capturer | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function captureAsync(src, slug, options, version) { | ||
@@ -102,3 +139,9 @@ return __awaiter(this, void 0, void 0, function* () { | ||
ModelBuilderService.captureAsync = captureAsync; | ||
//Get the status of a model builder async job | ||
/** | ||
* Get the status of a model builder async job | ||
* @param slug - the slug of model that was used in the job you wish to know the status of | ||
* @param job_id - the id of the job you wish to know the status of | ||
* | ||
* @returns a DocHorizonResponse containing status information about the found model builder job | ||
*/ | ||
function getAsyncStatus(slug, job_id) { | ||
@@ -118,3 +161,8 @@ return __awaiter(this, void 0, void 0, function* () { | ||
ModelBuilderService.getAsyncStatus = getAsyncStatus; | ||
//Get all available model builder async jobs | ||
/** | ||
* Get all available model builder async jobs for a particular model | ||
* @param slug - the slug of the model you wish to get all async jobs from | ||
* | ||
* @returns a DocHorizonResponse containing all found async jobs for a particular model | ||
*/ | ||
function getAsyncJobs(slug) { | ||
@@ -133,3 +181,9 @@ return __awaiter(this, void 0, void 0, function* () { | ||
ModelBuilderService.getAsyncJobs = getAsyncJobs; | ||
//Get a list of available model builder async jobs | ||
/** | ||
* Get a list of all available model builder async jobs for a particular model | ||
* @param slug - the slug of the model you wish to get all async jobs from | ||
* @param status - optionally, provide an AsyncStatus to filter the results on | ||
* @see {@link AsyncStatus} for available statusses | ||
* @returns a list containing all found async job ids for a particular model | ||
*/ | ||
function getListOfJobIds(slug, status) { | ||
@@ -142,3 +196,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
ModelBuilderService.getListOfJobIds = getListOfJobIds; | ||
//Remove a model builder async job | ||
/** | ||
* Remove a model builder async job | ||
* @param slug - the slug of the model you wish to delete | ||
* @param job_id - the job_id of the async job you wish to delete | ||
* | ||
* @returns a DocHorizonResponse containing deletion information | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function removeAsyncJob(slug, job_id) { | ||
@@ -158,3 +219,9 @@ return __awaiter(this, void 0, void 0, function* () { | ||
ModelBuilderService.removeAsyncJob = removeAsyncJob; | ||
//Get logs of a model builder async job | ||
/** | ||
* Get logs for a model builder async job | ||
* @param slug - the slug of the model used | ||
* @param job_id - the job id you wish to obtain logs from | ||
* | ||
* @returns a DocHorizonResponse containing any found logs for the provided slug and job id | ||
*/ | ||
function getLogsOfAsyncJob(slug, job_id) { | ||
@@ -173,3 +240,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
ModelBuilderService.getLogsOfAsyncJob = getLogsOfAsyncJob; | ||
//Get results of a model builder async job | ||
/** | ||
* Get the results of a model builder async job | ||
* @param slug - the slug of the used model builder model | ||
* @param job_id - the id of the job you wish to get the results off | ||
* | ||
* @returns a DocHorizonResponse containing the results from the model builder capturer | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getResultsOfAsyncJob(slug, job_id) { | ||
@@ -198,3 +272,7 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
//Get a list of available model builder configurations | ||
/** | ||
* Get a list of all available model builder configurations for the used API key | ||
* | ||
* @returns a list of available models | ||
*/ | ||
function getModelsList() { | ||
@@ -201,0 +279,0 @@ return __awaiter(this, void 0, void 0, function* () { |
import { DocHorizonDocument } from "../../../Types/UserOptionsTypes"; | ||
import { DocHorizonResponse } from "../../../Types/ApiTypes"; | ||
import { AsyncOptions, AsyncStatus } from "../Async.types"; | ||
/** | ||
* Prompt Builder Service | ||
* | ||
* Exposing multiple functions to execute using the prompt builder API | ||
*/ | ||
export declare namespace PromptBuilderService { | ||
/** | ||
* Capture a document using a prompt builder configuration | ||
* @param src - the document in the form of a DocHorizonDocument object, or a string | ||
* @see {@link DocHorizonDocument} | ||
* @param slug - the slug of the prompt builder configuration to use | ||
* | ||
* @returns DocHorizonResponse - A promise of type DocHorizonResponse | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function capture(src: string | string[] | DocHorizonDocument | DocHorizonDocument[], slug: string): Promise<DocHorizonResponse>; | ||
/** | ||
* Get the available prompt configurations for the used API key | ||
* | ||
* @returns Promise<DocHorizonResponse> - A promise of type DocHorizonResponse | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getConfigurations(): Promise<DocHorizonResponse>; | ||
/** | ||
* Get the JSON schema of a prompt configuration | ||
* | ||
* @param slug - slug of the prompt configuration you wish to get the Json schema of | ||
* @returns Promise<DocHorizonResponse> - a promise of type DocHorizonResponse | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getJsonSchema(slug: string): Promise<DocHorizonResponse>; | ||
/** | ||
* Capture data from a document using a prompt configuration - async | ||
* | ||
* @param src - the document to capture data from. Can be given in the form of a string or a | ||
* DocHorizonDocument. {@link DocHorizonDocument}. Multiple strings or DocHorizonDocument | ||
* types can be given in the form of an array. | ||
* @param slug - slug of the prompt configuration to use | ||
* @param options - Object of Asynchronous options | ||
* @see {@link AsyncOptions} | ||
* | ||
* @returns Promise<DocHorizonResponse> - a promise of type DocHorizonResponse | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function captureAsync(src: string | string[] | DocHorizonDocument | DocHorizonDocument[], slug: string, options?: AsyncOptions): Promise<DocHorizonResponse>; | ||
/** | ||
* Get the status of a prompt builder async job | ||
* @param slug - slug of the prompt builder configuration to get status information on | ||
* @param job_id - id of the job to get status information on | ||
* | ||
* @returns a DocHorizonResponse containing found status information of the provided job id | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getAsyncStatus(slug: string, job_id: string): Promise<DocHorizonResponse>; | ||
/** | ||
* Get all available prompt builder async jobs | ||
* | ||
* @param slug - the slug of a prompt builder configuration to get async jobs of | ||
* | ||
* @returns a DocHorizonResponse containing available prompt builder async jobs | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getAsyncJobs(slug: string): Promise<DocHorizonResponse>; | ||
/** | ||
* Get all available prompt builder async jobs in the form of a list | ||
* @param slug - the slug of a prompt builder configuration to get async jobs of | ||
* @param status - optionally, provide a status to filter the results | ||
* @see {@link AsyncStatus} | ||
* | ||
* @returns a list of found job ids | ||
*/ | ||
function getListOfJobIds(slug: string, status?: AsyncStatus): Promise<string[]>; | ||
/** | ||
* Remove a prompt builder async job | ||
* | ||
* @param slug - the slug of a prompt builder configuration to remove the async job of | ||
* @param job_id - the id of a job to remove | ||
* | ||
* @returns a DocHorizonResponse containing information about the deletion | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function removeAsyncJob(slug: string, job_id: string): Promise<DocHorizonResponse>; | ||
/** | ||
* Get logs of a prompt builder async job | ||
* @param slug - the slug of a prompt builder configuration to remove the async job of | ||
* @param job_id - the id of a job to get logs of | ||
* | ||
* @returns a DocHorizonResponse containing any found logs | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getLogsOfAsyncJob(slug: string, job_id: string): Promise<DocHorizonResponse>; | ||
/** | ||
* Get results of a prompt builder async job | ||
* @param slug - the slug of the prompt builder configuration to get the results of | ||
* @param job_id - the id of a job to get results for | ||
* | ||
* @returns a DocHorizonResponse containing results from the prompt builder capturer | ||
* deletion | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getResultsOfAsyncJob(slug: string, job_id: string): Promise<DocHorizonResponse>; | ||
/** | ||
* Get a list of available prompt builder configurations | ||
* | ||
* @returns a list of prompt builder configuration strings | ||
*/ | ||
function getConfigurationsList(): Promise<string[]>; | ||
} |
@@ -17,2 +17,7 @@ "use strict"; | ||
const Async_service_1 = require("../Async.service"); | ||
/** | ||
* Prompt Builder Service | ||
* | ||
* Exposing multiple functions to execute using the prompt builder API | ||
*/ | ||
var PromptBuilderService; | ||
@@ -30,3 +35,11 @@ (function (PromptBuilderService) { | ||
}; | ||
//Capture data from a document using a specific prompt | ||
/** | ||
* Capture a document using a prompt builder configuration | ||
* @param src - the document in the form of a DocHorizonDocument object, or a string | ||
* @see {@link DocHorizonDocument} | ||
* @param slug - the slug of the prompt builder configuration to use | ||
* | ||
* @returns DocHorizonResponse - A promise of type DocHorizonResponse | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function capture(src, slug) { | ||
@@ -51,3 +64,8 @@ return __awaiter(this, void 0, void 0, function* () { | ||
PromptBuilderService.capture = capture; | ||
//Get all available prompt configurations | ||
/** | ||
* Get the available prompt configurations for the used API key | ||
* | ||
* @returns Promise<DocHorizonResponse> - A promise of type DocHorizonResponse | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getConfigurations() { | ||
@@ -63,3 +81,9 @@ return __awaiter(this, void 0, void 0, function* () { | ||
PromptBuilderService.getConfigurations = getConfigurations; | ||
//Get the Json schema of a prompt configuration | ||
/** | ||
* Get the JSON schema of a prompt configuration | ||
* | ||
* @param slug - slug of the prompt configuration you wish to get the Json schema of | ||
* @returns Promise<DocHorizonResponse> - a promise of type DocHorizonResponse | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getJsonSchema(slug) { | ||
@@ -78,3 +102,15 @@ return __awaiter(this, void 0, void 0, function* () { | ||
PromptBuilderService.getJsonSchema = getJsonSchema; | ||
//Capture data from a document using a specific prompt asynchronously | ||
/** | ||
* Capture data from a document using a prompt configuration - async | ||
* | ||
* @param src - the document to capture data from. Can be given in the form of a string or a | ||
* DocHorizonDocument. {@link DocHorizonDocument}. Multiple strings or DocHorizonDocument | ||
* types can be given in the form of an array. | ||
* @param slug - slug of the prompt configuration to use | ||
* @param options - Object of Asynchronous options | ||
* @see {@link AsyncOptions} | ||
* | ||
* @returns Promise<DocHorizonResponse> - a promise of type DocHorizonResponse | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function captureAsync(src, slug, options) { | ||
@@ -96,3 +132,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
PromptBuilderService.captureAsync = captureAsync; | ||
//Get the status of a prompt builder async job | ||
/** | ||
* Get the status of a prompt builder async job | ||
* @param slug - slug of the prompt builder configuration to get status information on | ||
* @param job_id - id of the job to get status information on | ||
* | ||
* @returns a DocHorizonResponse containing found status information of the provided job id | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getAsyncStatus(slug, job_id) { | ||
@@ -112,3 +155,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
PromptBuilderService.getAsyncStatus = getAsyncStatus; | ||
//Get all available prompt builder async jobs | ||
/** | ||
* Get all available prompt builder async jobs | ||
* | ||
* @param slug - the slug of a prompt builder configuration to get async jobs of | ||
* | ||
* @returns a DocHorizonResponse containing available prompt builder async jobs | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getAsyncJobs(slug) { | ||
@@ -127,3 +177,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
PromptBuilderService.getAsyncJobs = getAsyncJobs; | ||
//Get a list of available prompt builder async jobs | ||
/** | ||
* Get all available prompt builder async jobs in the form of a list | ||
* @param slug - the slug of a prompt builder configuration to get async jobs of | ||
* @param status - optionally, provide a status to filter the results | ||
* @see {@link AsyncStatus} | ||
* | ||
* @returns a list of found job ids | ||
*/ | ||
function getListOfJobIds(slug, status) { | ||
@@ -136,3 +193,11 @@ return __awaiter(this, void 0, void 0, function* () { | ||
PromptBuilderService.getListOfJobIds = getListOfJobIds; | ||
//Remove a prompt builder async job | ||
/** | ||
* Remove a prompt builder async job | ||
* | ||
* @param slug - the slug of a prompt builder configuration to remove the async job of | ||
* @param job_id - the id of a job to remove | ||
* | ||
* @returns a DocHorizonResponse containing information about the deletion | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function removeAsyncJob(slug, job_id) { | ||
@@ -152,3 +217,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
PromptBuilderService.removeAsyncJob = removeAsyncJob; | ||
//Get logs of a prompt builder async job | ||
/** | ||
* Get logs of a prompt builder async job | ||
* @param slug - the slug of a prompt builder configuration to remove the async job of | ||
* @param job_id - the id of a job to get logs of | ||
* | ||
* @returns a DocHorizonResponse containing any found logs | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getLogsOfAsyncJob(slug, job_id) { | ||
@@ -168,3 +240,11 @@ return __awaiter(this, void 0, void 0, function* () { | ||
PromptBuilderService.getLogsOfAsyncJob = getLogsOfAsyncJob; | ||
//Get results of a prompt builder async job | ||
/** | ||
* Get results of a prompt builder async job | ||
* @param slug - the slug of the prompt builder configuration to get the results of | ||
* @param job_id - the id of a job to get results for | ||
* | ||
* @returns a DocHorizonResponse containing results from the prompt builder capturer | ||
* deletion | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function getResultsOfAsyncJob(slug, job_id) { | ||
@@ -183,3 +263,7 @@ return __awaiter(this, void 0, void 0, function* () { | ||
PromptBuilderService.getResultsOfAsyncJob = getResultsOfAsyncJob; | ||
//Get a list of available prompt builder configurations | ||
/** | ||
* Get a list of available prompt builder configurations | ||
* | ||
* @returns a list of prompt builder configuration strings | ||
*/ | ||
function getConfigurationsList() { | ||
@@ -186,0 +270,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -6,2 +6,10 @@ type Configuration = { | ||
export { Configuration }; | ||
/** | ||
* How a prompt or model is defined in terms of naming and identifying | ||
* | ||
* @property name - name of the configuration | ||
* @property slug - slug of the configuration | ||
* | ||
* @interface | ||
*/ | ||
export type ModelPromptBuilderConfigResult = { | ||
@@ -8,0 +16,0 @@ name: string; |
import { DocHorizonResponse } from "../../Types/ApiTypes"; | ||
import { CiaOptions } from "./CIA.types"; | ||
/** | ||
* CIA Service | ||
* | ||
* Exposing the search function to search for company data | ||
*/ | ||
export declare namespace CIAService { | ||
/** | ||
* Search for company data given provided parameters/fields | ||
* | ||
* @param options - an object containing the search parameters/fields | ||
* @see {@link CiaOptions} | ||
* | ||
* @returns a DocHorizonResponse containing any found data for the CIA search | ||
*/ | ||
function search(options: CiaOptions): Promise<DocHorizonResponse>; | ||
} |
@@ -14,2 +14,7 @@ "use strict"; | ||
const APIFunctions_1 = require("../APIFunctions"); | ||
/** | ||
* CIA Service | ||
* | ||
* Exposing the search function to search for company data | ||
*/ | ||
var CIAService; | ||
@@ -20,3 +25,10 @@ (function (CIAService) { | ||
}; | ||
//Search for company data given provided parameters | ||
/** | ||
* Search for company data given provided parameters/fields | ||
* | ||
* @param options - an object containing the search parameters/fields | ||
* @see {@link CiaOptions} | ||
* | ||
* @returns a DocHorizonResponse containing any found data for the CIA search | ||
*/ | ||
function search(options) { | ||
@@ -23,0 +35,0 @@ return __awaiter(this, void 0, void 0, function* () { |
import countries from "i18n-iso-countries"; | ||
export type CountryCode = countries.Alpha2Code; | ||
/** | ||
* Object containing search fields and other configuration options to send to the CIA service's | ||
* search function | ||
* | ||
* @property address_city | ||
* @property address_municipality | ||
* @property address_number | ||
* @property address_postal_code | ||
* @property address_state | ||
* @property address_street_name | ||
* @property coc_number | ||
* @property company_name | ||
* @property country_code | ||
* @property depth - choose the depth the results are returned as. Available options are entity, | ||
* location and address | ||
* @property email | ||
* @property fiscal_number | ||
* @property iban | ||
* @property phone | ||
* @property po_box | ||
* @property registration_number | ||
* @property vat_number | ||
* @property website | ||
* | ||
* @interface | ||
*/ | ||
export type CiaOptions = { | ||
@@ -4,0 +30,0 @@ address_city?: string; |
import { DocHorizonResponse } from "../../Types/ApiTypes"; | ||
/** | ||
* The Capturing Service | ||
* | ||
* Exposing functions related to the capturing models | ||
*/ | ||
export declare namespace CapturingService { | ||
/** | ||
* Get all enabled capturing models for this API key | ||
* | ||
* @returns a DocHorizonResponse containing the enabled capturing models for the used API key | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function listEnabledModels(): Promise<DocHorizonResponse>; | ||
/** | ||
* Get a list of all enabled capturing models for this API key | ||
* | ||
* @returns a list of strings containing the enabled capturing models for the used | ||
* API key | ||
*/ | ||
function getListOfEnabledCapturingModels(): Promise<string[]>; | ||
} |
@@ -14,2 +14,7 @@ "use strict"; | ||
const APIFunctions_1 = require("../APIFunctions"); | ||
/** | ||
* The Capturing Service | ||
* | ||
* Exposing functions related to the capturing models | ||
*/ | ||
var CapturingService; | ||
@@ -20,3 +25,8 @@ (function (CapturingService) { | ||
}; | ||
//Get all enabled capturing models for this Api key | ||
/** | ||
* Get all enabled capturing models for this API key | ||
* | ||
* @returns a DocHorizonResponse containing the enabled capturing models for the used API key | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function listEnabledModels() { | ||
@@ -32,3 +42,8 @@ return __awaiter(this, void 0, void 0, function* () { | ||
CapturingService.listEnabledModels = listEnabledModels; | ||
//Get a list of enabled capturing models for this Api key | ||
/** | ||
* Get a list of all enabled capturing models for this API key | ||
* | ||
* @returns a list of strings containing the enabled capturing models for the used | ||
* API key | ||
*/ | ||
function getListOfEnabledCapturingModels() { | ||
@@ -35,0 +50,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -0,1 +1,13 @@ | ||
/** | ||
* How a capturing model is defined | ||
* | ||
* @property name - name of the capturing service can be any of the ServiceName types | ||
* @see {@link ServiceName} | ||
* | ||
* @property service - name of the service identifier which can be any of the ServiceIdentifier | ||
* types | ||
* @see {@link ServiceIdentifier} | ||
* | ||
* @interface | ||
*/ | ||
export type Model = { | ||
@@ -2,0 +14,0 @@ name: ServiceName; |
import { DocHorizonResponse } from "../../Types/ApiTypes"; | ||
import { MergeOptions, RenderOptions, SplitOptions } from "./DocumentToolkit.types"; | ||
import { DocHorizonDocument } from "../../Types/UserOptionsTypes"; | ||
/** | ||
* Document Toolkit Service | ||
* | ||
* Exposes functions for various Document Toolkit operations | ||
*/ | ||
export declare namespace DocumentToolkitService { | ||
/** | ||
* Obtain information about a provided document | ||
* @param src - the document in the form of a DocHorizonDocument object, or a string | ||
* @see {@link DocHorizonDocument} | ||
* | ||
* @returns a DocHorizonResponse containing response data from the Document Toolkit Info endpoint | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function info(src: string | DocHorizonDocument): Promise<DocHorizonResponse>; | ||
/** | ||
* Merge multiple documents into one | ||
* @param src - A list of strings or a list of DocHorizonDocument objects | ||
* @see {@link DocHorizonDocument} | ||
* | ||
* @param options - an object containing merge options | ||
* @see {@link MergeOptions} | ||
*/ | ||
function merge(src: string[] | DocHorizonDocument[], options?: MergeOptions): Promise<DocHorizonResponse>; | ||
/** | ||
* Get the results of a merge operation in the form of actual filedata | ||
* @param res - A DocHorizonResponse type, from the merge operation of the document toolkit | ||
* @see {@link DocHorizonResponse} | ||
* | ||
* @returns a base64 data string of the merged result | ||
*/ | ||
function getMergedResults(res: DocHorizonResponse): Promise<string>; | ||
/** | ||
* Split a file into multiple files | ||
* @param src - either a string indicating a document, or a DocHorizonDocument | ||
* @param options - an object containing options in regards to the splitting proces | ||
* @see {@link SplitOptions} | ||
*/ | ||
function split(src: string | DocHorizonDocument, options?: SplitOptions): Promise<DocHorizonResponse>; | ||
/** | ||
* Render a document as an image | ||
* @param src - either a string indicating a document, or a DocHorizonDocument | ||
* @see {@link DocHorizonDocument} | ||
* @param options - an object containing options for the render operation | ||
* @see {@link RenderOptions} | ||
*/ | ||
function render(src: string | DocHorizonDocument, options: RenderOptions): Promise<DocHorizonResponse>; | ||
/** | ||
* Get image data out of a render operation result | ||
* @param res - The DocHorizonResponse from the Render Function | ||
* @see {@link render} | ||
* @see {@link DocHorizonResponse} | ||
* @param index - an optional value to indicate which image you would like to get, if there | ||
* are multile pages/images. If this is not given the first image will always be retrieved | ||
* | ||
* @returns a string containing image data | ||
*/ | ||
function getRenderedImage(res: DocHorizonResponse, index?: number): Promise<string>; | ||
/** | ||
* Get file data OR file ids of the results of a Document Toolkit Split operation | ||
* | ||
* @param res - the DocHorizonResponse result of a split operation | ||
* @see {@link split} | ||
* @see {@link DocHorizonResponse} | ||
* | ||
* @returns a list of strings, either in the form of file data or file ids, for the result of | ||
* the split operation | ||
* | ||
*/ | ||
function getSplitDocumentsList(res: DocHorizonResponse): Promise<string[]>; | ||
} |
@@ -16,2 +16,7 @@ "use strict"; | ||
const DocHorizonDocumentFunctions_1 = require("../DocHorizonDocumentFunctions"); | ||
/** | ||
* Document Toolkit Service | ||
* | ||
* Exposes functions for various Document Toolkit operations | ||
*/ | ||
var DocumentToolkitService; | ||
@@ -25,3 +30,10 @@ (function (DocumentToolkitService) { | ||
}; | ||
//Obtain information about a provided document | ||
/** | ||
* Obtain information about a provided document | ||
* @param src - the document in the form of a DocHorizonDocument object, or a string | ||
* @see {@link DocHorizonDocument} | ||
* | ||
* @returns a DocHorizonResponse containing response data from the Document Toolkit Info endpoint | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function info(src) { | ||
@@ -38,3 +50,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
DocumentToolkitService.info = info; | ||
//Merge multiple documents into one | ||
/** | ||
* Merge multiple documents into one | ||
* @param src - A list of strings or a list of DocHorizonDocument objects | ||
* @see {@link DocHorizonDocument} | ||
* | ||
* @param options - an object containing merge options | ||
* @see {@link MergeOptions} | ||
*/ | ||
function merge(src, options) { | ||
@@ -53,3 +72,9 @@ return __awaiter(this, void 0, void 0, function* () { | ||
DocumentToolkitService.merge = merge; | ||
//Get file data or a file id of the result of a Merge operation | ||
/** | ||
* Get the results of a merge operation in the form of actual filedata | ||
* @param res - A DocHorizonResponse type, from the merge operation of the document toolkit | ||
* @see {@link DocHorizonResponse} | ||
* | ||
* @returns a base64 data string of the merged result | ||
*/ | ||
function getMergedResults(res) { | ||
@@ -68,3 +93,8 @@ return __awaiter(this, void 0, void 0, function* () { | ||
DocumentToolkitService.getMergedResults = getMergedResults; | ||
//Split a file into multiple files | ||
/** | ||
* Split a file into multiple files | ||
* @param src - either a string indicating a document, or a DocHorizonDocument | ||
* @param options - an object containing options in regards to the splitting proces | ||
* @see {@link SplitOptions} | ||
*/ | ||
function split(src, options) { | ||
@@ -88,3 +118,9 @@ return __awaiter(this, void 0, void 0, function* () { | ||
DocumentToolkitService.split = split; | ||
//Render a document as an image | ||
/** | ||
* Render a document as an image | ||
* @param src - either a string indicating a document, or a DocHorizonDocument | ||
* @see {@link DocHorizonDocument} | ||
* @param options - an object containing options for the render operation | ||
* @see {@link RenderOptions} | ||
*/ | ||
function render(src, options) { | ||
@@ -117,3 +153,12 @@ return __awaiter(this, void 0, void 0, function* () { | ||
DocumentToolkitService.render = render; | ||
//Get image data of the result of a Render operation | ||
/** | ||
* Get image data out of a render operation result | ||
* @param res - The DocHorizonResponse from the Render Function | ||
* @see {@link render} | ||
* @see {@link DocHorizonResponse} | ||
* @param index - an optional value to indicate which image you would like to get, if there | ||
* are multile pages/images. If this is not given the first image will always be retrieved | ||
* | ||
* @returns a string containing image data | ||
*/ | ||
function getRenderedImage(res, index) { | ||
@@ -134,3 +179,13 @@ return __awaiter(this, void 0, void 0, function* () { | ||
DocumentToolkitService.getRenderedImage = getRenderedImage; | ||
//Get the file data or file ids of the results of a split operation | ||
/** | ||
* Get file data OR file ids of the results of a Document Toolkit Split operation | ||
* | ||
* @param res - the DocHorizonResponse result of a split operation | ||
* @see {@link split} | ||
* @see {@link DocHorizonResponse} | ||
* | ||
* @returns a list of strings, either in the form of file data or file ids, for the result of | ||
* the split operation | ||
* | ||
*/ | ||
function getSplitDocumentsList(res) { | ||
@@ -137,0 +192,0 @@ return __awaiter(this, void 0, void 0, function* () { |
type OutputTarget = "Base64" | "StorageAPI"; | ||
/** | ||
* Object containing merge options for the Merge functionality of the document toolkit | ||
* | ||
* @property output_target - String indicating whether to output the result as "Base64" or as a | ||
* DocHorizon storage id | ||
* | ||
* @interface | ||
*/ | ||
type MergeOptions = { | ||
output_target: OutputTarget; | ||
}; | ||
/** | ||
* Object to give options to the image rendering operation | ||
* | ||
* @property height - height in px | ||
* @property page_ranges - string or list of strings indicating which page ranges to apply these | ||
* options to | ||
* @property width - width in px | ||
* | ||
* @interface | ||
*/ | ||
type ImageRenderOptions = { | ||
@@ -10,2 +28,13 @@ height?: number; | ||
}; | ||
/** | ||
* Options to send to the render operation | ||
* | ||
* @property output_data - whether to output the result as "Base64" or save is as a "StorageAPI" id | ||
* @see {@link OutputTarget} | ||
* | ||
* @property renders - list of ImageRender options, or one object of imageRenderOptions | ||
* @see {@link ImageRenderOptions} | ||
* | ||
* @interface | ||
*/ | ||
type RenderOptions = { | ||
@@ -15,2 +44,12 @@ output_target?: OutputTarget; | ||
}; | ||
/** | ||
* Options to send to the split operation | ||
* | ||
* @property output_target - whether to output the result as "Base64" or save it as a | ||
* "StorageAPI" id | ||
* @see {@link OutputTarget} | ||
* | ||
* @property page_ranges - a list of strings or a string containing information on how the | ||
* document should be split | ||
*/ | ||
type SplitOptions = { | ||
@@ -27,2 +66,11 @@ output_target?: OutputTarget; | ||
}; | ||
/** | ||
* typical output data structure | ||
* | ||
* @property content_type - content type of the file | ||
* @property data - datastring of the file in base64 | ||
* @property file_id - if set, the file_id of the file | ||
* | ||
* @interface | ||
*/ | ||
export type Output = { | ||
@@ -33,2 +81,10 @@ content_type: string; | ||
}; | ||
/** | ||
* type containing a document with output data | ||
* | ||
* @property document - document object containing a field called output with Output data | ||
* @see {@link Output} | ||
* | ||
* @interface | ||
*/ | ||
export type Document = { | ||
@@ -39,2 +95,15 @@ document: { | ||
}; | ||
/** | ||
* Render object that contains output data and rendered pages | ||
* | ||
* @property output - object containing output data | ||
* @see {@link Output} | ||
* | ||
* @property page_range - string indicating which page range this render is made from | ||
* @property pages - object containing page metadata such as height, page_number, point_to_pixel | ||
* ratio, width, x coordinate and y coordinate | ||
* | ||
* @interface | ||
* | ||
*/ | ||
export type Render = { | ||
@@ -52,5 +121,23 @@ output: Output; | ||
}; | ||
/** | ||
* The result of the render endpoint | ||
* | ||
* @property renders - a list of Render objects | ||
* @see {@link Render} | ||
* | ||
* @interface | ||
*/ | ||
export type RenderResult = { | ||
renders: Render[]; | ||
}; | ||
/** | ||
* pluralized version of the Document object, containing a page_range field for each returned | ||
* document. | ||
* | ||
* @property documents - list of objects containing an Output and a page_range string. | ||
* @see {@link Output} | ||
* @see {@link Document} | ||
* | ||
* @interface | ||
*/ | ||
export type Documents = { | ||
@@ -57,0 +144,0 @@ documents: { |
import { DocHorizonResponse } from "../../Types/ApiTypes"; | ||
import { DocHorizonDocument } from "../../Types/UserOptionsTypes"; | ||
/** | ||
* The Storage Service | ||
* | ||
* Exposes a function to save a file to DocHorizon storage | ||
*/ | ||
export declare namespace StorageService { | ||
/** | ||
* Save a file to DocHorizon storage | ||
* @param src - either a string indicating a document, or a DocHorizonDocument | ||
* @see {@link DocHorizonDocument} | ||
* | ||
* @returns a DocHorizonResponse indicating whether a file has been succesfully saved | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function saveToStorage(src: DocHorizonDocument | string): Promise<DocHorizonResponse>; | ||
} |
@@ -15,2 +15,7 @@ "use strict"; | ||
const APIFunctions_1 = require("../APIFunctions"); | ||
/** | ||
* The Storage Service | ||
* | ||
* Exposes a function to save a file to DocHorizon storage | ||
*/ | ||
var StorageService; | ||
@@ -22,3 +27,10 @@ (function (StorageService) { | ||
}; | ||
//Save a document to DocHorizon storage | ||
/** | ||
* Save a file to DocHorizon storage | ||
* @param src - either a string indicating a document, or a DocHorizonDocument | ||
* @see {@link DocHorizonDocument} | ||
* | ||
* @returns a DocHorizonResponse indicating whether a file has been succesfully saved | ||
* @see {@link DocHorizonResponse} | ||
*/ | ||
function saveToStorage(src) { | ||
@@ -25,0 +37,0 @@ return __awaiter(this, void 0, void 0, function* () { |
import { ImageRenderOptions } from "../Services/DocumentToolkit/DocumentToolkit.types"; | ||
import { Webhook } from "../Services/Capturing/Async.types"; | ||
import { RelationMatching } from "../Services/Capturing/Financial/Financial.types"; | ||
/** | ||
* Preset object to send to an endpoint | ||
* | ||
* @property slug - string indicating which preset configuration to use for the API call | ||
* | ||
* @interface | ||
*/ | ||
type Preset = { | ||
slug: string; | ||
}; | ||
/** | ||
* Object representing a keyword matching rule | ||
* | ||
* @property id - id to identify the rule | ||
* @property keywords - a list of strings for each keyword to match with | ||
* @property regex - a regex to use to look for keywords to match with | ||
* | ||
* @interface | ||
*/ | ||
type Rule = { | ||
@@ -12,2 +28,15 @@ id: string; | ||
}; | ||
/** | ||
* Object containing either keyword_matching, relation_matching, or both, to use in an API call | ||
* | ||
* @property keyword_matching - Object containing a field called rules, that holds a list of | ||
* keyword_matching rules to be used in the request | ||
* @see {@link Rule} | ||
* | ||
* @property relation_matching - Object containing assignments and relation data to be used for | ||
* the request | ||
* @see {@link RelationMatching} | ||
* | ||
* @interface | ||
*/ | ||
type Components = { | ||
@@ -19,5 +48,42 @@ keyword_matching?: { | ||
}; | ||
/** | ||
* Object to configure hitl for an API call | ||
* | ||
* @property slug - slug indicating which hitl configuration to use | ||
* | ||
* @interface | ||
*/ | ||
type Hitl = { | ||
slug: string; | ||
}; | ||
/** | ||
* A type defining what the options of an API call could be | ||
* The fields are all optional because the actual fields are dependent of a certain endpoint. | ||
* In the financial model capture endpoint, FinancialOptions are expected. These options are | ||
* later on added to a JSON body that consists of a Document type and an AdditionalBodyData type | ||
* | ||
* @property preset - a preset object containing a slug of a preset to be used in the request | ||
* @see {@link Preset} | ||
* | ||
* @property components - an object containing either keyword_matching, relation_matching, or both | ||
* @see {@link Components} | ||
* | ||
* @property output_target - a string indicating whether to output the result as "Base64" or | ||
* "StorageAPI" | ||
* | ||
* @property page_ranges - a string of list of strings indicating which range of pages to use | ||
* for this request | ||
* | ||
* @property renders - options to apply to a render operation | ||
* @see {@link ImageRenderOptions} | ||
* | ||
* @property hitl - Human In The Loop object containing a slug of a hitl configuration to be | ||
* used in the request | ||
* @see {@link Hitl} | ||
* | ||
* @property webhook - Webhook configuration object to be able to use webhook in an async request | ||
* @see {@link Webhook} | ||
* | ||
* @interface | ||
*/ | ||
export type AdditionalBodyData = { | ||
@@ -24,0 +90,0 @@ preset?: Preset; |
@@ -7,2 +7,10 @@ import { AsyncJobList, AsyncPostResult } from "../Services/Capturing/Async.types"; | ||
export type APIMethod = "GET" | "POST" | "PUT" | "DELETE"; | ||
/** | ||
* How an endpoint is identified | ||
* | ||
* @property method - "GET" or "POST" or "PUT" or "DELETE | ||
* @property url - string of the url of the endpoint | ||
* | ||
* @interface | ||
*/ | ||
export type Endpoint = { | ||
@@ -12,2 +20,13 @@ method: APIMethod; | ||
}; | ||
/** | ||
* How parameters are delivered before an API call | ||
* | ||
* @property PathParams - a dictionary of key-values where the key stands for the path param | ||
* field and the value for the string to fill in as parameter in the url | ||
* @property QueryParams - a dictionary of key-values where the key stand for the field key in | ||
* the url and the value is the value of said key | ||
* | ||
* @ | ||
* @interface | ||
*/ | ||
export type ParamData = { | ||
@@ -17,2 +36,11 @@ PathParams?: Record<string, string | number | boolean>; | ||
}; | ||
/** | ||
* The standard results obtained when doing an API call | ||
* | ||
* @property result - string indicating whether the call was succesful | ||
* @property request_id - string identifying the request | ||
* @property code - number indicating a status | ||
* | ||
* @interface | ||
*/ | ||
export type ApiSharedResult = { | ||
@@ -26,5 +54,28 @@ result: "success" | "response"; | ||
}; | ||
/** | ||
* The data returned by the API. Its contents are dependent of which service is used | ||
* | ||
* @property data - the specific returned data, which type depends on which function used | ||
* {@link FinancialPresetsResult} FinancialPresetResult | ||
* {@link ModelPromptBuilderConfigResult} Model or Prompt Config Result | ||
* {@link AsyncJobList} Async Job Lists Result | ||
* {@link Model} Model results | ||
* {@link Document} document data result | ||
* {@link Documents} document data result, but with page-ranges | ||
* {@link RenderResult} a list of rendered image data | ||
* {@link AsyncPostResult} results from async post functions | ||
* Or Record<string, any> for Anything else that can be mapped as K,V | ||
* | ||
* @interface | ||
*/ | ||
export type ApiResponseData = ApiSharedResult & { | ||
data?: FinancialPresetsResult[] | ModelPromptBuilderConfigResult[] | AsyncJobList | Model[] | Document[] | Document | Documents | RenderResult | AsyncPostResult | Record<string, any>; | ||
}; | ||
/** | ||
* The response type obtained as a result of doing an API call | ||
* @property httpCode - the HTTP code of the request | ||
* @property docHorizonData - The Api Response Data of the request {@link ApiResponseData} | ||
* | ||
* @interface | ||
*/ | ||
export type DocHorizonResponse = { | ||
@@ -34,2 +85,13 @@ httpCode: number; | ||
}; | ||
/** | ||
* Properties indicating necessary properties for doing an API request | ||
* | ||
* @property endpoint - endpoint data consisting of a url and method | ||
* {@see {@link Endpoint}} | ||
* @property params - any path or query parameters present | ||
* {@see {@link ParamData}} | ||
* @property body - bodydata delivered in json-like format | ||
* | ||
* @interface | ||
*/ | ||
export type RequestProperties = { | ||
@@ -36,0 +98,0 @@ endpoint: Endpoint; |
@@ -11,2 +11,16 @@ import { FinancialAsyncOptions, FinancialOptions } from "../Services/Capturing/Financial/Financial.types"; | ||
}; | ||
/** | ||
* A document object that can be used in capturing services | ||
* | ||
* @property data - string containing path pointing to a document | ||
* @property url - string containing url pointing to a document | ||
* @property file_id - string containing file id from DocHorizon storage pointing to a document | ||
* @property content_type - string indicating the content type of the document | ||
* @property password - string containing a password to use if the document is password-protected | ||
* @property page_ranges - list containing (a) string(s) indicating which page ranges of the | ||
* document to use | ||
* @property filename - string indicating the name of the file | ||
* | ||
* @interface | ||
*/ | ||
type DocHorizonDocument = { | ||
@@ -13,0 +27,0 @@ data?: string; |
{ | ||
"name": "@klippa/dochorizon-sdk", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "## NodeJS developer SDK for DocHorizon.", | ||
@@ -42,9 +42,11 @@ "main": "dist/index.js", | ||
"typedoc": "^0.25.12", | ||
"typescript": "^5.3.2" | ||
"typedoc-plugin-markdown": "^3.17.1", | ||
"typedoc-plugin-missing-exports": "^2.2.0", | ||
"typescript": "^5.3.2", | ||
"i18n-iso-countries": "^7.10.0", | ||
"js-yaml": "^4.1.0" | ||
}, | ||
"dependencies": { | ||
"dotenv": "^16.3.1", | ||
"i18n-iso-countries": "^7.10.0", | ||
"js-yaml": "^4.1.0" | ||
"dotenv": "^16.3.1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
367993
1
11271
13
- Removedi18n-iso-countries@^7.10.0
- Removedjs-yaml@^4.1.0
- Removedargparse@2.0.1(transitive)
- Removeddiacritics@1.3.0(transitive)
- Removedi18n-iso-countries@7.13.0(transitive)
- Removedjs-yaml@4.1.0(transitive)