@konomi-app/kintone-utilities 6.0.1 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +15 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +744 -26
- package/dist/index.d.ts +744 -26
- package/dist/index.js +15 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -756,6 +756,7 @@ type Row<T extends OneOf$1[]> = {
|
|
|
756
756
|
type: 'ROW';
|
|
757
757
|
fields: T;
|
|
758
758
|
};
|
|
759
|
+
type LayoutRow<T extends OneOf$1[]> = Row<T>;
|
|
759
760
|
type Subtable<T extends InSubtable$1[]> = {
|
|
760
761
|
type: 'SUBTABLE';
|
|
761
762
|
code: string;
|
|
@@ -929,7 +930,7 @@ declare namespace kintoneAPI {
|
|
|
929
930
|
type LayoutField = OneOf$1;
|
|
930
931
|
namespace layout {
|
|
931
932
|
type Label = Label;
|
|
932
|
-
type Row =
|
|
933
|
+
type Row = LayoutRow<LayoutField[]>;
|
|
933
934
|
type Group = Group<Row[]>;
|
|
934
935
|
type Spacer = Spacer;
|
|
935
936
|
type HR = HR;
|
|
@@ -975,6 +976,45 @@ declare namespace kintoneAPI {
|
|
|
975
976
|
theme: 'WHITE' | 'CLIPBOARD' | 'BINDER' | 'PENCIL' | 'CLIPS' | 'RED' | 'BLUE' | 'GREEN' | 'YELLOW' | 'BLACK';
|
|
976
977
|
revision: string;
|
|
977
978
|
};
|
|
979
|
+
type AppStatusAssigneeEntityType = 'USER' | 'GROUP' | 'ORGANIZATION' | 'FIELD_ENTITY' | 'CREATOR' | 'CUSTOM_FIELD';
|
|
980
|
+
type AppStatusAssigneeEntity = {
|
|
981
|
+
entity: {
|
|
982
|
+
type: AppStatusAssigneeEntityType;
|
|
983
|
+
code: string | null;
|
|
984
|
+
};
|
|
985
|
+
includeSubs: boolean;
|
|
986
|
+
};
|
|
987
|
+
type AppStatusState = {
|
|
988
|
+
name: string;
|
|
989
|
+
index: string;
|
|
990
|
+
assignee: {
|
|
991
|
+
type: 'ONE' | 'ALL' | 'ANY';
|
|
992
|
+
entities: AppStatusAssigneeEntity[];
|
|
993
|
+
};
|
|
994
|
+
};
|
|
995
|
+
type AppStatusExecutableUserEntityType = 'USER' | 'GROUP' | 'ORGANIZATION' | 'FIELD_ENTITY';
|
|
996
|
+
type AppStatusAction = {
|
|
997
|
+
name: string;
|
|
998
|
+
from: string;
|
|
999
|
+
to: string;
|
|
1000
|
+
filterCond: string;
|
|
1001
|
+
type: 'PRIMARY' | 'SECONDARY';
|
|
1002
|
+
executableUser?: {
|
|
1003
|
+
entities: {
|
|
1004
|
+
entity: {
|
|
1005
|
+
type: AppStatusExecutableUserEntityType;
|
|
1006
|
+
code: string;
|
|
1007
|
+
};
|
|
1008
|
+
includeSubs: boolean;
|
|
1009
|
+
}[];
|
|
1010
|
+
};
|
|
1011
|
+
};
|
|
1012
|
+
type AppStatus = {
|
|
1013
|
+
enable: boolean;
|
|
1014
|
+
states: Record<string, AppStatusState> | null;
|
|
1015
|
+
actions: AppStatusAction[] | null;
|
|
1016
|
+
revision: string;
|
|
1017
|
+
};
|
|
978
1018
|
namespace response {
|
|
979
1019
|
type App = {
|
|
980
1020
|
readonly app?: kintoneAPI.App;
|
|
@@ -1398,15 +1438,6 @@ declare class KintoneEventManager {
|
|
|
1398
1438
|
*/
|
|
1399
1439
|
declare const KintoneEventListener: typeof KintoneEventManager;
|
|
1400
1440
|
|
|
1401
|
-
/**
|
|
1402
|
-
* プラグインがアプリ単位で保存している設定情報を返却します
|
|
1403
|
-
*
|
|
1404
|
-
* 設定情報の取得に失敗した場合は、nullを返却します
|
|
1405
|
-
* @param id プラグインID
|
|
1406
|
-
* @returns プラグインの設定情報
|
|
1407
|
-
* @deprecated 代わりに{@link restorePluginConfig}を使用してください
|
|
1408
|
-
*/
|
|
1409
|
-
declare const restoreStorage: <T = any>(id: string) => T | null;
|
|
1410
1441
|
/**
|
|
1411
1442
|
* アプリにプラグインの設定情報を保存します
|
|
1412
1443
|
* @param target プラグインの設定情報
|
|
@@ -1458,21 +1489,73 @@ declare class PluginLocalStorage {
|
|
|
1458
1489
|
get hasNewVersion(): boolean;
|
|
1459
1490
|
}
|
|
1460
1491
|
|
|
1492
|
+
/** デバッグオプションを付与するユーティリティ型 */
|
|
1461
1493
|
type WithDebug<T> = T & {
|
|
1462
1494
|
debug?: boolean;
|
|
1463
1495
|
};
|
|
1496
|
+
/** ゲストスペースIDオプションを付与するユーティリティ型 */
|
|
1464
1497
|
type WithGuestSpaceId<T> = T & {
|
|
1465
1498
|
guestSpaceId?: number | string;
|
|
1466
1499
|
};
|
|
1500
|
+
/** デバッグ・ゲストスペースIDの共通リクエストパラメータを付与するユーティリティ型 */
|
|
1467
1501
|
type WithCommonRequestParams<T> = WithDebug<WithGuestSpaceId<T>>;
|
|
1468
1502
|
|
|
1503
|
+
/**
|
|
1504
|
+
* 指定したIDのアプリ情報を1件取得します。
|
|
1505
|
+
*
|
|
1506
|
+
* @param params.id - 取得対象のアプリID
|
|
1507
|
+
* @param params.guestSpaceId - ゲストスペースID(省略可)
|
|
1508
|
+
* @param params.debug - デバッグログを出力する場合は `true`
|
|
1509
|
+
* @returns アプリ情報オブジェクト
|
|
1510
|
+
*
|
|
1511
|
+
* @example
|
|
1512
|
+
* ```ts
|
|
1513
|
+
* const app = await getApp({ id: 1 });
|
|
1514
|
+
* console.log(app.name); // アプリ名
|
|
1515
|
+
* ```
|
|
1516
|
+
*/
|
|
1469
1517
|
declare const getApp: (params: WithCommonRequestParams<{
|
|
1470
1518
|
id: kintoneAPI.IDToRequest;
|
|
1471
1519
|
}>) => Promise<kintoneAPI.App>;
|
|
1520
|
+
/**
|
|
1521
|
+
* kintone環境内の全アプリ情報を再帰的に取得します。
|
|
1522
|
+
*
|
|
1523
|
+
* APIの取得件数上限(100件)を超える場合も、全件自動で取得します。
|
|
1524
|
+
*
|
|
1525
|
+
* @param params.offset - 取得開始位置(デフォルト: `0`)
|
|
1526
|
+
* @param params._apps - 内部用の蓄積配列(外部からの指定不要)
|
|
1527
|
+
* @param params.guestSpaceId - ゲストスペースID(省略可)
|
|
1528
|
+
* @param params.debug - デバッグログを出力する場合は `true`
|
|
1529
|
+
* @returns 全アプリ情報の配列
|
|
1530
|
+
*
|
|
1531
|
+
* @example
|
|
1532
|
+
* ```ts
|
|
1533
|
+
* const apps = await getAllApps();
|
|
1534
|
+
* console.log(`アプリ数: ${apps.length}`);
|
|
1535
|
+
* ```
|
|
1536
|
+
*/
|
|
1472
1537
|
declare const getAllApps: (params?: WithCommonRequestParams<{
|
|
1473
1538
|
offset?: number;
|
|
1474
1539
|
_apps?: kintoneAPI.App[];
|
|
1475
1540
|
}>) => Promise<kintoneAPI.App[]>;
|
|
1541
|
+
/**
|
|
1542
|
+
* 指定アプリの一覧(ビュー)情報を取得します。
|
|
1543
|
+
*
|
|
1544
|
+
* @param params.app - アプリID
|
|
1545
|
+
* @param params.lang - 取得する言語(デフォルト: `'default'`)
|
|
1546
|
+
* @param params.preview - プレビュー環境のビューを取得する場合は `true`
|
|
1547
|
+
* @param params.guestSpaceId - ゲストスペースID(省略可)
|
|
1548
|
+
* @param params.debug - デバッグログを出力する場合は `true`
|
|
1549
|
+
* @returns ビュー情報のオブジェクトとリビジョン番号
|
|
1550
|
+
*
|
|
1551
|
+
* @example
|
|
1552
|
+
* ```ts
|
|
1553
|
+
* const { views, revision } = await getViews({ app: 1 });
|
|
1554
|
+
* Object.keys(views).forEach((viewName) => {
|
|
1555
|
+
* console.log(viewName, views[viewName]);
|
|
1556
|
+
* });
|
|
1557
|
+
* ```
|
|
1558
|
+
*/
|
|
1476
1559
|
declare const getViews: (params: WithCommonRequestParams<{
|
|
1477
1560
|
app: kintoneAPI.IDToRequest;
|
|
1478
1561
|
lang?: kintoneAPI.rest.Lang;
|
|
@@ -1481,10 +1564,48 @@ declare const getViews: (params: WithCommonRequestParams<{
|
|
|
1481
1564
|
views: Record<string, kintoneAPI.view.Response>;
|
|
1482
1565
|
revision: string;
|
|
1483
1566
|
}>;
|
|
1567
|
+
/**
|
|
1568
|
+
* 指定アプリの一覧(ビュー)設定を更新します。
|
|
1569
|
+
*
|
|
1570
|
+
* …※ プレビュー環境に対して更新されます。運用環境への反映には別途デプロイが必要です。
|
|
1571
|
+
*
|
|
1572
|
+
* @param params.app - アプリID
|
|
1573
|
+
* @param params.views - 更新するビュー情報のオブジェクト
|
|
1574
|
+
* @param params.guestSpaceId - ゲストスペースID(省略可)
|
|
1575
|
+
* @param params.debug - デバッグログを出力する場合は `true`
|
|
1576
|
+
* @returns 更新後のリビジョン情報
|
|
1577
|
+
*
|
|
1578
|
+
* @example
|
|
1579
|
+
* ```ts
|
|
1580
|
+
* await updateViews({
|
|
1581
|
+
* app: 1,
|
|
1582
|
+
* views: {
|
|
1583
|
+
* '一覧': { type: 'LIST', name: '一覧', fields: ['フィールドA'], index: 0 },
|
|
1584
|
+
* },
|
|
1585
|
+
* });
|
|
1586
|
+
* ```
|
|
1587
|
+
*/
|
|
1484
1588
|
declare const updateViews: (params: WithCommonRequestParams<{
|
|
1485
1589
|
app: kintoneAPI.IDToRequest;
|
|
1486
1590
|
views: Record<string, kintoneAPI.view.Parameter>;
|
|
1487
1591
|
}>) => Promise<any>;
|
|
1592
|
+
/**
|
|
1593
|
+
* 指定アプリのフォームフィールド情報を取得します。
|
|
1594
|
+
*
|
|
1595
|
+
* @param params.app - アプリID
|
|
1596
|
+
* @param params.preview - プレビュー環境のフィールドを取得する場合は `true`
|
|
1597
|
+
* @param params.guestSpaceId - ゲストスペースID(省略可)
|
|
1598
|
+
* @param params.debug - デバッグログを出力する場合は `true`
|
|
1599
|
+
* @returns フィールドプロパティとリビジョン番号
|
|
1600
|
+
*
|
|
1601
|
+
* @example
|
|
1602
|
+
* ```ts
|
|
1603
|
+
* const { properties, revision } = await getFormFields({ app: 1 });
|
|
1604
|
+
* Object.entries(properties).forEach(([code, field]) => {
|
|
1605
|
+
* console.log(`${code}: ${field.type}`);
|
|
1606
|
+
* });
|
|
1607
|
+
* ```
|
|
1608
|
+
*/
|
|
1488
1609
|
declare const getFormFields: (params: WithCommonRequestParams<{
|
|
1489
1610
|
app: kintoneAPI.IDToRequest;
|
|
1490
1611
|
preview?: boolean;
|
|
@@ -1492,6 +1613,21 @@ declare const getFormFields: (params: WithCommonRequestParams<{
|
|
|
1492
1613
|
properties: kintoneAPI.FieldProperties;
|
|
1493
1614
|
revision: string;
|
|
1494
1615
|
}>;
|
|
1616
|
+
/**
|
|
1617
|
+
* 指定アプリのフォームレイアウト情報を取得します。
|
|
1618
|
+
*
|
|
1619
|
+
* @param params.app - アプリID
|
|
1620
|
+
* @param params.preview - プレビュー環境のレイアウトを取得する場合は `true`
|
|
1621
|
+
* @param params.guestSpaceId - ゲストスペースID(省略可)
|
|
1622
|
+
* @param params.debug - デバッグログを出力する場合は `true`
|
|
1623
|
+
* @returns レイアウト情報とリビジョン番号
|
|
1624
|
+
*
|
|
1625
|
+
* @example
|
|
1626
|
+
* ```ts
|
|
1627
|
+
* const { layout } = await getFormLayout({ app: 1 });
|
|
1628
|
+
* layout.forEach((row) => console.log(row.type));
|
|
1629
|
+
* ```
|
|
1630
|
+
*/
|
|
1495
1631
|
declare const getFormLayout: (params: WithCommonRequestParams<{
|
|
1496
1632
|
app: kintoneAPI.IDToRequest;
|
|
1497
1633
|
preview?: boolean;
|
|
@@ -1499,10 +1635,49 @@ declare const getFormLayout: (params: WithCommonRequestParams<{
|
|
|
1499
1635
|
layout: kintoneAPI.Layout;
|
|
1500
1636
|
revision: string;
|
|
1501
1637
|
}>;
|
|
1638
|
+
/**
|
|
1639
|
+
* 指定アプリのアプリ設定(アイコン、テーマなど)を取得します。
|
|
1640
|
+
*
|
|
1641
|
+
* @param params.app - アプリID
|
|
1642
|
+
* @param params.preview - プレビュー環境の設定を取得する場合は `true`
|
|
1643
|
+
* @param params.guestSpaceId - ゲストスペースID(省略可)
|
|
1644
|
+
* @param params.debug - デバッグログを出力する場合は `true`
|
|
1645
|
+
* @returns アプリ設定オブジェクト
|
|
1646
|
+
*
|
|
1647
|
+
* @example
|
|
1648
|
+
* ```ts
|
|
1649
|
+
* const settings = await getAppSettings({ app: 1 });
|
|
1650
|
+
* console.log(settings.name, settings.icon);
|
|
1651
|
+
* ```
|
|
1652
|
+
*/
|
|
1502
1653
|
declare const getAppSettings: (params: WithCommonRequestParams<{
|
|
1503
1654
|
app: kintoneAPI.IDToRequest;
|
|
1504
1655
|
preview?: boolean;
|
|
1505
1656
|
}>) => Promise<kintoneAPI.AppSettings>;
|
|
1657
|
+
/**
|
|
1658
|
+
* 指定アプリのプロセス管理設定を取得します。
|
|
1659
|
+
*
|
|
1660
|
+
* @param params.app - アプリID
|
|
1661
|
+
* @param params.lang - 取得する言語(デフォルト: `'default'`)
|
|
1662
|
+
* @param params.preview - プレビュー環境の設定を取得する場合は `true`
|
|
1663
|
+
* @param params.guestSpaceId - ゲストスペースID(省略可)
|
|
1664
|
+
* @param params.debug - デバッグログを出力する場合は `true`
|
|
1665
|
+
* @returns プロセス管理設定オブジェクト(有効フラグ、ステータス一覧、アクション一覧)
|
|
1666
|
+
*
|
|
1667
|
+
* @example
|
|
1668
|
+
* ```ts
|
|
1669
|
+
* const status = await getAppStatus({ app: 1 });
|
|
1670
|
+
* if (status.enable) {
|
|
1671
|
+
* console.log(Object.keys(status.states ?? {})); // ステータス名一覧
|
|
1672
|
+
* status.actions?.forEach((action) => console.log(action.name));
|
|
1673
|
+
* }
|
|
1674
|
+
* ```
|
|
1675
|
+
*/
|
|
1676
|
+
declare const getAppStatus: (params: WithCommonRequestParams<{
|
|
1677
|
+
app: kintoneAPI.IDToRequest;
|
|
1678
|
+
lang?: kintoneAPI.rest.Lang;
|
|
1679
|
+
preview?: boolean;
|
|
1680
|
+
}>) => Promise<kintoneAPI.AppStatus>;
|
|
1506
1681
|
|
|
1507
1682
|
declare const API_LIMIT_POST = 100;
|
|
1508
1683
|
type BulkRequestProgressParams = {
|
|
@@ -1512,6 +1687,29 @@ type BulkRequestProgressParams = {
|
|
|
1512
1687
|
type WithBulkRequestCallback<T> = T & {
|
|
1513
1688
|
onProgress?: (params: BulkRequestProgressParams) => void;
|
|
1514
1689
|
};
|
|
1690
|
+
/**
|
|
1691
|
+
* バックドア(プロキシ経由)でkintone REST APIを呼び出します。
|
|
1692
|
+
*
|
|
1693
|
+
* APIトークン認証を使い、`kintone.proxy()` を通じてリクエストを送信します。
|
|
1694
|
+
* アプリAのカスタマイズからアプリBのレコードを操作するようなケースで使用します。
|
|
1695
|
+
*
|
|
1696
|
+
* @param params.apiToken - APIトークン
|
|
1697
|
+
* @param params.method - HTTPメソッド
|
|
1698
|
+
* @param params.path - APIエンドポイントのパス
|
|
1699
|
+
* @param params.body - リクエストボディ(省略可)
|
|
1700
|
+
* @returns APIレスポンス(JSONパース済み)
|
|
1701
|
+
* @throws レスポンスのステータスコードが200でない場合
|
|
1702
|
+
*
|
|
1703
|
+
* @example
|
|
1704
|
+
* ```ts
|
|
1705
|
+
* const record = await backdoor({
|
|
1706
|
+
* apiToken: 'YOUR_API_TOKEN',
|
|
1707
|
+
* method: 'GET',
|
|
1708
|
+
* path: 'record',
|
|
1709
|
+
* body: { app: 1, id: 100 },
|
|
1710
|
+
* });
|
|
1711
|
+
* ```
|
|
1712
|
+
*/
|
|
1515
1713
|
declare const backdoor: (params: {
|
|
1516
1714
|
apiToken: string;
|
|
1517
1715
|
method: kintoneAPI.rest.Method;
|
|
@@ -1523,10 +1721,66 @@ type RecordGetRequest = {
|
|
|
1523
1721
|
id: kintoneAPI.IDToRequest;
|
|
1524
1722
|
};
|
|
1525
1723
|
type GetRecordParams = WithCommonRequestParams<RecordGetRequest>;
|
|
1724
|
+
/**
|
|
1725
|
+
* 指定したIDのレコードを1件取得します。
|
|
1726
|
+
*
|
|
1727
|
+
* @typeParam T - レコードの型
|
|
1728
|
+
* @param params.app - アプリID
|
|
1729
|
+
* @param params.id - レコードID
|
|
1730
|
+
* @param params.guestSpaceId - ゲストスペースID(省略可)
|
|
1731
|
+
* @param params.debug - デバッグログを出力する場合は `true`
|
|
1732
|
+
* @returns レコードデータ
|
|
1733
|
+
*
|
|
1734
|
+
* @example
|
|
1735
|
+
* ```ts
|
|
1736
|
+
* const record = await getRecord({ app: 1, id: 100 });
|
|
1737
|
+
* console.log(record['フィールドコード'].value);
|
|
1738
|
+
* ```
|
|
1739
|
+
*/
|
|
1526
1740
|
declare const getRecord: <T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData>(params: GetRecordParams) => Promise<T>;
|
|
1741
|
+
/**
|
|
1742
|
+
* バックドア(APIトークン認証)を使用してレコードを1件取得します。
|
|
1743
|
+
*
|
|
1744
|
+
* @typeParam T - レコードの型
|
|
1745
|
+
* @param params.app - アプリID
|
|
1746
|
+
* @param params.id - レコードID
|
|
1747
|
+
* @param params.apiToken - APIトークン
|
|
1748
|
+
* @returns レコードデータ
|
|
1749
|
+
*
|
|
1750
|
+
* @example
|
|
1751
|
+
* ```ts
|
|
1752
|
+
* const record = await backdoorGetRecord({
|
|
1753
|
+
* app: 1,
|
|
1754
|
+
* id: 100,
|
|
1755
|
+
* apiToken: 'YOUR_API_TOKEN',
|
|
1756
|
+
* });
|
|
1757
|
+
* ```
|
|
1758
|
+
*/
|
|
1527
1759
|
declare const backdoorGetRecord: <T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData>(params: RecordGetRequest & {
|
|
1528
1760
|
apiToken: string;
|
|
1529
1761
|
}) => Promise<T>;
|
|
1762
|
+
/**
|
|
1763
|
+
* 複数のレコードを一度に取得します(最大500件)。
|
|
1764
|
+
*
|
|
1765
|
+
* クエリでフィルタリングやソートが可能です。500件を超える場合は `getAllRecords` を使用してください。
|
|
1766
|
+
*
|
|
1767
|
+
* @typeParam T - レコードの型
|
|
1768
|
+
* @param params.app - アプリID
|
|
1769
|
+
* @param params.query - クエリ文字列(省略可)
|
|
1770
|
+
* @param params.fields - 取得するフィールドコードの配列(省略可)
|
|
1771
|
+
* @param params.totalCount - トータルカウントを取得する場合は `true`
|
|
1772
|
+
* @returns レコード配列とトータルカウント
|
|
1773
|
+
*
|
|
1774
|
+
* @example
|
|
1775
|
+
* ```ts
|
|
1776
|
+
* const { records, totalCount } = await getRecords({
|
|
1777
|
+
* app: 1,
|
|
1778
|
+
* query: 'ステータス in ("未処理")',
|
|
1779
|
+
* fields: ['$id', 'タイトル'],
|
|
1780
|
+
* totalCount: true,
|
|
1781
|
+
* });
|
|
1782
|
+
* ```
|
|
1783
|
+
*/
|
|
1530
1784
|
declare const getRecords: <T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData>(params: GetRecordsParams) => Promise<kintoneAPI.rest.RecordsGetResponse<T>>;
|
|
1531
1785
|
type UpdateKey<T extends kintoneAPI.rest.Frame> = {
|
|
1532
1786
|
field: keyof T;
|
|
@@ -1543,13 +1797,75 @@ type RecordPutRequest<T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData> =
|
|
|
1543
1797
|
revision?: kintoneAPI.rest.Revision;
|
|
1544
1798
|
} & PrimaryKeyToUpdate<T>;
|
|
1545
1799
|
type UpdateRecordParams<T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData> = WithCommonRequestParams<RecordPutRequest<T>>;
|
|
1800
|
+
/**
|
|
1801
|
+
* レコードを1件更新します。
|
|
1802
|
+
*
|
|
1803
|
+
* `id` または `updateKey`(重複禁止フィールド)で更新対象を指定できます。
|
|
1804
|
+
*
|
|
1805
|
+
* @typeParam T - レコードの型
|
|
1806
|
+
* @param params.app - アプリID
|
|
1807
|
+
* @param params.id - 更新対象のレコードID(`id` または `updateKey` のどちらか一方を指定)
|
|
1808
|
+
* @param params.updateKey - 重複禁止フィールドによる更新キー
|
|
1809
|
+
* @param params.record - 更新内容
|
|
1810
|
+
* @param params.revision - リビジョン番号(楽観的排他制御)
|
|
1811
|
+
* @returns 更新後のリビジョン番号
|
|
1812
|
+
*
|
|
1813
|
+
* @example
|
|
1814
|
+
* ```ts
|
|
1815
|
+
* await updateRecord({
|
|
1816
|
+
* app: 1,
|
|
1817
|
+
* id: 100,
|
|
1818
|
+
* record: { タイトル: { value: '更新済み' } },
|
|
1819
|
+
* });
|
|
1820
|
+
* ```
|
|
1821
|
+
*/
|
|
1546
1822
|
declare const updateRecord: <T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData>(params: UpdateRecordParams<T>) => Promise<kintoneAPI.rest.RecordPutResponse>;
|
|
1547
1823
|
type RecordPostRequest<T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData> = {
|
|
1548
1824
|
app: kintoneAPI.IDToRequest;
|
|
1549
1825
|
record: kintoneAPI.rest.RecordToRequest<T>;
|
|
1550
1826
|
};
|
|
1551
1827
|
type AddRecordParams<T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData> = WithCommonRequestParams<RecordPostRequest<T>>;
|
|
1828
|
+
/**
|
|
1829
|
+
* レコードを1件追加します。
|
|
1830
|
+
*
|
|
1831
|
+
* @typeParam T - レコードの型
|
|
1832
|
+
* @param params.app - アプリID
|
|
1833
|
+
* @param params.record - 追加するレコードデータ
|
|
1834
|
+
* @param params.guestSpaceId - ゲストスペースID(省略可)
|
|
1835
|
+
* @param params.debug - デバッグログを出力する場合は `true`
|
|
1836
|
+
* @returns 追加されたレコードのIDとリビジョン
|
|
1837
|
+
*
|
|
1838
|
+
* @example
|
|
1839
|
+
* ```ts
|
|
1840
|
+
* const { id } = await addRecord({
|
|
1841
|
+
* app: 1,
|
|
1842
|
+
* record: { タイトル: { value: '新規レコード' } },
|
|
1843
|
+
* });
|
|
1844
|
+
* console.log(`作成されたレコードID: ${id}`);
|
|
1845
|
+
* ```
|
|
1846
|
+
*/
|
|
1552
1847
|
declare const addRecord: <T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData>(params: AddRecordParams<T>) => Promise<kintoneAPI.rest.RecordPostResponse>;
|
|
1848
|
+
/**
|
|
1849
|
+
* 複数レコードを一度に追加します(最大100件)。
|
|
1850
|
+
*
|
|
1851
|
+
* 100件を超える場合は `addAllRecords` を使用してください。
|
|
1852
|
+
*
|
|
1853
|
+
* @typeParam T - レコードの型
|
|
1854
|
+
* @param params.app - アプリID
|
|
1855
|
+
* @param params.records - 追加するレコードの配列
|
|
1856
|
+
* @returns 追加されたレコードのID配列とリビジョン配列
|
|
1857
|
+
*
|
|
1858
|
+
* @example
|
|
1859
|
+
* ```ts
|
|
1860
|
+
* const { ids } = await addRecords({
|
|
1861
|
+
* app: 1,
|
|
1862
|
+
* records: [
|
|
1863
|
+
* { タイトル: { value: 'レコード1' } },
|
|
1864
|
+
* { タイトル: { value: 'レコード2' } },
|
|
1865
|
+
* ],
|
|
1866
|
+
* });
|
|
1867
|
+
* ```
|
|
1868
|
+
*/
|
|
1553
1869
|
declare const addRecords: <T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData>(params: WithCommonRequestParams<RecordsPostRequest<T>>) => Promise<kintoneAPI.rest.RecordsPostResponse>;
|
|
1554
1870
|
type RecordUpsertRequest<T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData> = {
|
|
1555
1871
|
app: kintoneAPI.IDToRequest;
|
|
@@ -1557,6 +1873,26 @@ type RecordUpsertRequest<T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData
|
|
|
1557
1873
|
updateKey: UpdateKey<T>;
|
|
1558
1874
|
};
|
|
1559
1875
|
type UpsertRecordParams<T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData> = WithCommonRequestParams<RecordUpsertRequest<T>>;
|
|
1876
|
+
/**
|
|
1877
|
+
* レコードのアップサート(存在すれば更新、なければ追加)を行います。
|
|
1878
|
+
*
|
|
1879
|
+
* `updateKey` で指定した重複禁止フィールドの値に基づき、既存レコードを検索して分岐します。
|
|
1880
|
+
*
|
|
1881
|
+
* @typeParam T - レコードの型
|
|
1882
|
+
* @param params.app - アプリID
|
|
1883
|
+
* @param params.record - 追加または更新するレコードデータ
|
|
1884
|
+
* @param params.updateKey - 重複禁止フィールドによるキー
|
|
1885
|
+
* @returns 追加または更新されたレコードのIDとリビジョン
|
|
1886
|
+
*
|
|
1887
|
+
* @example
|
|
1888
|
+
* ```ts
|
|
1889
|
+
* const result = await upsertRecord({
|
|
1890
|
+
* app: 1,
|
|
1891
|
+
* updateKey: { field: '社員番号', value: 'EMP001' },
|
|
1892
|
+
* record: { 氏名: { value: '山田太郎' } },
|
|
1893
|
+
* });
|
|
1894
|
+
* ```
|
|
1895
|
+
*/
|
|
1560
1896
|
declare const upsertRecord: <T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData>(params: UpsertRecordParams<T>) => Promise<kintoneAPI.rest.RecordPostResponse>;
|
|
1561
1897
|
type RecordsPutRequest<T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData> = {
|
|
1562
1898
|
app: kintoneAPI.IDToRequest;
|
|
@@ -1573,6 +1909,29 @@ type RecordsPutRequest<T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData>
|
|
|
1573
1909
|
}))[];
|
|
1574
1910
|
};
|
|
1575
1911
|
type UpdateAllRecordsParams<T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData> = WithBulkRequestCallback<WithCommonRequestParams<RecordsPutRequest<T>>>;
|
|
1912
|
+
/**
|
|
1913
|
+
* 大量のレコードを一括更新します。
|
|
1914
|
+
*
|
|
1915
|
+
* 内部で `bulkRequest` を使用し、API制限ごとに自動分割してリクエストを送信します。
|
|
1916
|
+
*
|
|
1917
|
+
* @typeParam T - レコードの型
|
|
1918
|
+
* @param params.app - アプリID
|
|
1919
|
+
* @param params.records - 更新するレコードの配列(`id` または `updateKey` と `record` を含む)
|
|
1920
|
+
* @param params.onProgress - 進捗コールバック(`{ total, done }` を受け取る)
|
|
1921
|
+
* @returns 更新されたレコードのIDとリビジョンの配列
|
|
1922
|
+
*
|
|
1923
|
+
* @example
|
|
1924
|
+
* ```ts
|
|
1925
|
+
* await updateAllRecords({
|
|
1926
|
+
* app: 1,
|
|
1927
|
+
* records: [
|
|
1928
|
+
* { id: 1, record: { ステータス: { value: '完了' } } },
|
|
1929
|
+
* { id: 2, record: { ステータス: { value: '完了' } } },
|
|
1930
|
+
* ],
|
|
1931
|
+
* onProgress: ({ total, done }) => console.log(`${done}/${total}`),
|
|
1932
|
+
* });
|
|
1933
|
+
* ```
|
|
1934
|
+
*/
|
|
1576
1935
|
declare const updateAllRecords: <T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData>(params: UpdateAllRecordsParams<T>) => Promise<kintoneAPI.rest.RecordsPutResponse>;
|
|
1577
1936
|
type RecordsPostRequest<T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData> = {
|
|
1578
1937
|
app: kintoneAPI.IDToRequest;
|
|
@@ -1580,6 +1939,30 @@ type RecordsPostRequest<T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData>
|
|
|
1580
1939
|
limit?: number;
|
|
1581
1940
|
};
|
|
1582
1941
|
type AddAllRecordsParams<T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData> = WithBulkRequestCallback<WithCommonRequestParams<RecordsPostRequest<T>>>;
|
|
1942
|
+
/**
|
|
1943
|
+
* 大量のレコードを一括追加します。
|
|
1944
|
+
*
|
|
1945
|
+
* 内部で `bulkRequest` を使用し、API制限ごとに自動分割してリクエストを送信します。
|
|
1946
|
+
* 空配列を渡した場合は何もせず空の結果を返します。
|
|
1947
|
+
*
|
|
1948
|
+
* @typeParam T - レコードの型
|
|
1949
|
+
* @param params.app - アプリID
|
|
1950
|
+
* @param params.records - 追加するレコードの配列
|
|
1951
|
+
* @param params.limit - 1リクエストあたりのレコード数上限(デフォルト: 100)
|
|
1952
|
+
* @param params.onProgress - 進捗コールバック
|
|
1953
|
+
* @returns 追加されたレコードのID配列とリビジョン配列
|
|
1954
|
+
*
|
|
1955
|
+
* @example
|
|
1956
|
+
* ```ts
|
|
1957
|
+
* const { ids } = await addAllRecords({
|
|
1958
|
+
* app: 1,
|
|
1959
|
+
* records: Array.from({ length: 500 }, (_, i) => ({
|
|
1960
|
+
* タイトル: { value: `レコード${i + 1}` },
|
|
1961
|
+
* })),
|
|
1962
|
+
* });
|
|
1963
|
+
* console.log(`${ids.length}件追加しました`);
|
|
1964
|
+
* ```
|
|
1965
|
+
*/
|
|
1583
1966
|
declare const addAllRecords: <T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData>(params: AddAllRecordsParams<T>) => Promise<kintoneAPI.rest.RecordsPostResponse>;
|
|
1584
1967
|
type RecordsDeleteRequest = {
|
|
1585
1968
|
app: kintoneAPI.IDToRequest;
|
|
@@ -1587,9 +1970,46 @@ type RecordsDeleteRequest = {
|
|
|
1587
1970
|
revisions?: number[];
|
|
1588
1971
|
};
|
|
1589
1972
|
type DeleteAllRecordsParams = WithBulkRequestCallback<WithCommonRequestParams<RecordsDeleteRequest>>;
|
|
1973
|
+
/**
|
|
1974
|
+
* 大量のレコードを一括削除します。
|
|
1975
|
+
*
|
|
1976
|
+
* 内部で `bulkRequest` を使用し、API制限ごとに自動分割して削除リクエストを送信します。
|
|
1977
|
+
*
|
|
1978
|
+
* @param params.app - アプリID
|
|
1979
|
+
* @param params.ids - 削除対象のレコードIDの配列
|
|
1980
|
+
* @param params.revisions - リビジョン番号の配列(楽観的排他制御、省略可)
|
|
1981
|
+
* @param params.onProgress - 進捗コールバック
|
|
1982
|
+
* @returns バルクリクエストの結果
|
|
1983
|
+
*
|
|
1984
|
+
* @example
|
|
1985
|
+
* ```ts
|
|
1986
|
+
* await deleteAllRecords({
|
|
1987
|
+
* app: 1,
|
|
1988
|
+
* ids: [1, 2, 3, 4, 5],
|
|
1989
|
+
* });
|
|
1990
|
+
* ```
|
|
1991
|
+
*/
|
|
1590
1992
|
declare const deleteAllRecords: (params: DeleteAllRecordsParams) => Promise<{
|
|
1591
1993
|
results: kintoneAPI.rest.RecordsDeleteResponse[];
|
|
1592
1994
|
}>;
|
|
1995
|
+
/**
|
|
1996
|
+
* クエリに一致する全レコードを削除します。
|
|
1997
|
+
*
|
|
1998
|
+
* 指定したクエリで全レコードを取得した後、そのIDを使って一括削除を実行します。
|
|
1999
|
+
*
|
|
2000
|
+
* @param params.app - アプリID
|
|
2001
|
+
* @param params.query - 削除対象をフィルタリングするクエリ文字列
|
|
2002
|
+
* @param params.onProgress - 進捗コールバック
|
|
2003
|
+
* @returns バルクリクエストの結果
|
|
2004
|
+
*
|
|
2005
|
+
* @example
|
|
2006
|
+
* ```ts
|
|
2007
|
+
* await deleteAllRecordsByQuery({
|
|
2008
|
+
* app: 1,
|
|
2009
|
+
* query: 'ステータス in ("削除済み")',
|
|
2010
|
+
* });
|
|
2011
|
+
* ```
|
|
2012
|
+
*/
|
|
1593
2013
|
declare const deleteAllRecordsByQuery: (params: WithBulkRequestCallback<WithCommonRequestParams<{
|
|
1594
2014
|
app: kintoneAPI.IDToRequest;
|
|
1595
2015
|
query: string;
|
|
@@ -1664,6 +2084,26 @@ type RecordAssigneesPutRequest = {
|
|
|
1664
2084
|
revision?: kintoneAPI.IDToRequest;
|
|
1665
2085
|
};
|
|
1666
2086
|
type UpdateRecordAssigneesParams = WithCommonRequestParams<RecordAssigneesPutRequest>;
|
|
2087
|
+
/**
|
|
2088
|
+
* レコードの作業者(アサイニー)を更新します。
|
|
2089
|
+
*
|
|
2090
|
+
* プロセス管理が有効なアプリで、レコードの作業者を変更する際に使用します。
|
|
2091
|
+
*
|
|
2092
|
+
* @param params.app - アプリID
|
|
2093
|
+
* @param params.id - レコードID
|
|
2094
|
+
* @param params.assignees - 作業者のログイン名の配列
|
|
2095
|
+
* @param params.revision - リビジョン番号(省略可)
|
|
2096
|
+
* @returns 更新後のリビジョン情報
|
|
2097
|
+
*
|
|
2098
|
+
* @example
|
|
2099
|
+
* ```ts
|
|
2100
|
+
* await updateRecordAssignees({
|
|
2101
|
+
* app: 1,
|
|
2102
|
+
* id: 100,
|
|
2103
|
+
* assignees: ['user1', 'user2'],
|
|
2104
|
+
* });
|
|
2105
|
+
* ```
|
|
2106
|
+
*/
|
|
1667
2107
|
declare const updateRecordAssignees: (params: UpdateRecordAssigneesParams) => Promise<kintoneAPI.rest.RecordAssigneesPutResponse>;
|
|
1668
2108
|
type RecordStatusToPut = {
|
|
1669
2109
|
action: string;
|
|
@@ -1675,18 +2115,76 @@ type RecordStatusPutRequest = {
|
|
|
1675
2115
|
app: kintoneAPI.IDToRequest;
|
|
1676
2116
|
} & RecordStatusToPut;
|
|
1677
2117
|
type UpdateRecordStatusParams = WithCommonRequestParams<RecordStatusPutRequest>;
|
|
2118
|
+
/**
|
|
2119
|
+
* レコードのプロセスステータスを1件更新します。
|
|
2120
|
+
*
|
|
2121
|
+
* @param params.app - アプリID
|
|
2122
|
+
* @param params.action - 実行するアクション名
|
|
2123
|
+
* @param params.assignee - 次の作業者のログイン名(省略可)
|
|
2124
|
+
* @param params.id - レコードID
|
|
2125
|
+
* @param params.revision - リビジョン番号(省略可)
|
|
2126
|
+
* @returns 更新後のリビジョン情報
|
|
2127
|
+
*
|
|
2128
|
+
* @example
|
|
2129
|
+
* ```ts
|
|
2130
|
+
* await updateRecordStatus({
|
|
2131
|
+
* app: 1,
|
|
2132
|
+
* id: 100,
|
|
2133
|
+
* action: '承認する',
|
|
2134
|
+
* assignee: 'manager1',
|
|
2135
|
+
* });
|
|
2136
|
+
* ```
|
|
2137
|
+
*/
|
|
1678
2138
|
declare const updateRecordStatus: (params: UpdateRecordStatusParams) => Promise<kintoneAPI.rest.RecordStatusPutResponse>;
|
|
1679
2139
|
type RecordStatusesPutRequest = {
|
|
1680
2140
|
app: kintoneAPI.IDToRequest;
|
|
1681
2141
|
records: RecordStatusToPut[];
|
|
1682
2142
|
};
|
|
1683
2143
|
type UpdateAllRecordStatusesParams = WithBulkRequestCallback<WithCommonRequestParams<RecordStatusesPutRequest>>;
|
|
2144
|
+
/**
|
|
2145
|
+
* 複数レコードのプロセスステータスを一括更新します。
|
|
2146
|
+
*
|
|
2147
|
+
* 内部で `bulkRequest` を使用し、API制限ごとに自動分割してリクエストを送信します。
|
|
2148
|
+
*
|
|
2149
|
+
* @param params.app - アプリID
|
|
2150
|
+
* @param params.records - 更新対象のレコード配列(`action`, `id` 等を含む)
|
|
2151
|
+
* @param params.onProgress - 進捗コールバック
|
|
2152
|
+
* @returns 更新されたレコードの配列
|
|
2153
|
+
*
|
|
2154
|
+
* @example
|
|
2155
|
+
* ```ts
|
|
2156
|
+
* await updateAllRecordStatuses({
|
|
2157
|
+
* app: 1,
|
|
2158
|
+
* records: [
|
|
2159
|
+
* { id: 1, action: '承認する' },
|
|
2160
|
+
* { id: 2, action: '承認する' },
|
|
2161
|
+
* ],
|
|
2162
|
+
* });
|
|
2163
|
+
* ```
|
|
2164
|
+
*/
|
|
1684
2165
|
declare const updateAllRecordStatuses: (params: UpdateAllRecordStatusesParams) => Promise<kintoneAPI.rest.RecordStatusesPutResponse>;
|
|
1685
2166
|
type RecordACLEvaluateGetRequest = {
|
|
1686
2167
|
app: kintoneAPI.IDToRequest;
|
|
1687
2168
|
ids: kintoneAPI.IDToRequest[];
|
|
1688
2169
|
};
|
|
1689
2170
|
type GetRecordACLEvaluateParams = WithCommonRequestParams<RecordACLEvaluateGetRequest>;
|
|
2171
|
+
/**
|
|
2172
|
+
* レコードのアクセス権を評価します。
|
|
2173
|
+
*
|
|
2174
|
+
* 指定したレコードIDに対して、現在のユーザーのアクセス権情報を取得します。
|
|
2175
|
+
*
|
|
2176
|
+
* @param params.app - アプリID
|
|
2177
|
+
* @param params.ids - 評価対象のレコードIDの配列
|
|
2178
|
+
* @returns 各レコードのアクセス権評価結果
|
|
2179
|
+
*
|
|
2180
|
+
* @example
|
|
2181
|
+
* ```ts
|
|
2182
|
+
* const result = await getRecordACLEvaluate({
|
|
2183
|
+
* app: 1,
|
|
2184
|
+
* ids: [1, 2, 3],
|
|
2185
|
+
* });
|
|
2186
|
+
* ```
|
|
2187
|
+
*/
|
|
1690
2188
|
declare const getRecordACLEvaluate: (params: GetRecordACLEvaluateParams) => Promise<kintoneAPI.rest.RecordACLEvaluateGetResponse>;
|
|
1691
2189
|
type OneOfBulkRequest<T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData> = {
|
|
1692
2190
|
method: kintoneAPI.rest.Method;
|
|
@@ -1722,12 +2220,51 @@ type BulkRequestParams<T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData>
|
|
|
1722
2220
|
onProgress?: (params: BulkRequestProgressParams) => void;
|
|
1723
2221
|
limit?: number;
|
|
1724
2222
|
}>;
|
|
2223
|
+
/**
|
|
2224
|
+
* 複数のAPIリクエストを一括で実行します(バルクリクエスト)。
|
|
2225
|
+
*
|
|
2226
|
+
* API制限ごとにリクエストを自動分割し、チャンクごとに順次実行します。
|
|
2227
|
+
* レコードの追加・更新・削除・ステータス更新などの操作を混在させることができます。
|
|
2228
|
+
*
|
|
2229
|
+
* @typeParam T - レコードの型
|
|
2230
|
+
* @param params.requests - 実行するリクエストの配列(type と params を持つ)
|
|
2231
|
+
* @param params.onProgress - 進捗コールバック
|
|
2232
|
+
* @param params.limit - 1回のバルクリクエストあたりのリクエスト数上限(デフォルト: 20)
|
|
2233
|
+
* @returns 全リクエストの実行結果
|
|
2234
|
+
*
|
|
2235
|
+
* @example
|
|
2236
|
+
* ```ts
|
|
2237
|
+
* const result = await bulkRequest({
|
|
2238
|
+
* requests: [
|
|
2239
|
+
* { type: 'addAllRecords', params: { app: 1, records: [...] } },
|
|
2240
|
+
* { type: 'deleteRecords', params: { app: 2, ids: [1, 2, 3] } },
|
|
2241
|
+
* ],
|
|
2242
|
+
* });
|
|
2243
|
+
* ```
|
|
2244
|
+
*/
|
|
1725
2245
|
declare const bulkRequest: <T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData>(params: BulkRequestParams<T>) => Promise<kintoneAPI.rest.BulkResponse>;
|
|
1726
2246
|
|
|
1727
2247
|
/**
|
|
1728
2248
|
* 🧪 実験的な実装
|
|
1729
2249
|
*
|
|
1730
|
-
* APIクライアントをClassではなく、カリー化した関数で実装することで、ユーザーがAPI
|
|
2250
|
+
* APIクライアントをClassではなく、カリー化した関数で実装することで、ユーザーがAPIクライアントを拡張しやすくする。
|
|
2251
|
+
*
|
|
2252
|
+
* アプリ情報を事前に指定し、レコード操作時にはアプリ情報の指定を省略できます。
|
|
2253
|
+
*
|
|
2254
|
+
* @typeParam T - レコードの型
|
|
2255
|
+
* @param props.app - アプリID
|
|
2256
|
+
* @param props.guestsSpaceId - ゲストスペースID(省略可)
|
|
2257
|
+
* @param props.debug - デバッグログを出力する場合は `true`
|
|
2258
|
+
* @returns レコード操作用のメソッドを持つオブジェクト
|
|
2259
|
+
*
|
|
2260
|
+
* @example
|
|
2261
|
+
* ```ts
|
|
2262
|
+
* const client = useApi({ app: 1 });
|
|
2263
|
+
* const result = await client.records.$post({
|
|
2264
|
+
* records: [{ タイトル: { value: 'テスト' } }],
|
|
2265
|
+
* });
|
|
2266
|
+
* console.log(result.ids);
|
|
2267
|
+
* ```
|
|
1731
2268
|
*/
|
|
1732
2269
|
declare const useApi: <T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData>(props: {
|
|
1733
2270
|
app: kintoneAPI.IDToRequest;
|
|
@@ -1740,10 +2277,31 @@ declare const useApi: <T extends kintoneAPI.rest.Frame = kintoneAPI.RecordData>(
|
|
|
1740
2277
|
};
|
|
1741
2278
|
|
|
1742
2279
|
/**
|
|
1743
|
-
* kintone
|
|
2280
|
+
* kintoneへファイルをアップロードします。
|
|
1744
2281
|
*
|
|
1745
|
-
*
|
|
1746
|
-
*
|
|
2282
|
+
* `FormData` を使用し、`fetch` APIでファイルをアップロードします。
|
|
2283
|
+
* アップロード成功後、返された `fileKey` をレコードの添付ファイルフィールドの値として使用できます。
|
|
2284
|
+
*
|
|
2285
|
+
* @param params.file.name - ファイル名
|
|
2286
|
+
* @param params.file.data - ファイルデータ(Blob)
|
|
2287
|
+
* @param params.guestSpaceId - ゲストスペースID(省略可)
|
|
2288
|
+
* @param params.debug - デバッグログを出力する場合は `true`
|
|
2289
|
+
* @returns アップロードされたファイルの `fileKey`
|
|
2290
|
+
*
|
|
2291
|
+
* @example
|
|
2292
|
+
* ```ts
|
|
2293
|
+
* const blob = new Blob(['テスト内容'], { type: 'text/plain' });
|
|
2294
|
+
* const { fileKey } = await uploadFile({
|
|
2295
|
+
* file: { name: 'test.txt', data: blob },
|
|
2296
|
+
* });
|
|
2297
|
+
*
|
|
2298
|
+
* // レコード更新時に使用
|
|
2299
|
+
* await updateRecord({
|
|
2300
|
+
* app: 1,
|
|
2301
|
+
* id: 100,
|
|
2302
|
+
* record: { 添付ファイル: { value: [{ fileKey }] } },
|
|
2303
|
+
* });
|
|
2304
|
+
* ```
|
|
1747
2305
|
*/
|
|
1748
2306
|
declare const uploadFile: (params: WithCommonRequestParams<{
|
|
1749
2307
|
file: {
|
|
@@ -1753,10 +2311,46 @@ declare const uploadFile: (params: WithCommonRequestParams<{
|
|
|
1753
2311
|
}>) => Promise<{
|
|
1754
2312
|
fileKey: string;
|
|
1755
2313
|
}>;
|
|
2314
|
+
/**
|
|
2315
|
+
* kintoneからファイルをダウンロードします。
|
|
2316
|
+
*
|
|
2317
|
+
* `fileKey` を指定して、添付ファイルをBlobとして取得します。
|
|
2318
|
+
*
|
|
2319
|
+
* @param params.fileKey - ダウンロード対象のファイルキー
|
|
2320
|
+
* @param params.guestSpaceId - ゲストスペースID(省略可)
|
|
2321
|
+
* @param params.debug - デバッグログを出力する場合は `true`
|
|
2322
|
+
* @returns ファイルデータ(Blob)
|
|
2323
|
+
*
|
|
2324
|
+
* @example
|
|
2325
|
+
* ```ts
|
|
2326
|
+
* const blob = await downloadFile({ fileKey: 'xxxx-xxxx-xxxx' });
|
|
2327
|
+
* const url = URL.createObjectURL(blob);
|
|
2328
|
+
* ```
|
|
2329
|
+
*/
|
|
1756
2330
|
declare const downloadFile: (params: WithCommonRequestParams<{
|
|
1757
2331
|
fileKey: string;
|
|
1758
2332
|
}>) => Promise<Blob>;
|
|
1759
2333
|
|
|
2334
|
+
/**
|
|
2335
|
+
* 指定レコードのコメントを全件取得します。
|
|
2336
|
+
*
|
|
2337
|
+
* APIの取得件数上限(10件)を超える場合も、全件自動で再帰的に取得します。
|
|
2338
|
+
*
|
|
2339
|
+
* @param props.app - アプリID
|
|
2340
|
+
* @param props.record - レコードID
|
|
2341
|
+
* @param props.order - ソート順(`'asc'` | `'desc'`)
|
|
2342
|
+
* @returns コメントの配列
|
|
2343
|
+
*
|
|
2344
|
+
* @example
|
|
2345
|
+
* ```ts
|
|
2346
|
+
* const comments = await getRecordComments({
|
|
2347
|
+
* app: 1,
|
|
2348
|
+
* record: 100,
|
|
2349
|
+
* order: 'desc',
|
|
2350
|
+
* });
|
|
2351
|
+
* comments.forEach((c) => console.log(c.text));
|
|
2352
|
+
* ```
|
|
2353
|
+
*/
|
|
1760
2354
|
declare const getRecordComments: (props: kintoneAPI.rest.CommentsGetRequest) => Promise<{
|
|
1761
2355
|
id: string;
|
|
1762
2356
|
text: string;
|
|
@@ -1764,7 +2358,41 @@ declare const getRecordComments: (props: kintoneAPI.rest.CommentsGetRequest) =>
|
|
|
1764
2358
|
creator: kintoneAPI.rest.People;
|
|
1765
2359
|
mentions: kintoneAPI.rest.People[];
|
|
1766
2360
|
}[]>;
|
|
2361
|
+
/**
|
|
2362
|
+
* レコードにコメントを1件追加します。
|
|
2363
|
+
*
|
|
2364
|
+
* @param params.app - アプリID
|
|
2365
|
+
* @param params.record - レコードID
|
|
2366
|
+
* @param params.comment - コメント内容(`text`, `mentions` 等)
|
|
2367
|
+
* @returns 追加されたコメントのID
|
|
2368
|
+
*
|
|
2369
|
+
* @example
|
|
2370
|
+
* ```ts
|
|
2371
|
+
* const { id } = await addRecordComment({
|
|
2372
|
+
* app: 1,
|
|
2373
|
+
* record: 100,
|
|
2374
|
+
* comment: { text: '確認しました' },
|
|
2375
|
+
* });
|
|
2376
|
+
* ```
|
|
2377
|
+
*/
|
|
1767
2378
|
declare const addRecordComment: (params: kintoneAPI.rest.CommentPostRequest) => Promise<kintoneAPI.rest.CommentPostResponse>;
|
|
2379
|
+
/**
|
|
2380
|
+
* レコードのコメントを1件削除します。
|
|
2381
|
+
*
|
|
2382
|
+
* @param params.app - アプリID
|
|
2383
|
+
* @param params.record - レコードID
|
|
2384
|
+
* @param params.comment - 削除するコメントのID
|
|
2385
|
+
* @returns 空オブジェクト
|
|
2386
|
+
*
|
|
2387
|
+
* @example
|
|
2388
|
+
* ```ts
|
|
2389
|
+
* await deleteRecordComment({
|
|
2390
|
+
* app: 1,
|
|
2391
|
+
* record: 100,
|
|
2392
|
+
* comment: 5,
|
|
2393
|
+
* });
|
|
2394
|
+
* ```
|
|
2395
|
+
*/
|
|
1768
2396
|
declare const deleteRecordComment: (params: kintoneAPI.rest.CommentDeleteRequest) => Promise<kintoneAPI.rest.CommentDeleteResponse>;
|
|
1769
2397
|
|
|
1770
2398
|
type AppReportsGetRequest = {
|
|
@@ -1772,8 +2400,39 @@ type AppReportsGetRequest = {
|
|
|
1772
2400
|
lang?: kintoneAPI.rest.Lang;
|
|
1773
2401
|
};
|
|
1774
2402
|
type GetAppChartsParams = WithCommonRequestParams<AppReportsGetRequest>;
|
|
2403
|
+
/**
|
|
2404
|
+
* 指定アプリのグラフ(レポート)設定を取得します。
|
|
2405
|
+
*
|
|
2406
|
+
* @param params.app - アプリID
|
|
2407
|
+
* @param params.lang - 取得する言語(省略可)
|
|
2408
|
+
* @param params.guestSpaceId - ゲストスペースID(省略可)
|
|
2409
|
+
* @param params.debug - デバッグログを出力する場合は `true`
|
|
2410
|
+
* @returns グラフ設定情報
|
|
2411
|
+
*
|
|
2412
|
+
* @example
|
|
2413
|
+
* ```ts
|
|
2414
|
+
* const { reports } = await getAppCharts({ app: 1 });
|
|
2415
|
+
* Object.keys(reports).forEach((name) => {
|
|
2416
|
+
* console.log(name, reports[name].chartType);
|
|
2417
|
+
* });
|
|
2418
|
+
* ```
|
|
2419
|
+
*/
|
|
1775
2420
|
declare const getAppCharts: (params: GetAppChartsParams) => Promise<kintoneAPI.rest.AppReportsGetResponse>;
|
|
1776
2421
|
|
|
2422
|
+
/**
|
|
2423
|
+
* 指定したスペースの情報を取得します。
|
|
2424
|
+
*
|
|
2425
|
+
* @param params.id - スペースID
|
|
2426
|
+
* @param params.guestSpaceId - ゲストスペースID(省略可)
|
|
2427
|
+
* @param params.debug - デバッグログを出力する場合は `true`
|
|
2428
|
+
* @returns スペース情報
|
|
2429
|
+
*
|
|
2430
|
+
* @example
|
|
2431
|
+
* ```ts
|
|
2432
|
+
* const space = await getSpace({ id: 1 });
|
|
2433
|
+
* console.log(space.name);
|
|
2434
|
+
* ```
|
|
2435
|
+
*/
|
|
1777
2436
|
declare const getSpace: (params: WithCommonRequestParams<kintoneAPI.rest.space.GetSpaceRequest>) => Promise<kintoneAPI.rest.space.GetSpaceResponse>;
|
|
1778
2437
|
type CreateSpaceParams = WithCommonRequestParams<{
|
|
1779
2438
|
id: kintoneAPI.IDToRequest;
|
|
@@ -1793,12 +2452,47 @@ type CreateSpaceParams = WithCommonRequestParams<{
|
|
|
1793
2452
|
type CreateSpaceResponse = {
|
|
1794
2453
|
id: string;
|
|
1795
2454
|
};
|
|
2455
|
+
/**
|
|
2456
|
+
* テンプレートからスペースを新規作成します。
|
|
2457
|
+
*
|
|
2458
|
+
* @param params.id - スペーステンプレートID
|
|
2459
|
+
* @param params.name - スペース名
|
|
2460
|
+
* @param params.members - メンバー情報の配列
|
|
2461
|
+
* @param params.isPrivate - 非公開スペースにする場合は `true`
|
|
2462
|
+
* @param params.isGuest - ゲストスペースにする場合は `true`
|
|
2463
|
+
* @param params.fixedMember - メンバーを固定する場合は `true`
|
|
2464
|
+
* @returns 作成されたスペースのID
|
|
2465
|
+
*
|
|
2466
|
+
* @example
|
|
2467
|
+
* ```ts
|
|
2468
|
+
* const { id } = await createSpace({
|
|
2469
|
+
* id: 10, // テンプレートID
|
|
2470
|
+
* name: '新規プロジェクト',
|
|
2471
|
+
* members: [
|
|
2472
|
+
* { entity: { type: 'USER', code: 'user1' }, isAdmin: true },
|
|
2473
|
+
* ],
|
|
2474
|
+
* });
|
|
2475
|
+
* ```
|
|
2476
|
+
*/
|
|
1796
2477
|
declare const createSpace: (params: CreateSpaceParams) => Promise<CreateSpaceResponse>;
|
|
1797
2478
|
type DeleteSpaceParams = WithCommonRequestParams<{
|
|
1798
2479
|
/** 更新するスレッドのスレッドID */
|
|
1799
2480
|
id: kintoneAPI.rest.space.SpaceIdToRequest;
|
|
1800
2481
|
}>;
|
|
1801
2482
|
type DeleteSpaceResponse = {};
|
|
2483
|
+
/**
|
|
2484
|
+
* スペースを削除します。
|
|
2485
|
+
*
|
|
2486
|
+
* @param params.id - 削除対象のスペースID
|
|
2487
|
+
* @param params.guestSpaceId - ゲストスペースID(省略可)
|
|
2488
|
+
* @param params.debug - デバッグログを出力する場合は `true`
|
|
2489
|
+
* @returns 空オブジェクト
|
|
2490
|
+
*
|
|
2491
|
+
* @example
|
|
2492
|
+
* ```ts
|
|
2493
|
+
* await deleteSpace({ id: 1 });
|
|
2494
|
+
* ```
|
|
2495
|
+
*/
|
|
1802
2496
|
declare const deleteSpace: (params: DeleteSpaceParams) => Promise<DeleteSpaceResponse>;
|
|
1803
2497
|
type UpdateThreadParams = WithCommonRequestParams<{
|
|
1804
2498
|
/** 更新するスレッドのスレッドID */
|
|
@@ -1825,6 +2519,25 @@ type UpdateThreadParams = WithCommonRequestParams<{
|
|
|
1825
2519
|
body?: string;
|
|
1826
2520
|
}>;
|
|
1827
2521
|
type UpdateThreadResponse = {};
|
|
2522
|
+
/**
|
|
2523
|
+
* スペース内のスレッド情報を更新します。
|
|
2524
|
+
*
|
|
2525
|
+
* スレッド名や本文を更新できます。シングルスレッドのスペースではスレッド名の更新はできません。
|
|
2526
|
+
*
|
|
2527
|
+
* @param params.id - スレッドID
|
|
2528
|
+
* @param params.name - スレッド名(1~128文字、省略時は更新なし)
|
|
2529
|
+
* @param params.body - スレッドの本文(HTML対応、65535文字まで、省略時は更新なし)
|
|
2530
|
+
* @returns 空オブジェクト
|
|
2531
|
+
*
|
|
2532
|
+
* @example
|
|
2533
|
+
* ```ts
|
|
2534
|
+
* await updateThread({
|
|
2535
|
+
* id: 5,
|
|
2536
|
+
* name: '更新後のスレッド名',
|
|
2537
|
+
* body: '<b>重要なお知らせ</b>',
|
|
2538
|
+
* });
|
|
2539
|
+
* ```
|
|
2540
|
+
*/
|
|
1828
2541
|
declare const updateThread: (params: UpdateThreadParams) => Promise<UpdateThreadResponse>;
|
|
1829
2542
|
|
|
1830
2543
|
/**
|
|
@@ -1845,6 +2558,22 @@ declare const withSpaceIdFallback: <T extends (...args: any) => any>(params: {
|
|
|
1845
2558
|
func: T;
|
|
1846
2559
|
funcParams: Parameters<T>[0];
|
|
1847
2560
|
}) => Promise<ReturnType<T>>;
|
|
2561
|
+
/**
|
|
2562
|
+
* REST APIでアクセスする先のアプリがゲストスペースに存在するかどうかを判定します。
|
|
2563
|
+
*
|
|
2564
|
+
* ゲストスペースIDなしでアクセスし、`GAIA_IL23` エラーが返るかどうかで判定します。
|
|
2565
|
+
*
|
|
2566
|
+
* @param appId - 判定対象のアプリID
|
|
2567
|
+
* @returns ゲストスペースのアプリであれば `true`
|
|
2568
|
+
*
|
|
2569
|
+
* @example
|
|
2570
|
+
* ```ts
|
|
2571
|
+
* const guest = await isGuestSpace('123');
|
|
2572
|
+
* if (guest) {
|
|
2573
|
+
* console.log('ゲストスペースのアプリです');
|
|
2574
|
+
* }
|
|
2575
|
+
* ```
|
|
2576
|
+
*/
|
|
1848
2577
|
declare const isGuestSpace: (appId: string) => Promise<boolean>;
|
|
1849
2578
|
type Operator = '=' | '!=' | '>' | '<' | '>=' | '<=' | 'in' | 'not in' | 'like' | 'not like';
|
|
1850
2579
|
type OrderBy = 'asc' | 'desc';
|
|
@@ -1880,17 +2609,6 @@ declare const useQuery: <T>(conditions: QueryCondition<T>[], options?: {
|
|
|
1880
2609
|
orderBy: OrderBy;
|
|
1881
2610
|
};
|
|
1882
2611
|
}) => string;
|
|
1883
|
-
/**
|
|
1884
|
-
* 受け取った配列を指定したサイズで分割します
|
|
1885
|
-
*
|
|
1886
|
-
* @example
|
|
1887
|
-
* ```ts
|
|
1888
|
-
* const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9];
|
|
1889
|
-
* const result = chunk(arr, 3);
|
|
1890
|
-
* console.log(result); // [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
|
1891
|
-
* ```
|
|
1892
|
-
*/
|
|
1893
|
-
declare const chunk: <T>(arr: T[], size: number) => T[][];
|
|
1894
2612
|
|
|
1895
2613
|
type KintoneConfig = {
|
|
1896
2614
|
baseUrl?: {
|
|
@@ -2288,4 +3006,4 @@ declare const getFieldElements: (fieldCode: string) => HTMLElement[] | null;
|
|
|
2288
3006
|
*/
|
|
2289
3007
|
declare const xapp: typeof kintone.mobile.app | typeof kintone.app;
|
|
2290
3008
|
|
|
2291
|
-
export { API_LIMIT_POST, type AddAllRecordsParams, type AddRecordParams, type AppReportsGetRequest, type BulkRequestParams, type CreateSpaceParams, type CreateSpaceResponse, type DeleteAllRecordsParams, type DeleteSpaceParams, type DeleteSpaceResponse, type GetAllRecordsParams, type GetAppChartsParams, type GetRecordACLEvaluateParams, type GetRecordsParams, type GetYuruCharaOptions, type KintoneConfig, KintoneEventListener, KintoneEventManager, type OnFileLoadOptions, type OneOfBulkRequest, type PluginConfig, PluginLocalStorage, type PluginManifest, type PrimaryKeyToUpdate, type QueryCondition, type RecordACLEvaluateGetRequest, type RecordAssigneesPutRequest, type RecordGetRequest, type RecordPostRequest, type RecordPutRequest, type RecordStatusPutRequest, type RecordStatusToPut, type RecordStatusesPutRequest, type RecordUpsertRequest, type RecordsDeleteRequest, type RecordsGetRequest, type RecordsPostRequest, type RecordsPutRequest, type SavedFields, type UpdateAllRecordStatusesParams, type UpdateAllRecordsParams, type UpdateKey, type UpdateRecordAssigneesParams, type UpdateRecordParams, type UpdateRecordStatusParams, type UpdateThreadParams, type UpdateThreadResponse, type UpsertRecordParams, addAllRecords, addRecord, addRecordComment, addRecords, backdoor, backdoorGetRecord, bulkRequest,
|
|
3009
|
+
export { API_LIMIT_POST, type AddAllRecordsParams, type AddRecordParams, type AppReportsGetRequest, type BulkRequestParams, type CreateSpaceParams, type CreateSpaceResponse, type DeleteAllRecordsParams, type DeleteSpaceParams, type DeleteSpaceResponse, type GetAllRecordsParams, type GetAppChartsParams, type GetRecordACLEvaluateParams, type GetRecordsParams, type GetYuruCharaOptions, type KintoneConfig, KintoneEventListener, KintoneEventManager, type OnFileLoadOptions, type OneOfBulkRequest, type PluginConfig, PluginLocalStorage, type PluginManifest, type PrimaryKeyToUpdate, type QueryCondition, type RecordACLEvaluateGetRequest, type RecordAssigneesPutRequest, type RecordGetRequest, type RecordPostRequest, type RecordPutRequest, type RecordStatusPutRequest, type RecordStatusToPut, type RecordStatusesPutRequest, type RecordUpsertRequest, type RecordsDeleteRequest, type RecordsGetRequest, type RecordsPostRequest, type RecordsPutRequest, type SavedFields, type UpdateAllRecordStatusesParams, type UpdateAllRecordsParams, type UpdateKey, type UpdateRecordAssigneesParams, type UpdateRecordParams, type UpdateRecordStatusParams, type UpdateThreadParams, type UpdateThreadResponse, type UpsertRecordParams, addAllRecords, addRecord, addRecordComment, addRecords, backdoor, backdoorGetRecord, bulkRequest, compareField, convertFullwidthAlphanumericToHalfwidth, convertHalfwidthKatakanaToFullwidth, convertKatakanaToHiragana, createSpace, cx, deleteAllRecords, deleteAllRecordsByQuery, deleteRecordComment, deleteSpace, detectGuestSpaceId, downloadFile, filterFieldProperties, getAllApps, getAllRecords, getAllRecordsWithCursor, getAllRecordsWithId, getApp, getAppCharts, getAppId, getAppObject, getAppSettings, getAppStatus, getCalcFieldValueAsString, getCurrentRecord, getCybozuGroupUsers, getCybozuGroups, getCybozuOrganizationUsers, getCybozuOrganizations, getCybozuUserGroups, getCybozuUserOrganizations, getCybozuUsers, getDefaultValue, getEmptyValue, getFieldElement, getFieldElements, getFieldValueAsString, getFormFields, getFormLayout, getHeaderSpace, getMetaFieldId_UNSTABLE, getMetaFields_UNSTABLE, getMetaSubtableFields_UNSTABLE, getMetaSubtable_UNSTABLE, getMetaTable_UNSTABLE, getNumberFieldValueAsString, getQuery, getQueryCondition, getQueryString_UNSTABLE, getRecord, getRecordACLEvaluate, getRecordComments, getRecordId, getRecords, getSortFromQuery, getSpace, getSpaceElement, getViews, getWareki, getYuruChara, isGuestSpace, isMobile, kintoneAPI, onFileLoad, restorePluginConfig, setCurrentRecord, setFieldShown, setPluginProxyConfig, sortField, storePluginConfig, storeStorage, updateAllRecordStatuses, updateAllRecords, updateRecord, updateRecordAssignees, updateRecordStatus, updateThread, updateViews, uploadFile, upsertRecord, useApi, useQuery, useSorting, withLogging, withMobileEvents, withSpaceIdFallback, xapp };
|