Coder Social home page Coder Social logo

now-client's Introduction

๐šซ now client

Build Status XO code style Slack Channel

Node.js module to interact with the official ๐šซ now instant API.

You need to provide your API token, which you can obtain here. It is possible to pass it as a parameter or with the NOW_TOKEN environment variable. When no token is given, it will use the one contained in your ~/.now.json file.

npm install --save now-client

Usage

Firstly, load the package:

const NowClient = require('now-client')

Then initialize it using your token:

const now = new NowClient('YOUR TOKEN')

And finally, you can use its methods to retrieve data:

await now.getDeployments()

API Reference

Kind: global class

new Now([token])

Initializes the API. Looks for token in ~/.now.json if none is provided.

Param Type Description
[token] String Your now API token.

now.getDeployments([callback]) โ‡’ Promise

Returns an array with all deployments.

Kind: instance method of Now
See: https://zeit.co/api#list-endpoint

Param Type Description
[callback] function Callback will be called with (err, deployments)

now.getDeployment(id, [callback]) โ‡’ Promise

Returns an object with deployment data.

Kind: instance method of Now
See: https://zeit.co/api#get-endpoint

Param Type Description
id String ID of deployment
[callback] function Callback will be called with (err, deployment)

now.createDeployment(body, [callback]) โ‡’ Promise

Creates a new deployment and returns its data.

Kind: instance method of Now
See: https://zeit.co/api#instant-endpoint

Param Type Description
body Object The keys should represent a file path, with their respective values containing the file contents.
[callback] function Callback will be called with (err, deployment)

now.deleteDeployment(id, [callback]) โ‡’ Promise

Deletes a deployment and returns its data.

Kind: instance method of Now
See: https://zeit.co/api#rm-endpoint

Param Type Description
id String ID of deployment
[callback] function Callback will be called with (err, deployment)

now.getFiles(id, [callback]) โ‡’ Promise

Returns an array with the file structure.

Kind: instance method of Now
See: https://zeit.co/api#file-structure-endpoint

Param Type Description
id String ID of deployment
[callback] function Callback will be called with (err, fileStructure)

now.getFile(id, fileId, [callback]) โ‡’ Promise

Returns the content of a file either as string or object, depending on the filetype.

Kind: instance method of Now
See: https://zeit.co/api#file--endpoint

Param Type Description
id String ID of deployment
fileId String ID of the file
[callback] function Callback will be called with (err, fileContent)

now.getDomains([callback])] โ‡’ Promise

Returns an array with all domain names and related aliases.

Kind: instance method of Now See: https://zeit.co/api#get-domains

Param Type Description
[callback] function Callback will be called with (err, domains)

now.addDomain(domain, [callback])] โ‡’ Promise

Adds a new domain and returns its data.

Kind: instance method of Now See: https://zeit.co/api#post.domains

Param Type Description
domain object An object containing a string name and a boolean isExternalDNS
[callback] function Callback will be called with (err)

now.deleteDomain(name, [callback])] โ‡’ Promise

Deletes a domain name.

Kind: instance method of Now See: https://zeit.co/api#delete-domains

Param Type Description
name String Domain name
[callback] function Callback will be called with (err)

now.getDomainRecords(domain, [callback])] โ‡’ Promise

Returns an array with all DNS records configured for a domain name.

Kind: instance method of Now See: https://zeit.co/api#get-domain-records

Param Type Description
name String Domain name
[callback] function Callback will be called with (err, domains)

now.addDomainRecord(domain, recordData, [callback])] โ‡’ Promise

Adds a new DNS record for a domain.

Kind: instance method of Now See: https://zeit.co/api#post-domain-records

Param Type Description
domain String Domain name
recordData object An object containing a description of the new record according to the documentation.
[callback] function Callback will be called with (err)

now.deleteDomainRecord(name, recordId, [callback])] โ‡’ Promise

Deletes a DNS record associated with a domain.

Kind: instance method of Now See: https://zeit.co/api#delete-domain-records

Param Type Description
domain String Domain name
recordId String Record ID
[callback] function Callback will be called with (err)

now.getCertificates([cn], [callback])] โ‡’ Promise

Returns an array of all certificates.

Kind: instance method of Now See: https://zeit.co/api#get-certs

Param Type Description
[cn] String Common Name
[callback] function Callback will be called with (err, certs)

now.createCertificate(cn, [callback])] โ‡’ Promise

Creates a new certificate for a domain registered to the user.

Kind: instance method of Now See: https://zeit.co/api#post-certs

Param Type Description
cn String Common Name
[callback] function Callback will be called with (err)

now.renewCertificate(cn, [callback])] โ‡’ Promise

Renews an existing certificate.

Kind: instance method of Now See: https://zeit.co/api#post-certs

Param Type Description
cn String Common Name
[callback] function Callback will be called with (err)

now.replaceCertificate(cn, cert, key, [ca], [callback])] โ‡’ Promise

Replace an existing certificate.

Kind: instance method of Now See: https://zeit.co/api#put-certs

Param Type Description
cn String Common Name
cert String X.509 certificate
key String Private key for the certificate
ca String CA certificate chain
[callback] function Callback will be called with (err, created)

now.deleteCertificate(cn, [callback])] โ‡’ Promise

Deletes a certificate.

Kind: instance method of Now See: https://zeit.co/api#delete-certs

Param Type Description
cn String Common Name
[callback] function Callback will be called with (err)

now.getAliases([id OR callback], [callback]) โ‡’ Promise

Returns an array with all aliases.

Kind: instance method of Now
See: https://zeit.co/api#user-aliases

Param Type Description
[id OR callback] String | function ID of deployment or callback
[callback] function Callback will be called with (err, aliases)

now.createAlias(id, alias, [callback]) โ‡’ Promise

Creates an alias for the given deployment.

Kind: instance method of Now
See: https://zeit.co/api#create-alias

Param Type Description
id String ID of deployment
alias String Hostname or custom url for the alias
[callback] function Callback will be called with (err, data)

now.deleteAlias(id, [callback]) โ‡’ Promise

Deletes an alias and returns a status.

Kind: instance method of Now
See: https://zeit.co/api#delete-user-aliases

Param Type Description
id String ID of alias
[callback] function Callback will be called with (err, status)

now.getSecrets([id OR callback], [callback]) โ‡’ Promise

Returns an array with all secrets.

Kind: instance method of Now
See: https://zeit.co/api#get-now-secrets

Param Type Description
[id OR callback] String | function ID of deployment or callback
[callback] function Callback will be called with (err, secrets)

now.createSecret(name, value, [callback]) โ‡’ Promise

Creates a secret and returns its ID.

Kind: instance method of Now
See: https://zeit.co/api#post-now-secrets

Param Type Description
name String name for the secret
value String value for the secret
[callback] function Callback will be called with (err, data)

now.renameSecret(id, name, [callback]) โ‡’ Promise

Changes the name of the given secret and returns its ID and name.

Kind: instance method of Now
See: https://zeit.co/api#patch-now-secrets

Param Type Description
id String id or name of the secret
name String new name for the secret
[callback] function Callback will be called with (err, data)

now.deleteSecret(id, [callback]) โ‡’ Promise

Deletes a secret and returns its ID.

Kind: instance method of Now
See: https://zeit.co/api#delete-now-secrets

Param Type Description
id String ID or name of the secret
[callback] function Callback will be called with (err, status)

now-client's People

Contributors

berzniz avatar codyzu avatar greenkeeperio-bot avatar jfmengels avatar leo avatar mattphillips avatar millette avatar olliv avatar timolins avatar vdanchenkov avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.