File tree Expand file tree Collapse file tree 5 files changed +110
-0
lines changed Expand file tree Collapse file tree 5 files changed +110
-0
lines changed Original file line number Diff line number Diff line change 4141- [ move] ( #move )
4242- [ getPlugins] ( #getPlugins )
4343- [ addPlugins] ( #addPlugins )
44+ - [ getStatistics] ( #getStatistics )
4445
4546## Overview
4647
@@ -1508,3 +1509,27 @@ Adds Plug-ins to an App.
15081509#### Reference
15091510
15101511- https://kintone.dev/en/docs/kintone/rest-api/apps/add-plugins/
1512+
1513+ ### getStatistics
1514+
1515+ Gets usage statistics for multiple Apps.
1516+
1517+ > [ !NOTE]
1518+ > This API is available only in Wide Course.
1519+
1520+ #### Parameters
1521+
1522+ | Name | Type | Required | Description |
1523+ | ------ | :----: | :------: | ------------------------------------------------------------------------------------------------------------- |
1524+ | offset | Number | | The offset. Default value is 0 if this parameter is ignored. |
1525+ | limit | Number | | The number of Apps to retrieve. Must be between 1 and 100. Default value is 100 if this parameter is ignored. |
1526+
1527+ #### Returns
1528+
1529+ | Name | Type | Description |
1530+ | ---- | :---: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1531+ | apps | Array | An array of objects containing App usage statistics. <br />For each object's properties, see "Response Parameters" section of [ the reference] ( https://kintone.dev/en/kintone/docs/rest-api/apps/get-apps-statistics/ ) |
1532+
1533+ #### Reference
1534+
1535+ - https://cybozu.dev/ja/kintone/docs/rest-api/apps/get-apps-statistics/
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ import type {
3737 AdminNotesForParameter ,
3838 SpaceID ,
3939 PluginLocale ,
40+ GetStatisticsRequest ,
41+ GetStatisticsResponse ,
4042} from "./types" ;
4143import { BaseClient } from "./BaseClient" ;
4244import type { AppPlugin } from "./types/app/plugin" ;
@@ -635,4 +637,13 @@ export class AppClient extends BaseClient {
635637 } ) ;
636638 return this . client . post ( path , params ) ;
637639 }
640+
641+ public getStatistics (
642+ params ?: GetStatisticsRequest ,
643+ ) : Promise < GetStatisticsResponse > {
644+ const path = this . buildPath ( {
645+ endpointName : "apps/statistics" ,
646+ } ) ;
647+ return this . client . get ( path , params ?? { } ) ;
648+ }
638649}
Original file line number Diff line number Diff line change @@ -130,4 +130,40 @@ describe("App Test", () => {
130130 } ) ;
131131 } ) ;
132132 } ) ;
133+
134+ describe ( "getStatistics" , ( ) => {
135+ describe ( "without params" , ( ) => {
136+ beforeEach ( async ( ) => {
137+ await appClient . getStatistics ( ) ;
138+ } ) ;
139+ it ( "should pass the path to the http client" , ( ) => {
140+ expect ( mockClient . getLogs ( ) [ 0 ] . path ) . toBe ( "/k/v1/apps/statistics.json" ) ;
141+ } ) ;
142+ it ( "should send a get request" , ( ) => {
143+ expect ( mockClient . getLogs ( ) [ 0 ] . method ) . toBe ( "get" ) ;
144+ } ) ;
145+ it ( "should pass empty params to the http client" , ( ) => {
146+ expect ( mockClient . getLogs ( ) [ 0 ] . params ) . toEqual ( { } ) ;
147+ } ) ;
148+ } ) ;
149+
150+ describe ( "with offset and limit" , ( ) => {
151+ const params = {
152+ offset : 10 ,
153+ limit : 50 ,
154+ } ;
155+ beforeEach ( async ( ) => {
156+ await appClient . getStatistics ( params ) ;
157+ } ) ;
158+ it ( "should pass the path to the http client" , ( ) => {
159+ expect ( mockClient . getLogs ( ) [ 0 ] . path ) . toBe ( "/k/v1/apps/statistics.json" ) ;
160+ } ) ;
161+ it ( "should send a get request" , ( ) => {
162+ expect ( mockClient . getLogs ( ) [ 0 ] . method ) . toBe ( "get" ) ;
163+ } ) ;
164+ it ( "should pass offset and limit as a param to the http client" , ( ) => {
165+ expect ( mockClient . getLogs ( ) [ 0 ] . params ) . toEqual ( params ) ;
166+ } ) ;
167+ } ) ;
168+ } ) ;
133169} ) ;
Original file line number Diff line number Diff line change @@ -28,3 +28,4 @@ export * from "./notification";
2828export * from "./report" ;
2929export * from "./action" ;
3030export * from "./adminNotes" ;
31+ export * from "./statistics" ;
Original file line number Diff line number Diff line change 1+ import type { AppID , SpaceID } from "../" ;
2+
3+ export type GetStatisticsRequest = {
4+ offset ?: number ;
5+ limit ?: number ;
6+ } ;
7+
8+ export type AppStatistics = {
9+ id : AppID ;
10+ name : string ;
11+ space : {
12+ id : SpaceID ;
13+ name : string ;
14+ } | null ;
15+ appGroup : string ;
16+ status : "CHANGED" | "NOT_ACTIVATED" | "ACTIVATED" ;
17+ recordUpdatedAt : string ;
18+ recordCount : string ;
19+ fieldCount : string ;
20+ dailyRequestCount : string ;
21+ storageUsage : string ;
22+ customized : boolean ;
23+ creator : {
24+ code : string ;
25+ name : string ;
26+ } ;
27+ createdAt : string ;
28+ modifier : {
29+ code : string ;
30+ name : string ;
31+ } ;
32+ modifiedAt : string ;
33+ } ;
34+
35+ export type GetStatisticsResponse = {
36+ apps : AppStatistics [ ] ;
37+ } ;
You can’t perform that action at this time.
0 commit comments