1.3.3 • Published 8 years ago

now-universal-client v1.3.3

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

now-universal-client

🎁 Promise-based Universal API wrapper for now.sh

Usage

$ npm install --save now-universal-client
const {getDeployments} = require('now-universal-client')
const TOKEN = 'YOUR TOKEN'

let deployments

try {
  deployments = await getDeployments({token: TOKEN})
} catch (err) {
  console.error(err)
}

console.log(deployments)

API

const now = require('now-universal-client')

now.getDeployments({token}) ⇒ Promise

Returns an array with all deployments.

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

ParamTypeDescription
tokenStringYour ZEIT token

Resolves to an array of deployments.

now.getDeployment({token, id}) ⇒ Promise

Returns an object with deployment data.

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

ParamTypeDescription
tokenStringYour ZEIT token
idStringID of deployment

Resolves to the deployment object.

now.createDeployment({token, data}) ⇒ Promise

Creates a new deployment and returns its data.

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

ParamTypeDescription
tokenStringYour ZEIT token
dataObjectThe keys should represent a file path, with their respective values containing the file contents.

Resolves to the deployment object.

now.deleteDeployment({token, id}) ⇒ Promise

Deletes a deployment and returns its data.

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

ParamTypeDescription
tokenStringYour ZEIT token
idStringID of deployment

Resolves to the deployment object.

now.getFiles({token, id}) ⇒ Promise

Returns an array with the file structure.

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

ParamTypeDescription
tokenStringYour ZEIT token
idStringID of deployment

Resolves to an array with the file structure.

now.getFile({token, id, fileId}) ⇒ 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
tokenStringYour ZEIT token
idStringID of deployment
fileIdStringID of the file

Resolves to either a String or an Object of the file's content.

now.getDomains({token}) ⇒ Promise

Returns an array with all domain names and related aliases.

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

ParamTypeDescription
tokenStringYour ZEIT token

Resolves to an array with all domain names and related aliases.

now.addDomain({token, domain}) ⇒ Promise

Adds a new domain and returns its data.

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

ParamTypeDescription
tokenStringYour ZEIT token
domainobjectAn object containing a string name and a boolean isExternalDNS

Resolves to an object with the domain's data.

now.deleteDomain({token, name}) ⇒ Promise

Deletes a domain name.

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

ParamTypeDescription
tokenStringYour ZEIT token
nameStringDomain name

now.getDomainRecords({token, domain}) ⇒ 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
tokenStringYour ZEIT token
nameStringDomain name

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

now.addDomainRecord({token, domain, recordData}) ⇒ Promise

Adds a new DNS record for a domain.

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

ParamTypeDescription
tokenStringYour ZEIT token
domainobjectAn object containing a string name and a boolean isExternalDNS
recordDataobjectAn object containing a description of the new record according to the documentation.

now.deleteDomainRecord({token, name, recordId}) ⇒ Promise

Deletes a DNS record associated with a domain.

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

ParamTypeDescription
tokenStringYour ZEIT token
domainStringDomain name
recordIdStringRecord ID

now.getCertificates({token, cn}) ⇒ Promise

Returns an array of all certificates.

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

ParamTypeDescription
tokenStringYour ZEIT token
cnStringCommon Name

Resolves to an array of all certificates.

now.createCertificate({token, cn}) ⇒ 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
tokenStringYour ZEIT token
cnStringCommon Name

now.renewCertificate({token, cn}) ⇒ Promise

Renews an existing certificate.

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

ParamTypeDescription
tokenStringYour ZEIT token
cnStringCommon Name

now.replaceCertificate({token, cn, cert, key, ca}) ⇒ Promise

Replace an existing certificate.

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

ParamTypeDescription
tokenStringYour ZEIT token
cnStringCommon Name
certStringX.509 certificate
keyStringPrivate key for the certificate
caStringCA certificate chain

Resolves to an object with the new certificate details.

now.deleteCertificate({token, cn}) ⇒ Promise

Deletes a certificate.

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

ParamTypeDescription
tokenStringYour ZEIT token
cnStringCommon Name

now.getAliases({token, id}) ⇒ Promise

Returns an array with all aliases.

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

ParamTypeDescription
tokenStringYour ZEIT token
id OR callbackString | functionID of deployment or callback

Resolves to an array with all aliases.

now.createAlias({token, id, alias}) ⇒ Promise

Creates an alias for the given deployment.

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

ParamTypeDescription
tokenStringYour ZEIT token
idStringID of deployment
aliasStringHostname or custom url for the alias

Resolves to an Object with the alias data

now.deleteAlias({token, id}) ⇒ Promise

Deletes an alias and returns a status.

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

ParamTypeDescription
tokenStringYour ZEIT token
idStringID of alias

Resolves to the status

now.getSecrets({token, id}) ⇒ Promise

Returns an array with all secrets.

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

ParamTypeDescription
tokenStringYour ZEIT token
id OR callbackString | functionID of deployment or callback

Resolves to an array with all secrets.

now.createSecret({token, name, value}) ⇒ Promise

Creates a secret and returns its ID.

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

ParamTypeDescription
tokenStringYour ZEIT token
nameStringname for the secret
valueStringvalue for the secret

Resolves to a secret's ID.

now.renameSecret({token, id, name}) ⇒ 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
tokenStringYour ZEIT token
idStringid or name of the secret
nameStringnew name for the secret

Resolves to a secret's ID and name.

now.deleteSecret({token, id}) ⇒ Promise

Deletes a secret and returns its ID.

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

ParamTypeDescription
tokenStringYour ZEIT token
idStringID or name of the secret

Resolves to a secret's status.

now.getEvents({token}) ⇒ Promise

Get the latest events happened in your team.

ParamTypeDescription
tokenStringYour ZEIT token

Resolves to an array of events.

now.getUser({token}) ⇒ Promise

Get the info of user with the provided token

ParamTypeDescription
tokenStringYour ZEIT token

Resolves to a user object.

now.getTeams({token}) ⇒ Promise

Get the teams that are related to the given token.

ParamTypeDescription
tokenStringYour ZEIT token

Resolves to an array of teams.

License

See License.

1.3.3

8 years ago

1.3.2

8 years ago

1.3.1

8 years ago

1.3.0

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago