Socket
Socket
Sign inDemoInstall

now-client

Package Overview
Dependencies
Maintainers
3
Versions
148
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

now-client

Node.js wrapper for the Now API


Version published
Weekly downloads
811
decreased by-5.92%
Maintainers
3
Weekly downloads
 
Created
Source

now client


DEPRECATED: Read more here.


Build Status XO code style Slack Channel

The official JavaScript client for interacting with the now instant API (please note that this API only allows you to send strings, it doesn't support streaming - but binary files can be encoded as base64 strings).

Usage

Firstly, install the package using npm:

npm install --save now-client

Next, load it:

const NowClient = require('now-client')

Then initialize it:

  • <token> holds your token, which can obtained here (optional, will read from ~/.now/auth.json if not defined - you can also define it using the NOW_TOKEN environment variable)
  • <team> specifies the ID of the team to which the actions should apply (optional)
const now = new NowClient(<token>, <team>)

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.

ParamTypeDescription
[token]StringYour 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

ParamTypeDescription
[callback]functionCallback 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

ParamTypeDescription
idStringID of deployment
[callback]functionCallback 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

ParamTypeDescription
bodyObjectThe keys should represent a file path, with their respective values containing the file contents.
[callback]functionCallback 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

ParamTypeDescription
idStringID of deployment
[callback]functionCallback 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

ParamTypeDescription
idStringID of deployment
[callback]functionCallback 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

ParamTypeDescription
idStringID of deployment
fileIdStringID of the file
[callback]functionCallback 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

ParamTypeDescription
[callback]functionCallback 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

ParamTypeDescription
domainobjectAn object containing a string name and a boolean isExternalDNS
[callback]functionCallback 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

ParamTypeDescription
nameStringDomain name
[callback]functionCallback 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

ParamTypeDescription
nameStringDomain name
[callback]functionCallback 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

ParamTypeDescription
domainStringDomain name
recordDataobjectAn object containing a description of the new record according to the documentation.
[callback]functionCallback 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

ParamTypeDescription
domainStringDomain name
recordIdStringRecord ID
[callback]functionCallback 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

ParamTypeDescription
[cn]StringCommon Name
[callback]functionCallback 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

ParamTypeDescription
cnStringCommon Name
[callback]functionCallback 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

ParamTypeDescription
cnStringCommon Name
[callback]functionCallback 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

ParamTypeDescription
cnStringCommon Name
certStringX.509 certificate
keyStringPrivate key for the certificate
caStringCA certificate chain
[callback]functionCallback 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

ParamTypeDescription
cnStringCommon Name
[callback]functionCallback 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

ParamTypeDescription
[id OR callback]String | functionID of deployment or callback
[callback]functionCallback 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

ParamTypeDescription
idStringID of deployment
aliasStringHostname or custom url for the alias
[callback]functionCallback 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

ParamTypeDescription
idStringID of alias
[callback]functionCallback 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

ParamTypeDescription
[id OR callback]String | functionID of deployment or callback
[callback]functionCallback 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

ParamTypeDescription
nameStringname for the secret
valueStringvalue for the secret
[callback]functionCallback 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

ParamTypeDescription
idStringid or name of the secret
nameStringnew name for the secret
[callback]functionCallback 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

ParamTypeDescription
idStringID or name of the secret
[callback]functionCallback will be called with (err, status)

Keywords

FAQs

Package last updated on 17 Jan 2018

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