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

@devopness/sdk-js

Package Overview
Dependencies
Maintainers
1
Versions
323
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@devopness/sdk-js

Devopness API JS/TS SDK - Painless essential DevOps to everyone

  • 1.15.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
184
increased by91.67%
Maintainers
1
Weekly downloads
 
Created
Source

Devopness SDK - JavaScript

MIT License CI

NPM

The official Devopness SDK for JavaScript, available for browsers, mobile devices and Node.js backends.

The Devopness SDK provides convenient access to the Devopness API from applications written in the JavaScript language. It includes a pre-defined set of classes for API resources and aims to make it easy and fun to consume Devopness API from web apps, Node.js apps, or mobile apps written in the JavaScript language.

About Devopness

Devopness aims to drastically change the way software developers deploy applications and manage on-premise and cloud servers in a secure and performant fashion.

By streamlining essential DevOps practices we're making first class software deployment and server management tools accessible and affordable to every developer in the world.

Usage

Installation

Use npm to install the Devopness SDK package as a dependency of your project:

npm install @devopness/sdk-js@latest

Upgrade

To upgrade the Devopness SDK npm package to the latest version, add the @latest suffix to the package name:

npm install @devopness/sdk-js@latest

Initializing

To initialize the usage of Devopness SDK just import it and create a new instance of DevopnessApiClient class.

Here is a generic simple example that can be used from Node.js, TypeScript or Javascript applications:

import { DevopnessApiClient } from '@devopness/sdk-js'
const devopnessApi = new DevopnessApiClient();

Authenticating

To authenticate, just invoke the login method on the users service:

async function authenticate(email, pass) {
  const userTokens = await devopnessApi.users.login({ email: email, password: pass });
  // The `accessToken` must be set every time a token is obtained or refreshed.
  devopnessApi.accessToken = userTokens.data.access_token;
}

// invoke the authentication method
authenticate('user@email.com', 'secret-password');

Invoking authentication protected endpoints

Once an authentication token is set, any protected endpoint can be invoked. Example retrieving current user details:

async function getUserProfile() {
    // invoke the authentication method to ensure an auth token
    // is retrieved and set to the SDK instance
    await authenticate('user@email.com', 'secret-password');

    // Now that we're authenticated, we can invoke methods on any services.
    // Here we're invoking the `getCurrentUser()` method on the `users` service
    const currentUser = await devopnessApi.users.getCurrentUser();
    console.log('Successfully retrieved user profile: ', currentUser);
}

getUserProfile();

TypeScript support

This package includes TypeScript declarations for every method. TypeScript versions >= 3.1 are supported.

Some methods in Devopness SDK JavaScript accept and return objects from the Devopness API. The type declarations for these objects will always track the latest version of the API. Therefore, if you'e using the latest version of this package you can rely on the Devopness API documentation for checking the input and return types of each API endpoint.

Keywords

FAQs

Package last updated on 11 Jun 2020

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