Skip to content

Commit a5bfe7c

Browse files
committed
update readme
1 parent 478f68e commit a5bfe7c

File tree

2 files changed

+201
-0
lines changed

2 files changed

+201
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ public class Example {
103103
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
104104

105105
CallsApi apiInstance = new CallsApi(defaultClient);
106+
// Or create the instance with a your clientId and clientSecret (for OAuth2):
107+
// CallsApi apiInstance = new CallsApi("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET", null);
108+
106109
String accountId = "9900000"; // String | Your Bandwidth Account ID.
107110
CreateCall createCall = new CreateCall(); // CreateCall | JSON object containing information to create an outbound call
108111
try {
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
# {{artifactId}}
2+
3+
{{appName}}
4+
- API version: {{appVersion}}
5+
{{^hideGenerationTimestamp}}
6+
- Build date: {{generatedDate}}
7+
{{/hideGenerationTimestamp}}
8+
- Generator version: {{generatorVersion}}
9+
10+
{{{appDescriptionWithNewLines}}}
11+
12+
{{#infoUrl}}
13+
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
14+
{{/infoUrl}}
15+
16+
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
17+
18+
19+
## Requirements
20+
21+
Building the API client library requires:
22+
1. Java 1.8+
23+
2. Maven (3.8.3+)/Gradle (7.2+)
24+
25+
## Installation
26+
27+
To install the API client library to your local Maven repository, simply execute:
28+
29+
```shell
30+
mvn clean install
31+
```
32+
33+
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
34+
35+
```shell
36+
mvn clean deploy
37+
```
38+
39+
Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
40+
41+
### Maven users
42+
43+
Add this dependency to your project's POM:
44+
45+
```xml
46+
<dependency>
47+
<groupId>{{{groupId}}}</groupId>
48+
<artifactId>{{{artifactId}}}</artifactId>
49+
<version>{{{artifactVersion}}}</version>
50+
<scope>compile</scope>
51+
</dependency>
52+
```
53+
54+
### Gradle users
55+
56+
Add this dependency to your project's build file:
57+
58+
```groovy
59+
repositories {
60+
mavenCentral() // Needed if the '{{{artifactId}}}' jar has been published to maven central.
61+
mavenLocal() // Needed if the '{{{artifactId}}}' jar has been published to the local maven repo.
62+
}
63+
64+
dependencies {
65+
implementation "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}"
66+
}
67+
```
68+
69+
### Others
70+
71+
At first generate the JAR by executing:
72+
73+
```shell
74+
mvn clean package
75+
```
76+
77+
Then manually install the following JARs:
78+
79+
* `target/{{{artifactId}}}-{{{artifactVersion}}}.jar`
80+
* `target/lib/*.jar`
81+
82+
## Getting Started
83+
84+
Please follow the [installation](#installation) instruction and execute the following Java code:
85+
86+
```java
87+
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
88+
// Import classes:
89+
import {{{invokerPackage}}}.ApiClient;
90+
import {{{invokerPackage}}}.ApiException;
91+
import {{{invokerPackage}}}.Configuration;{{#hasAuthMethods}}
92+
import {{{invokerPackage}}}.auth.*;{{/hasAuthMethods}}
93+
import {{{modelPackage}}}.*;
94+
import {{{package}}}.{{{classname}}};
95+
96+
public class Example {
97+
public static void main(String[] args) {
98+
ApiClient defaultClient = Configuration.getDefaultApiClient();
99+
defaultClient.setBasePath("{{{basePath}}}");
100+
{{#withAWSV4Signature}}
101+
// Configure AWS Signature V4 authorization
102+
defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE")
103+
{{/withAWSV4Signature}}
104+
{{#hasAuthMethods}}
105+
{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
106+
// Configure HTTP basic authorization: {{{name}}}
107+
HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}");
108+
{{{name}}}.setUsername("YOUR USERNAME");
109+
{{{name}}}.setPassword("YOUR PASSWORD");{{/isBasicBasic}}{{#isBasicBearer}}
110+
// Configure HTTP bearer authorization: {{{name}}}
111+
HttpBearerAuth {{{name}}} = (HttpBearerAuth) defaultClient.getAuthentication("{{{name}}}");
112+
{{{name}}}.setBearerToken("BEARER TOKEN");{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
113+
// Configure API key authorization: {{{name}}}
114+
ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}");
115+
{{{name}}}.setApiKey("YOUR API KEY");
116+
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
117+
//{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}}
118+
// Configure OAuth2 access token for authorization: {{{name}}}
119+
OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}");
120+
{{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}}
121+
{{/authMethods}}
122+
{{/hasAuthMethods}}
123+
124+
{{{classname}}} apiInstance = new {{{classname}}}(defaultClient);
125+
// Or create the instance with a your clientId and clientSecret (for OAuth2):
126+
// {{{classname}}} apiInstance = new {{{classname}}}("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET", null);
127+
128+
{{#allParams}}
129+
{{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}}
130+
{{/allParams}}
131+
try {
132+
{{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}}
133+
.{{{paramName}}}({{{paramName}}}){{/optionalParams}}
134+
.execute();{{/vendorExtensions.x-group-parameters}}{{#returnType}}
135+
System.out.println(result);{{/returnType}}
136+
} catch (ApiException e) {
137+
System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}");
138+
System.err.println("Status code: " + e.getCode());
139+
System.err.println("Reason: " + e.getResponseBody());
140+
System.err.println("Response headers: " + e.getResponseHeaders());
141+
e.printStackTrace();
142+
}
143+
}
144+
}
145+
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
146+
```
147+
148+
## Documentation for API Endpoints
149+
150+
All URIs are relative to *{{basePath}}*
151+
152+
Class | Method | HTTP request | Description
153+
------------ | ------------- | ------------- | -------------
154+
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}}
155+
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
156+
157+
## Documentation for Models
158+
159+
{{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md)
160+
{{/model}}{{/models}}
161+
162+
<a id="documentation-for-authorization"></a>
163+
## Documentation for Authorization
164+
165+
{{^authMethods}}Endpoints do not require authorization.{{/authMethods}}
166+
{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}}
167+
{{#authMethods}}
168+
<a id="{{name}}"></a>
169+
### {{name}}
170+
171+
{{#isApiKey}}- **Type**: API key
172+
- **API key parameter name**: {{keyParamName}}
173+
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
174+
{{/isApiKey}}
175+
{{#isBasicBasic}}- **Type**: HTTP basic authentication
176+
{{/isBasicBasic}}
177+
{{#isBasicBearer}}- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
178+
{{/isBasicBearer}}
179+
{{#isHttpSignature}}- **Type**: HTTP signature authentication
180+
{{/isHttpSignature}}
181+
{{#isOAuth}}- **Type**: OAuth
182+
- **Flow**: {{flow}}
183+
- **Authorization URL**: {{authorizationUrl}}
184+
- **Scopes**: {{^scopes}}N/A{{/scopes}}
185+
{{#scopes}} - {{scope}}: {{description}}
186+
{{/scopes}}
187+
{{/isOAuth}}
188+
189+
{{/authMethods}}
190+
191+
## Recommendation
192+
193+
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
194+
195+
## Author
196+
197+
{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}}
198+
{{/-last}}{{/apis}}{{/apiInfo}}

0 commit comments

Comments
 (0)