Skip to content

Commit 9b65f44

Browse files
committed
Model builders implemented
1 parent 6927cf0 commit 9b65f44

File tree

248 files changed

+11533
-31
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

248 files changed

+11533
-31
lines changed

src/model/ai-bcr-image-storage-file.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,35 @@ export class AiBcrImageStorageFile extends model.AiBcrImage {
6969
}
7070
}
7171

72+
/**
73+
* AiBcrImageStorageFile model builder
74+
*/
75+
export class AiBcrImageStorageFileBuilder {
76+
private readonly model: AiBcrImageStorageFile;
77+
public constructor(model: AiBcrImageStorageFile) {
78+
this.model = model;
79+
}
80+
81+
/**
82+
* Build model.
83+
*/
84+
public build(): AiBcrImageStorageFile {
85+
return this.model;
86+
}
7287

88+
/**
89+
* Determines that image contains single VCard or more.
90+
*/
91+
public isSingle(isSingle: boolean): AiBcrImageStorageFileBuilder {
92+
this.model.isSingle = isSingle;
93+
return this;
94+
}
95+
/**
96+
* Image location
97+
*/
98+
public file(file: model.StorageFileLocation): AiBcrImageStorageFileBuilder {
99+
this.model.file = file;
100+
return this;
101+
}
102+
}
73103

src/model/ai-bcr-image.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,28 @@ export class AiBcrImage {
6666
}
6767
}
6868

69+
/**
70+
* AiBcrImage model builder
71+
*/
72+
export class AiBcrImageBuilder {
73+
private readonly model: AiBcrImage;
74+
public constructor(model: AiBcrImage) {
75+
this.model = model;
76+
}
77+
78+
/**
79+
* Build model.
80+
*/
81+
public build(): AiBcrImage {
82+
return this.model;
83+
}
6984

85+
/**
86+
* Determines that image contains single VCard or more.
87+
*/
88+
public isSingle(isSingle: boolean): AiBcrImageBuilder {
89+
this.model.isSingle = isSingle;
90+
return this;
91+
}
92+
}
7093

src/model/ai-bcr-options.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,35 @@ export class AiBcrOptions {
7878
}
7979
}
8080

81+
/**
82+
* AiBcrOptions model builder
83+
*/
84+
export class AiBcrOptionsBuilder {
85+
private readonly model: AiBcrOptions;
86+
public constructor(model: AiBcrOptions) {
87+
this.model = model;
88+
}
89+
90+
/**
91+
* Build model.
92+
*/
93+
public build(): AiBcrOptions {
94+
return this.model;
95+
}
8196

97+
/**
98+
* Comma-separated ISO-639 codes of languages (either 639-1 or 639-3; i.e. \"it\" or \"ita\" for Italian); it's \"\" by default.
99+
*/
100+
public languages(languages: string): AiBcrOptionsBuilder {
101+
this.model.languages = languages;
102+
return this;
103+
}
104+
/**
105+
* Comma-separated codes of countries.
106+
*/
107+
public countries(countries: string): AiBcrOptionsBuilder {
108+
this.model.countries = countries;
109+
return this;
110+
}
111+
}
82112

src/model/ai-bcr-parse-request.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,29 @@ export class AiBcrParseRequest {
4343
this.isSingle = isSingle;
4444
}
4545
}
46+
47+
export class AiBcrParseRequestBuilder {
48+
private model: AiBcrParseRequest
49+
public constructor(model: AiBcrParseRequest) {
50+
this.model = model;
51+
}
52+
public build(): AiBcrParseRequest {
53+
return this.model;
54+
}
55+
public file(file: Buffer): AiBcrParseRequestBuilder {
56+
this.model.file = file;
57+
return this;
58+
}
59+
public countries(countries: string): AiBcrParseRequestBuilder {
60+
this.model.countries = countries;
61+
return this;
62+
}
63+
public languages(languages: string): AiBcrParseRequestBuilder {
64+
this.model.languages = languages;
65+
return this;
66+
}
67+
public isSingle(isSingle: boolean): AiBcrParseRequestBuilder {
68+
this.model.isSingle = isSingle;
69+
return this;
70+
}
71+
}

src/model/ai-bcr-parse-storage-request.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,42 @@ export class AiBcrParseStorageRequest {
9090
}
9191
}
9292

93+
/**
94+
* AiBcrParseStorageRequest model builder
95+
*/
96+
export class AiBcrParseStorageRequestBuilder {
97+
private readonly model: AiBcrParseStorageRequest;
98+
public constructor(model: AiBcrParseStorageRequest) {
99+
this.model = model;
100+
}
101+
102+
/**
103+
* Build model.
104+
*/
105+
public build(): AiBcrParseStorageRequest {
106+
return this.model;
107+
}
93108

109+
/**
110+
* Parse output folder location on storage
111+
*/
112+
public outFolder(outFolder: model.StorageFolderLocation): AiBcrParseStorageRequestBuilder {
113+
this.model.outFolder = outFolder;
114+
return this;
115+
}
116+
/**
117+
* Images to parse.
118+
*/
119+
public images(images: Array< model.AiBcrImageStorageFile >): AiBcrParseStorageRequestBuilder {
120+
this.model.images = images;
121+
return this;
122+
}
123+
/**
124+
* Recognition options.
125+
*/
126+
public options(options: model.AiBcrOptions): AiBcrParseStorageRequestBuilder {
127+
this.model.options = options;
128+
return this;
129+
}
130+
}
94131

src/model/ai-name-complete-request.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,37 @@ export class AiNameCompleteRequest {
5959
this.style = style;
6060
}
6161
}
62+
63+
export class AiNameCompleteRequestBuilder {
64+
private model: AiNameCompleteRequest
65+
public constructor(model: AiNameCompleteRequest) {
66+
this.model = model;
67+
}
68+
public build(): AiNameCompleteRequest {
69+
return this.model;
70+
}
71+
public name(name: string): AiNameCompleteRequestBuilder {
72+
this.model.name = name;
73+
return this;
74+
}
75+
public language(language: string): AiNameCompleteRequestBuilder {
76+
this.model.language = language;
77+
return this;
78+
}
79+
public location(location: string): AiNameCompleteRequestBuilder {
80+
this.model.location = location;
81+
return this;
82+
}
83+
public encoding(encoding: string): AiNameCompleteRequestBuilder {
84+
this.model.encoding = encoding;
85+
return this;
86+
}
87+
public script(script: string): AiNameCompleteRequestBuilder {
88+
this.model.script = script;
89+
return this;
90+
}
91+
public style(style: string): AiNameCompleteRequestBuilder {
92+
this.model.style = style;
93+
return this;
94+
}
95+
}

src/model/ai-name-component-list.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,25 @@ export class AiNameComponentList extends model.ListResponseOfAiNameComponent {
5858
}
5959
}
6060

61+
/**
62+
* AiNameComponentList model builder
63+
*/
64+
export class AiNameComponentListBuilder {
65+
private readonly model: AiNameComponentList;
66+
public constructor(model: AiNameComponentList) {
67+
this.model = model;
68+
}
6169

70+
/**
71+
* Build model.
72+
*/
73+
public build(): AiNameComponentList {
74+
return this.model;
75+
}
76+
77+
public value(value: Array< model.AiNameComponent >): AiNameComponentListBuilder {
78+
this.model.value = value;
79+
return this;
80+
}
81+
}
6282

src/model/ai-name-component.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,49 @@ export class AiNameComponent {
102102
}
103103
}
104104

105+
/**
106+
* AiNameComponent model builder
107+
*/
108+
export class AiNameComponentBuilder {
109+
private readonly model: AiNameComponent;
110+
public constructor(model: AiNameComponent) {
111+
this.model = model;
112+
}
113+
114+
/**
115+
* Build model.
116+
*/
117+
public build(): AiNameComponent {
118+
return this.model;
119+
}
105120

121+
/**
122+
* Component value
123+
*/
124+
public value(value: string): AiNameComponentBuilder {
125+
this.model.value = value;
126+
return this;
127+
}
128+
/**
129+
* Name component category. Enum, available values: Unknown, Mononym, Score, Format, FirstInitial, FirstName, MiddleInitial, MiddleName, MiddleNickname, MiddleSobriquet, MiddleMaidenName, MiddlePatronym, MiddleMatronym, LastInitial, LastName, LastNobiliaryParticle, LastNominalConjunction, LastPaternalSurname, LastMaternalSurname, PrefixTitle, PostfixGenerationalTitle, PostfixPostnominalLetters, ArabicIsm, ArabicKunya, ArabicNasab, ArabicSlaqab, ArabicNisbah
130+
*/
131+
public category(category: string): AiNameComponentBuilder {
132+
this.model.category = category;
133+
return this;
134+
}
135+
/**
136+
* Score from 0.0 to 1.0
137+
*/
138+
public score(score: number): AiNameComponentBuilder {
139+
this.model.score = score;
140+
return this;
141+
}
142+
/**
143+
* Component position from 0
144+
*/
145+
public position(position: number): AiNameComponentBuilder {
146+
this.model.position = position;
147+
return this;
148+
}
149+
}
106150

src/model/ai-name-cultural-context.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,5 +114,56 @@ export class AiNameCulturalContext {
114114
}
115115
}
116116

117+
/**
118+
* AiNameCulturalContext model builder
119+
*/
120+
export class AiNameCulturalContextBuilder {
121+
private readonly model: AiNameCulturalContext;
122+
public constructor(model: AiNameCulturalContext) {
123+
this.model = model;
124+
}
117125

126+
/**
127+
* Build model.
128+
*/
129+
public build(): AiNameCulturalContext {
130+
return this.model;
131+
}
132+
133+
/**
134+
* An ISO-639 code of the language; either 639-1 or 639-3 (e.g. \"it\" or \"ita\" for Italian)
135+
*/
136+
public language(language: string): AiNameCulturalContextBuilder {
137+
this.model.language = language;
138+
return this;
139+
}
140+
/**
141+
* A geographic code such as an ISO-3166 two letter country code, for example \"FR\" for France
142+
*/
143+
public location(location: string): AiNameCulturalContextBuilder {
144+
this.model.location = location;
145+
return this;
146+
}
147+
/**
148+
* A writing system code; starts with the ISO-15924 script name
149+
*/
150+
public script(script: string): AiNameCulturalContextBuilder {
151+
this.model.script = script;
152+
return this;
153+
}
154+
/**
155+
* A character encoding name
156+
*/
157+
public encoding(encoding: string): AiNameCulturalContextBuilder {
158+
this.model.encoding = encoding;
159+
return this;
160+
}
161+
/**
162+
* Name writing style. Enum, available values: Formal, Informal, Legal, Academic
163+
*/
164+
public style(style: string): AiNameCulturalContextBuilder {
165+
this.model.style = style;
166+
return this;
167+
}
168+
}
118169

src/model/ai-name-expand-request.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,37 @@ export class AiNameExpandRequest {
5959
this.style = style;
6060
}
6161
}
62+
63+
export class AiNameExpandRequestBuilder {
64+
private model: AiNameExpandRequest
65+
public constructor(model: AiNameExpandRequest) {
66+
this.model = model;
67+
}
68+
public build(): AiNameExpandRequest {
69+
return this.model;
70+
}
71+
public name(name: string): AiNameExpandRequestBuilder {
72+
this.model.name = name;
73+
return this;
74+
}
75+
public language(language: string): AiNameExpandRequestBuilder {
76+
this.model.language = language;
77+
return this;
78+
}
79+
public location(location: string): AiNameExpandRequestBuilder {
80+
this.model.location = location;
81+
return this;
82+
}
83+
public encoding(encoding: string): AiNameExpandRequestBuilder {
84+
this.model.encoding = encoding;
85+
return this;
86+
}
87+
public script(script: string): AiNameExpandRequestBuilder {
88+
this.model.script = script;
89+
return this;
90+
}
91+
public style(style: string): AiNameExpandRequestBuilder {
92+
this.model.style = style;
93+
return this;
94+
}
95+
}

0 commit comments

Comments
 (0)