New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

openflighthub-api-client-sdk

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openflighthub-api-client-sdk

This is a typescript sdk made to talk to the [OpenFlightHub Api](https://hub.openflighthub.org/api). **It must be run in the browser!**

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

OpenFlightHub API Client SDK

This is a typescript sdk made to talk to the OpenFlightHub Api. It must be run in the browser!

Features

  • typescript typings (for parameters, request bodies and returned data)
  • automatically handles idempotency

Dependencies

  • none

Usage

install via npm:

npm i --save openflighthub-api-client-sdk
import {OpenFlightHubApi} from 'openflighthub-api-client-sdk'

const api = new OpenFlightHubApi({
    restApiBaseUrl: 'https://hub.openflighthub.org/api',
    liveWebsocketBaseUrl: 'wss://hub.openflighthub.org/api/live'
})

// Version

console.log('API Version', api.rest.API_VERSION)
console.log('Client SDK Version', api.VERSION)


// Login

api.rest.auth.login.post({
    username: 'test@openflighthub.org',
    password: '1234'
}).then(response => {
    const myUserId = response.id
})

// Get information for a drone

const FAKE_DRONE_ID = 1

api.rest.drone.get({
    droneId: FAKE_DRONE_ID
}).then(drone => {
    console.log(drone.serial_number)
})

// Get last position of drone

api.rest.drone.lastPosition.get({
    droneId: FAKE_DRONE_ID
}).then(lastPosition => {
    console.log(lastPosition.latitude, lastPosition.latitude)
})

// Get live positions of drone via websocket

api.live.subscribeToDrone(FAKE_DRONE_ID, (event, filter, data)=>{
    console.log('new position of drone', data.id, data.position.latitude, data.position.longitude)
})



// Live connection status

api.live.status.addListener('connected', () => {
    console.log('api is connected')
})

api.live.status.addListener('disconnected', reason => {
    console.log('api is disconnected')
})

Changelog

see CHANGELOG.md

For Developers

see dev/README.md

Keywords

FAQs

Package last updated on 27 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc