#protect #unifi #server #sdk #camera #api #system

unifi_protect

用于与 unifi protect 服务器交互的 SDK

16 个不稳定版本 (3 个重大更改)

0.5.2 2024年2月16日
0.5.1 2024年2月16日
0.4.9 2024年2月16日
0.4.8 2023年8月11日
0.1.3 2023年7月23日

网页开发 中排名第 1906


用于 unifi-protect-bulk-downlo…

GPL-3.0 许可证

29KB
791 行代码(不含注释)

UniFi-Protect Rust 库

Crates.io Docs.rs Build Status

该库允许与 unifi protect 服务器(如运行在 ubiquiti 云密钥 gen2 上的服务器)交互。它旨在最终成为 Rust 中 unifi protect API 的完整实现,紧密遵循基于 JavaScript 的 https://github.com/hjdhjd/unifi-protect/ 的示例。它还用于从 unifi protect 系统下载录像的 unifi-protect-bulk-download 工具。

要将库添加到现有的 cargo 项目中: cargo add unifi-protect

基本用法

use unifi_protect::UnifiProtectServer;

// [ ...]
// within an async context:

// create a new instance using the base uri of the unifi protect server (same uri you would use to reach the system's web portal)
let mut server = UnifiProtectServer::new("BASE_URI"); // ( e.g. "https://192.168.1.28")
// login with username + password credentials (same credentials you would use to login to the system's web portal)
server
    .login("USERNAME", "PASSWORD")
    .await
    .expect("Failed to login");
server
    .fetch_cameras()
    .await
    .expect("Failed to fetch cameras");
println!("Found {} cameras", server.cameras.len());

依赖项

~6–18MB
~273K SLoC