@markupai/api 0.3.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -1
- package/dist/cjs/Client.js +2 -2
- package/dist/cjs/api/errors/TooManyRequestsError.d.ts +9 -0
- package/dist/cjs/api/errors/TooManyRequestsError.js +52 -0
- package/dist/cjs/api/errors/index.d.ts +1 -0
- package/dist/cjs/api/errors/index.js +1 -0
- package/dist/cjs/api/resources/styleChecks/client/Client.d.ts +3 -2
- package/dist/cjs/api/resources/styleChecks/client/Client.js +5 -2
- package/dist/cjs/api/resources/{styleSuggestions/client/requests/CreateStyleSuggestionV1StyleSuggestionsPostRequest.d.ts → styleChecks/client/requests/StyleCheckRequestBody.d.ts} +4 -4
- package/dist/cjs/api/resources/styleChecks/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/styleGuides/client/Client.js +3 -0
- package/dist/cjs/api/resources/styleGuides/client/requests/StyleGuideRequestBody.d.ts +3 -0
- package/dist/cjs/api/resources/styleRewrites/client/Client.d.ts +3 -2
- package/dist/cjs/api/resources/styleRewrites/client/Client.js +5 -2
- package/dist/cjs/api/resources/{styleChecks/client/requests/CreateStyleCheckV1StyleChecksPostRequest.d.ts → styleRewrites/client/requests/StyleRewriteRequestBody.d.ts} +4 -4
- package/dist/cjs/api/resources/styleRewrites/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/styleSuggestions/client/Client.d.ts +3 -2
- package/dist/cjs/api/resources/styleSuggestions/client/Client.js +5 -2
- package/dist/cjs/api/resources/{styleRewrites/client/requests/CreateStyleRewriteV1StyleRewritesPostRequest.d.ts → styleSuggestions/client/requests/StyleSuggestionRequestBody.d.ts} +4 -4
- package/dist/cjs/api/resources/styleSuggestions/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/types/BaseStyleGuideType.d.ts +9 -0
- package/dist/cjs/api/types/BaseStyleGuideType.js +11 -0
- package/dist/cjs/api/types/StyleGuideResponse.d.ts +3 -1
- package/dist/cjs/api/types/StyleGuides.d.ts +1 -2
- package/dist/cjs/api/types/StyleGuides.js +0 -1
- package/dist/cjs/api/types/WorkflowInfo.d.ts +2 -0
- package/dist/cjs/api/types/index.d.ts +1 -0
- package/dist/cjs/api/types/index.js +1 -0
- package/dist/cjs/core/auth/index.d.ts +2 -2
- package/dist/cjs/core/fetcher/EndpointMetadata.d.ts +13 -0
- package/dist/cjs/core/fetcher/EndpointMetadata.js +2 -0
- package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +12 -0
- package/dist/cjs/core/fetcher/EndpointSupplier.js +22 -0
- package/dist/cjs/core/fetcher/Fetcher.d.ts +4 -2
- package/dist/cjs/core/fetcher/Fetcher.js +3 -2
- package/dist/cjs/core/fetcher/index.d.ts +2 -0
- package/dist/cjs/core/fetcher/index.js +3 -1
- package/dist/cjs/core/fetcher/requestWithRetries.js +44 -8
- package/dist/cjs/core/file/exports.d.ts +1 -1
- package/dist/cjs/core/headers.d.ts +2 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/errors/TooManyRequestsError.d.mts +9 -0
- package/dist/esm/api/errors/TooManyRequestsError.mjs +15 -0
- package/dist/esm/api/errors/index.d.mts +1 -0
- package/dist/esm/api/errors/index.mjs +1 -0
- package/dist/esm/api/resources/styleChecks/client/Client.d.mts +3 -2
- package/dist/esm/api/resources/styleChecks/client/Client.mjs +5 -2
- package/dist/esm/api/resources/{styleSuggestions/client/requests/CreateStyleSuggestionV1StyleSuggestionsPostRequest.d.mts → styleChecks/client/requests/StyleCheckRequestBody.d.mts} +4 -4
- package/dist/esm/api/resources/styleChecks/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/styleGuides/client/Client.mjs +3 -0
- package/dist/esm/api/resources/styleGuides/client/requests/StyleGuideRequestBody.d.mts +3 -0
- package/dist/esm/api/resources/styleRewrites/client/Client.d.mts +3 -2
- package/dist/esm/api/resources/styleRewrites/client/Client.mjs +5 -2
- package/dist/esm/api/resources/styleRewrites/client/requests/{CreateStyleRewriteV1StyleRewritesPostRequest.d.mts → StyleRewriteRequestBody.d.mts} +4 -4
- package/dist/esm/api/resources/styleRewrites/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/styleSuggestions/client/Client.d.mts +3 -2
- package/dist/esm/api/resources/styleSuggestions/client/Client.mjs +5 -2
- package/dist/esm/api/resources/{styleChecks/client/requests/CreateStyleCheckV1StyleChecksPostRequest.d.mts → styleSuggestions/client/requests/StyleSuggestionRequestBody.d.mts} +4 -4
- package/dist/esm/api/resources/styleSuggestions/client/requests/index.d.mts +1 -1
- package/dist/esm/api/types/BaseStyleGuideType.d.mts +9 -0
- package/dist/esm/api/types/BaseStyleGuideType.mjs +8 -0
- package/dist/esm/api/types/StyleGuideResponse.d.mts +3 -1
- package/dist/esm/api/types/StyleGuides.d.mts +1 -2
- package/dist/esm/api/types/StyleGuides.mjs +0 -1
- package/dist/esm/api/types/WorkflowInfo.d.mts +2 -0
- package/dist/esm/api/types/index.d.mts +1 -0
- package/dist/esm/api/types/index.mjs +1 -0
- package/dist/esm/core/auth/index.d.mts +2 -2
- package/dist/esm/core/fetcher/EndpointMetadata.d.mts +13 -0
- package/dist/esm/core/fetcher/EndpointMetadata.mjs +1 -0
- package/dist/esm/core/fetcher/EndpointSupplier.d.mts +12 -0
- package/dist/esm/core/fetcher/EndpointSupplier.mjs +19 -0
- package/dist/esm/core/fetcher/Fetcher.d.mts +4 -2
- package/dist/esm/core/fetcher/Fetcher.mjs +3 -2
- package/dist/esm/core/fetcher/index.d.mts +2 -0
- package/dist/esm/core/fetcher/index.mjs +1 -0
- package/dist/esm/core/fetcher/requestWithRetries.mjs +44 -8
- package/dist/esm/core/file/exports.d.mts +1 -1
- package/dist/esm/core/headers.d.mts +2 -3
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +8 -13
- package/reference.md +3 -3
- /package/dist/cjs/api/resources/styleChecks/client/requests/{CreateStyleCheckV1StyleChecksPostRequest.js → StyleCheckRequestBody.js} +0 -0
- /package/dist/cjs/api/resources/styleRewrites/client/requests/{CreateStyleRewriteV1StyleRewritesPostRequest.js → StyleRewriteRequestBody.js} +0 -0
- /package/dist/cjs/api/resources/styleSuggestions/client/requests/{CreateStyleSuggestionV1StyleSuggestionsPostRequest.js → StyleSuggestionRequestBody.js} +0 -0
- /package/dist/esm/api/resources/styleChecks/client/requests/{CreateStyleCheckV1StyleChecksPostRequest.mjs → StyleCheckRequestBody.mjs} +0 -0
- /package/dist/esm/api/resources/styleRewrites/client/requests/{CreateStyleRewriteV1StyleRewritesPostRequest.mjs → StyleRewriteRequestBody.mjs} +0 -0
- /package/dist/esm/api/resources/styleSuggestions/client/requests/{CreateStyleSuggestionV1StyleSuggestionsPostRequest.mjs → StyleSuggestionRequestBody.mjs} +0 -0
package/README.md
CHANGED
|
@@ -5,6 +5,23 @@
|
|
|
5
5
|
|
|
6
6
|
The official Markup AI SDK for interacting with the Markup AI API.
|
|
7
7
|
|
|
8
|
+
## Table of Contents
|
|
9
|
+
|
|
10
|
+
- [Installation](#installation)
|
|
11
|
+
- [Reference](#reference)
|
|
12
|
+
- [Usage](#usage)
|
|
13
|
+
- [Request and Response Types](#request-and-response-types)
|
|
14
|
+
- [Exception Handling](#exception-handling)
|
|
15
|
+
- [Advanced](#advanced)
|
|
16
|
+
- [Additional Headers](#additional-headers)
|
|
17
|
+
- [Additional Query String Parameters](#additional-query-string-parameters)
|
|
18
|
+
- [Retries](#retries)
|
|
19
|
+
- [Timeouts](#timeouts)
|
|
20
|
+
- [Aborting Requests](#aborting-requests)
|
|
21
|
+
- [Access Raw Response Data](#access-raw-response-data)
|
|
22
|
+
- [Runtime Compatibility](#runtime-compatibility)
|
|
23
|
+
- [Contributing](#contributing)
|
|
24
|
+
|
|
8
25
|
## Installation
|
|
9
26
|
|
|
10
27
|
```sh
|
|
@@ -26,7 +43,7 @@ const client = new MarkupAIClient({ token: "YOUR_TOKEN" });
|
|
|
26
43
|
await client.styleGuides.listStyleGuides();
|
|
27
44
|
```
|
|
28
45
|
|
|
29
|
-
## Request
|
|
46
|
+
## Request and Response Types
|
|
30
47
|
|
|
31
48
|
The SDK exports all request and response types as TypeScript interfaces. Simply import them with the
|
|
32
49
|
following namespace:
|
package/dist/cjs/Client.js
CHANGED
|
@@ -48,8 +48,8 @@ class MarkupAIClient {
|
|
|
48
48
|
this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
|
|
49
49
|
"X-Fern-Language": "JavaScript",
|
|
50
50
|
"X-Fern-SDK-Name": "@markupai/api",
|
|
51
|
-
"X-Fern-SDK-Version": "
|
|
52
|
-
"User-Agent": "@markupai/api/
|
|
51
|
+
"X-Fern-SDK-Version": "1.1.0",
|
|
52
|
+
"User-Agent": "@markupai/api/1.1.0",
|
|
53
53
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
54
54
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
55
55
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as errors from "../../errors/index.js";
|
|
5
|
+
import * as MarkupAI from "../index.js";
|
|
6
|
+
import * as core from "../../core/index.js";
|
|
7
|
+
export declare class TooManyRequestsError extends errors.MarkupAIError {
|
|
8
|
+
constructor(body: MarkupAI.ErrorResponse, rawResponse?: core.RawResponse);
|
|
9
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.TooManyRequestsError = void 0;
|
|
40
|
+
const errors = __importStar(require("../../errors/index.js"));
|
|
41
|
+
class TooManyRequestsError extends errors.MarkupAIError {
|
|
42
|
+
constructor(body, rawResponse) {
|
|
43
|
+
super({
|
|
44
|
+
message: "TooManyRequestsError",
|
|
45
|
+
statusCode: 429,
|
|
46
|
+
body: body,
|
|
47
|
+
rawResponse: rawResponse,
|
|
48
|
+
});
|
|
49
|
+
Object.setPrototypeOf(this, TooManyRequestsError.prototype);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.TooManyRequestsError = TooManyRequestsError;
|
|
@@ -20,3 +20,4 @@ __exportStar(require("./UnprocessableEntityError.js"), exports);
|
|
|
20
20
|
__exportStar(require("./InternalServerError.js"), exports);
|
|
21
21
|
__exportStar(require("./ContentTooLargeError.js"), exports);
|
|
22
22
|
__exportStar(require("./NotFoundError.js"), exports);
|
|
23
|
+
__exportStar(require("./TooManyRequestsError.js"), exports);
|
|
@@ -36,13 +36,14 @@ export declare class StyleChecks {
|
|
|
36
36
|
/**
|
|
37
37
|
* Analyze text for grammar, style, and clarity issues.
|
|
38
38
|
*
|
|
39
|
-
* @param {MarkupAI.
|
|
39
|
+
* @param {MarkupAI.StyleCheckRequestBody} request
|
|
40
40
|
* @param {StyleChecks.RequestOptions} requestOptions - Request-specific configuration.
|
|
41
41
|
*
|
|
42
42
|
* @throws {@link MarkupAI.UnauthorizedError}
|
|
43
43
|
* @throws {@link MarkupAI.ForbiddenError}
|
|
44
44
|
* @throws {@link MarkupAI.ContentTooLargeError}
|
|
45
45
|
* @throws {@link MarkupAI.UnprocessableEntityError}
|
|
46
|
+
* @throws {@link MarkupAI.TooManyRequestsError}
|
|
46
47
|
* @throws {@link MarkupAI.InternalServerError}
|
|
47
48
|
*
|
|
48
49
|
* @example
|
|
@@ -53,7 +54,7 @@ export declare class StyleChecks {
|
|
|
53
54
|
* style_guide: "style_guide"
|
|
54
55
|
* })
|
|
55
56
|
*/
|
|
56
|
-
createStyleCheck(request: MarkupAI.
|
|
57
|
+
createStyleCheck(request: MarkupAI.StyleCheckRequestBody, requestOptions?: StyleChecks.RequestOptions): core.HttpResponsePromise<MarkupAI.WorkflowResponse>;
|
|
57
58
|
private __createStyleCheck;
|
|
58
59
|
/**
|
|
59
60
|
* Retrieve style check results.
|
|
@@ -61,13 +61,14 @@ class StyleChecks {
|
|
|
61
61
|
/**
|
|
62
62
|
* Analyze text for grammar, style, and clarity issues.
|
|
63
63
|
*
|
|
64
|
-
* @param {MarkupAI.
|
|
64
|
+
* @param {MarkupAI.StyleCheckRequestBody} request
|
|
65
65
|
* @param {StyleChecks.RequestOptions} requestOptions - Request-specific configuration.
|
|
66
66
|
*
|
|
67
67
|
* @throws {@link MarkupAI.UnauthorizedError}
|
|
68
68
|
* @throws {@link MarkupAI.ForbiddenError}
|
|
69
69
|
* @throws {@link MarkupAI.ContentTooLargeError}
|
|
70
70
|
* @throws {@link MarkupAI.UnprocessableEntityError}
|
|
71
|
+
* @throws {@link MarkupAI.TooManyRequestsError}
|
|
71
72
|
* @throws {@link MarkupAI.InternalServerError}
|
|
72
73
|
*
|
|
73
74
|
* @example
|
|
@@ -85,7 +86,6 @@ class StyleChecks {
|
|
|
85
86
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86
87
|
var _a, _b, _c, _d;
|
|
87
88
|
const _request = yield core.newFormData();
|
|
88
|
-
yield _request.appendFile("file_upload", request.file_upload);
|
|
89
89
|
_request.append("dialect", request.dialect);
|
|
90
90
|
if (request.tone != null) {
|
|
91
91
|
_request.append("tone", request.tone);
|
|
@@ -94,6 +94,7 @@ class StyleChecks {
|
|
|
94
94
|
if (request.webhook_url != null) {
|
|
95
95
|
_request.append("webhook_url", request.webhook_url);
|
|
96
96
|
}
|
|
97
|
+
yield _request.appendFile("file_upload", request.file_upload);
|
|
97
98
|
const _maybeEncodedRequest = yield _request.getRequest();
|
|
98
99
|
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({ Authorization: yield this._getAuthorizationHeader() }, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
99
100
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
@@ -121,6 +122,8 @@ class StyleChecks {
|
|
|
121
122
|
throw new MarkupAI.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
122
123
|
case 422:
|
|
123
124
|
throw new MarkupAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
125
|
+
case 429:
|
|
126
|
+
throw new MarkupAI.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
124
127
|
case 500:
|
|
125
128
|
throw new MarkupAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
126
129
|
default:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
-
import * as core from "../../../../../core/index.js";
|
|
5
4
|
import * as MarkupAI from "../../../../index.js";
|
|
5
|
+
import * as core from "../../../../../core/index.js";
|
|
6
6
|
/**
|
|
7
7
|
* @example
|
|
8
8
|
* {
|
|
@@ -11,9 +11,7 @@ import * as MarkupAI from "../../../../index.js";
|
|
|
11
11
|
* style_guide: "style_guide"
|
|
12
12
|
* }
|
|
13
13
|
*/
|
|
14
|
-
export interface
|
|
15
|
-
/** The document to analyze. Text files (.txt), PDFs (.pdf), and Markdown files (.md) are accepted. The max file size is 1.5 MB */
|
|
16
|
-
file_upload: core.file.Uploadable.FileLike;
|
|
14
|
+
export interface StyleCheckRequestBody {
|
|
17
15
|
/** The language variant you'd like us to use for analysis. Choose from American English, British English, or other supported dialects. */
|
|
18
16
|
dialect: MarkupAI.Dialects;
|
|
19
17
|
/** The tone variation you're aiming for. Options include formal, academic, casual, and other tone variations to match your content goals. */
|
|
@@ -22,4 +20,6 @@ export interface CreateStyleSuggestionV1StyleSuggestionsPostRequest {
|
|
|
22
20
|
style_guide: string;
|
|
23
21
|
/** A URL that results will be POSTed to once the process completes. */
|
|
24
22
|
webhook_url?: string;
|
|
23
|
+
/** The document to analyze. Text (.txt), Markdown (.md), HTML (.html .htm), DITA (.dita, .xml), and PDF (.pdf) files are accepted. The max file size is 1.5 MB. */
|
|
24
|
+
file_upload: core.file.Uploadable.FileLike;
|
|
25
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { type
|
|
1
|
+
export { type StyleCheckRequestBody } from "./StyleCheckRequestBody.js";
|
|
@@ -153,6 +153,9 @@ class StyleGuides {
|
|
|
153
153
|
const _request = yield core.newFormData();
|
|
154
154
|
yield _request.appendFile("file_upload", request.file_upload);
|
|
155
155
|
_request.append("name", request.name);
|
|
156
|
+
if (request.base_style_guide != null) {
|
|
157
|
+
_request.append("base_style_guide", request.base_style_guide);
|
|
158
|
+
}
|
|
156
159
|
const _maybeEncodedRequest = yield _request.getRequest();
|
|
157
160
|
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({ Authorization: yield this._getAuthorizationHeader() }, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
158
161
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
import * as core from "../../../../../core/index.js";
|
|
5
|
+
import * as MarkupAI from "../../../../index.js";
|
|
5
6
|
/**
|
|
6
7
|
* @example
|
|
7
8
|
* {
|
|
@@ -14,4 +15,6 @@ export interface StyleGuideRequestBody {
|
|
|
14
15
|
file_upload: core.file.Uploadable.FileLike;
|
|
15
16
|
/** A friendly name for your style guide to help you identify it later. */
|
|
16
17
|
name: string;
|
|
18
|
+
/** The base style guide to extend (AP, Chicago, or Microsoft). If not provided, the style guide will be created from scratch. */
|
|
19
|
+
base_style_guide?: MarkupAI.BaseStyleGuideType;
|
|
17
20
|
}
|
|
@@ -36,13 +36,14 @@ export declare class StyleRewrites {
|
|
|
36
36
|
/**
|
|
37
37
|
* Rewrite text with style corrections applied.
|
|
38
38
|
*
|
|
39
|
-
* @param {MarkupAI.
|
|
39
|
+
* @param {MarkupAI.StyleRewriteRequestBody} request
|
|
40
40
|
* @param {StyleRewrites.RequestOptions} requestOptions - Request-specific configuration.
|
|
41
41
|
*
|
|
42
42
|
* @throws {@link MarkupAI.UnauthorizedError}
|
|
43
43
|
* @throws {@link MarkupAI.ForbiddenError}
|
|
44
44
|
* @throws {@link MarkupAI.ContentTooLargeError}
|
|
45
45
|
* @throws {@link MarkupAI.UnprocessableEntityError}
|
|
46
|
+
* @throws {@link MarkupAI.TooManyRequestsError}
|
|
46
47
|
* @throws {@link MarkupAI.InternalServerError}
|
|
47
48
|
*
|
|
48
49
|
* @example
|
|
@@ -53,7 +54,7 @@ export declare class StyleRewrites {
|
|
|
53
54
|
* style_guide: "style_guide"
|
|
54
55
|
* })
|
|
55
56
|
*/
|
|
56
|
-
createStyleRewrite(request: MarkupAI.
|
|
57
|
+
createStyleRewrite(request: MarkupAI.StyleRewriteRequestBody, requestOptions?: StyleRewrites.RequestOptions): core.HttpResponsePromise<MarkupAI.WorkflowResponse>;
|
|
57
58
|
private __createStyleRewrite;
|
|
58
59
|
/**
|
|
59
60
|
* Retrieve rewrite results.
|
|
@@ -61,13 +61,14 @@ class StyleRewrites {
|
|
|
61
61
|
/**
|
|
62
62
|
* Rewrite text with style corrections applied.
|
|
63
63
|
*
|
|
64
|
-
* @param {MarkupAI.
|
|
64
|
+
* @param {MarkupAI.StyleRewriteRequestBody} request
|
|
65
65
|
* @param {StyleRewrites.RequestOptions} requestOptions - Request-specific configuration.
|
|
66
66
|
*
|
|
67
67
|
* @throws {@link MarkupAI.UnauthorizedError}
|
|
68
68
|
* @throws {@link MarkupAI.ForbiddenError}
|
|
69
69
|
* @throws {@link MarkupAI.ContentTooLargeError}
|
|
70
70
|
* @throws {@link MarkupAI.UnprocessableEntityError}
|
|
71
|
+
* @throws {@link MarkupAI.TooManyRequestsError}
|
|
71
72
|
* @throws {@link MarkupAI.InternalServerError}
|
|
72
73
|
*
|
|
73
74
|
* @example
|
|
@@ -85,7 +86,6 @@ class StyleRewrites {
|
|
|
85
86
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86
87
|
var _a, _b, _c, _d;
|
|
87
88
|
const _request = yield core.newFormData();
|
|
88
|
-
yield _request.appendFile("file_upload", request.file_upload);
|
|
89
89
|
_request.append("dialect", request.dialect);
|
|
90
90
|
if (request.tone != null) {
|
|
91
91
|
_request.append("tone", request.tone);
|
|
@@ -94,6 +94,7 @@ class StyleRewrites {
|
|
|
94
94
|
if (request.webhook_url != null) {
|
|
95
95
|
_request.append("webhook_url", request.webhook_url);
|
|
96
96
|
}
|
|
97
|
+
yield _request.appendFile("file_upload", request.file_upload);
|
|
97
98
|
const _maybeEncodedRequest = yield _request.getRequest();
|
|
98
99
|
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({ Authorization: yield this._getAuthorizationHeader() }, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
99
100
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
@@ -121,6 +122,8 @@ class StyleRewrites {
|
|
|
121
122
|
throw new MarkupAI.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
122
123
|
case 422:
|
|
123
124
|
throw new MarkupAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
125
|
+
case 429:
|
|
126
|
+
throw new MarkupAI.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
124
127
|
case 500:
|
|
125
128
|
throw new MarkupAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
126
129
|
default:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
-
import * as core from "../../../../../core/index.js";
|
|
5
4
|
import * as MarkupAI from "../../../../index.js";
|
|
5
|
+
import * as core from "../../../../../core/index.js";
|
|
6
6
|
/**
|
|
7
7
|
* @example
|
|
8
8
|
* {
|
|
@@ -11,9 +11,7 @@ import * as MarkupAI from "../../../../index.js";
|
|
|
11
11
|
* style_guide: "style_guide"
|
|
12
12
|
* }
|
|
13
13
|
*/
|
|
14
|
-
export interface
|
|
15
|
-
/** The document to analyze. Text files (.txt), PDFs (.pdf), and Markdown files (.md) are accepted. The max file size is 1.5 MB */
|
|
16
|
-
file_upload: core.file.Uploadable.FileLike;
|
|
14
|
+
export interface StyleRewriteRequestBody {
|
|
17
15
|
/** The language variant you'd like us to use for analysis. Choose from American English, British English, or other supported dialects. */
|
|
18
16
|
dialect: MarkupAI.Dialects;
|
|
19
17
|
/** The tone variation you're aiming for. Options include formal, academic, casual, and other tone variations to match your content goals. */
|
|
@@ -22,4 +20,6 @@ export interface CreateStyleCheckV1StyleChecksPostRequest {
|
|
|
22
20
|
style_guide: string;
|
|
23
21
|
/** A URL that results will be POSTed to once the process completes. */
|
|
24
22
|
webhook_url?: string;
|
|
23
|
+
/** The document to rewrite. Text (.txt), Markdown (.md), HTML (.html .htm), and DITA (.dita, .xml) files are accepted. The max file size is 1.5 MB. */
|
|
24
|
+
file_upload: core.file.Uploadable.FileLike;
|
|
25
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { type
|
|
1
|
+
export { type StyleRewriteRequestBody } from "./StyleRewriteRequestBody.js";
|
|
@@ -36,13 +36,14 @@ export declare class StyleSuggestions {
|
|
|
36
36
|
/**
|
|
37
37
|
* Get suggested corrections for text.
|
|
38
38
|
*
|
|
39
|
-
* @param {MarkupAI.
|
|
39
|
+
* @param {MarkupAI.StyleSuggestionRequestBody} request
|
|
40
40
|
* @param {StyleSuggestions.RequestOptions} requestOptions - Request-specific configuration.
|
|
41
41
|
*
|
|
42
42
|
* @throws {@link MarkupAI.UnauthorizedError}
|
|
43
43
|
* @throws {@link MarkupAI.ForbiddenError}
|
|
44
44
|
* @throws {@link MarkupAI.ContentTooLargeError}
|
|
45
45
|
* @throws {@link MarkupAI.UnprocessableEntityError}
|
|
46
|
+
* @throws {@link MarkupAI.TooManyRequestsError}
|
|
46
47
|
* @throws {@link MarkupAI.InternalServerError}
|
|
47
48
|
*
|
|
48
49
|
* @example
|
|
@@ -53,7 +54,7 @@ export declare class StyleSuggestions {
|
|
|
53
54
|
* style_guide: "style_guide"
|
|
54
55
|
* })
|
|
55
56
|
*/
|
|
56
|
-
createStyleSuggestion(request: MarkupAI.
|
|
57
|
+
createStyleSuggestion(request: MarkupAI.StyleSuggestionRequestBody, requestOptions?: StyleSuggestions.RequestOptions): core.HttpResponsePromise<MarkupAI.WorkflowResponse>;
|
|
57
58
|
private __createStyleSuggestion;
|
|
58
59
|
/**
|
|
59
60
|
* Retrieve suggestion results.
|
|
@@ -61,13 +61,14 @@ class StyleSuggestions {
|
|
|
61
61
|
/**
|
|
62
62
|
* Get suggested corrections for text.
|
|
63
63
|
*
|
|
64
|
-
* @param {MarkupAI.
|
|
64
|
+
* @param {MarkupAI.StyleSuggestionRequestBody} request
|
|
65
65
|
* @param {StyleSuggestions.RequestOptions} requestOptions - Request-specific configuration.
|
|
66
66
|
*
|
|
67
67
|
* @throws {@link MarkupAI.UnauthorizedError}
|
|
68
68
|
* @throws {@link MarkupAI.ForbiddenError}
|
|
69
69
|
* @throws {@link MarkupAI.ContentTooLargeError}
|
|
70
70
|
* @throws {@link MarkupAI.UnprocessableEntityError}
|
|
71
|
+
* @throws {@link MarkupAI.TooManyRequestsError}
|
|
71
72
|
* @throws {@link MarkupAI.InternalServerError}
|
|
72
73
|
*
|
|
73
74
|
* @example
|
|
@@ -85,7 +86,6 @@ class StyleSuggestions {
|
|
|
85
86
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86
87
|
var _a, _b, _c, _d;
|
|
87
88
|
const _request = yield core.newFormData();
|
|
88
|
-
yield _request.appendFile("file_upload", request.file_upload);
|
|
89
89
|
_request.append("dialect", request.dialect);
|
|
90
90
|
if (request.tone != null) {
|
|
91
91
|
_request.append("tone", request.tone);
|
|
@@ -94,6 +94,7 @@ class StyleSuggestions {
|
|
|
94
94
|
if (request.webhook_url != null) {
|
|
95
95
|
_request.append("webhook_url", request.webhook_url);
|
|
96
96
|
}
|
|
97
|
+
yield _request.appendFile("file_upload", request.file_upload);
|
|
97
98
|
const _maybeEncodedRequest = yield _request.getRequest();
|
|
98
99
|
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({ Authorization: yield this._getAuthorizationHeader() }, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
99
100
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
@@ -121,6 +122,8 @@ class StyleSuggestions {
|
|
|
121
122
|
throw new MarkupAI.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
122
123
|
case 422:
|
|
123
124
|
throw new MarkupAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
125
|
+
case 429:
|
|
126
|
+
throw new MarkupAI.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
124
127
|
case 500:
|
|
125
128
|
throw new MarkupAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
126
129
|
default:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
-
import * as core from "../../../../../core/index.js";
|
|
5
4
|
import * as MarkupAI from "../../../../index.js";
|
|
5
|
+
import * as core from "../../../../../core/index.js";
|
|
6
6
|
/**
|
|
7
7
|
* @example
|
|
8
8
|
* {
|
|
@@ -11,9 +11,7 @@ import * as MarkupAI from "../../../../index.js";
|
|
|
11
11
|
* style_guide: "style_guide"
|
|
12
12
|
* }
|
|
13
13
|
*/
|
|
14
|
-
export interface
|
|
15
|
-
/** The document to analyze. Text files (.txt), PDFs (.pdf), and Markdown files (.md) are accepted. The max file size is 1.5 MB */
|
|
16
|
-
file_upload: core.file.Uploadable.FileLike;
|
|
14
|
+
export interface StyleSuggestionRequestBody {
|
|
17
15
|
/** The language variant you'd like us to use for analysis. Choose from American English, British English, or other supported dialects. */
|
|
18
16
|
dialect: MarkupAI.Dialects;
|
|
19
17
|
/** The tone variation you're aiming for. Options include formal, academic, casual, and other tone variations to match your content goals. */
|
|
@@ -22,4 +20,6 @@ export interface CreateStyleRewriteV1StyleRewritesPostRequest {
|
|
|
22
20
|
style_guide: string;
|
|
23
21
|
/** A URL that results will be POSTed to once the process completes. */
|
|
24
22
|
webhook_url?: string;
|
|
23
|
+
/** The document to analyze. Text (.txt), Markdown (.md), HTML (.html .htm), DITA (.dita, .xml), and PDF (.pdf) files are accepted. The max file size is 1.5 MB. */
|
|
24
|
+
file_upload: core.file.Uploadable.FileLike;
|
|
25
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { type
|
|
1
|
+
export { type StyleSuggestionRequestBody } from "./StyleSuggestionRequestBody.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
export type BaseStyleGuideType = "ap" | "chicago" | "microsoft";
|
|
5
|
+
export declare const BaseStyleGuideType: {
|
|
6
|
+
readonly Ap: "ap";
|
|
7
|
+
readonly Chicago: "chicago";
|
|
8
|
+
readonly Microsoft: "microsoft";
|
|
9
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BaseStyleGuideType = void 0;
|
|
7
|
+
exports.BaseStyleGuideType = {
|
|
8
|
+
Ap: "ap",
|
|
9
|
+
Chicago: "chicago",
|
|
10
|
+
Microsoft: "microsoft",
|
|
11
|
+
};
|
|
@@ -16,6 +16,8 @@ export interface StyleGuideResponse {
|
|
|
16
16
|
updated_at?: string;
|
|
17
17
|
/** The ID of the user who last updated the style guide. If null, the style guide has never been updated. */
|
|
18
18
|
updated_by?: string;
|
|
19
|
-
/**
|
|
19
|
+
/** User-friendly summary of the style guide's contents and characteristics */
|
|
20
20
|
summary?: string;
|
|
21
|
+
/** The base style guide type that this style guide extends (AP, Chicago, or Microsoft). */
|
|
22
|
+
base_style_guide_type?: MarkupAI.BaseStyleGuideType;
|
|
21
23
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
-
export type StyleGuides = "ap" | "chicago" | "microsoft" | "
|
|
4
|
+
export type StyleGuides = "ap" | "chicago" | "microsoft" | "style_brand_importer";
|
|
5
5
|
export declare const StyleGuides: {
|
|
6
6
|
readonly Ap: "ap";
|
|
7
7
|
readonly Chicago: "chicago";
|
|
8
8
|
readonly Microsoft: "microsoft";
|
|
9
|
-
readonly Demo: "demo";
|
|
10
9
|
readonly StyleBrandImporter: "style_brand_importer";
|
|
11
10
|
};
|
|
@@ -7,6 +7,8 @@ export interface WorkflowInfo {
|
|
|
7
7
|
id: string;
|
|
8
8
|
/** API version */
|
|
9
9
|
api_version?: string;
|
|
10
|
+
/** The original name of the file passed into the workflow */
|
|
11
|
+
filename?: string;
|
|
10
12
|
/** UTC timestamp when the result was generated */
|
|
11
13
|
generated_at?: string;
|
|
12
14
|
status?: MarkupAI.WorkflowStatus;
|
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./AnalysisScore.js"), exports);
|
|
18
|
+
__exportStar(require("./BaseStyleGuideType.js"), exports);
|
|
18
19
|
__exportStar(require("./ClarityCategory.js"), exports);
|
|
19
20
|
__exportStar(require("./ClarityScore.js"), exports);
|
|
20
21
|
__exportStar(require("./ConfigOptions.js"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AuthProvider } from "./AuthProvider.js";
|
|
2
|
-
export {
|
|
1
|
+
export type { AuthProvider } from "./AuthProvider.js";
|
|
2
|
+
export type { AuthRequest } from "./AuthRequest.js";
|
|
3
3
|
export { BasicAuth } from "./BasicAuth.js";
|
|
4
4
|
export { BearerToken } from "./BearerToken.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type SecuritySchemeKey = string;
|
|
2
|
+
/**
|
|
3
|
+
* A collection of security schemes, where the key is the name of the security scheme and the value is the list of scopes required for that scheme.
|
|
4
|
+
* All schemes in the collection must be satisfied for authentication to be successful.
|
|
5
|
+
*/
|
|
6
|
+
export type SecuritySchemeCollection = Record<SecuritySchemeKey, AuthScope[]>;
|
|
7
|
+
export type AuthScope = string;
|
|
8
|
+
export type EndpointMetadata = {
|
|
9
|
+
/**
|
|
10
|
+
* An array of security scheme collections. Each collection represents an alternative way to authenticate.
|
|
11
|
+
*/
|
|
12
|
+
security?: SecuritySchemeCollection[];
|
|
13
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EndpointMetadata } from "./EndpointMetadata.js";
|
|
2
|
+
import { Supplier } from "./Supplier.js";
|
|
3
|
+
type EndpointSupplierFn<T> = (arg: {
|
|
4
|
+
endpointMetadata: EndpointMetadata;
|
|
5
|
+
}) => T | Promise<T>;
|
|
6
|
+
export type EndpointSupplier<T> = Supplier<T> | EndpointSupplierFn<T>;
|
|
7
|
+
export declare const EndpointSupplier: {
|
|
8
|
+
get: <T>(supplier: EndpointSupplier<T>, arg: {
|
|
9
|
+
endpointMetadata: EndpointMetadata;
|
|
10
|
+
}) => Promise<T>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EndpointSupplier = void 0;
|
|
13
|
+
exports.EndpointSupplier = {
|
|
14
|
+
get: (supplier, arg) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
if (typeof supplier === "function") {
|
|
16
|
+
return supplier(arg);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
return supplier;
|
|
20
|
+
}
|
|
21
|
+
}),
|
|
22
|
+
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { APIResponse } from "./APIResponse.js";
|
|
2
|
-
import {
|
|
2
|
+
import { EndpointMetadata } from "./EndpointMetadata.js";
|
|
3
|
+
import { EndpointSupplier } from "./EndpointSupplier.js";
|
|
3
4
|
export type FetchFunction = <R = unknown>(args: Fetcher.Args) => Promise<APIResponse<R, Fetcher.Error>>;
|
|
4
5
|
export declare namespace Fetcher {
|
|
5
6
|
interface Args {
|
|
6
7
|
url: string;
|
|
7
8
|
method: string;
|
|
8
9
|
contentType?: string;
|
|
9
|
-
headers?: Record<string, string |
|
|
10
|
+
headers?: Record<string, string | EndpointSupplier<string | null | undefined> | null | undefined>;
|
|
10
11
|
queryParameters?: Record<string, unknown>;
|
|
11
12
|
body?: unknown;
|
|
12
13
|
timeoutMs?: number;
|
|
@@ -16,6 +17,7 @@ export declare namespace Fetcher {
|
|
|
16
17
|
requestType?: "json" | "file" | "bytes";
|
|
17
18
|
responseType?: "json" | "blob" | "sse" | "streaming" | "text" | "arrayBuffer" | "binary-response";
|
|
18
19
|
duplex?: "half";
|
|
20
|
+
endpointMetadata?: EndpointMetadata;
|
|
19
21
|
}
|
|
20
22
|
type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError;
|
|
21
23
|
interface FailedStatusCodeError {
|