[DEV] add capability to copy the tool file
This commit is contained in:
parent
151aa498e5
commit
6944331761
@ -37,8 +37,8 @@
|
|||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
|
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="test" value="true"/>
|
<attribute name="test" value="true"/>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
|
5
pom.xml
5
pom.xml
@ -185,6 +185,11 @@
|
|||||||
|
|
||||||
<build>
|
<build>
|
||||||
<sourceDirectory>src</sourceDirectory>
|
<sourceDirectory>src</sourceDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>${basedir}/src/resources</directory>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
<testSourceDirectory>test/src</testSourceDirectory>
|
<testSourceDirectory>test/src</testSourceDirectory>
|
||||||
<testResources>
|
<testResources>
|
||||||
<testResource>
|
<testResource>
|
||||||
|
@ -496,6 +496,21 @@ public class DataFactoryTsApi {
|
|||||||
myWriter = new FileWriter(pathPackage + File.separator + "index.ts");
|
myWriter = new FileWriter(pathPackage + File.separator + "index.ts");
|
||||||
myWriter.write(index.toString());
|
myWriter.write(index.toString());
|
||||||
myWriter.close();
|
myWriter.close();
|
||||||
|
final InputStream ioStream = DataFactoryTsApi.class
|
||||||
|
.getClassLoader()
|
||||||
|
.getResourceAsStream("rest-tools.ts");
|
||||||
|
if (ioStream == null) {
|
||||||
|
throw new IllegalArgumentException("rest-tools.ts is not found");
|
||||||
|
}
|
||||||
|
final BufferedReader buffer = new BufferedReader(new InputStreamReader(ioStream));
|
||||||
|
myWriter = new FileWriter(pathPackage + File.separator + "rest-tools.ts");
|
||||||
|
String line;
|
||||||
|
while( (line = buffer.readLine()) != null) {
|
||||||
|
myWriter.write(line);
|
||||||
|
myWriter.write("\n");
|
||||||
|
}
|
||||||
|
ioStream.close();
|
||||||
|
myWriter.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
* @copyright 2024, Edouard DUPIN, all right reserved
|
* @copyright 2024, Edouard DUPIN, all right reserved
|
||||||
* @license MPL-2 (Generate file)
|
* @license MPL-2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { RestErrorResponse } from "./model"
|
import { RestErrorResponse } from "./model"
|
||||||
@ -21,6 +21,7 @@ export enum HTTPMimeType {
|
|||||||
JSON = 'application/json',
|
JSON = 'application/json',
|
||||||
OCTET_STREAM = 'application/octet-stream',
|
OCTET_STREAM = 'application/octet-stream',
|
||||||
MULTIPART = 'multipart/form-data',
|
MULTIPART = 'multipart/form-data',
|
||||||
|
CSV = 'text/csv',
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RESTConfig {
|
export interface RESTConfig {
|
||||||
@ -43,11 +44,6 @@ export interface RESTModel {
|
|||||||
tokenInUrl?: boolean;
|
tokenInUrl?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RESTRequest {
|
|
||||||
params?: object;
|
|
||||||
body?: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ModelResponseHttp {
|
export interface ModelResponseHttp {
|
||||||
status: number;
|
status: number;
|
||||||
data: any;
|
data: any;
|
||||||
@ -222,3 +218,13 @@ export function RESTRequestJsonArray<TYPE>(request: RESTRequestType, checker: (d
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function RESTRequestVoid(request: RESTRequestType): Promise<void> {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
RESTRequest(request).then((value: ModelResponseHttp) => {
|
||||||
|
resolve();
|
||||||
|
}).catch((reason: RestErrorResponse) => {
|
||||||
|
reject(reason);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user