Skip to content

Commit 1895887

Browse files
Merge pull request #24 from DeepLcom/show-billed-characters
[ACL-949] Add show_billed_characters parameter to OpenAPI spec
2 parents 05e1a8f + bf58bb2 commit 1895887

File tree

3 files changed

+51
-8
lines changed

3 files changed

+51
-8
lines changed

openapi.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@
8080
"context": {
8181
"$ref": "#/components/schemas/Context"
8282
},
83+
"show_billed_characters": {
84+
"$ref": "#/components/schemas/ShowBilledCharacters"
85+
},
8386
"split_sentences": {
8487
"$ref": "#/components/schemas/SplitSentencesOption"
8588
},
@@ -184,6 +187,9 @@
184187
"context": {
185188
"$ref": "#/components/schemas/Context"
186189
},
190+
"show_billed_characters": {
191+
"$ref": "#/components/schemas/ShowBilledCharacters"
192+
},
187193
"split_sentences": {
188194
"$ref": "#/components/schemas/SplitSentencesOption"
189195
},
@@ -252,6 +258,10 @@
252258
"text": {
253259
"description": "The translated text.",
254260
"type": "string"
261+
},
262+
"billed_characters": {
263+
"description": "Number of characters counted by DeepL for billing purposes. Only present if the show_billed_characters parameter is set to true.",
264+
"type": "integer"
255265
}
256266
}
257267
}
@@ -264,7 +274,8 @@
264274
"translations": [
265275
{
266276
"detected_source_language": "EN",
267-
"text": "Hallo, Welt!"
277+
"text": "Hallo, Welt!",
278+
"billed_characters": 42
268279
}
269280
]
270281
}
@@ -1854,6 +1865,10 @@
18541865
],
18551866
"default": "0"
18561867
},
1868+
"ShowBilledCharacters": {
1869+
"description": "When true, the response will include the billed_characters parameter, giving the \nnumber of characters from the request that will be counted by DeepL for billing purposes.",
1870+
"type": "boolean"
1871+
},
18571872
"SplitSentencesOption": {
18581873
"description": "Sets whether the translation engine should first split the input into sentences. For text translations where \n`tag_handling` is not set to `html`, the default value is `1`, meaning the engine splits on punctuation and on newlines.\n\nFor text translations where `tag_handling=html`, the default value is `nonewlines`, meaning the engine splits on punctuation only, ignoring newlines. \n\nThe use of `nonewlines` as the default value for text translations where `tag_handling=html` is new behavior that was implemented in November 2022, \nwhen HTML handling was moved out of beta. \n\nPossible values are: \n\n * `0` - no splitting at all, whole input is treated as one sentence\n * `1` (default when `tag_handling` is not set to `html`) - splits on punctuation and on newlines\n * `nonewlines` (default when `tag_handling=html`) - splits on punctuation only, ignoring newlines\n\nFor applications that send one sentence per text parameter, we recommend setting `split_sentences` to `0`, in order to prevent the engine from splitting the sentence unintentionally.\n\n\nPlease note that newlines will split sentences when `split_sentences=1`. We recommend cleaning files so they don't contain breaking sentences or setting the parameter `split_sentences` to `nonewlines`.",
18591874
"type": "string",

openapi.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ paths:
138138
$ref: '#/components/schemas/TargetLanguageText'
139139
context:
140140
$ref: '#/components/schemas/Context'
141+
show_billed_characters:
142+
$ref: '#/components/schemas/ShowBilledCharacters'
141143
split_sentences:
142144
$ref: '#/components/schemas/SplitSentencesOption'
143145
preserve_formatting:
@@ -212,6 +214,8 @@ paths:
212214
$ref: '#/components/schemas/TargetLanguageText'
213215
context:
214216
$ref: '#/components/schemas/Context'
217+
show_billed_characters:
218+
$ref: '#/components/schemas/ShowBilledCharacters'
215219
split_sentences:
216220
$ref: '#/components/schemas/SplitSentencesOption'
217221
preserve_formatting:
@@ -262,12 +266,17 @@ paths:
262266
text:
263267
description: The translated text.
264268
type: string
269+
billed_characters:
270+
description: Number of characters counted by DeepL for billing purposes.
271+
Only present if the show_billed_characters parameter is set to true.
272+
type: integer
265273
examples:
266274
Basic:
267275
value:
268276
translations:
269277
- detected_source_language: EN
270278
text: Hallo, Welt!
279+
billed_characters: 42
271280
Glossary:
272281
value:
273282
translations:
@@ -1547,6 +1556,11 @@ components:
15471556
- '0'
15481557
- '1'
15491558
default: '0'
1559+
ShowBilledCharacters:
1560+
description: |-
1561+
When true, the response will include the billed_characters parameter, giving the
1562+
number of characters from the request that will be counted by DeepL for billing purposes.
1563+
type: boolean
15501564
SplitSentencesOption:
15511565
description: |-
15521566
Sets whether the translation engine should first split the input into sentences. For text translations where

openapi_gitbook.yaml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ paths:
9595
$ref: '#/components/schemas/TargetLanguageText'
9696
context:
9797
$ref: '#/components/schemas/Context'
98+
show_billed_characters:
99+
$ref: '#/components/schemas/ShowBilledCharacters'
98100
split_sentences:
99101
$ref: '#/components/schemas/SplitSentencesOption'
100102
preserve_formatting:
@@ -150,6 +152,8 @@ paths:
150152
$ref: '#/components/schemas/TargetLanguageText'
151153
context:
152154
$ref: '#/components/schemas/Context'
155+
show_billed_characters:
156+
$ref: '#/components/schemas/ShowBilledCharacters'
153157
split_sentences:
154158
$ref: '#/components/schemas/SplitSentencesOption'
155159
preserve_formatting:
@@ -214,6 +218,11 @@ paths:
214218
description: The translated text.
215219
type: string
216220
example: Hallo, Welt!
221+
billed_characters:
222+
description: Number of characters counted by DeepL for billing purposes.
223+
Only present if the show_billed_characters parameter is set to true.
224+
type: integer
225+
example: 42
217226
400:
218227
$ref: '#/components/responses/BadRequest'
219228
403:
@@ -1156,6 +1165,13 @@ components:
11561165
name: Authorization
11571166
in: header
11581167
schemas:
1168+
Context:
1169+
description: |-
1170+
Additional context that can influence a translation but is not translated itself.
1171+
1172+
Characters included in the `context` parameter will not be counted toward billing.
1173+
type: string
1174+
example: This is context.
11591175
CreateGlossaryParameters:
11601176
type: object
11611177
required:
@@ -1315,13 +1331,6 @@ components:
13151331
using the `splitting_tags` parameter.
13161332
type: boolean
13171333
default: true
1318-
Context:
1319-
description: |-
1320-
Additional context that can influence a translation but is not translated itself.
1321-
1322-
Characters included in the `context` parameter will not be counted toward billing.
1323-
type: string
1324-
example: This is context.
13251334
OutlineDetectionOptionStr:
13261335
description: |-
13271336
Disable the automatic detection of XML structure by setting the `outline_detection` parameter
@@ -1346,6 +1355,11 @@ components:
13461355
- '0'
13471356
- '1'
13481357
default: '0'
1358+
ShowBilledCharacters:
1359+
description: |-
1360+
When true, the response will include the billed_characters parameter, giving the
1361+
number of characters from the request that will be counted by DeepL for billing purposes.
1362+
type: boolean
13491363
SplitSentencesOption:
13501364
description: |-
13511365
Sets whether the translation engine should first split the input into sentences.

0 commit comments

Comments
 (0)