Skip to content

Commit cd6b387

Browse files
committed
Added Remove User, Get Credits Endpoints
1 parent 7c6bedc commit cd6b387

6 files changed

Lines changed: 37 additions & 7 deletions

File tree

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,18 @@ const userId = await client.createUser();
139139
* [`setUserName`](https://developers.shrimpy.io/docs/#naming-a-user)
140140
```js
141141
await client.setUserName(
142+
'701e0d16-1e9e-42c9-b6a1-4cada1f395b8', //userId
142143
'mycustomname' // name
143144
);
144145
```
145146

147+
* [`removeUser`](https://developers.shrimpy.io/docs/#removing-a-user)
148+
```js
149+
await client.removeUser(
150+
'701e0d16-1e9e-42c9-b6a1-4cada1f395b8', //userId
151+
);
152+
```
153+
146154
* [`enableUser`](https://developers.shrimpy.io/docs/#enabling-a-user)
147155
```js
148156
await client.enableUser(
@@ -492,9 +500,9 @@ const orderbooks = await client.getHistoricalOrderBooks(
492500
const status = await client.getStatus();
493501
```
494502

495-
* [`getUsage`](https://developers.shrimpy.io/docs/#get-usage)
503+
* [`getCredits`](https://developers.shrimpy.io/docs/#get-credits)
496504
```js
497-
const usage = await client.getUsage();
505+
const usage = await client.getCredits();
498506
```
499507

500508
## Websocket

lib/client/shrimpy-api-client.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
IHistoricalTrade,
2222
ILimitOrder,
2323
ILimitOrderStatus,
24+
IManagementCredits,
2425
IManagementStatus,
2526
IManagementUsage,
2627
IMarketOrderBooks,
@@ -251,6 +252,11 @@ export class ShrimpyApiClient {
251252
await this._callEndpoint<any>(endpoint, 'POST', parameters, true);
252253
}
253254

255+
public async removeUser(userId: string): Promise<void> {
256+
const endpoint = `users/${userId}`;
257+
await this._callEndpoint<any>(endpoint, 'DELETE', {}, true);
258+
}
259+
254260
public async enableUser(userId: string): Promise<void> {
255261
// Deprecated, this endpoint no longer has any functionality
256262
// It has been preserved to avoid breaking deployments from library upgrades
@@ -797,7 +803,14 @@ export class ShrimpyApiClient {
797803
return await this._callEndpoint<IManagementStatus>(endpoint, 'GET', null, true);
798804
}
799805

806+
public async getCredits(): Promise<IManagementCredits> {
807+
const endpoint = `management/credits`;
808+
return await this._callEndpoint<IManagementCredits>(endpoint, 'GET', null, true);
809+
}
810+
800811
public async getUsage(): Promise<IManagementUsage> {
812+
// Deprecated, this endpoint no longer has any functionality
813+
// It has been preserved to avoid breaking deployments from library upgrades
801814
const endpoint = `management/usage`;
802815
return await this._callEndpoint<IManagementUsage>(endpoint, 'GET', null, true);
803816
}

lib/models/imanagement-credits.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export interface IManagementCredits {
2+
credits: number;
3+
}

lib/models/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export * from './ihistorical-instrument';
2222
export * from './ihistorical-trade';
2323
export * from './ilimit-order';
2424
export * from './ilimit-order-status';
25+
export * from './imanagement-credits';
2526
export * from './imanagement-status';
2627
export * from './imanagement-usage';
2728
export * from './imarket-order-books';

package-lock.json

Lines changed: 9 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "shrimpy-node",
3-
"version": "0.2.11",
3+
"version": "0.2.12",
44
"author": "Shrimpy",
55
"bugs": "https://github.com/shrimpy-dev/shrimpy-node/issues",
66
"contributors": [

0 commit comments

Comments
 (0)