Skip to content

Commit 91ac44b

Browse files
committed
fix comments
1 parent b3c6fc5 commit 91ac44b

3 files changed

Lines changed: 17 additions & 25 deletions

File tree

src/v2/client.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import { BaseProduct } from "@/v2/product/baseProduct.js";
1212

1313
/**
1414
* Options for the V2 Mindee Client.
15-
*
16-
* @category ClientV2
1715
* @example
1816
* const client = new MindeeClientV2({
1917
* apiKey: "YOUR_API_KEY",
@@ -32,8 +30,6 @@ export interface ClientOptions {
3230

3331
/**
3432
* Mindee Client V2 class that centralizes most basic operations.
35-
*
36-
* @category ClientV2
3733
*/
3834
export class Client {
3935
/** Mindee V2 API handler. */
@@ -89,7 +85,6 @@ export class Client {
8985
* @param product the product to retrieve.
9086
* @param inferenceId id of the queue to poll.
9187
* @typeParam T an extension of an `Inference`. Can be omitted as it will be inferred from the `productClass`.
92-
* @category Asynchronous
9388
* @returns a `Promise` containing the inference.
9489
*/
9590
async getResult<P extends typeof BaseProduct>(
@@ -108,7 +103,6 @@ export class Client {
108103
*
109104
* @param jobId id of the queue to poll.
110105
* @typeParam T an extension of an `Inference`. Can be omitted as it will be inferred from the `productClass`.
111-
* @category Asynchronous
112106
* @returns a `Promise` containing a `Job`, which also contains a `Document` if the
113107
* parsing is complete.
114108
*/
@@ -126,7 +120,6 @@ export class Client {
126120
*
127121
* @param pollingOptions options for the polling loop, see {@link PollingOptions}.
128122
* @typeParam T an extension of an `Inference`. Can be omitted as it will be inferred from the `productClass`.
129-
* @category Synchronous
130123
* @returns a `Promise` containing parsing results.
131124
*/
132125
async enqueueAndGetResult<P extends typeof BaseProduct>(

src/v2/http/apiSettings.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ const API_V2_KEY_ENVVAR_NAME: string = "MINDEE_V2_API_KEY";
66
const API_V2_HOST_ENVVAR_NAME: string = "MINDEE_V2_API_HOST";
77
const DEFAULT_MINDEE_API_HOST: string = "api-v2.mindee.net";
88

9+
/**
10+
* Settings for the V2 API.
11+
*/
912
export class ApiSettings extends BaseSettings {
1013
baseHeaders: Record<string, string>;
1114

src/v2/http/mindeeApiV2.ts

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ import { MindeeHttpErrorV2 } from "./errors.js";
1818
import { logger } from "@/logger.js";
1919
import { BaseProduct } from "@/v2/product/baseProduct.js";
2020

21-
21+
/**
22+
* Mindee V2 API handler.
23+
*/
2224
export class MindeeApiV2 {
2325
settings: ApiSettings;
2426

@@ -27,11 +29,10 @@ export class MindeeApiV2 {
2729
}
2830

2931
/**
30-
* Sends a file to the extraction inference queue.
32+
* Sends a file to the product inference queue.
3133
* @param product product to enqueue.
3234
* @param inputSource Local file loaded as an input.
3335
* @param params {ExtractionParameters} parameters relating to the enqueueing options.
34-
* @category V2
3536
* @throws Error if the server's response contains an error.
3637
* @returns a `Promise` containing a job response.
3738
*/
@@ -51,24 +52,22 @@ export class MindeeApiV2 {
5152
}
5253

5354
/**
54-
* Requests the results of a queued document from the API.
55+
* Get the specified Job.
5556
* Throws an error if the server's response contains an error.
56-
* @param jobId The document's ID in the queue.
57-
* @category Asynchronous
58-
* @returns a `Promise` containing information on the queue.
57+
* @param jobId The Job ID as returned by the enqueue request.
58+
* @returns a `Promise` containing the job response.
5959
*/
6060
async getJob(jobId: string): Promise<JobResponse> {
6161
const response = await this.#reqGetJob(jobId);
6262
return this.#processResponse(response, JobResponse);
6363
}
6464

6565
/**
66-
* Requests the job of a queued document from the API.
66+
* Get the result of a queued document from the API.
6767
* Throws an error if the server's response contains an error.
6868
* @param product
69-
* @param inferenceId The result's ID in the queue.
70-
* @category Asynchronous
71-
* @returns a `Promise` containing either the parsed result, or information on the queue.
69+
* @param inferenceId The inference ID for the result.
70+
* @returns a `Promise` containing the parsed result.
7271
*/
7372
async getProductResultById<P extends typeof BaseProduct>(
7473
product: P,
@@ -81,12 +80,11 @@ export class MindeeApiV2 {
8180
}
8281

8382
/**
84-
* Requests the job of a queued document from the API.
83+
* Get the result of a queued document from the API.
8584
* Throws an error if the server's response contains an error.
8685
* @param product
87-
* @param url The document's ID in the queue.
88-
* @category Asynchronous
89-
* @returns a `Promise` containing either the parsed result, or information on the queue.
86+
* @param url The URL as returned by a Job's resultUrl property.
87+
* @returns a `Promise` containing the parsed result.
9088
*/
9189
async getProductResultByUrl<P extends typeof BaseProduct>(
9290
product: P,
@@ -130,7 +128,6 @@ export class MindeeApiV2 {
130128

131129
/**
132130
* Sends a document to the inference queue.
133-
*
134131
* @param product Product to enqueue.
135132
* @param inputSource Local or remote file as an input.
136133
* @param params {ExtractionParameters} parameters relating to the enqueueing options.
@@ -172,7 +169,6 @@ export class MindeeApiV2 {
172169
/**
173170
* Make a request to GET the status of a document in the queue.
174171
* @param url URL path to the result.
175-
* @category Asynchronous
176172
* @returns a `Promise` containing the parsed result.
177173
*/
178174
async #reqGetProductResult(url: string): Promise<BaseHttpResponse> {
@@ -182,7 +178,7 @@ export class MindeeApiV2 {
182178
timeoutSecs: this.settings.timeoutSecs,
183179
};
184180
if (!url.startsWith("https://")) {
185-
throw new MindeeError("URL must start with https://");
181+
throw new MindeeError(`Invalid URL: ${url}`);
186182
}
187183
return await sendRequestAndReadResponse(this.settings.dispatcher, options, url);
188184
}

0 commit comments

Comments
 (0)