@markupai/api 0.0.6 → 0.1.1

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.
Files changed (98) hide show
  1. package/api/errors/ContentTooLargeError.d.ts +2 -1
  2. package/api/errors/UnauthorizedError.d.ts +9 -0
  3. package/api/errors/UnauthorizedError.js +52 -0
  4. package/api/errors/index.d.ts +2 -1
  5. package/api/errors/index.js +2 -1
  6. package/api/resources/styleChecks/client/Client.d.ts +8 -5
  7. package/api/resources/styleChecks/client/Client.js +22 -9
  8. package/api/resources/styleChecks/client/requests/{StyleChecksCreateStyleCheckRequest.d.ts → CreateStyleCheckV1StyleChecksPostRequest.d.ts} +2 -3
  9. package/api/resources/styleChecks/client/requests/index.d.ts +1 -1
  10. package/api/resources/styleGuides/client/Client.d.ts +18 -3
  11. package/api/resources/styleGuides/client/Client.js +54 -15
  12. package/{dist/api/resources/styleGuides/client/requests/BodyStyleGuidesUpdateStyleGuide.d.ts → api/resources/styleGuides/client/requests/BodyUpdateStyleGuideV1StyleGuidesStyleGuideIdPatch.d.ts} +1 -1
  13. package/api/resources/styleGuides/client/requests/StyleGuideRequestBody.d.ts +5 -3
  14. package/api/resources/styleGuides/client/requests/index.d.ts +1 -1
  15. package/api/resources/styleRewrites/client/Client.d.ts +8 -5
  16. package/api/resources/styleRewrites/client/Client.js +22 -9
  17. package/{dist/api/resources/styleChecks/client/requests/StyleChecksCreateStyleCheckRequest.d.ts → api/resources/styleRewrites/client/requests/CreateStyleRewriteV1StyleRewritesPostRequest.d.ts} +2 -3
  18. package/api/resources/styleRewrites/client/requests/index.d.ts +1 -1
  19. package/api/resources/styleSuggestions/client/Client.d.ts +8 -5
  20. package/api/resources/styleSuggestions/client/Client.js +22 -9
  21. package/api/resources/{styleRewrites/client/requests/StyleRewritesCreateStyleRewriteRequest.d.ts → styleSuggestions/client/requests/CreateStyleSuggestionV1StyleSuggestionsPostRequest.d.ts} +2 -3
  22. package/api/resources/styleSuggestions/client/requests/index.d.ts +1 -1
  23. package/api/types/AnalysisScore.d.ts +8 -0
  24. package/api/types/ClarityCategory.d.ts +4 -0
  25. package/api/types/ClarityScore.d.ts +3 -5
  26. package/api/types/ErrorResponse.d.ts +1 -1
  27. package/api/types/IssueCategory.d.ts +2 -4
  28. package/api/types/IssueCategory.js +1 -3
  29. package/api/types/QualityScore.d.ts +4 -0
  30. package/api/types/RewriteResponse.d.ts +1 -1
  31. package/api/types/ScoreOutput.d.ts +1 -5
  32. package/api/types/StyleCheckResponse.d.ts +1 -1
  33. package/api/types/Subcategory.d.ts +1 -1
  34. package/api/types/SuggestionResponse.d.ts +1 -1
  35. package/api/types/ToneScore.d.ts +2 -4
  36. package/api/types/index.d.ts +2 -0
  37. package/api/types/index.js +2 -0
  38. package/dist/api/errors/ContentTooLargeError.d.ts +2 -1
  39. package/dist/api/errors/UnauthorizedError.d.ts +9 -0
  40. package/dist/api/errors/UnauthorizedError.js +52 -0
  41. package/dist/api/errors/index.d.ts +2 -1
  42. package/dist/api/errors/index.js +2 -1
  43. package/dist/api/resources/styleChecks/client/Client.d.ts +8 -5
  44. package/dist/api/resources/styleChecks/client/Client.js +22 -9
  45. package/dist/api/resources/{styleRewrites/client/requests/StyleRewritesCreateStyleRewriteRequest.d.ts → styleChecks/client/requests/CreateStyleCheckV1StyleChecksPostRequest.d.ts} +2 -3
  46. package/dist/api/resources/styleChecks/client/requests/index.d.ts +1 -1
  47. package/dist/api/resources/styleGuides/client/Client.d.ts +18 -3
  48. package/dist/api/resources/styleGuides/client/Client.js +54 -15
  49. package/{api/resources/styleGuides/client/requests/BodyStyleGuidesUpdateStyleGuide.d.ts → dist/api/resources/styleGuides/client/requests/BodyUpdateStyleGuideV1StyleGuidesStyleGuideIdPatch.d.ts} +1 -1
  50. package/dist/api/resources/styleGuides/client/requests/StyleGuideRequestBody.d.ts +5 -3
  51. package/dist/api/resources/styleGuides/client/requests/index.d.ts +1 -1
  52. package/dist/api/resources/styleRewrites/client/Client.d.ts +8 -5
  53. package/dist/api/resources/styleRewrites/client/Client.js +22 -9
  54. package/dist/api/resources/styleRewrites/client/requests/CreateStyleRewriteV1StyleRewritesPostRequest.d.ts +21 -0
  55. package/dist/api/resources/styleRewrites/client/requests/CreateStyleRewriteV1StyleRewritesPostRequest.js +5 -0
  56. package/dist/api/resources/styleRewrites/client/requests/index.d.ts +1 -1
  57. package/dist/api/resources/styleSuggestions/client/Client.d.ts +8 -5
  58. package/dist/api/resources/styleSuggestions/client/Client.js +22 -9
  59. package/dist/api/resources/styleSuggestions/client/requests/CreateStyleSuggestionV1StyleSuggestionsPostRequest.d.ts +21 -0
  60. package/dist/api/resources/styleSuggestions/client/requests/CreateStyleSuggestionV1StyleSuggestionsPostRequest.js +5 -0
  61. package/dist/api/resources/styleSuggestions/client/requests/index.d.ts +1 -1
  62. package/dist/api/types/AnalysisScore.d.ts +8 -0
  63. package/dist/api/types/AnalysisScore.js +5 -0
  64. package/dist/api/types/ClarityCategory.d.ts +4 -0
  65. package/dist/api/types/ClarityCategory.js +5 -0
  66. package/dist/api/types/ClarityScore.d.ts +3 -5
  67. package/dist/api/types/ErrorResponse.d.ts +1 -1
  68. package/dist/api/types/IssueCategory.d.ts +2 -4
  69. package/dist/api/types/IssueCategory.js +1 -3
  70. package/dist/api/types/QualityScore.d.ts +4 -0
  71. package/dist/api/types/RewriteResponse.d.ts +1 -1
  72. package/dist/api/types/ScoreOutput.d.ts +1 -5
  73. package/dist/api/types/StyleCheckResponse.d.ts +1 -1
  74. package/dist/api/types/Subcategory.d.ts +1 -1
  75. package/dist/api/types/SuggestionResponse.d.ts +1 -1
  76. package/dist/api/types/ToneScore.d.ts +2 -4
  77. package/dist/api/types/index.d.ts +2 -0
  78. package/dist/api/types/index.js +2 -0
  79. package/dist/environments.d.ts +2 -2
  80. package/dist/environments.js +1 -1
  81. package/dist/version.d.ts +1 -1
  82. package/dist/version.js +1 -1
  83. package/environments.d.ts +2 -2
  84. package/environments.js +1 -1
  85. package/package.json +1 -1
  86. package/reference.md +13 -14
  87. package/version.d.ts +1 -1
  88. package/version.js +1 -1
  89. package/api/resources/styleSuggestions/client/requests/StyleSuggestionsCreateStyleSuggestionRequest.d.ts +0 -22
  90. package/dist/api/resources/styleSuggestions/client/requests/StyleSuggestionsCreateStyleSuggestionRequest.d.ts +0 -22
  91. /package/api/resources/styleChecks/client/requests/{StyleChecksCreateStyleCheckRequest.js → CreateStyleCheckV1StyleChecksPostRequest.js} +0 -0
  92. /package/api/resources/styleGuides/client/requests/{BodyStyleGuidesUpdateStyleGuide.js → BodyUpdateStyleGuideV1StyleGuidesStyleGuideIdPatch.js} +0 -0
  93. /package/api/resources/styleRewrites/client/requests/{StyleRewritesCreateStyleRewriteRequest.js → CreateStyleRewriteV1StyleRewritesPostRequest.js} +0 -0
  94. /package/api/resources/styleSuggestions/client/requests/{StyleSuggestionsCreateStyleSuggestionRequest.js → CreateStyleSuggestionV1StyleSuggestionsPostRequest.js} +0 -0
  95. /package/{dist/api/resources/styleChecks/client/requests/StyleChecksCreateStyleCheckRequest.js → api/types/AnalysisScore.js} +0 -0
  96. /package/{dist/api/resources/styleGuides/client/requests/BodyStyleGuidesUpdateStyleGuide.js → api/types/ClarityCategory.js} +0 -0
  97. /package/dist/api/resources/{styleRewrites/client/requests/StyleRewritesCreateStyleRewriteRequest.js → styleChecks/client/requests/CreateStyleCheckV1StyleChecksPostRequest.js} +0 -0
  98. /package/dist/api/resources/{styleSuggestions/client/requests/StyleSuggestionsCreateStyleSuggestionRequest.js → styleGuides/client/requests/BodyUpdateStyleGuideV1StyleGuidesStyleGuideIdPatch.js} +0 -0
@@ -62,12 +62,14 @@ class StyleRewrites {
62
62
  this._options = _options;
63
63
  }
64
64
  /**
65
- * Start a style and brand rewrite workflow. Returns a workflow ID to use for polling results.
65
+ * Rewrite text with style corrections applied.
66
66
  *
67
67
  * @param {File | fs.ReadStream | Blob} file_upload
68
- * @param {MarkupAI.StyleRewritesCreateStyleRewriteRequest} request
68
+ * @param {MarkupAI.CreateStyleRewriteV1StyleRewritesPostRequest} request
69
69
  * @param {StyleRewrites.RequestOptions} requestOptions - Request-specific configuration.
70
70
  *
71
+ * @throws {@link MarkupAI.UnauthorizedError}
72
+ * @throws {@link MarkupAI.ForbiddenError}
71
73
  * @throws {@link MarkupAI.ContentTooLargeError}
72
74
  * @throws {@link MarkupAI.UnprocessableEntityError}
73
75
  * @throws {@link MarkupAI.InternalServerError}
@@ -75,7 +77,6 @@ class StyleRewrites {
75
77
  * @example
76
78
  * await client.styleRewrites.createStyleRewrite(fs.createReadStream("/path/to/your/file"), {
77
79
  * dialect: "american_english",
78
- * tone: "academic",
79
80
  * style_guide: "style_guide"
80
81
  * })
81
82
  */
@@ -88,16 +89,18 @@ class StyleRewrites {
88
89
  const _request = yield core.newFormData();
89
90
  yield _request.appendFile("file_upload", file_upload);
90
91
  _request.append("dialect", request.dialect);
91
- _request.append("tone", request.tone);
92
+ if (request.tone != null) {
93
+ _request.append("tone", request.tone);
94
+ }
92
95
  _request.append("style_guide", request.style_guide);
93
96
  if (request.webhook_url != null) {
94
97
  _request.append("webhook_url", request.webhook_url);
95
98
  }
96
99
  const _maybeEncodedRequest = yield _request.getRequest();
97
100
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
98
- url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.MarkupAIEnvironment.Production, "v1/style/rewrites"),
101
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.MarkupAIEnvironment.Default, "v1/style/rewrites"),
99
102
  method: "POST",
100
- headers: Object.assign(Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@markupai/api", "X-Fern-SDK-Version": "0.0.6", "User-Agent": "@markupai/api/0.0.6", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
103
+ headers: Object.assign(Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@markupai/api", "X-Fern-SDK-Version": "0.1.1", "User-Agent": "@markupai/api/0.1.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
101
104
  requestType: "file",
102
105
  duplex: _maybeEncodedRequest.duplex,
103
106
  body: _maybeEncodedRequest.body,
@@ -110,6 +113,10 @@ class StyleRewrites {
110
113
  }
111
114
  if (_response.error.reason === "status-code") {
112
115
  switch (_response.error.statusCode) {
116
+ case 401:
117
+ throw new MarkupAI.UnauthorizedError(_response.error.body, _response.rawResponse);
118
+ case 403:
119
+ throw new MarkupAI.ForbiddenError(_response.error.body, _response.rawResponse);
113
120
  case 413:
114
121
  throw new MarkupAI.ContentTooLargeError(_response.error.body, _response.rawResponse);
115
122
  case 422:
@@ -142,11 +149,13 @@ class StyleRewrites {
142
149
  });
143
150
  }
144
151
  /**
145
- * Retrieve the results of a rewrite workflow. Returns `running` or `complete` status.
152
+ * Retrieve rewrite results.
146
153
  *
147
154
  * @param {string} workflowId
148
155
  * @param {StyleRewrites.RequestOptions} requestOptions - Request-specific configuration.
149
156
  *
157
+ * @throws {@link MarkupAI.UnauthorizedError}
158
+ * @throws {@link MarkupAI.ForbiddenError}
150
159
  * @throws {@link MarkupAI.NotFoundError}
151
160
  * @throws {@link MarkupAI.UnprocessableEntityError}
152
161
  * @throws {@link MarkupAI.InternalServerError}
@@ -161,9 +170,9 @@ class StyleRewrites {
161
170
  return __awaiter(this, void 0, void 0, function* () {
162
171
  var _a, _b, _c;
163
172
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
164
- url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.MarkupAIEnvironment.Production, `v1/style/rewrites/${encodeURIComponent(workflowId)}`),
173
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.MarkupAIEnvironment.Default, `v1/style/rewrites/${encodeURIComponent(workflowId)}`),
165
174
  method: "GET",
166
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@markupai/api", "X-Fern-SDK-Version": "0.0.6", "User-Agent": "@markupai/api/0.0.6", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
175
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@markupai/api", "X-Fern-SDK-Version": "0.1.1", "User-Agent": "@markupai/api/0.1.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
167
176
  contentType: "application/json",
168
177
  requestType: "json",
169
178
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -175,6 +184,10 @@ class StyleRewrites {
175
184
  }
176
185
  if (_response.error.reason === "status-code") {
177
186
  switch (_response.error.statusCode) {
187
+ case 401:
188
+ throw new MarkupAI.UnauthorizedError(_response.error.body, _response.rawResponse);
189
+ case 403:
190
+ throw new MarkupAI.ForbiddenError(_response.error.body, _response.rawResponse);
178
191
  case 404:
179
192
  throw new MarkupAI.NotFoundError(_response.error.body, _response.rawResponse);
180
193
  case 422:
@@ -6,15 +6,14 @@ import * as MarkupAI from "../../../../index";
6
6
  * @example
7
7
  * {
8
8
  * dialect: "american_english",
9
- * tone: "academic",
10
9
  * style_guide: "style_guide"
11
10
  * }
12
11
  */
13
- export interface StyleChecksCreateStyleCheckRequest {
12
+ export interface CreateStyleRewriteV1StyleRewritesPostRequest {
14
13
  /** The language variant you'd like us to use for analysis. Choose from American English, British English, or other supported dialects. */
15
14
  dialect: MarkupAI.Dialects;
16
15
  /** The tone variation you're aiming for. Options include formal, academic, casual, and other tone variations to match your content goals. */
17
- tone: MarkupAI.Tones;
16
+ tone?: MarkupAI.Tones;
18
17
  /** The style guide to follow for your content. You can use a style guide ID or choose from built-in options: `ap`, `chicago`, or `microsoft`. */
19
18
  style_guide: string;
20
19
  /** A URL that results will be POSTed to once the process completes. */
@@ -1 +1 @@
1
- export { type StyleRewritesCreateStyleRewriteRequest } from "./StyleRewritesCreateStyleRewriteRequest";
1
+ export { type CreateStyleRewriteV1StyleRewritesPostRequest } from "./CreateStyleRewriteV1StyleRewritesPostRequest";
@@ -32,12 +32,14 @@ export declare class StyleSuggestions {
32
32
  protected readonly _options: StyleSuggestions.Options;
33
33
  constructor(_options: StyleSuggestions.Options);
34
34
  /**
35
- * Start a style and brand suggestion workflow. Returns a workflow ID to use for polling results.
35
+ * Get suggested corrections for text.
36
36
  *
37
37
  * @param {File | fs.ReadStream | Blob} file_upload
38
- * @param {MarkupAI.StyleSuggestionsCreateStyleSuggestionRequest} request
38
+ * @param {MarkupAI.CreateStyleSuggestionV1StyleSuggestionsPostRequest} request
39
39
  * @param {StyleSuggestions.RequestOptions} requestOptions - Request-specific configuration.
40
40
  *
41
+ * @throws {@link MarkupAI.UnauthorizedError}
42
+ * @throws {@link MarkupAI.ForbiddenError}
41
43
  * @throws {@link MarkupAI.ContentTooLargeError}
42
44
  * @throws {@link MarkupAI.UnprocessableEntityError}
43
45
  * @throws {@link MarkupAI.InternalServerError}
@@ -45,18 +47,19 @@ export declare class StyleSuggestions {
45
47
  * @example
46
48
  * await client.styleSuggestions.createStyleSuggestion(fs.createReadStream("/path/to/your/file"), {
47
49
  * dialect: "american_english",
48
- * tone: "academic",
49
50
  * style_guide: "style_guide"
50
51
  * })
51
52
  */
52
- createStyleSuggestion(file_upload: File | fs.ReadStream | Blob, request: MarkupAI.StyleSuggestionsCreateStyleSuggestionRequest, requestOptions?: StyleSuggestions.RequestOptions): core.HttpResponsePromise<MarkupAI.WorkflowResponse>;
53
+ createStyleSuggestion(file_upload: File | fs.ReadStream | Blob, request: MarkupAI.CreateStyleSuggestionV1StyleSuggestionsPostRequest, requestOptions?: StyleSuggestions.RequestOptions): core.HttpResponsePromise<MarkupAI.WorkflowResponse>;
53
54
  private __createStyleSuggestion;
54
55
  /**
55
- * Retrieve the results of a style and brand suggestion workflow. Returns `running` or `complete` status.
56
+ * Retrieve suggestion results.
56
57
  *
57
58
  * @param {string} workflowId
58
59
  * @param {StyleSuggestions.RequestOptions} requestOptions - Request-specific configuration.
59
60
  *
61
+ * @throws {@link MarkupAI.UnauthorizedError}
62
+ * @throws {@link MarkupAI.ForbiddenError}
60
63
  * @throws {@link MarkupAI.NotFoundError}
61
64
  * @throws {@link MarkupAI.UnprocessableEntityError}
62
65
  * @throws {@link MarkupAI.InternalServerError}
@@ -62,12 +62,14 @@ class StyleSuggestions {
62
62
  this._options = _options;
63
63
  }
64
64
  /**
65
- * Start a style and brand suggestion workflow. Returns a workflow ID to use for polling results.
65
+ * Get suggested corrections for text.
66
66
  *
67
67
  * @param {File | fs.ReadStream | Blob} file_upload
68
- * @param {MarkupAI.StyleSuggestionsCreateStyleSuggestionRequest} request
68
+ * @param {MarkupAI.CreateStyleSuggestionV1StyleSuggestionsPostRequest} request
69
69
  * @param {StyleSuggestions.RequestOptions} requestOptions - Request-specific configuration.
70
70
  *
71
+ * @throws {@link MarkupAI.UnauthorizedError}
72
+ * @throws {@link MarkupAI.ForbiddenError}
71
73
  * @throws {@link MarkupAI.ContentTooLargeError}
72
74
  * @throws {@link MarkupAI.UnprocessableEntityError}
73
75
  * @throws {@link MarkupAI.InternalServerError}
@@ -75,7 +77,6 @@ class StyleSuggestions {
75
77
  * @example
76
78
  * await client.styleSuggestions.createStyleSuggestion(fs.createReadStream("/path/to/your/file"), {
77
79
  * dialect: "american_english",
78
- * tone: "academic",
79
80
  * style_guide: "style_guide"
80
81
  * })
81
82
  */
@@ -88,16 +89,18 @@ class StyleSuggestions {
88
89
  const _request = yield core.newFormData();
89
90
  yield _request.appendFile("file_upload", file_upload);
90
91
  _request.append("dialect", request.dialect);
91
- _request.append("tone", request.tone);
92
+ if (request.tone != null) {
93
+ _request.append("tone", request.tone);
94
+ }
92
95
  _request.append("style_guide", request.style_guide);
93
96
  if (request.webhook_url != null) {
94
97
  _request.append("webhook_url", request.webhook_url);
95
98
  }
96
99
  const _maybeEncodedRequest = yield _request.getRequest();
97
100
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
98
- url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.MarkupAIEnvironment.Production, "v1/style/suggestions"),
101
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.MarkupAIEnvironment.Default, "v1/style/suggestions"),
99
102
  method: "POST",
100
- headers: Object.assign(Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@markupai/api", "X-Fern-SDK-Version": "0.0.6", "User-Agent": "@markupai/api/0.0.6", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
103
+ headers: Object.assign(Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@markupai/api", "X-Fern-SDK-Version": "0.1.1", "User-Agent": "@markupai/api/0.1.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
101
104
  requestType: "file",
102
105
  duplex: _maybeEncodedRequest.duplex,
103
106
  body: _maybeEncodedRequest.body,
@@ -110,6 +113,10 @@ class StyleSuggestions {
110
113
  }
111
114
  if (_response.error.reason === "status-code") {
112
115
  switch (_response.error.statusCode) {
116
+ case 401:
117
+ throw new MarkupAI.UnauthorizedError(_response.error.body, _response.rawResponse);
118
+ case 403:
119
+ throw new MarkupAI.ForbiddenError(_response.error.body, _response.rawResponse);
113
120
  case 413:
114
121
  throw new MarkupAI.ContentTooLargeError(_response.error.body, _response.rawResponse);
115
122
  case 422:
@@ -142,11 +149,13 @@ class StyleSuggestions {
142
149
  });
143
150
  }
144
151
  /**
145
- * Retrieve the results of a style and brand suggestion workflow. Returns `running` or `complete` status.
152
+ * Retrieve suggestion results.
146
153
  *
147
154
  * @param {string} workflowId
148
155
  * @param {StyleSuggestions.RequestOptions} requestOptions - Request-specific configuration.
149
156
  *
157
+ * @throws {@link MarkupAI.UnauthorizedError}
158
+ * @throws {@link MarkupAI.ForbiddenError}
150
159
  * @throws {@link MarkupAI.NotFoundError}
151
160
  * @throws {@link MarkupAI.UnprocessableEntityError}
152
161
  * @throws {@link MarkupAI.InternalServerError}
@@ -161,9 +170,9 @@ class StyleSuggestions {
161
170
  return __awaiter(this, void 0, void 0, function* () {
162
171
  var _a, _b, _c;
163
172
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
164
- url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.MarkupAIEnvironment.Production, `v1/style/suggestions/${encodeURIComponent(workflowId)}`),
173
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.MarkupAIEnvironment.Default, `v1/style/suggestions/${encodeURIComponent(workflowId)}`),
165
174
  method: "GET",
166
- headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@markupai/api", "X-Fern-SDK-Version": "0.0.6", "User-Agent": "@markupai/api/0.0.6", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
175
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@markupai/api", "X-Fern-SDK-Version": "0.1.1", "User-Agent": "@markupai/api/0.1.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
167
176
  contentType: "application/json",
168
177
  requestType: "json",
169
178
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -175,6 +184,10 @@ class StyleSuggestions {
175
184
  }
176
185
  if (_response.error.reason === "status-code") {
177
186
  switch (_response.error.statusCode) {
187
+ case 401:
188
+ throw new MarkupAI.UnauthorizedError(_response.error.body, _response.rawResponse);
189
+ case 403:
190
+ throw new MarkupAI.ForbiddenError(_response.error.body, _response.rawResponse);
178
191
  case 404:
179
192
  throw new MarkupAI.NotFoundError(_response.error.body, _response.rawResponse);
180
193
  case 422:
@@ -6,15 +6,14 @@ import * as MarkupAI from "../../../../index";
6
6
  * @example
7
7
  * {
8
8
  * dialect: "american_english",
9
- * tone: "academic",
10
9
  * style_guide: "style_guide"
11
10
  * }
12
11
  */
13
- export interface StyleRewritesCreateStyleRewriteRequest {
12
+ export interface CreateStyleSuggestionV1StyleSuggestionsPostRequest {
14
13
  /** The language variant you'd like us to use for analysis. Choose from American English, British English, or other supported dialects. */
15
14
  dialect: MarkupAI.Dialects;
16
15
  /** The tone variation you're aiming for. Options include formal, academic, casual, and other tone variations to match your content goals. */
17
- tone: MarkupAI.Tones;
16
+ tone?: MarkupAI.Tones;
18
17
  /** The style guide to follow for your content. You can use a style guide ID or choose from built-in options: `ap`, `chicago`, or `microsoft`. */
19
18
  style_guide: string;
20
19
  /** A URL that results will be POSTed to once the process completes. */
@@ -1 +1 @@
1
- export { type StyleSuggestionsCreateStyleSuggestionRequest } from "./StyleSuggestionsCreateStyleSuggestionRequest";
1
+ export { type CreateStyleSuggestionV1StyleSuggestionsPostRequest } from "./CreateStyleSuggestionV1StyleSuggestionsPostRequest";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as MarkupAI from "../index";
5
+ export interface AnalysisScore {
6
+ clarity?: MarkupAI.ClarityScore;
7
+ tone?: MarkupAI.ToneScore;
8
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export type ClarityCategory = "clarity";
@@ -2,13 +2,11 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  export interface ClarityScore {
5
- average_sentence_length?: number;
6
- flesch_kincaid_grade?: number;
7
- flesch_reading_ease?: number;
8
- lexical_diversity?: number;
9
5
  score?: number;
6
+ flesch_reading_ease?: number;
10
7
  sentence_complexity?: number;
11
- sentence_count?: number;
12
8
  vocabulary_complexity?: number;
9
+ sentence_count?: number;
13
10
  word_count?: number;
11
+ average_sentence_length?: number;
14
12
  }
@@ -4,7 +4,7 @@
4
4
  export interface ErrorResponse {
5
5
  /** A description of the error that occurred. */
6
6
  detail: string;
7
- /** the HTTP status code generated by the server for this issue */
7
+ /** The HTTP status code generated by the server for this issue */
8
8
  status: number;
9
9
  /** A unique ID associated with the HTTP request. */
10
10
  request_id: string;
@@ -1,12 +1,10 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- export type IssueCategory = "grammar" | "sentence_length" | "sentence_structure" | "simple_vocab" | "style_guide" | "terminology" | "tone";
4
+ export type IssueCategory = "clarity" | "grammar" | "style_guide" | "terminology" | "tone";
5
5
  export declare const IssueCategory: {
6
+ readonly Clarity: "clarity";
6
7
  readonly Grammar: "grammar";
7
- readonly SentenceLength: "sentence_length";
8
- readonly SentenceStructure: "sentence_structure";
9
- readonly SimpleVocab: "simple_vocab";
10
8
  readonly StyleGuide: "style_guide";
11
9
  readonly Terminology: "terminology";
12
10
  readonly Tone: "tone";
@@ -5,10 +5,8 @@
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.IssueCategory = void 0;
7
7
  exports.IssueCategory = {
8
+ Clarity: "clarity",
8
9
  Grammar: "grammar",
9
- SentenceLength: "sentence_length",
10
- SentenceStructure: "sentence_structure",
11
- SimpleVocab: "simple_vocab",
12
10
  StyleGuide: "style_guide",
13
11
  Terminology: "terminology",
14
12
  Tone: "tone",
@@ -1,6 +1,10 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
+ import * as MarkupAI from "../index";
4
5
  export interface QualityScore {
5
6
  score?: number;
7
+ grammar?: MarkupAI.GrammarScore;
8
+ style_guide?: MarkupAI.StyleGuideScore;
9
+ terminology?: MarkupAI.TerminologyScore;
6
10
  }
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import * as MarkupAI from "../index";
5
5
  export interface RewriteResponse {
6
- workflow_id?: string;
6
+ workflow_id: string;
7
7
  status?: MarkupAI.WorkflowStatus;
8
8
  scores?: MarkupAI.ScoreOutput;
9
9
  issues?: MarkupAI.Suggestion[];
@@ -4,9 +4,5 @@
4
4
  import * as MarkupAI from "../index";
5
5
  export interface ScoreOutput {
6
6
  quality?: MarkupAI.QualityScore;
7
- clarity?: MarkupAI.ClarityScore;
8
- grammar?: MarkupAI.GrammarScore;
9
- style_guide?: MarkupAI.StyleGuideScore;
10
- tone?: MarkupAI.ToneScore;
11
- terminology?: MarkupAI.TerminologyScore;
7
+ analysis?: MarkupAI.AnalysisScore;
12
8
  }
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import * as MarkupAI from "../index";
5
5
  export interface StyleCheckResponse {
6
- workflow_id?: string;
6
+ workflow_id: string;
7
7
  status?: MarkupAI.WorkflowStatus;
8
8
  scores?: MarkupAI.ScoreOutput;
9
9
  issues?: MarkupAI.Issue[];
@@ -5,4 +5,4 @@ import * as MarkupAI from "../index";
5
5
  /**
6
6
  * The sub-category of the change
7
7
  */
8
- export type Subcategory = MarkupAI.GrammarCategory | MarkupAI.SimpleVocabCategory | MarkupAI.SentenceStructureCategory | MarkupAI.SentenceLengthCategory | MarkupAI.ToneCategory | MarkupAI.StyleGuideCategory | MarkupAI.TermReplaceCategory;
8
+ export type Subcategory = MarkupAI.GrammarCategory | MarkupAI.SimpleVocabCategory | MarkupAI.SentenceStructureCategory | MarkupAI.SentenceLengthCategory | MarkupAI.ToneCategory | MarkupAI.StyleGuideCategory | MarkupAI.TermReplaceCategory | MarkupAI.ClarityCategory;
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import * as MarkupAI from "../index";
5
5
  export interface SuggestionResponse {
6
- workflow_id?: string;
6
+ workflow_id: string;
7
7
  status?: MarkupAI.WorkflowStatus;
8
8
  scores?: MarkupAI.ScoreOutput;
9
9
  issues?: MarkupAI.Suggestion[];
@@ -5,8 +5,6 @@ export interface ToneScore {
5
5
  score?: number;
6
6
  informality?: number;
7
7
  liveliness?: number;
8
- target_informality?: number;
9
- target_liveliness?: number;
10
- informality_tolerance?: number;
11
- liveliness_tolerance?: number;
8
+ informality_alignment?: number;
9
+ liveliness_alignment?: number;
12
10
  }
@@ -1,4 +1,6 @@
1
+ export * from "./AnalysisScore";
1
2
  export * from "./CheckOptions";
3
+ export * from "./ClarityCategory";
2
4
  export * from "./ClarityScore";
3
5
  export * from "./Dialects";
4
6
  export * from "./ErrorResponse";
@@ -14,7 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./AnalysisScore"), exports);
17
18
  __exportStar(require("./CheckOptions"), exports);
19
+ __exportStar(require("./ClarityCategory"), exports);
18
20
  __exportStar(require("./ClarityScore"), exports);
19
21
  __exportStar(require("./Dialects"), exports);
20
22
  __exportStar(require("./ErrorResponse"), exports);
@@ -2,7 +2,8 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  import * as errors from "../../errors/index";
5
+ import * as MarkupAI from "../index";
5
6
  import * as core from "../../core";
6
7
  export declare class ContentTooLargeError extends errors.MarkupAIError {
7
- constructor(body?: unknown, rawResponse?: core.RawResponse);
8
+ constructor(body: MarkupAI.ErrorResponse, rawResponse?: core.RawResponse);
8
9
  }
@@ -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";
5
+ import * as MarkupAI from "../index";
6
+ import * as core from "../../core";
7
+ export declare class UnauthorizedError 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.UnauthorizedError = void 0;
40
+ const errors = __importStar(require("../../errors/index"));
41
+ class UnauthorizedError extends errors.MarkupAIError {
42
+ constructor(body, rawResponse) {
43
+ super({
44
+ message: "UnauthorizedError",
45
+ statusCode: 401,
46
+ body: body,
47
+ rawResponse: rawResponse,
48
+ });
49
+ Object.setPrototypeOf(this, UnauthorizedError.prototype);
50
+ }
51
+ }
52
+ exports.UnauthorizedError = UnauthorizedError;
@@ -1,5 +1,6 @@
1
+ export * from "./UnauthorizedError";
2
+ export * from "./ForbiddenError";
1
3
  export * from "./UnprocessableEntityError";
2
4
  export * from "./InternalServerError";
3
- export * from "./ForbiddenError";
4
5
  export * from "./ContentTooLargeError";
5
6
  export * from "./NotFoundError";
@@ -14,8 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./UnauthorizedError"), exports);
18
+ __exportStar(require("./ForbiddenError"), exports);
17
19
  __exportStar(require("./UnprocessableEntityError"), exports);
18
20
  __exportStar(require("./InternalServerError"), exports);
19
- __exportStar(require("./ForbiddenError"), exports);
20
21
  __exportStar(require("./ContentTooLargeError"), exports);
21
22
  __exportStar(require("./NotFoundError"), exports);
@@ -32,12 +32,14 @@ export declare class StyleChecks {
32
32
  protected readonly _options: StyleChecks.Options;
33
33
  constructor(_options: StyleChecks.Options);
34
34
  /**
35
- * Start a style and brand check workflow. Returns a workflow ID to use for polling results.
35
+ * Analyze text for grammar, style, and clarity issues.
36
36
  *
37
37
  * @param {File | fs.ReadStream | Blob} file_upload
38
- * @param {MarkupAI.StyleChecksCreateStyleCheckRequest} request
38
+ * @param {MarkupAI.CreateStyleCheckV1StyleChecksPostRequest} request
39
39
  * @param {StyleChecks.RequestOptions} requestOptions - Request-specific configuration.
40
40
  *
41
+ * @throws {@link MarkupAI.UnauthorizedError}
42
+ * @throws {@link MarkupAI.ForbiddenError}
41
43
  * @throws {@link MarkupAI.ContentTooLargeError}
42
44
  * @throws {@link MarkupAI.UnprocessableEntityError}
43
45
  * @throws {@link MarkupAI.InternalServerError}
@@ -45,18 +47,19 @@ export declare class StyleChecks {
45
47
  * @example
46
48
  * await client.styleChecks.createStyleCheck(fs.createReadStream("/path/to/your/file"), {
47
49
  * dialect: "american_english",
48
- * tone: "academic",
49
50
  * style_guide: "style_guide"
50
51
  * })
51
52
  */
52
- createStyleCheck(file_upload: File | fs.ReadStream | Blob, request: MarkupAI.StyleChecksCreateStyleCheckRequest, requestOptions?: StyleChecks.RequestOptions): core.HttpResponsePromise<MarkupAI.WorkflowResponse>;
53
+ createStyleCheck(file_upload: File | fs.ReadStream | Blob, request: MarkupAI.CreateStyleCheckV1StyleChecksPostRequest, requestOptions?: StyleChecks.RequestOptions): core.HttpResponsePromise<MarkupAI.WorkflowResponse>;
53
54
  private __createStyleCheck;
54
55
  /**
55
- * Retrieve the results of a style and brand check workflow. Returns `running` or `complete` status.
56
+ * Retrieve style check results.
56
57
  *
57
58
  * @param {string} workflowId
58
59
  * @param {StyleChecks.RequestOptions} requestOptions - Request-specific configuration.
59
60
  *
61
+ * @throws {@link MarkupAI.UnauthorizedError}
62
+ * @throws {@link MarkupAI.ForbiddenError}
60
63
  * @throws {@link MarkupAI.NotFoundError}
61
64
  * @throws {@link MarkupAI.UnprocessableEntityError}
62
65
  * @throws {@link MarkupAI.InternalServerError}