Skip to content

Commit 9d15f8c

Browse files
authored
chore: move bridgechains/{id} endpoint (#100)
1 parent 97a0502 commit 9d15f8c

6 files changed

Lines changed: 25 additions & 19 deletions

File tree

__tests__/mocks/bridgechains.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ export const mockBridgechains = (host: string) => {
77
data: [],
88
});
99

10-
nock(host)
11-
.get("/bridgechains/123")
12-
.reply(200, {
13-
data: [],
14-
});
15-
1610
nock(host)
1711
.post("/bridgechains/search")
1812
.reply(200, {

__tests__/mocks/businesses.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ export const mockBusinesses = (host: string) => {
1919
data: [],
2020
});
2121

22+
nock(host)
23+
.get("/businesses/123/bridgechains/123")
24+
.reply(200, {
25+
data: [],
26+
});
27+
2228
nock(host)
2329
.post("/businesses/search")
2430
.reply(200, {

__tests__/resources/bridgechains.test.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ describe("API - 2.0 - Resources - Bridgechains", () => {
1010
expect(response.status).toBe(200);
1111
});
1212

13-
it("should call \"get\" method", async () => {
14-
const response = await resource.get("123");
15-
16-
expect(response.status).toBe(200);
17-
});
18-
1913
it("should call \"search\" method", async () => {
2014
const response = await resource.search({});
2115

__tests__/resources/businesses.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ describe("API - 2.0 - Resources - Businesses", () => {
2222
expect(response.status).toBe(200);
2323
});
2424

25+
it("should call \"bridgechain\" method", async () => {
26+
const response = await resource.bridgechain("123", "123");
27+
28+
expect(response.status).toBe(200);
29+
});
30+
2531
it("should call \"search\" method", async () => {
2632
const response = await resource.search({});
2733

src/resources/bridgechains.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@ export class Bridgechains extends Resource {
1717
return this.sendGet("bridgechains", query);
1818
}
1919

20-
/**
21-
* Return bridgechain by genesis hash
22-
*/
23-
public async get(genesisHash: string): Promise<ApiResponse<Bridgechain>> {
24-
return this.sendGet(`bridgechains/${genesisHash}`);
25-
}
26-
2720
/**
2821
* Search bridgechains
2922
*/

src/resources/businesses.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@ export class Businesses extends Resource {
3838
return this.sendGet(`businesses/${walletAddress}/bridgechains`, query);
3939
}
4040

41+
/**
42+
* Return bridgechain of a business by genesis hash
43+
*
44+
* @param walletAddress The identifier of the wallet to be retrieved.
45+
* @param genesisHash The genesis hash of the bridgechain to be retrieved.
46+
*/
47+
public async bridgechain(
48+
walletAddress: string,
49+
genesisHash: string,
50+
): Promise<ApiResponse<Bridgechain>> {
51+
return this.sendGet(`businesses/${walletAddress}/bridgechains/${genesisHash}`);
52+
}
53+
4154
/**
4255
* Search business
4356
*/

0 commit comments

Comments
 (0)