Skip to content

Commit 6c8d789

Browse files
committed
Added top-level exports
1 parent 5a2561f commit 6c8d789

File tree

10 files changed

+80
-128
lines changed

10 files changed

+80
-128
lines changed
Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
1-
import * as http from './http/http';
2-
import * as auth from './auth/auth';
3-
import {Middleware, PromiseMiddleware} from './middleware';
4-
import * as models from './models/all';
5-
import { Configuration} from './configuration'
6-
import * as apis from './types/PromiseAPI';
7-
import * as exceptions from './apis/exception';
8-
9-
export {
10-
http,
11-
12-
auth,
13-
Middleware,
14-
PromiseMiddleware,
15-
models,
16-
Configuration,
17-
apis,
18-
exceptions
19-
};
1+
export * from './http/http';
2+
export * from './auth/auth';
3+
export {Middleware, PromiseMiddleware} from './middleware';
4+
export * from './models/all';
5+
export { Configuration} from './configuration'
6+
export * from './types/PromiseAPI';
7+
export * from './apis/exception';
Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
1-
import * as http from './http/http';
2-
import * as auth from './auth/auth';
3-
import {Middleware, PromiseMiddleware} from './middleware';
4-
import * as models from './models/all';
5-
import { Configuration} from './configuration'
6-
import * as apis from './types/PromiseAPI';
7-
import * as exceptions from './apis/exception';
8-
9-
export {
10-
http,
11-
12-
auth,
13-
Middleware,
14-
PromiseMiddleware,
15-
models,
16-
Configuration,
17-
apis,
18-
exceptions
19-
};
1+
export * from './http/http';
2+
export * from './auth/auth';
3+
export {Middleware, PromiseMiddleware} from './middleware';
4+
export * from './models/all';
5+
export { Configuration} from './configuration'
6+
export * from './types/PromiseAPI';
7+
export * from './apis/exception';
Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
1-
import * as http from './http/http';
2-
import * as auth from './auth/auth';
3-
import {Middleware, PromiseMiddleware} from './middleware';
4-
import * as models from './models/all';
5-
import { Configuration} from './configuration'
6-
import * as apis from './types/PromiseAPI';
7-
import * as exceptions from './apis/exception';
8-
9-
export {
10-
http,
11-
12-
auth,
13-
Middleware,
14-
PromiseMiddleware,
15-
models,
16-
Configuration,
17-
apis,
18-
exceptions
19-
};
1+
export * from './http/http';
2+
export * from './auth/auth';
3+
export {Middleware, PromiseMiddleware} from './middleware';
4+
export * from './models/all';
5+
export { Configuration} from './configuration'
6+
export * from './types/PromiseAPI';
7+
export * from './apis/exception';
Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
1-
import * as http from './http/http';
2-
import * as auth from './auth/auth';
3-
import {Middleware, PromiseMiddleware} from './middleware';
4-
import * as models from './models/all';
5-
import { Configuration} from './configuration'
6-
import * as apis from './types/PromiseAPI';
7-
import * as exceptions from './apis/exception';
8-
9-
export {
10-
http,
11-
12-
auth,
13-
Middleware,
14-
PromiseMiddleware,
15-
models,
16-
Configuration,
17-
apis,
18-
exceptions
19-
};
1+
export * from './http/http';
2+
export * from './auth/auth';
3+
export {Middleware, PromiseMiddleware} from './middleware';
4+
export * from './models/all';
5+
export { Configuration} from './configuration'
6+
export * from './types/PromiseAPI';
7+
export * from './apis/exception';

samples/client/petstore/typescript/tests/default/test/api/PetApi.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import { expect, assert } from "chai";
44
import * as fs from 'fs';
55

66
const configuration = new petstore.Configuration()
7-
const petApi = new petstore.apis.PromisePetApi(configuration)
7+
const petApi = new petstore.PromisePetApi(configuration)
88

9-
const tag = new petstore.models.Tag();
9+
const tag = new petstore.Tag();
1010
tag.name = "tag1"
1111
tag.id = Math.floor(Math.random() * 100000)
1212

13-
const pet = new petstore.models.Pet()
13+
const pet = new petstore.Pet()
1414
pet.id = Math.floor(Math.random() * 100000)
1515
pet.name = "PetName"
1616
pet.photoUrls = []
@@ -22,7 +22,7 @@ describe("PetApi", () =>{
2222
it("addPet", (done) => {
2323
petApi.addPet(pet).then(() => {
2424
return petApi.getPetById(pet.id)
25-
}).then((createdPet: petstore.models.Pet) => {
25+
}).then((createdPet: petstore.Pet) => {
2626
expect(createdPet).to.deep.equal(pet);
2727
done()
2828
}).catch((err) => {
@@ -35,7 +35,7 @@ describe("PetApi", () =>{
3535
return petApi.deletePet(pet.id)
3636
}).then(() => {
3737
return petApi.getPetById(pet.id)
38-
}).then((pet: petstore.models.Pet) => {
38+
}).then((pet: petstore.Pet) => {
3939
done("Pet with id " + pet.id + " was not deleted!");
4040
}).catch((err: any) => {
4141
if (err.code && err.code == 404) {
@@ -49,7 +49,7 @@ describe("PetApi", () =>{
4949
it("findPetsByStatus", (done) => {
5050
petApi.addPet(pet).then(() => {
5151
return petApi.findPetsByStatus(["available"])
52-
}).then((pets: petstore.models.Pet[]) => {
52+
}).then((pets: petstore.Pet[]) => {
5353
expect(pets.length).to.be.at.least(1);
5454
done();
5555
}).catch((err) => {
@@ -72,7 +72,7 @@ describe("PetApi", () =>{
7272
it("getPetById", (done) => {
7373
petApi.addPet(pet).then(() => {
7474
return petApi.getPetById(pet.id)
75-
}).then((returnedPet: petstore.models.Pet) => {
75+
}).then((returnedPet: petstore.Pet) => {
7676
expect(returnedPet).to.deep.equal(pet);
7777
done();
7878
}).catch((err) => {
@@ -93,7 +93,7 @@ describe("PetApi", () =>{
9393
});
9494
}).then(() => {
9595
return petApi.getPetById(pet.id);
96-
}).then((returnedPet: petstore.models.Pet) => {
96+
}).then((returnedPet: petstore.Pet) => {
9797
expect(returnedPet.id).to.equal(pet.id)
9898
expect(returnedPet.name).to.equal(updatedName);
9999
done();

samples/client/petstore/typescript/tests/default/test/auth/auth.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import { expect} from "chai";
66
describe("Security Authentication", () => {
77
describe("No Authentication", () => {
88
it("No Authentication", () => {
9-
let ctx = new petstore.http.RequestContext("http://google.com", petstore.http.HttpMethod.GET);
10-
let noAuth = new petstore.auth.NoAuthentication();
9+
let ctx = new petstore.RequestContext("http://google.com", petstore.HttpMethod.GET);
10+
let noAuth = new petstore.NoAuthentication();
1111
noAuth.applySecurityAuthentication(ctx);
1212

1313
expect(ctx.getUrl()).to.equal("http://google.com");
@@ -19,8 +19,8 @@ describe("Security Authentication", () => {
1919
describe("API Key Authentication", () => {
2020
// TODO: make all params const variables
2121
it("Header API Key", () => {
22-
let ctx = new petstore.http.RequestContext("http://google.com", petstore.http.HttpMethod.GET);
23-
let auth = new petstore.auth.APIKeyAuthentication("my_name", "paramName", "header", "apiKey");
22+
let ctx = new petstore.RequestContext("http://google.com", petstore.HttpMethod.GET);
23+
let auth = new petstore.APIKeyAuthentication("my_name", "paramName", "header", "apiKey");
2424
auth.applySecurityAuthentication(ctx);
2525

2626
expect(ctx.getUrl()).to.equal("http://google.com");
@@ -30,8 +30,8 @@ describe("Security Authentication", () => {
3030
});
3131

3232
it("Query API Key", () => {
33-
let ctx = new petstore.http.RequestContext("http://google.com?a=b", petstore.http.HttpMethod.GET);
34-
let auth = new petstore.auth.APIKeyAuthentication("my_name", "paramName", "query", "apiKey",);
33+
let ctx = new petstore.RequestContext("http://google.com?a=b", petstore.HttpMethod.GET);
34+
let auth = new petstore.APIKeyAuthentication("my_name", "paramName", "query", "apiKey",);
3535
auth.applySecurityAuthentication(ctx);
3636

3737
expect(ctx.getUrl()).to.contain("paramName=apiKey");
@@ -40,8 +40,8 @@ describe("Security Authentication", () => {
4040
});
4141

4242
it("Cookie API Key", () => {
43-
let ctx = new petstore.http.RequestContext("http://google.com", petstore.http.HttpMethod.GET);
44-
let auth = new petstore.auth.APIKeyAuthentication("my_name", "paramName", "cookie", "apiKey",);
43+
let ctx = new petstore.RequestContext("http://google.com", petstore.HttpMethod.GET);
44+
let auth = new petstore.APIKeyAuthentication("my_name", "paramName", "cookie", "apiKey",);
4545
auth.applySecurityAuthentication(ctx);
4646

4747
expect(ctx.getUrl()).to.equal("http://google.com");

samples/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import * as petstore from "ts-petstore-client";
33
import { expect} from "chai";
44
import * as FormData from "form-data";
55

6-
let libs: { [key: string]: petstore.http.HttpLibrary } = {
7-
"isomorphic-fetch": new petstore.http.IsomorphicFetchHttpLibrary()
6+
let libs: { [key: string]: petstore.HttpLibrary } = {
7+
"isomorphic-fetch": new petstore.IsomorphicFetchHttpLibrary()
88
}
99

1010

@@ -13,10 +13,10 @@ for (let libName in libs) {
1313

1414
describe("Isomorphic Fetch", () => {
1515
it("GET-Request", (done) => {
16-
let requestContext = new petstore.http.RequestContext("http://httpbin.org/get", petstore.http.HttpMethod.GET);
16+
let requestContext = new petstore.RequestContext("http://httpbin.org/get", petstore.HttpMethod.GET);
1717
requestContext.setHeaderParam("X-Test-Token", "Test-Token");
1818
requestContext.addCookie("test-cookie", "cookie-value");
19-
lib.send(requestContext).toPromise().then((resp: petstore.http.ResponseContext) => {
19+
lib.send(requestContext).toPromise().then((resp: petstore.ResponseContext) => {
2020
expect(resp.httpStatusCode, "Expected status code to be 200").to.eq(200);
2121
let body = JSON.parse(resp.body);
2222
expect(body["headers"]).to.exist;
@@ -31,7 +31,7 @@ for (let libName in libs) {
3131
})
3232

3333
it("POST-Request", (done) => {
34-
let requestContext = new petstore.http.RequestContext("http://httpbin.org/post", petstore.http.HttpMethod.POST);
34+
let requestContext = new petstore.RequestContext("http://httpbin.org/post", petstore.HttpMethod.POST);
3535
requestContext.setHeaderParam("X-Test-Token", "Test-Token");
3636
requestContext.addCookie("test-cookie", "cookie-value");
3737
let formData: FormData = new FormData()
@@ -40,7 +40,7 @@ for (let libName in libs) {
4040

4141
requestContext.setBody(formData);
4242
lib.send(requestContext).toPromise().then(
43-
(resp: petstore.http.ResponseContext) => {
43+
(resp: petstore.ResponseContext) => {
4444
expect(resp.httpStatusCode, "Expected status code to be 200").to.eq(200);
4545
let body = JSON.parse(resp.body);
4646
expect(body["headers"]).to.exist;
@@ -56,11 +56,11 @@ for (let libName in libs) {
5656
});
5757

5858
it("Cookies-Request", (done) => {
59-
let requestContext = new petstore.http.RequestContext("http://httpbin.org/cookies", petstore.http.HttpMethod.GET);
59+
let requestContext = new petstore.RequestContext("http://httpbin.org/cookies", petstore.HttpMethod.GET);
6060
requestContext.addCookie("test-cookie", "cookie-value");
6161

6262
lib.send(requestContext).toPromise().then(
63-
(resp: petstore.http.ResponseContext) => {
63+
(resp: petstore.ResponseContext) => {
6464
expect(resp.httpStatusCode, "Expected status code to be 200").to.eq(200);
6565
let body = JSON.parse(resp.body);
6666
expect(body["cookies"]["test-cookie"]).to.equal("cookie-value");

samples/client/petstore/typescript/tests/default/test/models/ObjectSerializer.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe("ObjectSerializer", () => {
4747
})
4848

4949
it("Class", () => {
50-
const input = new petstore.models.Category()
50+
const input = new petstore.Category()
5151
input.id = 4
5252
input.name = "Test"
5353
expect(ObjectSerializer.serialize(input, "Category", "")).to.deep.equal({ "id": input.id, "name": input.name})
@@ -62,7 +62,7 @@ describe("ObjectSerializer", () => {
6262
const tags = []
6363
const tagResult = []
6464
for (let i = 0; i < 2; i++) {
65-
const tag = new petstore.models.Tag()
65+
const tag = new petstore.Tag()
6666
tag.id = i
6767
tag.name = "Tag" + i
6868
tags.push(tag)
@@ -72,10 +72,10 @@ describe("ObjectSerializer", () => {
7272
})
7373
}
7474

75-
const category = new petstore.models.Category()
75+
const category = new petstore.Category()
7676
category.id = 4
7777
category.name = "TestCat"
78-
const pet = new petstore.models.Pet()
78+
const pet = new petstore.Pet()
7979
pet.id = 145
8080
pet.category = category
8181
pet.name = "PetName"
@@ -99,7 +99,7 @@ describe("ObjectSerializer", () => {
9999
const categories = []
100100
const result = []
101101
for (let i = 0; i < 2; i++) {
102-
const category = new petstore.models.Category()
102+
const category = new petstore.Category()
103103
category.id = i
104104
category.name = "Cat" + i
105105
categories.push(category)
@@ -151,7 +151,7 @@ describe("ObjectSerializer", () => {
151151
})
152152

153153
it("Class", () => {
154-
const input = new petstore.models.Category()
154+
const input = new petstore.Category()
155155
input.id = 4
156156
input.name = "Test"
157157
const deserialized = ObjectSerializer.deserialize({ "id": 4, "name": "Test"}, "Category")
@@ -169,7 +169,7 @@ describe("ObjectSerializer", () => {
169169
const tags = []
170170
const tagResult = []
171171
for (let i = 0; i < 2; i++) {
172-
const tag = new petstore.models.Tag()
172+
const tag = new petstore.Tag()
173173
tag.id = i
174174
tag.name = "Tag" + i
175175
tags.push(tag)
@@ -179,10 +179,10 @@ describe("ObjectSerializer", () => {
179179
})
180180
}
181181

182-
const category = new petstore.models.Category()
182+
const category = new petstore.Category()
183183
category.id = 4
184184
category.name = "TestCat"
185-
const pet = new petstore.models.Pet()
185+
const pet = new petstore.Pet()
186186
pet.id = 145
187187
pet.category = category
188188
pet.name = "PetName"
@@ -200,7 +200,7 @@ describe("ObjectSerializer", () => {
200200
"photoUrls": [ "url", "other url"],
201201
"status": "available",
202202
"tags": tagResult
203-
}, "Pet", "") as petstore.models.Pet
203+
}, "Pet", "") as petstore.Pet
204204

205205
expect(deserialized.constructor.name).to.equal("Pet")
206206
expect(deserialized.category.constructor.name).to.equal("Category")
@@ -214,7 +214,7 @@ describe("ObjectSerializer", () => {
214214
const categories = []
215215
const result = []
216216
for (let i = 0; i < 2; i++) {
217-
const category = new petstore.models.Category()
217+
const category = new petstore.Category()
218218
category.id = i
219219
category.name = "Cat" + i
220220
categories.push(category)

0 commit comments

Comments
 (0)