Skip to content

Commit

Permalink
Merge pull request #156 from Microsoft/sdk_readme
Browse files Browse the repository at this point in the history
Initial checkin for SDK readme
  • Loading branch information
lostintangent committed Mar 8, 2016
2 parents a4f9e3c + 5e3d7d1 commit aff8bab
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[CodePush](https://microsoft.github.io/code-push) is a cloud service that enables Cordova and React Native developers to deploy mobile app updates directly to their users' devices. It works by acting as a central repository that developers can publish updates to (JS, HTML, CSS and images), and that apps can query for updates from (using provided client SDKs for [Cordova](https://github.com/Microsoft/cordova-plugin-code-push) and [React Native](https://github.com/Microsoft/react-native-code-push)). This allows you to have a more deterministic and direct engagement model with your userbase, when addressing bugs and/or adding small features that don't require you to re-build a binary and re-distribute it through the respective app stores.

This repo includes the [management CLI](http://microsoft.github.io/code-push/docs/cli.html) as well as some shared code that is used by both the Cordova and React Native client SDKs. To get started using CodePush, refer to our [documentation](http://microsoft.github.io/code-push/index.html#getting_started), otherwise, read the following steps if you'd like to build/contribute to the project from source.
This repo includes the [management CLI](https://github.com/Microsoft/code-push/tree/master/cli) and [Node.js management SDK](https://github.com/Microsoft/code-push/tree/master/sdk), which allows you to manage and automate the needs of your Cordova and React Native apps. To get started using CodePush, refer to our [documentation](http://microsoft.github.io/code-push/index.html#getting_started), otherwise, read the following steps if you'd like to build/contribute to the project from source.

## Dev Setup

Expand Down
2 changes: 1 addition & 1 deletion cli/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CodePush management CLI
# CodePush Management CLI

CodePush is a cloud service that enables Cordova and React Native developers to deploy mobile app updates directly to their users' devices. It works by acting as a central repository that developers can publish updates to (JS, HTML, CSS and images), and that apps can query for updates from (using the provided client SDKs for [Cordova](http://github.com/Microsoft/cordova-plugin-code-push) and [React Native](http://github.com/Microsoft/react-native-code-push)). This allows you to have a more deterministic and direct engagement model with your user base, when addressing bugs and/or adding small features that don't require you to re-build a binary and re-distribute it through the respective app stores.

Expand Down
86 changes: 86 additions & 0 deletions sdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# CodePush Management SDK (Node.js)

A JavaScript library for programmatically managing your CodePush account (e.g. creating apps, promoting releases), which allows authoring Node.js-based build and/or deployment scripts, without needing to shell out to the [CLI](https://github.com/Microsoft/code-push/blob/master/cli/README.md).


## Getting Started

1. Create an access key to authenticate with the CodePush server using the following CodePush CLI command:

```shell
code-push access-key add "DESCRIPTION_OF_THE_KEY"
```

If you already created a key that you want to use here, then you can retrieve it by running `code-push access-key ls` and using the value of the `Key` column for the key you wish to use.

2. Install the management SDK by running `npm install code-push --save`

3. Import it using the following statement (using ES6 syntax as applicable):

```javascript
var CodePush = require("code-push");
```

4. Create an instance of the `CodePush` class, passing it the access key you created or retrieved in step #1:

```javascript
var codePush = new CodePush("YOUR_ACCESS_KEY");
```

5. Begin automating the management of your account! For more details on what you can do with this `codePush` object, refer to the API reference section below.

## API Reference

The `code-push` module exports a single class (typically referred to as `CodePush`), which represents a proxy to the CodePush account management REST API. This class has a single constructor for authenticating with the CodePush service, and a collection of instance methods that correspond to the commands in the management [CLI](https://github.com/Microsoft/code-push/blob/master/cli/README.md), which allow you to programmatically control every aspect of your CodePush account.

### Constructors

- __CodePush(accessKey: string)__ - Creates a new instance of the CodePush management SDK, using the specified access key to authenticated with the server.

### Methods

- __addAccessKey(description: string): Promise<AccessKey>__ - Creates a new access key with the specified description (e.g. "VSTS CI").

- __addApp(appName: string): Promise<App>__ - Creates a new CodePush app with the specified name.

- __addCollaborator(appName: string, email: string): Promise<void>__ - Adds the specified CodePush user as a collaborator to the specified CodePush app.

- __addDeployment(appName: string, deploymentName: string): Promise<Deployment>__ - Creates a new deployment with the specified name, and associated with the specified app.

- __getAccessKey(accessKey: string): Promise<AccessKey>__ - Retrieves the metadata about the specific access key.

- __getAccessKeys(): Promise<AccessKey[]>__ - Retrieves the list of access keys associated with your CodePush account.

- __getApp(appName: string): Promise<App>__ - Retrieves the metadata about the specified app.

- __getApps(): Promise<App[]>__ - Retrieves the list of apps associated with your CodePush account.

- __getCollaborators(appName: string): Promise<CollaboratorMap>__ - Retrieves the list of collaborators associated with the specified app.

- __getDeployment(appName: string, deploymentName: string): Promise<Deployment>__ - Retrieves the metadata for the specified app deployment.

- __getDeploymentHistory(appName: string, deploymentName: string): Promise<Package[]>__ - Retrieves the list of releases that have been made to the specified app deployment.

- __getDeploymentMetrics(appName: string, deploymentName): Promise<DeploymentMetrics>__ - Retrieves the installation metrics for the specified app deployment.

- __getDeployments(appName: string): Promose<Deployment[]>__ - Retrieves the list of deployments associated with the specified app.

- __promote(appName: string, sourceDeploymentName: string, destDeploymentName: string): Promise<void>__ - Promotes the latest release from one deployment to another for the specified app.

- __release(appName: string, deploymentName: string, updateContentsPath: string, targetBinaryVersion: string, description?: string, isMandatory: boolean = false): Promise<void>__ - Releases a new update to the specified deployment.

- __removeAccessKey(accessKey: string): Promise<void>__ - Removes the specified access key from your CodePush account.

- __removeApp(appName: string): Promise<void>__ - Deletes the specified CodePush app from your account.

- __removeCollaborator(appName: string, email: string): Promise<void>__ - Removes the specified account as a collaborator from the specified app.

- __removeDeployment(appName: string, deploymentName: string): Promise<void>__ - Removes the specified deployment from the specified app.

- __renameApp(oldAppName: string, newAppName: string): Promise<void>__ - Renames an existing app.

- __renameDeployment(appName: string, oldDeploymentName: string, newDeploymentName: string): Promise<void>__ - Renames an existing deployment within the specified app.

- __rollback(appName: string, deploymentName: string, targetRelease?: string): Promise<void>__ - Rolls back the latest release within the specified deployment. Optionally allows you to target a specific release in the deployment's history, as opposed to rolling to the previous release.
- __transferApp(appName: string, email: string): Promise<void>__ - Transfers the ownership of the specified app to the specified account.

0 comments on commit aff8bab

Please sign in to comment.