@@ -62,104 +62,107 @@ Applies prettier formatting to the schemas
6262
6363#### Java
6464
65- String access_token = "access_token";
66- ApiClient cl = new ApiClient();
67- ObjectMapper mapper = cl.getObjectMapper();
68- mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); // To allow certain requests with empty bodies
69- cl.setObjectMapper(mapper);
70- cl.setRequestInterceptor(r -> {
71- r.header("Authorization", "Bearer " + access_token);
72- });
73- UnitApi unitApi = new UnitApi(cl);
74-
75- CreateBusinessApplication createBusinessApplication = new CreateBusinessApplication();
76- CreateBusinessApplicationAttributes attr = new CreateBusinessApplicationAttributes();
77-
78- attr.setName("Peter Parker");
79-
80- Address address = new Address();
81- address.setStreet("20 Ingram St");
82- address.setCity("Forest Hills");
83- address.setPostalCode("11375");
84- address.setCountry("US");
85- address.setState("NY");
86- attr.setAddress(address);
87-
88-
89- Phone p = new Phone();
90- p.setNumber("5555555555");
91- p.setCountryCode("1");
92- attr.setPhone(p);
93-
94- attr.setStateOfIncorporation("DE");
95- attr.setEin("123456789");
96- attr.setEntityType(EntityType.CORPORATION);
97- attr.setIp("127.0.0.1");
98- attr.setAnnualRevenue(BusinessAnnualRevenue.BETWEEN250K_AND500K);
99- attr.setNumberOfEmployees(BusinessNumberOfEmployees.BETWEEN100_AND500);
100- attr.setCashFlow(CashFlow.PREDICTABLE);
101- attr.setYearOfIncorporation("1999");
102- List<String> countriesOfOperation = new ArrayList<String>();
103- countriesOfOperation.add("US");
104- countriesOfOperation.add("CA");
105-
106- attr.setCountriesOfOperation(countriesOfOperation);
107-
108- attr.setWebsite(null);
109-
110- String email = "[email protected] "; 111- Contact contact = new Contact();
112- contact.setEmail(email);
113- contact.setPhone(p);
114- FullName fn = new FullName();
115- fn.setFirst("Peter");
116- fn.setLast("Parker");
117- contact.setFullName(fn);
118- attr.setContact(contact);
119-
120-
121- CreateOfficer officer = new CreateOfficer();
122- officer.setAnnualIncome(AnnualIncome.BETWEEN50K_AND100K);
123- officer.setFullName(fn);
124- officer.setAddress(address);
125- officer.setEmail(email);
126- officer.setPhone(p);
127- LocalDate dateOfBirh = LocalDate.of(1997, 11, 1);
128- officer.setDateOfBirth(dateOfBirh);
129- officer.setTitle(CreateOfficer.TitleEnum.CEO);
130- officer.setOccupation(Occupation.ARCHITECT_OR_ENGINEER);
131- officer.setSourceOfIncome(SourceOfIncome.BUSINESS_OWNERSHIP_INTERESTS);
132- officer.setSsn("123456789");
133-
134- attr.setOfficer(officer);
135- attr.setBusinessVertical(BusinessVertical.ARTS_ENTERTAINMENT_AND_RECREATION);
136-
137- List<CreateBeneficialOwner> beneficialOwners = new ArrayList<CreateBeneficialOwner>();
138- CreateBeneficialOwner beneficialOwner = new CreateBeneficialOwner();
139- beneficialOwner.setAddress(address);
140- beneficialOwner.setFullName(fn);
141- beneficialOwner.setDateOfBirth(dateOfBirh);
142- beneficialOwner.setSsn("721074426");
143- beneficialOwner.setEmail(email);
144- beneficialOwner.setPhone(p);
145- beneficialOwner.setOccupation(Occupation.ARCHITECT_OR_ENGINEER);
146- beneficialOwner.setAnnualIncome(AnnualIncome.BETWEEN100K_AND250K);
147- beneficialOwner.setSourceOfIncome(SourceOfIncome.BUSINESS_OWNERSHIP_INTERESTS);
148- beneficialOwners.add(beneficialOwner);
149- attr.setBeneficialOwners(beneficialOwners);
150-
151- createBusinessApplication.setAttributes(attr);
152-
153- CreateApplicationRequest ca = new CreateApplicationRequest();
154- ca.data(new CreateApplicationRequestData(createBusinessApplication));
155-
156- UnitCreateApplicationResponse res = unitApi.createApplication(ca)
65+ ``` java
66+ String access_token = " access_token" ;
67+ ApiClient cl = new ApiClient ();
68+ ObjectMapper mapper = cl. getObjectMapper();
69+ mapper. configure(SerializationFeature . FAIL_ON_EMPTY_BEANS , false ); // To allow certain requests with empty bodies
70+ cl. setObjectMapper(mapper);
71+ cl. setRequestInterceptor(r - > {
72+ r. header(" Authorization" , " Bearer " + access_token);
73+ });
74+ UnitApi unitApi = new UnitApi (cl);
75+
76+ CreateBusinessApplication createBusinessApplication = new CreateBusinessApplication ();
77+ CreateBusinessApplicationAttributes attr = new CreateBusinessApplicationAttributes ();
78+
79+ attr. setName(" Peter Parker" );
80+
81+ Address address = new Address ();
82+ address. setStreet(" 20 Ingram St" );
83+ address. setCity(" Forest Hills" );
84+ address. setPostalCode(" 11375" );
85+ address. setCountry(" US" );
86+ address. setState(" NY" );
87+ attr. setAddress(address);
88+
89+
90+ Phone p = new Phone ();
91+ p. setNumber(" 5555555555" );
92+ p. setCountryCode(" 1" );
93+ attr. setPhone(p);
94+
95+ attr. setStateOfIncorporation(" DE" );
96+ attr. setEin(" 123456789" );
97+ attr. setEntityType(EntityType . CORPORATION );
98+ attr. setIp(" 127.0.0.1" );
99+ attr. setAnnualRevenue(BusinessAnnualRevenue . BETWEEN250K_AND500K );
100+ attr. setNumberOfEmployees(BusinessNumberOfEmployees . BETWEEN100_AND500 );
101+ attr. setCashFlow(CashFlow . PREDICTABLE );
102+ attr. setYearOfIncorporation(" 1999" );
103+ List<String > countriesOfOperation = new ArrayList<String > ();
104+ countriesOfOperation. add(" US" );
105+ countriesOfOperation. add(" CA" );
106+
107+ attr. setCountriesOfOperation(countriesOfOperation);
108+
109+ attr. setWebsite(null );
110+
111+ String email
= " [email protected] " ;
112+ Contact contact = new Contact ();
113+ contact. setEmail(email);
114+ contact. setPhone(p);
115+ FullName fn = new FullName ();
116+ fn. setFirst(" Peter" );
117+ fn. setLast(" Parker" );
118+ contact. setFullName(fn);
119+ attr. setContact(contact);
120+
121+
122+ CreateOfficer officer = new CreateOfficer ();
123+ officer. setAnnualIncome(AnnualIncome . BETWEEN50K_AND100K );
124+ officer. setFullName(fn);
125+ officer. setAddress(address);
126+ officer. setEmail(email);
127+ officer. setPhone(p);
128+ LocalDate dateOfBirh = LocalDate . of(1997 , 11 , 1 );
129+ officer. setDateOfBirth(dateOfBirh);
130+ officer. setTitle(CreateOfficer . TitleEnum . CEO );
131+ officer. setOccupation(Occupation . ARCHITECT_OR_ENGINEER );
132+ officer. setSourceOfIncome(SourceOfIncome . BUSINESS_OWNERSHIP_INTERESTS );
133+ officer. setSsn(" 123456789" );
134+
135+ attr. setOfficer(officer);
136+ attr. setBusinessVertical(BusinessVertical . ARTS_ENTERTAINMENT_AND_RECREATION );
137+
138+ List<CreateBeneficialOwner > beneficialOwners = new ArrayList<CreateBeneficialOwner > ();
139+ CreateBeneficialOwner beneficialOwner = new CreateBeneficialOwner ();
140+ beneficialOwner. setAddress(address);
141+ beneficialOwner. setFullName(fn);
142+ beneficialOwner. setDateOfBirth(dateOfBirh);
143+ beneficialOwner. setSsn(" 721074426" );
144+ beneficialOwner. setEmail(email);
145+ beneficialOwner. setPhone(p);
146+ beneficialOwner. setOccupation(Occupation . ARCHITECT_OR_ENGINEER );
147+ beneficialOwner. setAnnualIncome(AnnualIncome . BETWEEN100K_AND250K );
148+ beneficialOwner. setSourceOfIncome(SourceOfIncome . BUSINESS_OWNERSHIP_INTERESTS );
149+ beneficialOwners. add(beneficialOwner);
150+ attr. setBeneficialOwners(beneficialOwners);
151+
152+ createBusinessApplication. setAttributes(attr);
153+
154+ CreateApplicationRequest ca = new CreateApplicationRequest ();
155+ ca. data(new CreateApplicationRequestData (createBusinessApplication));
156+
157+ UnitCreateApplicationResponse res = unitApi. createApplication(ca)
158+ ```
157159
158160you can find more examples in the unit/e2e_tests/java directory
159161
160162#### Typescript
161163
162- import {
164+ ``` typescript
165+ import {
163166 Address ,
164167 AnnualIncome ,
165168 BusinessAnnualRevenue ,
@@ -174,104 +177,127 @@ you can find more examples in the unit/e2e_tests/java directory
174177 Phone ,
175178 SourceOfIncome ,
176179 UnitApi ,
177- } from "./api";
178- import { Configuration } from "./configuration";
180+ } from " ./api" ;
181+ import { Configuration } from " ./configuration" ;
179182
180- const config: Configuration = new Configuration({
181- accessToken: "access_token"
182- });
183- const unitApi: UnitApi = new UnitApi(config);
183+ const config: Configuration = new Configuration ({
184+ accessToken: " access_token" ,
185+ });
186+ const unitApi: UnitApi = new UnitApi (config );
184187
185- const address: Address = {
188+ const address: Address = {
186189 street: " 20 Ingram St" ,
187190 city: " Forest Hills" ,
188191 postalCode: " 11375" ,
189192 country: " US" ,
190193 state: " NY" ,
191- };
192- const phone: Phone = {
194+ };
195+ const phone: Phone = {
193196 number: " 5555555555" ,
194197 countryCode: " 1" ,
195- };
196- const fullName: FullName = {
198+ };
199+ const fullName: FullName = {
197200 first: " Peter" ,
198201 last: " Parker" ,
199- };
200- const email = "[email protected] "; 201- const dateOfBirth = "1997-11-01";
202- const today = new Date();
202+ };
203+ const email
= " [email protected] " ;
204+ const dateOfBirth = " 1997-11-01" ;
205+ const today = new Date ();
203206
204- const req: CreateApplicationRequest = {
207+ const req: CreateApplicationRequest = {
205208 data: {
206209 type: " businessApplication" ,
207210 attributes: {
208- name: "Peter Parker",
209- address,
210- phone,
211- stateOfIncorporation: "DE",
212- ein: "123456789",
213- entityType: EntityType.Corporation,
214- ip: "127.0.0.1",
215- annualRevenue: BusinessAnnualRevenue.Between1mAnd5m,
216- numberOfEmployees: BusinessNumberOfEmployees.Between100And500,
217- cashFlow: CashFlow.Predictable,
218- countriesOfOperation: ["US", "CA"],
219- businessVertical: BusinessVertical.AgricultureForestryFishingOrHunting,
220- yearOfIncorporation: (today.getFullYear() - 2).toString(),
221- contact: {
222- email,
223- fullName,
224- phone,
225- },
226- officer: {
227- annualIncome: AnnualIncome.Between100kAnd250k,
228- fullName,
229- address,
230- email,
231- phone,
232- dateOfBirth,
233- title: OfficerTitleEnum.Ceo,
234- occupation: Occupation.ArchitectOrEngineer,
235- sourceOfIncome: SourceOfIncome.BusinessOwnershipInterests,
236- ssn: "123456789",
237- },
238- beneficialOwners: [
239- {
211+ name: " Peter Parker" ,
240212 address ,
241- fullName,
242- dateOfBirth,
243- ssn: "721074426",
244- email,
245213 phone ,
246- occupation: Occupation.ArchitectOrEngineer,
247- sourceOfIncome: SourceOfIncome.BusinessOwnershipInterests,
214+ stateOfIncorporation: " DE" ,
215+ ein: " 123456789" ,
216+ entityType: EntityType .Corporation ,
217+ ip: " 127.0.0.1" ,
218+ annualRevenue: BusinessAnnualRevenue .Between1mAnd5m ,
219+ numberOfEmployees: BusinessNumberOfEmployees .Between100And500 ,
220+ cashFlow: CashFlow .Predictable ,
221+ countriesOfOperation: [" US" , " CA" ],
222+ businessVertical:
223+ BusinessVertical .AgricultureForestryFishingOrHunting ,
224+ yearOfIncorporation: (today .getFullYear () - 2 ).toString (),
225+ contact: {
226+ email ,
227+ fullName ,
228+ phone ,
248229 },
249- ],
230+ officer: {
231+ annualIncome: AnnualIncome .Between100kAnd250k ,
232+ fullName ,
233+ address ,
234+ email ,
235+ phone ,
236+ dateOfBirth ,
237+ title: OfficerTitleEnum .Ceo ,
238+ occupation: Occupation .ArchitectOrEngineer ,
239+ sourceOfIncome: SourceOfIncome .BusinessOwnershipInterests ,
240+ ssn: " 123456789" ,
241+ },
242+ beneficialOwners: [
243+ {
244+ address ,
245+ fullName ,
246+ dateOfBirth ,
247+ ssn: " 721074426" ,
248+ email ,
249+ phone ,
250+ occupation: Occupation .ArchitectOrEngineer ,
251+ sourceOfIncome: SourceOfIncome .BusinessOwnershipInterests ,
252+ },
253+ ],
250254 },
251255 },
252- };
256+ };
253257
254- let res = await unitApi.createApplication(req);
258+ let res = await unitApi .createApplication (req );
259+ ```
260+
261+ #### Python
262+
263+ ``` python
264+ import unit_python_sdk
265+ from unit_python_sdk.rest import ApiException
266+
267+ # Defining the host is optional and defaults to https://api.s.unit.sh
268+ # See configuration.py for a list of all supported configuration parameters.
269+ configuration = unit_python_sdk.Configuration(
270+ host = " https://api.s.unit.sh"
271+ )
255272
256- ## Known Generators Issues
257273
258- ### Authorization Tokens
259274
260- The default authorization configuration is located in components/securitySchemes/bearerAuth section in the openapi.json file and looks as follows:
275+ # Enter a context with an instance of the API client
276+ with unit_python_sdk.ApiClient(configuration) as api_client:
277+ # Create an instance of the API class
278+ api_client.set_default_header(" Authorization" , " Bearer access_token" );
279+ api_instance = unit_python_sdk.UnitApi(api_client)
261280
262- "bearerAuth": {
263- "type": "http",
264- "scheme": "bearer",
265- "bearerFormat": "JWT"
266- }
281+ try :
282+ full_name = unit_python_sdk.FullName(first = " Peter" , last = " Parker" );
283+ address = unit_python_sdk.Address(street = " 20 Ingram St" , street2 = None , city = " Forest Hills" , state = " NY" , postalCode = " 11375" , country = " US" );
284+ ssn = " 721074426"
285+ date_of_birth = " 2001-08-10" ;
286+ 287+ phone = unit_python_sdk.Phone(countryCode = " 1" , number = " 5555555555" );
288+ occupation = unit_python_sdk.Occupation.ARCHITECTORENGINEER ;
289+ attributes: unit_python_sdk.CreateIndividualApplicationAttributes = unit_python_sdk.CreateIndividualApplicationAttributes(fullName = full_name, email = email, phone = phone, ssn = ssn, dateOfBirth = date_of_birth, address = address, occupation = occupation);
290+ createIndividualApplication: unit_python_sdk.CreateIndividualApplication = unit_python_sdk.CreateIndividualApplication(type = " individualApplication" , attributes = attributes);
291+ data = unit_python_sdk.CreateApplicationRequestData(createIndividualApplication);
292+ req = unit_python_sdk.CreateApplicationRequest(data = data);
267293
268- When generating a python-sdk, you should change the configurations to:
269294
270- "bearerAuth": {
271- "type": "apiKey",
272- "in": "header",
273- "name": "Authorization"
274- }
295+ res = api_instance.create_application(req);
296+ except ApiException as e:
297+ print (" Exception when calling UnitApi->create_application: %s \n " % e)
298+ ```
299+
300+ ## Known Generators Issues
275301
276302### Java responses
277303
0 commit comments