@bitbar/cloud-api-client

中文文档
1.7.7发布于 2026/10/30MITTypeScriptES Module近 30 天下载 3606

Bitbar Cloud API Client for JavaScript

原始使用文档
文档目录13 节
  1. Getting Started
  2. Disclaimer
  3. Prerequisites
  4. Concepts
  5. Usage
  6. Examples
  7. Documentation
  8. Contribution
  9. Checking code quality
  10. Running tests
  11. Building
  12. Authors
  13. License

Bitbar Cloud API Client for JavaScript

License: MIT Build Status

This repository contains official Bitbar Cloud API Client for JavaScript. Smartbear's Bitbar Cloud hosts hundreds of Android and iOS devices, enabling users to create and test high quality mobile apps and games.

Getting Started

Disclaimer

PLEASE NOTE, that project is under development (versions is below 1.0.0). Because of that not all resources are implemented and/or tested. List of working resources can be found here.

Prerequisites

This package is using UMD pattern, so it means that you can use it:

  • in Node.js project

  • browser running project

    • without AMD
    • with AMD

Concepts

The syntax of the library is heavily inspired by the Chai HTTP syntax. Understanding the following general concepts will allow you to quickly learn the syntax

1. Chaining

Most methods in library is chainable. That's means that you don't need to write long code like:

var meRef = apiClient.me();
var projectRef = me.project(1);
var runRef = project.run(2);

Rather it was designed to use it this way:

apiClient.me().project(1).run(2);

2. Every URL Part is a Method

Example: API resource to download list of device sessions of run with ID 10 in project with ID 20 will be:

GET https://cloud.bitbar.com/api/me/projects/20/runs/10/device-sessions

First part is /me (/api doesn't count because it's "directory" where API is stored). So:

apiClient.me();

Second is /projects, but next is the ID, so method will be in singular form:

apiClient.me().project(20);

Third is /runs, but again - there is the ID, so (again) singular form:

apiClient.me().project(20).run(10);

Last one is /device-dessions. Because it's kebab-case, we need to transform it to camelCase:

apiclient.me().project(20).runs(10).deviceSessions();

Now, because GET method is default one in axios, then we don't need to explicit set it (but you can if you want). So what's left is to send it:

apiclient.me().project(20).runs(10).deviceSessions().send();

3. Structure

Now that you know how to build a chaining call you probably will want to e.g. set params, or set data to send. All classes are documented so it should be easy to read docs from code.

If resource chain ends on method that is singular (so in Swagger it returns single object) then it's descendant of APIResource. It means that you can use all methods that are there.

If resource chain ends on method that is plural (so in Swagger it returns list) then it's descendant of APIList. It means that you can use all methods that are there.

Both APIResource and APIList are children of APIEntity.

4. HTTP Methods

HTTP methods are also methods.

  • If you want to send GET request then add to your chain .get().
  • If you want to send POST request then add to your chain .post().
  • If you want to send DELETE request then add to your chain .delete().

5. Send

Method .send() is sending request and returning Promise. With this kind of approach you can chain all you want. When you are ready, then just call .send().

Usage

CommonJS

npm install @bitbar/cloud-api-client --save
const CloudApiClient = require('@bitbar/cloud-api-client');

const apiClient = new CloudApiClient.API({
  cloudUrl: 'https://cloud.bitbar.com',
  apiKey: 'PASTE_HERE_YOUR_OWN_KEY'
});

apiClient.me().send().then( (resp) => {
  console.log(resp.data);
}).catch( (err) => {
  console.error(err);
});

AMD

requirejs(['cloud-api-client'], function (CloudApiClient) {
  var api = new CloudApiClient.API({
    cloudUrl: 'https://cloud.bitbar.com',
    apiKey: 'PASTE_HERE_YOUR_OWN_KEY'
  });
});

Old School

<!-- note that this is URL to version 0.8.0 -- please check which version is latest -->
<script src="https://github.com/bitbar/cloud-api-client-js/releases/download/v0.8.0/cloud-api-client.min.js"></script>
var api = new CloudApiClient.API({
  cloudUrl: 'https://cloud.bitbar.com',
  apiKey: 'PASTE_HERE_YOUR_OWN_KEY'
});

Examples

Simple examples are placed in examples directory

Documentation

https://bitbar.github.io/cloud-api-client-js/

Contribution

Checking code quality

npm run lint

Running tests

npm run test

Building

npm run build

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

版本与发布记录

@bitbar/cloud-api-client 共发布 180 个版本,首次发布于 2020/01/10;过去 12 个月发布了 19 个版本。

版本发布日期距今
1.7.7latest2026/10/309 天前
1.7.62026/10/061 个月前
1.7.52026/08/063 个月前
1.7.42026/04/236 个月前
1.7.32026/04/156 个月前
1.7.22026/04/106 个月前

关于 @bitbar/cloud-api-client 的常见问题

@bitbar/cloud-api-client 是什么?

Bitbar Cloud API Client for JavaScript

如何安装 @bitbar/cloud-api-client?

在项目目录运行 npm install @bitbar/cloud-api-client,或使用 pnpm add / yarn add / bun add。

@bitbar/cloud-api-client 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@bitbar/cloud-api-client 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@bitbar/cloud-api-client 可以商用吗?

@bitbar/cloud-api-client 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@bitbar/cloud-api-client 的下载量有多少?

根据 npm 官方下载统计,@bitbar/cloud-api-client 在 2026/10/08 – 2026/11/06 这 30 天内被下载 3,606 次,日均约 120 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@bitbar/cloud-api-client 还在维护吗?

最新版本 1.7.7 发布于 2026/10/30(9 天前);至今共发布 180 个版本,其中过去 12 个月发布了 19 个;首次发布于 2020/01/10。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。