@@ -32,20 +32,23 @@ Add this dependency to your project's POM:
3232
3333## Basic Usage Examples
3434
35- For more examples of basic usage, see the [ Test suites] ( https://github.com/unit-finance/unit-openapi-java-sdk/tree/main/src/test/java/org/openapitools/client ) or [ API Reference documentation] ( https://docs.unit.co/ ) .
35+ For more examples of basic usage, see the [ Test suites] ( https://github.com/unit-finance/unit-openapi-java-sdk/tree/main/src/test/java/unit/java/sdk ) or [ API Reference documentation] ( https://docs.unit.co/ ) .
3636
3737``` java
38- String access_token = System . getenv(" access_token" );
39- ApiClient apiClient = new ApiClient ();
40- apiClient. setRequestInterceptor(r - > r. header(" Authorization" , " Bearer " + access_token));
38+ String access_token = " access_token" ;
39+ ApiClient cl = new ApiClient ();
40+ ObjectMapper mapper = cl. getObjectMapper();
41+ mapper. configure(SerializationFeature . FAIL_ON_EMPTY_BEANS , false ); // To allow certain requests with empty bodies
42+ cl. setObjectMapper(mapper);
43+ cl. setRequestInterceptor(r - > {
44+ r. header(" Authorization" , " Bearer " + access_token);
45+ });
46+ UnitApi unitApi = new UnitApi (cl);
4147
42- CreateIndividualApplication createIndividualApplication = new CreateIndividualApplication ();
43- CreateIndividualApplicationAttributes attr = new CreateIndividualApplicationAttributes ();
48+ CreateBusinessApplication createBusinessApplication = new CreateBusinessApplication ();
49+ CreateBusinessApplicationAttributes attr = new CreateBusinessApplicationAttributes ();
4450
45- FullName fn = new FullName ();
46- fn. setFirst(" Peter" );
47- fn. setLast(" Parker" );
48- attr. setFullName(fn);
51+ attr. setName(" Peter Parker" );
4952
5053Address address = new Address ();
5154address. setStreet(" 20 Ingram St" );
@@ -55,33 +58,78 @@ address.setCountry("US");
5558address. setState(" NY" );
5659attr. setAddress(address);
5760
58- attr. setSsn(" 721074426" );
59- attr. setDateOfBirth(LocalDate . parse(" 2001-08-10" ));
60- attr
. setEmail(
" [email protected] " );
61+
6162Phone p = new Phone ();
6263p. setNumber(" 5555555555" );
6364p. setCountryCode(" 1" );
6465attr. setPhone(p);
65- attr. setIdempotencyKey(" 3a1a33be-4e12-4603-9ed0-820922389fb8" );
66- attr. setOccupation(Occupation . ARCHITECT_OR_ENGINEER );
67-
68- createIndividualApplication. setAttributes(attr);
69-
70- CreateApplication ca = new CreateApplication ();
71- ca. data(new CreateApplicationData (createIndividualApplication));
7266
73- CreateApplicationApi createApiClient = new CreateApplicationApi (apiClient);
74- UnitCreateApplicationResponse res = apiClient. execute(request);
67+ attr. setStateOfIncorporation(" DE" );
68+ attr. setEin(" 123456789" );
69+ attr. setEntityType(EntityType . CORPORATION );
70+ attr. setIp(" 127.0.0.1" );
71+ attr. setAnnualRevenue(BusinessAnnualRevenue . BETWEEN250K_AND500K );
72+ attr. setNumberOfEmployees(BusinessNumberOfEmployees . BETWEEN100_AND500 );
73+ attr. setCashFlow(CashFlow . PREDICTABLE );
74+ attr. setYearOfIncorporation(" 1999" );
75+ List<String > countriesOfOperation = new ArrayList<String > ();
76+ countriesOfOperation. add(" US" );
77+ countriesOfOperation. add(" CA" );
78+
79+ attr. setCountriesOfOperation(countriesOfOperation);
80+
81+ attr. setWebsite(null );
82+
83+ String email
= " [email protected] " ;
84+ Contact contact = new Contact ();
85+ contact. setEmail(email);
86+ contact. setPhone(p);
87+ FullName fn = new FullName ();
88+ fn. setFirst(" Peter" );
89+ fn. setLast(" Parker" );
90+ contact. setFullName(fn);
91+ attr. setContact(contact);
92+
93+
94+ CreateOfficer officer = new CreateOfficer ();
95+ officer. setAnnualIncome(AnnualIncome . BETWEEN50K_AND100K );
96+ officer. setFullName(fn);
97+ officer. setAddress(address);
98+ officer. setEmail(email);
99+ officer. setPhone(p);
100+ LocalDate dateOfBirh = LocalDate . of(1997 , 11 , 1 );
101+ officer. setDateOfBirth(dateOfBirh);
102+ officer. setTitle(CreateOfficer . TitleEnum . CEO );
103+ officer. setOccupation(Occupation . ARCHITECT_OR_ENGINEER );
104+ officer. setSourceOfIncome(SourceOfIncome . BUSINESS_OWNERSHIP_INTERESTS );
105+ officer. setSsn(" 123456789" );
106+
107+ attr. setOfficer(officer);
108+ attr. setBusinessVertical(BusinessVertical . ARTS_ENTERTAINMENT_AND_RECREATION );
109+
110+ List<CreateBeneficialOwner > beneficialOwners = new ArrayList<CreateBeneficialOwner > ();
111+ CreateBeneficialOwner beneficialOwner = new CreateBeneficialOwner ();
112+ beneficialOwner. setAddress(address);
113+ beneficialOwner. setFullName(fn);
114+ beneficialOwner. setDateOfBirth(dateOfBirh);
115+ beneficialOwner. setSsn(" 721074426" );
116+ beneficialOwner. setEmail(email);
117+ beneficialOwner. setPhone(p);
118+ beneficialOwner. setOccupation(Occupation . ARCHITECT_OR_ENGINEER );
119+ beneficialOwner. setAnnualIncome(AnnualIncome . BETWEEN100K_AND250K );
120+ beneficialOwner. setSourceOfIncome(SourceOfIncome . BUSINESS_OWNERSHIP_INTERESTS );
121+ beneficialOwners. add(beneficialOwner);
122+ attr. setBeneficialOwners(beneficialOwners);
123+
124+ createBusinessApplication. setAttributes(attr);
125+
126+ CreateApplicationRequest ca = new CreateApplicationRequest ();
127+ ca. data(new CreateApplicationRequestData (createBusinessApplication));
128+
129+ UnitCreateApplicationResponse res = unitApi. createApplication(ca)
75130```
76131
77132## About
78133
79134To generate a customized version of the unit-java-sdk using our [ OpenAPI project] ( https://github.com/unit-finance/openapi-unit-sdk )
80- we suggest using the open-generator-cli to generate the Java client using the following command:
81-
82- ``` commandline
83- openapi-generator-cli generate -g java -i openapi.json -o unit
84- -p hideGenerationTimestamp=true -p packageName=unit.java.sdk
85- -p modelPackage=unit.java.sdk.model -p apiPackage=unit.java.sdk.api
86- --library native -p useJakartaEe=true
87- ```
135+ we suggest modifying ` npm run generate-java ` command in our [ openapi-unit-sdk repo] ( https://github.com/unit-finance/openapi-unit-sdk/tree/main ) [ package.json] ( https://github.com/unit-finance/openapi-unit-sdk/blob/main/package.json ) , which uses open-generator-cli as it's base
0 commit comments