Skip to content

Commit 08a3426

Browse files
authored
Merge pull request #542 from szprutamich/master
SDCB-11185 - Usage details new model
2 parents f159e60 + 34f231b commit 08a3426

11 files changed

Lines changed: 93 additions & 15 deletions

dist/api/APIResourceAccount.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { API } from '../API';
22
import { APIList } from './APIList';
33
import { APIResource } from './APIResource';
44
import { APIResourceBillingPeriod } from './APIResourceBillingPeriod';
5-
import { Account, AccountData } from './models/Account';
5+
import { Account, AccountData, AccountSessionUsage, AccountSessionUsageSummary } from './models/Account';
66
import { AccountConcurrencyStatusMap } from './models/AccountConcurrencyStatusMap';
77
import { AccountPreferences } from './models/AccountPreference';
88
import { AccountService, ServicePaymentStatus } from './models/AccountService';
@@ -32,5 +32,7 @@ export declare class APIResourceAccount extends APIResource<Account, QueryParams
3232
accountServices(): APIList<AccountService, import("./models/HTTP").CollectionQueryParams, any>;
3333
accountService(id: number): APIList<AccountService, import("./models/HTTP").CollectionQueryParams, any>;
3434
services(): APIResource<ServicePaymentStatus, QueryParams, QueryParams>;
35+
usageDetails(): APIList<AccountSessionUsage, import("./models/HTTP").CollectionQueryParams, any>;
36+
usageDetailsSummary(): APIResource<AccountSessionUsageSummary, QueryParams, QueryParams>;
3537
}
3638
export default APIResourceAccount;

dist/api/models/Account.d.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,23 @@ export type AccountUsage = {
4444
manualConcurrency: number;
4545
manualUsage: number;
4646
};
47+
export type AccountSessionUsage = {
48+
createTime: number;
49+
duration: number;
50+
type: SessionUsageType;
51+
userId: number;
52+
userName: string;
53+
};
54+
export type AccountSessionUsageSummary = {
55+
totalTime: number;
56+
usage: Record<SessionUsageType, number>;
57+
};
58+
export declare enum SessionUsageType {
59+
AUTOMATIC = "automatic",
60+
MANUAL = "manual",
61+
DEDICATED_AUTOMATIC = "dedicated_automatic",
62+
DEDICATED_MANUAL = "dedicated_manual"
63+
}
4764
export declare enum UtilizationType {
4865
ALL = "all",
4966
PUBLIC = "public",

dist/bitbar-cloud-api-client.js

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

dist/bitbar-cloud-api-client.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/bitbar-cloud-api-client.min.js

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

dist/bitbar-cloud-api-client.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 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": "@bitbar/cloud-api-client",
3-
"version": "1.5.0",
3+
"version": "1.5.1",
44
"description": "Bitbar Cloud API Client for JavaScript",
55
"main": "dist/bitbar-cloud-api-client.min.js",
66
"types": "dist/index.d.ts",

src/api/APIResourceAccount.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,20 @@ describe('APIResourceAccount', () => {
158158
});
159159
});
160160

161+
describe('@usageDetails', () => {
162+
it('should initialize proper endpoint path', () => {
163+
const call = service.usageDetails();
164+
expect(call).toBeInstanceOf(APIList);
165+
expect(call.toUrl()).toEqual(`${baseUrl}/usage-details`);
166+
});
167+
});
168+
169+
describe('@usageDetailsSummary', () => {
170+
it('should initialize proper endpoint path', () => {
171+
const call = service.usageDetailsSummary();
172+
expect(call).toBeInstanceOf(APIResource);
173+
expect(call.toUrl()).toEqual(`${baseUrl}/usage-details-summary`);
174+
});
175+
});
176+
161177
});

src/api/APIResourceAccount.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {API} from '../API';
22
import {APIList} from './APIList';
33
import {APIResource} from './APIResource';
44
import {APIResourceBillingPeriod} from './APIResourceBillingPeriod';
5-
import {Account, AccountData} from './models/Account';
5+
import {Account, AccountData, AccountSessionUsage, AccountSessionUsageSummary} from './models/Account';
66
import {AccountConcurrencyStatusMap} from './models/AccountConcurrencyStatusMap';
77
import {AccountPreferences} from './models/AccountPreference';
88
import {AccountService, ServicePaymentStatus} from './models/AccountService';
@@ -94,26 +94,36 @@ export class APIResourceAccount extends APIResource<Account, QueryParams, Accoun
9494
return new APIResource<AccountServicePayment, BillingPeriodQueryParams, NoData>(this).push('account-services', id, 'billing-period');
9595
}
9696

97-
// /account/{accountId}/visual-test/access
97+
// /accounts/{accountId}/visual-test/access
9898
visualTestAccess() {
9999
return new APIResource<VisualTestAccess, NoQueryParams, VisualTestAccess>(this).push('visual-tests', 'access');
100100
}
101101

102-
// /account/{accountId}/account-services
102+
// /accounts/{accountId}/account-services
103103
accountServices() {
104104
return new APIList<AccountService>(this).push('account-services');
105105
}
106106

107-
// /account/{accountId}/account-services/{id}
107+
// /accounts/{accountId}/account-services/{id}
108108
accountService(id: number) {
109109
return new APIList<AccountService>(this).push('account-services', id);
110110
}
111111

112-
// /account/{accountId}/services
112+
// /accounts/{accountId}/services
113113
services() {
114114
return new APIResource<ServicePaymentStatus>(this).push('services');
115115
}
116116

117+
// /accounts/{accountId}/usage-details
118+
usageDetails() {
119+
return new APIList<AccountSessionUsage>(this).push('usage-details');
120+
}
121+
122+
// /accounts/{accountId}/usage-details-summary
123+
usageDetailsSummary() {
124+
return new APIResource<AccountSessionUsageSummary>(this).push('usage-details-summary');
125+
}
126+
117127
}
118128

119129
export default APIResourceAccount;

0 commit comments

Comments
 (0)