Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 46 additions & 5 deletions types/safie-sdk/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,48 @@ declare namespace Safie {
function removeToken(): Promise<void>;
}

/**
* SDK全体の設定に関する機能群
*/
namespace Config {
/**
* テーマの設定に関する機能群
*/
namespace Theme {
/** 設定可能なテーマ種別 */
type ThemeType = "light" | "dark" | "system";
/**
* テーマを設定します。
* #### 概要
* - SDK全体のテーマを設定します
* - 現在アクティブな全てのSDKコンポーネント(StreamingPlayer, Timeline等)に即時反映されます
* - "system"を指定するとOSのカラースキーム設定がリアルタイムに反映されます
* - 設定しない場合、デフォルトとして"light"が適用されます
* @param theme テーマ種別
* @throws {@link ErrorDetail} `ThemeType`以外の値を指定した場合にスローされます
* @example
* ```js
* //ダークテーマに設定
* Safie.Config.Theme.set('dark');
* //OSのカラースキームに追従
* Safie.Config.Theme.set('system');
* ```
*/
function set(theme: ThemeType): void;
/**
* 現在設定されているテーマ種別を返します。
* #### 概要
* - 現在設定されているテーマ種別を返します
* @returns 設定されているテーマ種別
* @example
* ```js
* const theme = Safie.Config.Theme.get();
* ```
*/
function get(): ThemeType;
}
}

/**
* デバイス情報の操作に関する機能群
*/
Expand Down Expand Up @@ -122,10 +164,9 @@ declare namespace Safie {
serverConnecting: boolean;
};
/**
* @hidden
* デバイスのcapability情報
* デバイスの機能情報のリスト
*/
capabilities?: string[];
capabilities: string[];
}
/**
* デバイス一覧取得の結果
Expand Down Expand Up @@ -305,6 +346,7 @@ declare namespace Safie {
* @param options.limit 返却するリストの最大件数 (規定値: 20, 最大値: 100)
* @param options.offset 返却するリストのオフセット (規定値: 0)
* @param options.itemId デバイスに設定されているオプションによる絞り込み
* @param options.deviceIds デバイスIDによる絞り込み
* @returns
* @throws {@link ErrorDetail}
* @example
Expand All @@ -317,6 +359,7 @@ declare namespace Safie {
limit?: number;
offset?: number;
itemId?: number;
deviceIds?: string[];
}): Promise<QueryDevicesResult>;
/**
* サムネイル取得
Expand Down Expand Up @@ -725,8 +768,6 @@ declare namespace Safie {
* ストリーミングプレイヤー
* #### 概要
* 映像のストリーミング再生を行うプレイヤーです。
* #### 制限:
* - ハイブリッド録画プランを利用のデバイスにおいて、通信を開始後にSafie Developersのアプリケーションの変更及びデバイスオプションの削除を行っても、視聴中は反映されません。
* #### 必要な権限:
* - ライブ + 録画(VOD配信、タイムライン連携時の場合)
* #### 必要なOAuth2.0 scope:
Expand Down
6 changes: 5 additions & 1 deletion types/safie-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@types/safie-sdk",
"version": "1.8.9999",
"version": "1.9.9999",
"projects": [
"https://developers.safie.link/"
],
Expand All @@ -12,6 +12,10 @@
{
"name": "Safie Inc.",
"githubUsername": "SafieDev"
},
{
"name": "Yusuke Oba",
"githubUsername": "yusuke-oba1"
}
],
"nonNpm": true,
Expand Down
17 changes: 16 additions & 1 deletion types/safie-sdk/safie-sdk-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,31 @@ async function testAuth(): Promise<void> {
await Safie.Auth.removeToken();
}

function testConfig(): void {
// SDK全体のテーマ設定(v1.9で追加)
const themeTypes: Safie.Config.Theme.ThemeType[] = ["light", "dark", "system"];
themeTypes.forEach(theme => {
Safie.Config.Theme.set(theme);
});
const currentTheme: Safie.Config.Theme.ThemeType = Safie.Config.Theme.get();
console.log(currentTheme);
}

async function testDevices(): Promise<void> {
const devicesAll: Safie.Devices.QueryDevicesResult = await Safie.Devices.queryDevices();
await Safie.Devices.queryDevices({ limit: 30, offset: 10, itemId: 1 });
// デバイスIDによる絞り込み(v1.9で追加)
await Safie.Devices.queryDevices({ deviceIds: ["device1", "device2"] });
devicesAll.list.forEach((device: Safie.Devices.Device) => {
const id: string = device.deviceId;
const modelName: string = device.model.description;
const serial: string = device.serial;
const name: string = device.setting.name;
const streaming: boolean = device.status.videoStreaming;
const connected: boolean = device.status.serverConnecting;
console.log(id, modelName, serial, name, streaming, connected);
// デバイスの機能情報のリスト
const capabilities: string[] = device.capabilities;
console.log(id, modelName, serial, name, streaming, connected, capabilities);
});

const thumbnail: Blob = await Safie.Devices.queryThumbnail({ deviceId: "device" });
Expand Down Expand Up @@ -290,6 +304,7 @@ function testErrorHandling(error: Safie.ErrorDetail): void {

// 全テスト関数を参照することで未使用警告を抑止する
testAuth();
testConfig();
testDevices();
testPlayer();
testTimeline();
Expand Down