This commit is contained in:
Anna Kocheshkova 2018-04-19 16:12:53 +03:00
Родитель 3c69650b7e
Коммит 0a2835473f
135 изменённых файлов: 22 добавлений и 32180 удалений

Просмотреть файл

@ -68,30 +68,6 @@ For more details about configuring and debugging Expo applications see [Expo doc
You can add VSCode tasks to build an .apk file and generate iOS/Android bundles. See [here](doc/tasks.md) for more info.
## Using with React Native CodePush
We have added basic support for [react-native-code-push](https://github.com/Microsoft/react-native-code-push) npm package.
This is our first release of this feature and we would love to hear any feedback from you to make things better.
Please [feel free to reach us](https://github.com/Microsoft/vscode-react-native/issues) in case of any issues or questions.
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). [How does it work?](https://github.com/Microsoft/react-native-code-push#how-does-it-work)
To use it with your current project you should have the following things to be done:
1) Your currently opened project should be `react-native` one
2) You should have added `react-native-code-push` package into your project
3) You should have an app already created in [Microsoft AppCenter](https://appcenter.ms/) and configured react-native-code-push for your project:
* [How to configure React Native CodePush](https://github.com/Microsoft/react-native-code-push#getting-started)
* [How to create an App in the AppCenter portal](https://docs.microsoft.com/en-us/appcenter/sdk/getting-started/react-native#2-create-your-app-in-the-app-center-portal-to-obtain-the-app-secret)
To start using CodePush with current extension please do the following:
1) Login to AppCenter from CodePush status bar
2) Set current app that will be used for further code-push releases
3) Configure AppVersion/IsMandatory for release (optional)
4) Click on CodePush status bar and select `Releae React` command to make new CodePush release
For more details about configuring and using React Native CodePush applications see [this link](doc/rncp.md).
## Contributing
Please see our [contributing guide](CONTRIBUTING.md) for more information

Просмотреть файл

@ -1,55 +0,0 @@
## Using React Native CodePush with current extension
If you have added [react-native-code-push](https://github.com/Microsoft/react-native-code-push) npm package to your `react-native` project you will be able to make CodePush releases directly from the VSCode.
*Note*: You should create an app in [Microsoft AppCenter](https://appcenter.ms/) and configure `react-native-code-push` according to [docs](https://github.com/Microsoft/react-native-code-push#getting-started).
### Logging in to AppCenter
To login to Microsoft AppCenter click on CodePush status bar control and execute login
![rncp-login-to-appcenter](../images/rncp-login.png)
### Using React Native CodePush commands
From the Command Palette use the React Native Code Push:{Command Name} to run the command
![rncp-commands](../images/rncp-commands.png)
### Using React Native CodePush from status bar
When you are logged in to AppCenter mostly used commands will be avaliable when clicking on CodePush status bar control
![rncp-status-bar-commands](../images/rncp-menu-commands.png)
### Using `codepush.json` for CodePush releases
Please notice that the extension creates `.vscode/codepush.json` file in the project root to store codepush relative data. You could inspect it and change some values manually although we recommend to do it via appropriate `React Native CodePush` commands or via `CodePush` menu in the status bar.
```
{
"userId": "c4217868-8861-45b9-8f22-0ccc29125841",
"userName": "user-name",
"displayName": "display-name",
"email": "test@aaa.com",
"defaultApp": {
"ownerName": "owner-name",
"appName": "app-name",
"identifier": "owner-name/app-name",
"os": "ios",
"targetBinaryVersion": "",
"isMandatory": false,
"currentAppDeployments": {
"codePushDeployments": [
{
"name": "Staging"
},
{
"name": "Production"
}
],
"currentDeploymentName": "Staging"
}
}
}
```

Просмотреть файл

@ -85,8 +85,7 @@ var lintSources = [
].map(function (tsFolder) { return tsFolder + "/**/*.ts"; });
lintSources = lintSources.concat([
"!src/typings/**",
"!test/resources/sampleReactNative022Project/**",
"!src/extension/appcenter/lib/**"
"!test/resources/sampleReactNative022Project/**"
]);
var libtslint = require("tslint");
@ -121,7 +120,7 @@ function test() {
gulp.task("test", ["build", "tslint"], test);
gulp.task('coverage:instrument', function () {
return gulp.src(["src/**/*.js", "!test/**", "!src/extension/appcenter/lib/**"])
return gulp.src(["src/**/*.js", "!test/**"])
.pipe(istanbul({
// Use the isparta instrumenter (code coverage for ES6)
instrumenter: isparta.Instrumenter,
@ -133,7 +132,7 @@ gulp.task('coverage:instrument', function () {
gulp.task('coverage:report', function (done) {
return gulp.src(
["src/**/*.js", "!test/**", "!src/extension/appcenter/lib/**"],
["src/**/*.js", "!test/**"],
{ read: false }
)
.pipe(istanbul.writeReports({
@ -170,11 +169,9 @@ gulp.task("check-copyright", function (cb) {
"!**/*.d.ts",
"!coverage/**",
"!node_modules/**",
"!lib/**",
"!test/**/*.js",
"!SampleApplication/**",
"!test/resources/sampleReactNative022Project/**/*.js",
"!src/extension/appcenter/lib/**",
"!test/resources/sampleReactNative022Project/**/*.js"
])
.pipe(copyright());
});
@ -187,12 +184,10 @@ gulp.task("clean", function () {
var del = require("del");
var pathsToDelete = [
"src/**/*.js",
"!src/extension/appcenter/lib/**/*.js",
"src/**/*.js.map",
"test/**/*.js",
"test/**/*.js.map",
"out/",
"!src/extension/codepush/api/codepush-sdk/**/*.js",
"!test/resources/sampleReactNative022Project/**/*.js",
".vscode-test/"
]
@ -237,4 +232,4 @@ gulp.task("release", ["build"], function () {
fs.writeFileSync(path.join(__dirname, fileName), fs.readFileSync(path.join(backupFolder, fileName)));
});
});
});
});

Просмотреть файл

@ -12,9 +12,7 @@
"description": "Code-hinting, debugging and integrated commands for React Native",
"keywords": [
"react-native",
"multi-root ready",
"app-center",
"code-push"
"multi-root ready"
],
"bugs": "https://github.com/Microsoft/vscode-react-native/issues",
"license": "SEE LICENSE IN LICENSE.txt",
@ -42,17 +40,7 @@
"onCommand:reactNative.restartPackager",
"onCommand:reactNative.publishToExpHost",
"onCommand:reactNative.showDevMenu",
"onCommand:reactNative.reloadApp",
"onCommand:reactNative.appcenter.login",
"onCommand:reactNative.appcenter.logout",
"onCommand:reactNative.appcenter.whoami",
"onCommand:reactNative.appcenter.setcurrentapp",
"onCommand:reactNative.appcenter.getcurrentapp",
"onCommand:reactNative.appcenter.setcurrentdeployment",
"onCommand:reactNative.appcenter.releasereact",
"onCommand:reactNative.switchMandatoryPropForRelease",
"onCommand:reactNative.setTargetBinaryVersion",
"onCommand:reactNative.showmenu"
"onCommand:reactNative.reloadApp"
],
"main": "./src/extension/rn-extension",
"contributes": {
@ -100,56 +88,6 @@
{
"command": "reactNative.reloadApp",
"title": "React Native: Reload App"
},
{
"command": "reactNative.appcenter.login",
"title": "Login",
"category": "React Native Code Push"
},
{
"command": "reactNative.appcenter.logout",
"title": "Logout",
"category": "React Native Code Push"
},
{
"command": "reactNative.appcenter.whoami",
"title": "WhoAmI",
"category": "React Native Code Push"
},
{
"command": "reactNative.appcenter.setcurrentapp",
"title": "Set Current App",
"category": "React Native Code Push"
},
{
"command": "reactNative.appcenter.getcurrentapp",
"title": "Get Current App",
"category": "React Native Code Push"
},
{
"command": "reactNative.appcenter.setcurrentdeployment",
"title": "Set Current Deployment",
"category": "React Native Code Push"
},
{
"command": "reactNative.appcenter.releasereact",
"title": "Release React",
"category": "React Native Code Push"
},
{
"command": "reactNative.appcenter.switchMandatoryPropForRelease",
"title": "Switch Code Push release mandatory property",
"category": "React Native Code Push"
},
{
"command": "reactNative.appcenter.setTargetBinaryVersion",
"title": "Set Code Push release target binary verison",
"category": "React Native Code Push"
},
{
"command": "reactNative.appcenter.showmenu",
"title": "Show Menu",
"category": "React Native Code Push"
}
],
"debuggers": [
@ -536,30 +474,6 @@
],
"default": "Info",
"scope": "resource"
},
"react-native-tools.appcenter.loginendpoint": {
"description": "Endpoint to login to appcenter",
"type": "string",
"default": "https://appcenter.ms/cli-login",
"scope": "resource"
},
"react-native-tools.appcenter.api.endpoint": {
"description": "API Endpoint to appcenter",
"type": "string",
"default": "https://api.appcenter.ms",
"scope": "resource"
},
"react-native-tools.appcenter.legacycodepushservice": {
"description": "Legacy codepush service endpoint",
"type": "string",
"default": "https://codepush-management.azurewebsites.net/",
"scope": "resource"
},
"react-native-tools.appcenter.legacycodepushserviceenabled": {
"description": "Select if legacy service is used for CodePush release",
"type": "boolean",
"default": true,
"scope": "resource"
}
}
}
@ -572,57 +486,28 @@
"postinstall": "node ./node_modules/vscode/bin/install"
},
"dependencies": {
"chalk": "^2.3.0",
"crypto": "^1.0.1",
"date-fns": "^1.29.0",
"extract-opts": "2.2.0",
"flatten-source-map": "0.0.2",
"gradle-to-js": "^1.0.1",
"jsonwebtoken": "^8.1.1",
"jszip": "^3.1.5",
"lodash": "^4.17.5",
"mkdirp": "^0.5.1",
"moment": "^2.21.0",
"ms-rest": "^2.2.5",
"node-noop": "^1.0.0",
"noice-json-rpc": "^1.0.2",
"open": "0.0.5",
"opener": "^1.4.3",
"options": "0.0.6",
"plist": "^2.1.0",
"properties": "^1.2.1",
"q": "1.4.1",
"qr-image": "^3.2.0",
"qs": "^6.4.0",
"request": "^2.83.0",
"rimraf": "^2.6.2",
"rx-lite": "^4.0.8",
"semver": "^5.5.0",
"source-map": "0.5.2",
"semver": "5.1.0",
"source-map-resolve": "^0.5.0",
"strip-json-comments": "2.0.1",
"temp": "^0.8.3",
"typechecker": "2.0.8",
"ultron": "1.0.2",
"vscode-chrome-debug-core": "^3.17.3",
"vscode-debugadapter": "^1.23.0",
"vscode-debugprotocol": "^1.23.0",
"vscode-extension-telemetry": "0.0.5",
"which": "^1.3.0",
"ws": "^3.2.0",
"xml2js": "^0.4.19",
"yazl": "^2.4.3"
"ws": "^3.2.0"
},
"devDependencies": {
"@types/lodash": "^4.14.74",
"@types/mocha": "^2.2.40",
"@types/mock-fs": "^3.6.30",
"@types/open": "^0.0.29",
"@types/opener": "^1.4.0",
"@types/node": "^6.0.65",
"@types/qr-image": "^3.2.0",
"@types/qs": "^6.5.0",
"@types/request": "^2.47.0",
"@types/rx-lite": "4.0.4",
"@types/shelljs": "^0.7.0",
"@types/source-map": "0.5.2",
"@types/source-map-support": "^0.2.28",
@ -635,9 +520,11 @@
"gulp-preprocess": "^2.0.0",
"gulp-sourcemaps": "^1.6.0",
"gulp-tslint": "^8.1.2",
"gulp-typescript": "^3.1.5",
"gulp-util": "^3.0.7",
"isparta": "^4.0.0",
"minimist": "^1.2.0",
"mocha": "^3.2.0",
"mocha-teamcity-reporter": "^1.0.0",
"mock-fs": "^4.4.1",
"remap-istanbul": "^0.9.5",
@ -646,30 +533,19 @@
"sinon": "^1.17.3",
"source-map-support": "^0.4.0",
"through2": "^2.0.1",
"tslint": "^5.6.0",
"typescript": "2.4.2",
"vsce": "^1.3.0",
"vscode": "^1.1.6",
"@types/chalk": "^2.2.0",
"@types/date-fns": "^2.6.0",
"@types/jsonwebtoken": "^7.2.5",
"@types/jszip": "^3.1.3",
"@types/mkdirp": "^0.5.2",
"@types/rimraf": "^2.0.2",
"@types/semver": "^5.5.0",
"@types/temp": "^0.8.31",
"@types/which": "^1.3.1",
"@types/xml2js": "^0.4.2",
"gulp-install": "^1.1.0",
"gulp-sequence": "1.0.0",
"gulp-typescript": "^3.1.5",
"jest": "^22.1.4",
"jest-cli": "^22.1.4",
"rmdir": "^1.2.0",
"testdouble": "^3.3.3",
"ts-jest": "^22.0.3",
"ts-node": "^4.1.0",
"tslint": "^5.6.0",
"tslint-microsoft-contrib": "^5.0.2"
"tslint-microsoft-contrib": "^5.0.2",
"vscode": "^1.1.6"
},
"extensionDependencies": [
"ms-vscode.node-debug2"

Просмотреть файл

@ -15,17 +15,6 @@ export enum InternalErrorCode {
FailedToStartExponentPackager = 110,
FailedToPublishToExpHost = 111,
FailedToExecAppCenterLogin = 112,
FailedToExecAppCenterLogout = 113,
FailedToExecAppCenterWhoAmI = 114,
FailedToExecAppCenterSetCurrentApp = 115,
FailedToExecAppCenterGetCurrentApp = 116,
FailedToExecAppCenterReleaseReact = 117,
FailedToExecAppCenterSetCurrentDeployment = 118,
FailedToExecAppCenterShowMenu = 119,
FailedToExecAppCenterSwitchMandatoryPropForRelease = 120,
FailedToExecAppCenterSetTargetBinaryVersionForRelease = 121,
// Device Deployer errors
IOSDeployNotFound = 201,

Просмотреть файл

@ -206,7 +206,7 @@ export function makeSession(
export function makeAdapter(debugAdapterClass: typeof ChromeDebugAdapter): typeof ChromeDebugAdapter {
return class extends debugAdapterClass {
public doAttach(port: number, targetUrl?: string, address?: string, timeout?: number): Promise<void | DebugProtocol.Capabilities> {
public doAttach(port: number, targetUrl?: string, address?: string, timeout?: number): Promise<void> {
// We need to overwrite ChromeDebug's _attachMode to let Node2 adapter
// to set up breakpoints on initial pause event
(this as any)._attachMode = false;

Просмотреть файл

@ -1,6 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import AppCenterClientCredentials = require("../lib/app-center-node-client/src/appCenterClientCredentials");
export { AppCenterClientCredentials };

Просмотреть файл

@ -1,45 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import AppCenterClient from "../lib/app-center-node-client/index";
import { AppCenterClientCredentials } from "./appCenterClientCredentials";
import * as Q from "q";
import { Profile } from "../auth/profile/profile";
export interface AppCenterClientFactory {
fromToken(token: string | Q.Promise<string> | {(): Q.Promise<string>}, endpoint: string): AppCenterClient;
fromProfile(user: Profile, endpoint: string): AppCenterClient | null;
}
export function createAppCenterClient(): AppCenterClientFactory {
return {
fromToken(token: string | Q.Promise<string> | {(): Q.Promise<string>}, endpoint: string): AppCenterClient {
let tokenFunc: {(): Q.Promise<string>};
if (typeof token === "string") {
tokenFunc = () => Q.resolve(<string>token);
} else if (typeof token === "object") {
tokenFunc = () => <Q.Promise<string>>token;
} else {
tokenFunc = token;
}
return new AppCenterClient(new AppCenterClientCredentials(tokenFunc), endpoint);
},
fromProfile(user: Profile, endpoint): AppCenterClient | null {
if (!user) {
return null;
}
return new AppCenterClient(new AppCenterClientCredentials(() => user.accessToken), endpoint);
},
};
}
export function getQPromisifiedClientResult<T>(action: Promise<T>): Q.Promise<T> {
return Q.Promise((resolve, reject) => {
action.then((result: T) => {
resolve(result);
}).catch((e) => {
reject(e);
});
});
}

Просмотреть файл

@ -1,8 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import AppCenterClient from "../lib/app-center-node-client";
import * as models from "../lib/app-center-node-client/models";
export { AppCenterClient, models };
export { AppCenterClientFactory, createAppCenterClient, getQPromisifiedClientResult } from "./createClient";

Просмотреть файл

@ -1,106 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import { ILogger, LogLevel } from "../log/LogHelper";
import * as Q from "q";
import { AppCenterCommandExecutor } from "./command/commandExecutor";
import Auth from "../appcenter/auth/auth";
import { AppCenterClient } from "./api/index";
import { Profile } from "./auth/profile/profile";
import { AppCenterClientFactory, createAppCenterClient } from "./api/createClient";
import { SettingsHelper } from "../settingsHelper";
import { AppCenterCommandType } from "./appCenterConstants";
import { AppCenterExtensionManager } from "./appCenterExtensionManager";
import { ACStrings } from "./appCenterStrings";
import { ACUtils } from "./helpers/utils";
import { VsCodeUtils } from "./helpers/vscodeUtils";
export class AppCenterCommandPalleteHandler {
private commandExecutor: AppCenterCommandExecutor;
private client: AppCenterClient;
private logger: ILogger;
private clientFactory: AppCenterClientFactory;
private appCenterManager: AppCenterExtensionManager;
constructor(logger: ILogger) {
this.commandExecutor = new AppCenterCommandExecutor(logger);
this.clientFactory = createAppCenterClient();
this.logger = logger;
}
public set AppCenterManager(manager: AppCenterExtensionManager) {
this.appCenterManager = manager;
}
public run(command: AppCenterCommandType): Q.Promise<void> {
return ACUtils.isCodePushProject(this.appCenterManager.projectRootPath).then((isCodePush: boolean) => {
if (!isCodePush) {
VsCodeUtils.ShowWarningMessage(ACStrings.NoCodePushDetectedMsg);
return Q.resolve(void 0);
} else {
// Login is special case
if (command === AppCenterCommandType.Login) {
return this.commandExecutor.login(this.appCenterManager);
}
return Auth.getProfile(this.appCenterManager.projectRootPath).then((profile: Profile) => {
if (!profile) {
VsCodeUtils.ShowWarningMessage(ACStrings.UserIsNotLoggedInMsg);
return Q.resolve(void 0);
} else {
const clientOrNull: AppCenterClient | null = this.resolveAppCenterClient(profile);
if (clientOrNull) {
this.client = clientOrNull;
switch (command) {
case (AppCenterCommandType.Logout):
return this.commandExecutor.logout(this.appCenterManager);
case (AppCenterCommandType.Whoami):
return this.commandExecutor.whoAmI(this.appCenterManager);
case (AppCenterCommandType.SetCurrentApp):
return this.commandExecutor.setCurrentApp(this.client, this.appCenterManager);
case (AppCenterCommandType.GetCurrentApp):
return this.commandExecutor.getCurrentApp(this.appCenterManager);
case (AppCenterCommandType.SetCurrentDeployment):
return this.commandExecutor.setCurrentDeployment(this.appCenterManager);
case (AppCenterCommandType.CodePushReleaseReact):
return this.commandExecutor.releaseReact(this.client, this.appCenterManager);
case (AppCenterCommandType.ShowMenu):
return this.commandExecutor.showMenu(this.client, this.appCenterManager);
case (AppCenterCommandType.SwitchMandatoryPropForRelease):
return this.commandExecutor.switchIsMandatoryForRelease(this.appCenterManager);
case (AppCenterCommandType.SetTargetBinaryVersionForRelease):
return this.commandExecutor.setTargetBinaryVersionForRelease(this.appCenterManager);
default:
throw new Error("Unknown App Center command!");
}
} else {
this.logger.log("Failed to get App Center client", LogLevel.Error);
throw new Error("Failed to get App Center client!");
}
}
});
}
});
}
private resolveAppCenterClient(profile: Profile): AppCenterClient | null {
if (!this.client) {
if (profile) {
return this.clientFactory.fromProfile(profile, SettingsHelper.getAppCenterAPIEndpoint());
} else {
throw new Error("No App Center user specified!");
}
}
return this.client;
}
}

Просмотреть файл

@ -1,76 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
export class ACConstants {
public static ExtensionPrefixName: string = "reactNative";
public static AppCenterExtensionName: string = "appcenter";
public static DefaulAPIEndPoint: string = "https://api.appcenter.ms";
public static DefaultLoginEndPoint: string = "https://appcenter.ms/cli-login";
public static DefaultLegacyCodePushService: string = "https://codepush-management.azurewebsites.net/";
public static CodePushNpmPackageName: string = "react-native-code-push";
public static AppCenterReactNativePlatformName: string = "React-Native";
public static AppCenterCodePushStatusBarColor: string = "#F3F3B2";
public static AppCenterDefaultTargetBinaryVersion: string = "";
public static AppCenterDefaultIsMandatoryParam: boolean = false;
}
export class ACCommandNames {
public static CommandPrefix: string = ACConstants.AppCenterExtensionName + ".";
public static Login: string = ACCommandNames.CommandPrefix + "login";
public static Logout: string = ACCommandNames.CommandPrefix + "logout";
public static WhoAmI: string = ACCommandNames.CommandPrefix + "whoami";
public static SetCurrentApp: string = ACCommandNames.CommandPrefix + "setcurrentapp";
public static GetCurrentApp: string = ACCommandNames.CommandPrefix + "getcurrentapp";
public static SetCurrentDeployment: string = ACCommandNames.CommandPrefix + "setcurrentdeployment";
public static CodePushReleaseReact: string = ACCommandNames.CommandPrefix + "releasereact";
public static ShowMenu: string = ACCommandNames.CommandPrefix + "showmenu";
public static SwitchMandatoryPropertyForRelease: string = ACCommandNames.CommandPrefix + "switchMandatoryPropForRelease";
public static SetTargetBinaryVersionForRelease: string = ACCommandNames.CommandPrefix + "setTargetBinaryVersion";
}
export interface Deployment {
name: string;
}
export interface CurrentAppDeployments {
currentDeploymentName: string;
codePushDeployments: Deployment[];
}
export enum AppCenterOS {
ios = "ios",
android = "android",
}
export enum AppCenterLoginType {
Interactive,
Token,
}
export enum AppCenterCommandType {
// Auth commands
Login = 1,
Logout,
Whoami,
// App commands
SetCurrentApp,
GetCurrentApp,
// Deployment commands
SetCurrentDeployment,
// CodePush commands
CodePushReleaseReact,
SwitchMandatoryPropForRelease,
SetTargetBinaryVersionForRelease,
// Common commands
ShowMenu,
}
export enum MessageTypes {
Error = 0,
Warn = 1,
Info = 2,
}

Просмотреть файл

@ -1,58 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import { Disposable, StatusBarAlignment, StatusBarItem, window } from "vscode";
import Auth from "../appcenter/auth/auth";
import { ACStrings } from "./appCenterStrings";
import * as Q from "q";
import { ACCommandNames, ACConstants } from "./appCenterConstants";
import { Profile } from "./auth/profile/profile";
import { ACUtils } from "./helpers/utils";
import { VsCodeUtils } from "./helpers/vscodeUtils";
export class AppCenterExtensionManager implements Disposable {
private appCenterStatusBarItem: StatusBarItem;
private _projectRootPath: string;
public constructor(projectRootPath: string) {
this._projectRootPath = projectRootPath;
}
public get projectRootPath(): string {
return this._projectRootPath;
}
public setup(): Q.Promise<void> {
return ACUtils.isCodePushProject(this._projectRootPath).then((isCodePush: boolean) => {
if (!isCodePush) {
return Q.resolve(void 0);
} else {
this.appCenterStatusBarItem = window.createStatusBarItem(StatusBarAlignment.Left, 12);
return Auth.getProfile(this._projectRootPath).then((profile: Profile | null) => {
return this.setupAppCenterStatusBar(profile);
});
}
});
}
public dispose() {
if (this.appCenterStatusBarItem) {
this.appCenterStatusBarItem.dispose();
}
}
public setupAppCenterStatusBar(profile: Profile | null): Q.Promise<void> {
if (profile && profile.userName) {
return VsCodeUtils.setStatusBar(this.appCenterStatusBarItem,
`$(icon octicon-person) ${profile.userName}`,
ACStrings.YouAreLoggedInMsg(profile.userName),
`${ACConstants.ExtensionPrefixName}.${ACCommandNames.ShowMenu}`
);
}
return VsCodeUtils.setStatusBar(this.appCenterStatusBarItem,
`$(icon octicon-sign-in) ${ACStrings.LoginToAppCenterButton}`,
ACStrings.UserMustSignIn,
`${ACConstants.ExtensionPrefixName}.${ACCommandNames.Login}`
);
}
}

Просмотреть файл

@ -1,86 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import { DefaultApp } from "./command/commandParams";
export class ACStrings {
public static OkBtnLabel: string = "Ok";
public static UserMustSignIn: string = "You are signed out. Please login to App Center";
public static SelectLoginTypeMsg: string = "Select the way you would like to authenticate with App Center";
public static PleaseProvideToken: string = "Please provide token to authenticate";
public static PleaseLoginViaBrowser: string = "We are about to launch a browser window so you can automatically create an App Center API token";
public static UserLoggedOutMsg: string = "Successfully logged out of App Center";
public static UserIsNotLoggedInMsg: string = "You are not logged into App Center";
public static LogoutPrompt: string = "Please execute logout to signoff from App Center";
public static NoCodePushDetectedMsg: string = "Please install React Native Code Push package to run this command!";
public static NoCurrentAppSetMsg: string = "No current app specified";
public static NoCurrentDeploymentSetMsg: string = "No current deployment";
public static PleaseProvideCurrentAppMsg: string = "Please click here to specify current app";
public static PleaseProvideCurrentDeploymentMsg: string = "Please click here to specify current deployment";
public static ProvideCurrentAppPromptMsg: string = "Please specify an App Center app";
public static InvalidCurrentAppNameMsg: string = "Sorry, provided app name is invalid";
public static InvalidAppVersionParamMsg: string = "Sorry, provided app version is invalid";
public static FailedToExecuteLoginMsg: string = "Failed to execute login to App Center";
public static SelectCurrentDeploymentMsg: string = "Please select current deployment";
public static FetchAppsStatusBarMessage: string = "Fetching current apps for you...";
public static FetchDeploymentsStatusBarMessage: string = "Fetching app deployments for you...";
public static GettingAppInfoMessage: string = "Getting app info...";
public static DetectingAppVersionMessage: string = "Detecting app version...";
public static RunningBundleCommandMessage: string = "Running bundle command...";
public static ArchivingUpdateContentsMessage: string = "Archiving update contents...";
public static ReleasingUpdateContentsMessage: string = "Releasing update contents to CodePush...";
public static LoginToAppCenterButton: string = "Login to App Center";
public static PleaseProvideTargetBinaryVersion: string = "Please provide semver compliant version";
public static LogoutMenuLabel: string = "Logout";
public static MenuTitlePlaceholder: string = "Please select action";
public static YouAreLoggedInMsg: (name: string) => string = (name: string) => {
return `You are logged into App Center as '${name}'`;
}
public static YourCurrentAppMsg: (appName: string) => string = (appName: string) => {
return `Your current app is '${appName}'`;
}
public static YourCurrentAppAndDeployemntMsg: (appName: string, deploymentName: string) => string = (appName: string, deploymentName: string) => {
if (deploymentName) {
return `Your current app is '${appName}', current deployment is '${deploymentName}'`;
} else {
return `Your current app is '${appName}', you have no deployments specified`;
}
}
public static YourCurrentDeploymentMsg: (deploymentName: string) => string = (deploymentName: string) => {
return `Your current deployment is '${deploymentName}'`;
}
public static ReleaseReactMenuText: (app: DefaultApp | null) => string = (app: DefaultApp | null) => {
if (app) {
return `Release '${app.appName}' to '${app.currentAppDeployments.currentDeploymentName}' deployment`;
} else {
return `Release react (please specify current app first)`;
}
}
public static SetCurrentAppMenuText: (app: DefaultApp | null) => string = (app: DefaultApp | null) => {
if (app) {
return `Change '${app.appName}' to a different app`;
} else {
return `Set current app`;
}
}
public static SetCurrentAppDeploymentText: (app: DefaultApp) => string = (app: DefaultApp) => {
return `Change '${app.currentAppDeployments.currentDeploymentName}' to a different deployment`;
}
public static SetCurrentAppTargetBinaryVersionText: (app: DefaultApp) => string = (app: DefaultApp) => {
const targetBinaryVersionProvided = app.targetBinaryVersion !== undefined && app.targetBinaryVersion;
return `Change ${targetBinaryVersionProvided ? `'${app.targetBinaryVersion}'` : "automatically fetched"} target binary version`;
}
public static SetCurrentAppIsMandatoryText: (app: DefaultApp) => string = (app: DefaultApp) => {
const isMandatory = app.isMandatory !== undefined && app.isMandatory;
return `Change release to ${isMandatory ? "be not Mandatory" : "be Mandatory"}`;
}
}

Просмотреть файл

@ -1,58 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import * as Q from "q";
import { SettingsHelper } from "../../../extension/settingsHelper";
import { createAppCenterClient, getQPromisifiedClientResult } from "../api/index";
import { Profile, saveUser, deleteUser, getUser } from "../auth/profile/profile";
import * as models from "../lib/app-center-node-client/models";
export default class Auth {
public static getProfile(projectRootPath: string): Q.Promise<Profile | null> {
const profile: Profile | null = getUser(projectRootPath);
if (profile) {
return Q.resolve(profile);
} else {
return Q.resolve(null);
}
}
public static doTokenLogin(token: string, projectRootPath: string): Q.Promise<Profile | null> {
if (!token) {
return Q.resolve(null);
}
return this.removeLoggedInUser(projectRootPath).then(() => {
return Auth.fetchUserInfoByTokenAndSave(token, projectRootPath).then((profile: Profile) => {
return Q.resolve(profile);
}).catch((e: Error) => {
return Q.resolve(null);
});
});
}
public static doLogout(projectRootPath: string): Q.Promise<void> {
// TODO: Probably we need to delete token from server also?
return this.removeLoggedInUser(projectRootPath);
}
private static fetchUserInfoByTokenAndSave(token: string, projectRootPath: string): Q.Promise<Profile> {
return Auth.getUserInfo(token).then(userResponse => {
return saveUser(userResponse, { token: token }, projectRootPath).then((profile: Profile) => {
return Q.resolve(profile);
});
}).catch((e: any) => {
throw e;
});
}
private static getUserInfo(token: string): Q.Promise<models.UserProfileResponse> {
const client = createAppCenterClient().fromToken(token, SettingsHelper.getAppCenterAPIEndpoint());
return getQPromisifiedClientResult(client.account.users.get());
}
private static removeLoggedInUser(projectRootPath: string): Q.Promise<void> {
return deleteUser(projectRootPath).then(() => {
return Q.resolve(void 0);
}).catch(() => { }); // Noop, it's ok if deletion fails
}
}

Просмотреть файл

@ -1,12 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import * as path from "path";
export const profileDirName = ".vscode";
export const profileFile = "codepush.json";
export function getProfileDir(projectRootPath: string): string {
const profileDir = path.join(projectRootPath, profileDirName);
return profileDir;
}

Просмотреть файл

@ -1,120 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import * as fs from "fs";
import * as path from "path";
import * as mkdirp from "mkdirp";
import * as Q from "q";
import { TokenValueType, tokenStore } from "../tokenStore/index";
import { getProfileDir, profileFile } from "./getProfileDir";
import { DefaultApp } from "../../command/commandParams";
export interface Profile {
userId: string;
userName: string;
displayName: string;
email: string;
readonly accessToken: Q.Promise<string>;
defaultApp?: DefaultApp;
save(projectRootPath: string): Profile;
logout(projectRootPath: string): Q.Promise<void>;
}
class ProfileImpl implements Profile {
public userId: string;
public userName: string;
public displayName: string;
public email: string;
public defaultApp?: DefaultApp;
constructor(fileContents: any) {
this.userId = fileContents.userId || fileContents.id;
this.userName = fileContents.userName || fileContents.name;
this.displayName = fileContents.displayName;
this.email = fileContents.email;
this.defaultApp = fileContents.defaultApp;
}
get accessToken(): Q.Promise<string> {
const getter = tokenStore.get(this.userName)
.catch((err: Error) => {
// log error?
});
const emptyToken = "";
return getter.then((entry: any) => {
if (entry) {
return entry.accessToken.token;
}
return emptyToken;
}).catch((err: Error) => {
// Failed to get token from porfile, return no result
return emptyToken;
});
}
public save(projectRootPath: string): Profile {
let profile: any = {
userId: this.userId,
userName: this.userName,
displayName: this.displayName,
email: this.email,
defaultApp: this.defaultApp,
};
mkdirp.sync(getProfileDir(projectRootPath));
fs.writeFileSync(getProfileFilename(projectRootPath), JSON.stringify(profile, null, "\t"), { encoding: "utf8" });
return this;
}
public logout(projectRootPath: string): Q.Promise<void> {
return tokenStore.remove(this.userName).then(() => {
try {
fs.unlinkSync(getProfileFilename(projectRootPath));
} catch (err) {
// File not found is ok, probably doesn't exist
}
});
}
}
let currentProfile: Profile | null;
function getProfileFilename(projectRootPath: string): string {
const profileDir = getProfileDir(projectRootPath);
return path.join(profileDir, profileFile);
}
function loadProfile(projectRootPath: string): Profile | null {
const profilePath = getProfileFilename(projectRootPath);
if (!fs.existsSync(profilePath)) {
return null;
}
let profileContents = fs.readFileSync(profilePath, "utf8");
let profile: any = JSON.parse(profileContents);
return new ProfileImpl(profile);
}
export function getUser(projectRootPath: string): Profile | null {
if (!currentProfile) {
currentProfile = loadProfile(projectRootPath);
}
return currentProfile;
}
export function saveUser(user: any, token: TokenValueType, projectRootPath: string): Q.Promise<Profile> {
return tokenStore.set(user.name, token).then(() => {
let profile = new ProfileImpl(user);
profile.save(projectRootPath);
return profile;
});
}
export function deleteUser(projectRootPath: string): Q.Promise<void> {
let profile = getUser(projectRootPath);
if (profile) {
currentProfile = null;
return profile.logout(projectRootPath);
}
return Q.resolve(void 0);
}

Просмотреть файл

@ -1,84 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
//
// file-token-store - implementation of token store that stores the data in
// a JSON encoded file on dist.
//
// This doesn't secure the data in any way, relies on the directory having
// proper security settings.
//
import * as fs from "fs";
import * as rx from "rx-lite";
import { toPairs } from "lodash";
import * as Q from "q";
import { TokenEntry, TokenStore, TokenKeyType, TokenValueType } from "../tokenStore/tokenStore";
export class FileTokenStore implements TokenStore {
private filePath: string;
private tokenStoreCache: { [key: string]: TokenValueType } | undefined;
constructor(filePath: string) {
this.filePath = filePath;
this.tokenStoreCache = undefined;
}
public getStoreFilePath(): string {
return this.filePath;
}
public list(): rx.Observable<TokenEntry> {
this.loadTokenStoreCache();
return rx.Observable.from(toPairs(this.tokenStoreCache)).map(pair => ({ key: pair[0], accessToken: pair[1]}));
}
public get(key: TokenKeyType): Q.Promise<TokenEntry | null> {
this.loadTokenStoreCache();
let token;
if (this.tokenStoreCache) {
token = this.tokenStoreCache[key];
}
if (!token) {
return Q.resolve(null);
}
return Q<TokenEntry>({key: key, accessToken: token});
}
public set(key: TokenKeyType, value: TokenValueType): Q.Promise<void> {
this.loadTokenStoreCache();
if (this.tokenStoreCache) {
this.tokenStoreCache[key] = value;
}
this.writeTokenStoreCache();
return Q.resolve(void 0);
}
public remove(key: TokenKeyType): Q.Promise<void> {
this.loadTokenStoreCache();
if (this.tokenStoreCache) {
delete this.tokenStoreCache[key];
}
this.writeTokenStoreCache();
return Q.resolve(void 0);
}
private loadTokenStoreCache(): void {
if (!this.tokenStoreCache) {
try {
this.tokenStoreCache = JSON.parse(fs.readFileSync(this.filePath, "utf8"));
} catch (err) {
// No token cache file, creating new empty cache
this.tokenStoreCache = {};
}
}
}
private writeTokenStoreCache(): void {
fs.writeFileSync(this.filePath, JSON.stringify(this.tokenStoreCache));
}
}
export function createFileTokenStore(pathName: string): TokenStore {
return new FileTokenStore(pathName);
}

Просмотреть файл

@ -1,40 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import { TokenStore } from "./tokenStore";
import { createFileTokenStore } from "./fileTokenStore";
import * as path from "path";
import * as fs from "fs";
import * as os from "os";
export * from "./tokenStore";
export const tokenFile = "VSCodeAppCenterTokens.json";
let store: TokenStore;
const tokenDirName: string = ".vscode-react-native";
function getTokenDir(): string {
const tokenDir = path.join(getTokenDirParent(), tokenDirName);
return tokenDir;
}
function getTokenDirParent(): string {
if (os.platform() === "win32") {
return process.env.AppData;
} else {
return os.homedir();
}
}
// Currently only support file-base token store
const tokenFilePath = path.join(getTokenDir(), tokenFile);
if (!fs.existsSync(tokenFilePath)) {
if (!fs.existsSync(getTokenDir())) {
fs.mkdirSync(getTokenDir());
}
fs.writeFileSync(tokenFilePath, /* create empty */ "");
}
store = createFileTokenStore(tokenFilePath);
export const tokenStore = store;

Просмотреть файл

@ -1,37 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import { Observable } from "rx-lite";
import * as Q from "q";
export interface TokenStore {
// List all entries in the store for our project
list(): Observable<TokenEntry>;
// Get a specific token
get(key: TokenKeyType): Q.Promise<TokenEntry | null>;
// Add or update a token
set(key: TokenKeyType, token: TokenValueType): Q.Promise<void>;
// Remove a token
remove(key: TokenKeyType): Q.Promise<void> ;
}
// Information stored about in each token
export interface TokenEntry {
key: TokenKeyType;
accessToken: TokenValueType;
}
export interface TokenValueType {
token: string;
}
//
// Object used as token keys.
// Right now just a string, prepping for when we hook up to
// AAD and have to use ADAL tokens.
//
export type TokenKeyType = string;

Просмотреть файл

@ -1,81 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import * as which from "which";
import * as xml2js from "xml2js";
import * as fs from "fs";
import * as path from "path";
export function getAppVersion(projectRoot?: string): Promise<string> {
return new Promise<string>((resolve, reject) => {
let configString: string = "";
try {
projectRoot = projectRoot || process.cwd();
configString = fs.readFileSync(path.join(projectRoot, "config.xml"), { encoding: "utf8" });
} catch (error) {
reject(new Error(`Unable to find or read "config.xml" in the CWD. The "release-cordova" command must be executed in a Cordova project folder.`));
}
xml2js.parseString(configString, (err: Error, parsedConfig: any) => {
if (err) {
reject(new Error(`Unable to parse "config.xml" in the CWD. Ensure that the contents of "config.xml" is valid XML.`));
}
const config: any = parsedConfig.widget;
resolve(config["$"].version);
});
});
}
export function isValidOS(os: string): boolean {
switch (os.toLowerCase()) {
case "android":
case "ios":
return true;
default:
return false;
}
}
export function isValidPlatform(platform: string): boolean {
return platform.toLowerCase() === "cordova";
}
// Check whether the Cordova or PhoneGap CLIs are
// installed, and if not, fail early
export function getCordovaOrPhonegapCLI(): string {
let cordovaCLI: string = "cordova";
try {
which.sync(cordovaCLI);
return cordovaCLI;
} catch (e) {
cordovaCLI = "phonegap";
which.sync(cordovaCLI);
return cordovaCLI;
}
}
export function makeUpdateContents(os: string): string {
if (!isValidOS(os)) {
throw new Error(`Platform must be either "ios" or "android".`);
}
const projectRoot: string = process.cwd();
const platformFolder: string = path.join(projectRoot, "platforms", os);
let outputFolder: string = "";
if (os === "ios") {
outputFolder = path.join(platformFolder, "www");
} else if (os === "android") {
// Since cordova-android 7 assets directory moved to android/app/src/main/assets instead of android/assets
const outputFolderVer7 = path.join(platformFolder, "app", "src", "main", "assets", "www");
if (fs.existsSync(outputFolderVer7)) {
outputFolder = outputFolderVer7;
} else {
outputFolder = path.join(platformFolder, "assets", "www");
}
}
return outputFolder;
}

Просмотреть файл

@ -1,18 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import * as dateUtils from "./utils/date-utils";
import * as fileUtils from "./utils/file-utils";
import * as updateContents from "./update-contents/index";
import * as cordova from "./cordova/cordova-utils";
import * as reactNative from "./react-native/react-native-utils";
import * as validators from "./utils/validation-utils";
export {
dateUtils,
fileUtils,
updateContents,
cordova,
reactNative,
validators
};

Просмотреть файл

@ -1,360 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import * as fs from "fs";
import * as path from "path";
import chalk from "chalk";
import * as xml2js from "xml2js";
import * as mkdirp from "mkdirp";
const plist = require("plist");
const g2js = require("gradle-to-js/lib/parser");
const properties = require("properties");
const childProcess = require("child_process");
import { isValidVersion } from "../utils/validation-utils";
import * as fileUtils from "../utils/file-utils";
export let spawn = childProcess.spawn;
export interface VersionSearchParams {
os: string; // ios or android
plistFile: string;
plistFilePrefix: string;
gradleFile: string;
}
export async function getAndroidAppVersion(projectRoot?: string, gradleFile?: string): Promise<string> {
projectRoot = projectRoot || process.cwd();
console.log(chalk.cyan(`Detecting "Android" app version:\n`));
let buildGradlePath: string = path.join(projectRoot, "android", "app");
if (gradleFile) {
buildGradlePath = gradleFile;
}
if (fs.lstatSync(buildGradlePath).isDirectory()) {
buildGradlePath = path.join(buildGradlePath, "build.gradle");
}
if (fileUtils.fileDoesNotExistOrIsDirectory(buildGradlePath)) {
throw new Error(`Unable to find gradle file "${buildGradlePath}".`);
}
return g2js.parseFile(buildGradlePath)
.catch(() => {
throw new Error(`Unable to parse the "${buildGradlePath}" file. Please ensure it is a well-formed Gradle file.`);
})
.then((buildGradle: any) => {
let versionName: string | null = null;
// First "if" statement was implemented as workaround for case
// when "build.gradle" file contains several "android" nodes.
// In this case "buildGradle.android" prop represents array instead of object
// due to parsing issue in "g2js.parseFile" method.
if (buildGradle.android instanceof Array) {
for (let i = 0; i < buildGradle.android.length; i++) {
const gradlePart = buildGradle.android[i];
if (gradlePart.defaultConfig && gradlePart.defaultConfig.versionName) {
versionName = gradlePart.defaultConfig.versionName;
break;
}
}
} else if (buildGradle.android && buildGradle.android.defaultConfig && buildGradle.android.defaultConfig.versionName) {
versionName = buildGradle.android.defaultConfig.versionName;
} else {
throw new Error(`The "${buildGradlePath}" file doesn"t specify a value for the "android.defaultConfig.versionName" property.`);
}
if (typeof versionName !== "string") {
throw new Error(`The "android.defaultConfig.versionName" property value in "${buildGradlePath}" is not a valid string. If this is expected, consider using the --target-binary-version option to specify the value manually.`);
}
let appVersion: string = versionName.replace(/"/g, "").trim();
if (isValidVersion(appVersion)) {
// The versionName property is a valid semver string,
// so we can safely use that and move on.
console.log(`Using the target binary version value "${appVersion}" from "${buildGradlePath}".\n`);
return appVersion;
}
// The version property isn"t a valid semver string
// so we assume it is a reference to a property variable.
const propertyName = appVersion.replace("project.", "");
const propertiesFileName = "gradle.properties";
const knownLocations = [
path.join(projectRoot || "", "android", "app", propertiesFileName),
path.join(projectRoot || "", "android", propertiesFileName),
];
// Search for gradle properties across all `gradle.properties` files
let propertiesFile: string | null = null;
for (let i = 0; i < knownLocations.length; i++) {
propertiesFile = knownLocations[i];
if (fileUtils.fileExists(propertiesFile)) {
const propertiesContent: string = fs.readFileSync(propertiesFile).toString();
try {
const parsedProperties: any = properties.parse(propertiesContent);
appVersion = parsedProperties[propertyName];
if (appVersion) {
break;
}
} catch (e) {
throw new Error(`Unable to parse "${propertiesFile}". Please ensure it is a well-formed properties file.`);
}
}
}
if (!appVersion) {
throw new Error(`No property named "${propertyName}" exists in the "${propertiesFile}" file.`);
}
if (!isValidVersion(appVersion)) {
throw new Error(`The "${propertyName}" property in the "${propertiesFile}" file needs to specify a valid semver string, containing both a major and minor version (e.g. 1.3.2, 1.1).`);
}
console.log(`Using the target binary version value "${appVersion}" from the "${propertyName}" key in the "${propertiesFile}" file.\n`);
return appVersion.toString();
});
}
export async function getiOSAppVersion(projectRoot?: string, plistFilePrefix?: string, plistFile?: string): Promise<string> {
projectRoot = projectRoot || process.cwd();
const projectPackageJson: any = require(path.join(projectRoot, "package.json"));
const projectName: string = projectPackageJson.name;
console.log(chalk.cyan(`Detecting "iOS" app version:\n`));
let resolvedPlistFile: string | undefined = plistFile;
if (resolvedPlistFile) {
// If a plist file path is explicitly provided, then we don"t
// need to attempt to "resolve" it within the well-known locations.
if (!fileUtils.fileExists(resolvedPlistFile)) {
throw new Error(`The specified plist file doesn"t exist. Please check that the provided path is correct.`);
}
} else {
// Allow the plist prefix to be specified with or without a trailing
// separator character, but prescribe the use of a hyphen when omitted,
// since this is the most commonly used convetion for plist files.
if (plistFilePrefix && /.+[^-.]$/.test(plistFilePrefix)) {
plistFilePrefix += "-";
}
const iOSDirectory: string = "ios";
const plistFileName = `${plistFilePrefix || ""}Info.plist`;
const knownLocations = [
path.join(projectRoot, iOSDirectory, projectName, plistFileName),
path.join(projectRoot, iOSDirectory, plistFileName),
];
resolvedPlistFile = (<any>knownLocations).find(fileUtils.fileExists);
if (!resolvedPlistFile) {
throw new Error(`Unable to find either of the following plist files in order to infer your app"s binary version: "${knownLocations.join("\", \"")}". If your plist has a different name, or is located in a different directory, consider using either the "--plist-file" or "--plist-file-prefix" parameters to help inform the CLI how to find it.`);
}
}
const plistContents = fs.readFileSync(resolvedPlistFile).toString();
let parsedPlist: any;
try {
parsedPlist = plist.parse(plistContents);
} catch (e) {
throw new Error(`Unable to parse "${resolvedPlistFile}". Please ensure it is a well-formed plist file.`);
}
if (parsedPlist && parsedPlist.CFBundleShortVersionString) {
if (isValidVersion(parsedPlist.CFBundleShortVersionString)) {
console.log(`Using the target binary version value "${parsedPlist.CFBundleShortVersionString}" from "${resolvedPlistFile}".\n`);
return Promise.resolve(parsedPlist.CFBundleShortVersionString);
} else {
throw new Error(`The "CFBundleShortVersionString" key in the "${resolvedPlistFile}" file needs to specify a valid semver string, containing both a major and minor version (e.g. 1.3.2, 1.1).`);
}
} else {
throw new Error(`The "CFBundleShortVersionString" key doesn"t exist within the "${resolvedPlistFile}" file.`);
}
}
export async function getWindowsAppVersion(projectRoot?: string): Promise<string> {
projectRoot = projectRoot || process.cwd();
const projectPackageJson: any = require(path.join(projectRoot, "package.json"));
const projectName: string = projectPackageJson.name;
console.log(chalk.cyan(`Detecting "Windows" app version:\n`));
const appxManifestFileName: string = "Package.appxmanifest";
let appxManifestContainingFolder: string;
let appxManifestContents: string;
try {
appxManifestContainingFolder = path.join(projectRoot, "windows", projectName);
appxManifestContents = fs.readFileSync(path.join(appxManifestContainingFolder, appxManifestFileName)).toString();
} catch (err) {
throw new Error(`Unable to find or read "${appxManifestFileName}" in the "${path.join("windows", projectName)}" folder.`);
}
return new Promise<string>((resolve, reject) => {
xml2js.parseString(appxManifestContents, (err: Error, parsedAppxManifest: any) => {
if (err) {
reject(new Error(`Unable to parse the "${path.join(appxManifestContainingFolder, appxManifestFileName)}" file, it could be malformed.`));
return;
}
try {
const appVersion: string = parsedAppxManifest.Package.Identity[0]["$"].Version.match(/^\d+\.\d+\.\d+/)[0];
console.log(`Using the target binary version value "${appVersion}" from the "Identity" key in the "${appxManifestFileName}" file.\n`);
return resolve(appVersion);
} catch (e) {
reject(new Error(`Unable to parse the package version from the "${path.join(appxManifestContainingFolder, appxManifestFileName)}" file.`));
return;
}
});
});
}
export function runReactNativeBundleCommand(projectRootPath: string, bundleName: string, development: boolean | undefined, entryFile: string, outputFolder: string, platform: string, sourcemapOutput: string | undefined): Promise<void> {
const reactNativeBundleArgs: string[] = [];
const envNodeArgs: string | undefined = process.env.CODE_PUSH_NODE_ARGS;
if (typeof envNodeArgs !== "undefined") {
Array.prototype.push.apply(reactNativeBundleArgs, envNodeArgs.trim().split(/\s+/));
}
Array.prototype.push.apply(reactNativeBundleArgs, [
path.join(projectRootPath, "node_modules", "react-native", "local-cli", "cli.js"), "bundle",
"--assets-dest", outputFolder,
"--bundle-output", path.join(outputFolder, bundleName),
"--dev", development,
"--entry-file", entryFile,
"--platform", platform,
]);
if (sourcemapOutput) {
reactNativeBundleArgs.push("--sourcemap-output", sourcemapOutput);
}
console.log(chalk.cyan(`Running "react-native bundle" command:\n`));
const reactNativeBundleProcess = spawn("node", reactNativeBundleArgs);
console.log(`node ${reactNativeBundleArgs.join(" ")}`);
return new Promise<void>((resolve, reject) => {
reactNativeBundleProcess.stdout.on("data", (data: Buffer) => {
console.log(data.toString().trim());
});
reactNativeBundleProcess.stderr.on("data", (data: Buffer) => {
console.error(data.toString().trim());
});
reactNativeBundleProcess.on("close", (exitCode: number) => {
if (exitCode) {
reject(new Error(`"react-native bundle" command exited with code ${exitCode}.`));
}
resolve(void 0);
});
});
}
export function isValidOS(os: string): boolean {
switch (os.toLowerCase()) {
case "android":
case "ios":
case "windows":
return true;
default:
return false;
}
}
export function isValidPlatform(platform: string): boolean {
return platform.toLowerCase() === "react-native";
}
export function isReactNativeProject(): boolean {
try {
const projectPackageJson: any = require(path.join(process.cwd(), "package.json"));
const projectName: string = projectPackageJson.name;
if (!projectName) {
throw new Error(`The "package.json" file in the CWD does not have the "name" field set.`);
}
return projectPackageJson.dependencies["react-native"] || (projectPackageJson.devDependencies && projectPackageJson.devDependencies["react-native"]);
} catch (error) {
throw new Error(`Unable to find or read "package.json" in the CWD. The "release-react" command must be executed in a React Native project folder.`);
}
}
export function getDefaultBundleName(os: string): string {
if (!isValidOS(os)) {
throw new Error(`Platform must be either "ios" or "android".`);
}
return os === "ios"
? "main.jsbundle"
: `index.${os}.bundle`;
}
export function getDefautEntryFilePath(os: string, projectDir?: string): string {
if (!isValidOS(os)) {
throw new Error(`Platform must be either "ios" or "android".`);
}
if (!projectDir) {
projectDir = process.cwd();
}
let entryFilePath: string = path.join(projectDir, `index.${os}.js`);
if (fileUtils.fileDoesNotExistOrIsDirectory(entryFilePath)) {
entryFilePath = path.join(projectDir, "index.js");
}
if (fileUtils.fileDoesNotExistOrIsDirectory(entryFilePath)) {
throw new Error(`Entry file "index.${os}.js" or "index.js" does not exist.`);
}
return entryFilePath;
}
export class BundleConfig {
public os: string;
public projectRootPath: string;
public outputDir?: string;
public entryFilePath?: string;
public bundleName?: string;
public development?: boolean;
public sourcemapOutput?: string;
}
export async function makeUpdateContents(bundleConfig: BundleConfig): Promise<string> {
if (!isValidOS(bundleConfig.os)) {
throw new Error(`Platform must be either "ios" or "android".`);
}
if (!bundleConfig.projectRootPath) {
bundleConfig.projectRootPath = process.cwd();
}
let updateContentsPath: string;
updateContentsPath = bundleConfig.outputDir || await fileUtils.mkTempDir("code-push");
// we have to add "CodePush" root folder to make update contents file structure
// to be compatible with React Native client SDK
updateContentsPath = path.join(updateContentsPath, "CodePush");
mkdirp.sync(updateContentsPath);
if (!bundleConfig.bundleName) {
bundleConfig.bundleName = getDefaultBundleName(bundleConfig.os);
}
if (!bundleConfig.entryFilePath) {
bundleConfig.entryFilePath = getDefautEntryFilePath(bundleConfig.os, bundleConfig.projectRootPath);
}
if (bundleConfig.outputDir) {
bundleConfig.sourcemapOutput = path.join(updateContentsPath, bundleConfig.bundleName + ".map");
}
fileUtils.createEmptyTmpReleaseFolder(updateContentsPath);
fileUtils.removeReactTmpDir();
await runReactNativeBundleCommand(bundleConfig.projectRootPath, bundleConfig.bundleName, bundleConfig.development, bundleConfig.entryFilePath, updateContentsPath, bundleConfig.os, bundleConfig.sourcemapOutput);
return updateContentsPath;
}

Просмотреть файл

@ -1,157 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
/**
* NOTE!!! This utility file is duplicated for use by the CodePush service (for server-driven hashing/
* integrity checks) and Management SDK (for end-to-end code signing), please keep them in sync.
*/
import * as crypto from "crypto";
import * as fs from "fs";
import * as path from "path";
import * as stream from "stream";
import * as _ from "lodash";
import * as fileUtils from "../../utils/file-utils";
// Do not throw an exception if either of these modules are missing, as they may not be needed by the
// consumer of this file.
const HASH_ALGORITHM = "sha256";
export class PackageManifest {
private _map: Map<string, string>;
public constructor(map?: Map<string, string>) {
if (!map) {
map = new Map<string, string>();
}
this._map = map;
}
public toMap(): Map<string, string> {
return this._map;
}
public computePackageHash(): string {
let entries: string[] = [];
this._map.forEach((hash: string, name: string): void => {
entries.push(name + ":" + hash);
});
// Make sure this list is alphabetically ordered so that other clients
// can also compute this hash easily given the update contents.
entries = entries.sort();
return crypto.createHash(HASH_ALGORITHM)
.update(JSON.stringify(entries))
.digest("hex");
}
public serialize(): string {
const obj: any = {};
this._map.forEach(function (value, key) {
obj[key] = value;
});
return JSON.stringify(obj);
}
public static deserialize(serializedContents: string): PackageManifest {
const map = new Map<string, string>();
try {
const obj: any = JSON.parse(serializedContents);
for (const key of Object.keys(obj)) {
map.set(key, obj[key]);
}
return new PackageManifest(map);
} catch (e) {
console.error(e);
return new PackageManifest(map);
}
}
public static isIgnored(relativeFilePath: string): boolean {
const __MACOSX = "__MACOSX/";
const DS_STORE = ".DS_Store";
const CODEPUSH_METADATA = ".codepushrelease";
return _.startsWith(relativeFilePath, __MACOSX)
|| relativeFilePath === DS_STORE
|| _.endsWith(relativeFilePath, "/" + DS_STORE)
|| relativeFilePath === CODEPUSH_METADATA
|| _.endsWith(relativeFilePath, "/" + CODEPUSH_METADATA);
}
}
export async function generatePackageHashFromDirectory(directoryPath: string, basePath: string): Promise<string> {
try {
if (!fileUtils.isDirectory(directoryPath)) {
throw new Error("Not a directory. Please either create a directory, or use hashFile().");
}
} catch (error) {
throw new Error("Directory does not exist. Please either create a directory, or use hashFile().");
}
const manifest: PackageManifest = await generatePackageManifestFromDirectory(directoryPath, basePath);
return manifest.computePackageHash();
}
export function generatePackageManifestFromDirectory(directoryPath: string, basePath: string): Promise<PackageManifest> {
return new Promise<PackageManifest>(async (resolve, reject) => {
const fileHashesMap = new Map<string, string>();
const files: string[] = await fileUtils.walk(directoryPath);
if (!files || files.length === 0) {
reject(`Error: Can"t sign the release because no files were found.`);
return;
}
// Hash the files sequentially, because streaming them in parallel is not necessarily faster
const generateManifestPromise: Promise<void> = files.reduce((soFar: Promise<void>, filePath: string) => {
return soFar
.then(() => {
const relativePath: string = fileUtils.normalizePath(path.relative(basePath, filePath));
if (!PackageManifest.isIgnored(relativePath)) {
return hashFile(filePath)
.then((hash: string) => {
fileHashesMap.set(relativePath, hash);
});
}
return undefined;
});
}, Promise.resolve(void 0));
generateManifestPromise
.then(() => {
resolve(new PackageManifest(fileHashesMap));
}, reject);
});
}
export function hashFile(filePath: string): Promise<string> {
const readStream: fs.ReadStream = fs.createReadStream(filePath);
return hashStream(readStream);
}
export function hashStream(readStream: stream.Readable): Promise<string> {
return new Promise<string>((resolve, reject) => {
const hashStream = <stream.Transform><any>crypto.createHash(HASH_ALGORITHM);
readStream
.on("error", (error: any): void => {
hashStream.end();
reject(error);
})
.on("end", (): void => {
hashStream.end();
const buffer = <Buffer>hashStream.read();
const hash: string = buffer.toString("hex");
resolve(hash);
});
readStream.pipe(hashStream);
});
}

Просмотреть файл

@ -1,82 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import * as fs from "fs";
import * as hashUtils from "./hash-utils";
import * as jwt from "jsonwebtoken";
import * as path from "path";
import * as fileUtils from "../../utils/file-utils";
const CURRENT_CLAIM_VERSION: string = "1.0.0";
const METADATA_FILE_NAME: string = ".codepushrelease";
interface CodeSigningClaims {
claimVersion: string;
contentHash: string;
}
export default async function sign(privateKeyPath: string, updateContentsPath: string): Promise<void> {
if (!privateKeyPath) {
return Promise.resolve<void>(void 0);
}
let privateKey: Buffer;
let signatureFilePath: string;
try {
privateKey = await fileUtils.readFile(privateKeyPath);
} catch (err) {
return Promise.reject(new Error(`The path specified for the signing key ("${privateKeyPath}") was not valid.`));
}
// If releasing a single file, copy the file to a temporary "CodePush" directory in which to publish the release
try {
if (!fileUtils.isDirectory(updateContentsPath)) {
updateContentsPath = fileUtils.copyFileToTmpDir(updateContentsPath);
}
} catch (error) {
Promise.reject(error);
}
signatureFilePath = path.join(updateContentsPath, METADATA_FILE_NAME);
let prevSignatureExists = true;
try {
await fileUtils.access(signatureFilePath, fs.constants.F_OK);
} catch (err) {
if (err.code === "ENOENT") {
prevSignatureExists = false;
} else {
return Promise.reject<void>(new Error(
`Could not delete previous release signature at ${signatureFilePath}.
Please, check your access rights.`)
);
}
}
if (prevSignatureExists) {
console.log(`Deleting previous release signature at ${signatureFilePath}`);
await fileUtils.rmDir(signatureFilePath);
}
const hash: string = await hashUtils.generatePackageHashFromDirectory(updateContentsPath, path.join(updateContentsPath, ".."));
const claims: CodeSigningClaims = {
claimVersion: CURRENT_CLAIM_VERSION,
contentHash: hash,
};
return new Promise<void>((resolve, reject) => {
jwt.sign(claims, privateKey, { algorithm: "RS256" }, async (err: Error, signedJwt: string) => {
if (err) {
reject(new Error("The specified signing key file was not valid"));
}
try {
fs.writeFileSync(signatureFilePath, signedJwt);
console.log(`Generated a release signature and wrote it to ${signatureFilePath}`);
resolve(void 0);
} catch (error) {
reject(error);
}
});
});
}

Просмотреть файл

@ -1,7 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import sign from "./code-signing/sign";
import zip from "./zip";
export { sign, zip };

Просмотреть файл

@ -1,67 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
/// <reference path="../../typings/index.d.ts" />
import * as fs from "fs";
import * as path from "path";
import * as yazl from "yazl";
import * as fileUtils from "../utils/file-utils";
interface ReleaseFile {
sourceLocation: string; // The current location of the file on disk
targetLocation: string; // The desired location of the file within the zip
}
export default function zip(updateContentsPath: string, outputDir?: string): Promise<string> {
return new Promise<string>(async (resolve, reject) => {
const releaseFiles: ReleaseFile[] = [];
try {
if (!fileUtils.isDirectory(updateContentsPath)) {
releaseFiles.push({
sourceLocation: updateContentsPath,
targetLocation: fileUtils.normalizePath(path.basename(updateContentsPath)), // Put the file in the root
});
}
} catch (error) {
error.message = error.message + " Make sure you have added the platform you are making a release to.`.";
reject(error);
}
const directoryPath: string = updateContentsPath;
const baseDirectoryPath = path.join(directoryPath, ".."); // For legacy reasons, put the root directory in the zip
const files: string[] = await fileUtils.walk(updateContentsPath);
files.forEach((filePath: string) => {
const relativePath: string = path.relative(baseDirectoryPath, filePath);
releaseFiles.push({
sourceLocation: filePath,
targetLocation: fileUtils.normalizePath(relativePath),
});
});
if (!outputDir) {
outputDir = process.cwd();
}
const packagePath: string = path.join(outputDir, fileUtils.generateRandomFilename(15) + ".zip");
const zipFile = new yazl.ZipFile();
const writeStream: fs.WriteStream = fs.createWriteStream(packagePath);
zipFile.outputStream.pipe(writeStream)
.on("error", (error: Error): void => {
reject(error);
})
.on("close", (): void => {
resolve(packagePath);
});
releaseFiles.forEach((releaseFile: ReleaseFile) => {
zipFile.addFile(releaseFile.sourceLocation, releaseFile.targetLocation);
});
zipFile.end();
});
}

Просмотреть файл

@ -1,15 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import { differenceInMinutes, format } from "date-fns";
export function formatDate(unixOffset: number): string {
let formattedDateString: string;
const date = new Date(unixOffset);
if (differenceInMinutes(Date.now(), date) < 2) {
formattedDateString = "Just now";
} else {
formattedDateString = format(date, "MMM DD, hh:mm A");
}
return formattedDateString;
}

Просмотреть файл

@ -1,155 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import * as fs from "fs";
import * as path from "path";
import * as os from "os";
import * as rimraf from "rimraf";
import * as temp from "temp";
import * as _ from "lodash";
const noop = require("node-noop").noop;
export function fileExists(file: string): boolean {
try {
return fs.statSync(file).isFile();
} catch (e) { return false; }
}
export function isBinaryOrZip(path: string): boolean {
return path.search(/\.zip$/i) !== -1
|| path.search(/\.apk$/i) !== -1
|| path.search(/\.ipa$/i) !== -1;
}
export function isDirectory(path: string): boolean {
return fs.statSync(path).isDirectory();
}
export function copyFileToTmpDir(filePath: string): string {
if (!isDirectory(filePath)) {
const outputFolderPath: string = temp.mkdirSync("code-push");
rimraf.sync(outputFolderPath);
fs.mkdirSync(outputFolderPath);
const outputFilePath: string = path.join(outputFolderPath, path.basename(filePath));
fs.writeFileSync(outputFilePath, fs.readFileSync(filePath));
return outputFolderPath;
}
return "";
}
export function generateRandomFilename(length: number): string {
let filename: string = "";
const validChar: string = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (let i = 0; i < length; i++) {
filename += validChar.charAt(Math.floor(Math.random() * validChar.length));
}
return filename;
}
export function fileDoesNotExistOrIsDirectory(path: string): boolean {
try {
return isDirectory(path);
} catch (error) {
return true;
}
}
export function createEmptyTmpReleaseFolder(folderPath: string): void {
rimraf.sync(folderPath);
fs.mkdirSync(folderPath);
}
export function removeReactTmpDir(): void {
rimraf.sync(`${os.tmpdir()}/react-*`);
}
export function normalizePath(filePath: string): string {
// replace all backslashes coming from cli running on windows machines by slashes
return filePath.replace(/\\/g, "/");
}
export async function walk(dir: string): Promise<string[]> {
const stats = await stat(dir);
if (stats.isDirectory()) {
let files: string[] = [];
for (const file of await readdir(dir)) {
files = files.concat(await walk(path.join(dir, file)));
}
return files;
} else {
return [dir];
}
}
export async function stat(path: string | Buffer): Promise<fs.Stats> {
return (await callFs(fs.stat, path))[0];
}
export async function readdir(path: string | Buffer): Promise<string[]> {
return (await callFs(fs.readdir, path))[0];
}
export function readFile(filename: string): Promise<Buffer>;
export function readFile(filename: string, encoding: string): Promise<string>;
export function readFile(filename: string, options: { flag?: string; }): Promise<Buffer>;
export function readFile(filename: string, options?: string | { encoding: string; flag?: string; }): Promise<string>;
export async function readFile(...args: any[]): Promise<any> {
return (await callFs(fs.readFile, ...args))[0];
}
export async function access(path: string | Buffer, mode: number): Promise<void> {
return callFs(fs.access, path, mode).then(() => { noop(); });
}
export function rmDir(source: string, recursive: boolean = true): Promise<void> {
if (recursive) {
return new Promise<void>((resolve, reject) => {
rimraf(source, err => {
if (err) {
reject(err);
} else {
resolve();
}
});
});
} else {
return callFs(fs.rmdir, source).then(() => { noop(); });
}
}
export function mkTempDir(affixes: string): Promise<string> {
return callTemp(temp.mkdir, affixes);
}
function callTemp<TResult>(func: (...args: any[]) => void, ...args: any[]): Promise<TResult> {
return new Promise<TResult>((resolve, reject) => {
func.apply(temp, _.concat(args, [
(err: any, result: TResult) => {
if (err) {
reject(err);
} else {
resolve(result);
}
},
]));
});
}
function callFs(func: (...args: any[]) => void, ...args: any[]): Promise<any[]> {
return new Promise<any[]>((resolve, reject) => {
func.apply(fs, _.concat(args, [
(err: any, ...args: any[]) => {
if (err) {
reject(err);
} else {
resolve(args);
}
},
]));
});
}

Просмотреть файл

@ -1,19 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import * as semver from "semver";
// Check if the given string is a semver-compliant version number (e.g. "1.2.3")
// (missing minor/patch values will be added on server side to pass semver.satisfies check)
export function isValidVersion(version: string): boolean {
return !!semver.valid(version) || /^\d+\.\d+$/.test(version) || /^\d+$/.test(version);
}
// Allow plain integer versions (as well as "1.0" values) for now, e.g. "1" is valid here and we assume that it is equal to "1.0.0".
export function isValidRange(semverRange: string): boolean {
return !!semver.validRange(semverRange);
}
export function isValidRollout(rollout: number): boolean {
return (rollout != null && rollout > 0 && rollout <= 100);
}

Просмотреть файл

@ -1 +0,0 @@
/// <reference path="modules/yazl/index.d.ts" />

Просмотреть файл

@ -1,32 +0,0 @@
declare module "yazl" {
import * as events from "events";
import * as stream from "stream";
export interface IDosDateTime {
date: number;
time: number;
}
export interface IFinalSizeCallback {
(finalSize: number): void;
}
export interface IOptions {
compress?: boolean;
mode?: number;
mtime?: Date;
size?: number;
}
export function dateToDosDateTime(date: Date): IDosDateTime;
export class ZipFile extends events.EventEmitter {
public outputStream: stream.Readable;
public addBuffer(buffer: Buffer, metadataPath: string, options?: IOptions): void;
public addEmptyDirectory(metadataPath: string, options?: IOptions): void;
public addFile(realPath: string, metadataPath: string, options?: IOptions): void;
public addReadStream(readStream: stream.Readable, metadataPath: string, options?: IOptions): void;
public end(finalSizeCallback?: IFinalSizeCallback): void;
}
}

Просмотреть файл

@ -1,8 +0,0 @@
{
"resolution": "main",
"tree": {
"main": "index.d.ts",
"name": "yazl",
"type": "typings"
}
}

Просмотреть файл

@ -1,6 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import codePushRelease from "./release";
export { codePushRelease };

Просмотреть файл

@ -1,26 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import { AppCenterClient, models } from "../../api/index";
import { ICodePushReleaseParams } from "../../command/commandParams";
import { getQPromisifiedClientResult } from "../../api/createClient";
import * as fs from "fs";
export function appcenterCodePushRelease(client: AppCenterClient, params: ICodePushReleaseParams): Q.Promise<models.CodePushRelease> {
const app = params.app;
return getQPromisifiedClientResult(client.codepush.codePushDeploymentReleases.create(
app.appName,
params.deploymentName,
app.ownerName,
<string>params.appVersion,
{
packageProperty: fs.createReadStream(params.updatedContentZipPath),
deploymentName: params.deploymentName,
description: params.description,
disabled: params.isDisabled,
mandatory: params.isMandatory,
noDuplicateReleaseError: false, // TODO: remove it, not needed to send to server
rollout: params.rollout,
})
);
}

Просмотреть файл

@ -1,21 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import LegacyCodePushServiceClient from "./legacyCodePushServiceClient";
import { models } from "../../api/index";
import { ICodePushReleaseParams } from "../../command/commandParams";
import { PackageInfo } from "./legacyCodePushServiceClient";
import * as Q from "q";
export function legacyCodePushRelease(params: ICodePushReleaseParams, token: string, serverUrl: string): Q.Promise<models.CodePushRelease> {
const releaseData: PackageInfo = {
description: params.description,
isDisabled: params.isDisabled,
isMandatory: params.isMandatory,
rollout: params.rollout,
appVersion: params.appVersion,
};
return new LegacyCodePushServiceClient(token, params.app, serverUrl)
.release(params.deploymentName, params.updatedContentZipPath, releaseData);
}

Просмотреть файл

@ -1,111 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import * as request from "request";
import { DefaultApp } from "../../command/commandParams";
import * as fs from "fs";
import * as Q from "q";
import { models } from "../../api/index";
export interface PackageInfo {
appVersion?: string;
description?: string;
isDisabled?: boolean;
isMandatory?: boolean;
label?: string;
packageHash?: string;
rollout?: number;
}
export interface Package extends PackageInfo {
/*generated*/ blobUrl: string;
/*generated*/ diffPackageMap?: PackageHashToBlobInfoMap;
/*generated*/ originalLabel?: string; // Set on "Promote" and "Rollback"
/*generated*/ originalDeployment?: string; // Set on "Promote"
/*generated*/ releasedBy?: string; // Set by commitPackage
/*generated*/ releaseMethod?: string; // "Upload", "Promote" or "Rollback". Unknown if unspecified
/*generated*/ size: number;
/*generated*/ uploadTime: number;
}
export interface PackageHashToBlobInfoMap {
[packageHash: string]: BlobInfo;
}
export interface BlobInfo {
size: number;
url: string;
}
export type Headers = { [headerName: string]: string };
export default class LegacyCodePushServiceClient {
private static API_VERSION: number = 2;
constructor(private accessKey: string, private app: DefaultApp, private serverUrl: string) {
if (!accessKey) throw new Error("A token must be specified to execute server calls.");
if (!serverUrl) throw new Error("A server url must be specified to execute server calls.");
}
public release(deploymentName: string, filePath: string, updateMetadata: PackageInfo): Q.Promise<models.CodePushRelease> {
const appName = this.app.identifier;
return Q.Promise<models.CodePushRelease>((resolve, reject) => {
const options = {
url: this.serverUrl + this.urlEncode(`/apps/${this.appNameParam(appName)}/deployments/${deploymentName}/release`),
headers: {
"Accept": `application/vnd.code-push.v${LegacyCodePushServiceClient.API_VERSION}+json`,
"Authorization": `Bearer ${this.accessKey}`,
},
formData: {
"packageInfo": JSON.stringify(updateMetadata),
"package": fs.createReadStream(filePath),
},
};
request.post(options, (err: any, httpResponse: any) => {
if (err) {
reject(this.getErrorMessage(err, httpResponse));
return;
}
if (httpResponse.statusCode === 201) {
resolve(<models.CodePushRelease>JSON.parse(httpResponse.body).package);
} else {
reject(this.getErrorMessage(null, httpResponse));
return;
}
});
});
}
// A template string tag function that URL encodes the substituted values
private urlEncode(strings: any, ...values: string[]): string {
let result = "";
for (let i = 0; i < strings.length; i++) {
result += strings[i];
if (i < values.length) {
result += encodeURIComponent(values[i]);
}
}
return result;
}
// IIS and Azure web apps have this annoying behavior where %2F (URL encoded slashes) in the URL are URL decoded
// BEFORE the requests reach node. That essentially means there's no good way to encode a "/" in the app name--
// URL encodeing will work when running locally but when running on Azure it gets decoded before express sees it,
// so app names with slashes don't get routed properly. See https://github.com/tjanczuk/iisnode/issues/343 (or other sites
// that complain about the same) for some more info. I explored some IIS config based workarounds, but the previous
// link seems to say they won't work, so I eventually gave up on that.
// Anyway, to workaround this issue, we now allow the client to encode / characters as ~~ (two tildes, URL encoded).
// The CLI now converts / to ~~ if / appears in an app name, before passing that as part of the URL. This code below
// does the encoding. It's hack, but seems like the least bad option here.
// Eventually, this service will go away & we'll all be on Max's new service. That's hosted in docker, no more IIS,
// so this issue should go away then.
private appNameParam(appName: string) {
return appName.replace("/", "~~");
}
private getErrorMessage(error: Error | null, response: request.RequestResponse): string {
return response && response.body ? response.body : (error ? error.message : "");
}
}

Просмотреть файл

@ -1,40 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import { AppCenterClient, models } from "../api/index";
import { ILogger, LogLevel } from "../../log/LogHelper";
import { ICodePushReleaseParams } from "../command/commandParams";
import * as Q from "q";
import { CommandResult, success, failure, ErrorCodes } from "../command/commandResult";
import { appcenterCodePushRelease } from "./release-strategy/appcenterCodePushRelease";
import { legacyCodePushRelease } from "./release-strategy/legacyCodePushRelease";
import { SettingsHelper } from "../../settingsHelper";
// Use old service endpoint unless we will fix issue with 1MB payload limitation for new one
const useLegacyCodePushServer: boolean = SettingsHelper.getLegacyCodePushServiceEnabled();
export default class CodePushRelease {
public static exec(client: AppCenterClient, params: ICodePushReleaseParams, logger: ILogger): Q.Promise<CommandResult> {
return ((): Q.Promise<CodePushRelease> => {
if (useLegacyCodePushServer) {
return legacyCodePushRelease(params, <string>params.token, SettingsHelper.getLegacyCodePushEndpoint());
} else {
return appcenterCodePushRelease(client, params);
}
})().then((result: models.CodePushRelease) => {
return success(result);
}).catch((error) => {
if (error && error.reposnse && error.response.statusCode === 409) {
logger.log(error.response.body, LogLevel.Error);
return failure(ErrorCodes.Exception, error.response.body);
}
logger.log("An error occured on doing Code Push release", LogLevel.Error);
if (typeof error === "string") {
return failure(ErrorCodes.Exception, error);
} else {
return failure(ErrorCodes.Exception, "An error occured on doing Code Push release");
}
});
}
}

Просмотреть файл

@ -1,497 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import * as vscode from "vscode";
import * as Q from "q";
import * as qs from "qs";
import * as os from "os";
import { ILogger, LogLevel } from "../../log/LogHelper";
import Auth from "../../appcenter/auth/auth";
import { AppCenterLoginType, ACConstants, AppCenterOS, CurrentAppDeployments, Deployment, ACCommandNames } from "../appCenterConstants";
import { Profile } from "../../appcenter/auth/profile/profile";
import { SettingsHelper } from "../../settingsHelper";
import { AppCenterClient, models } from "../api/index";
import { DefaultApp, ICodePushReleaseParams } from "./commandParams";
import { AppCenterExtensionManager } from "../appCenterExtensionManager";
import { ACStrings } from "../appCenterStrings";
import CodePushRelease from "../codepush/release";
import { ACUtils } from "../helpers/utils";
import { updateContents, reactNative, fileUtils } from "../codepush/codepush-sdk/src/index";
import BundleConfig = reactNative.BundleConfig;
import { getQPromisifiedClientResult } from "../api/createClient";
import { validRange } from "semver";
import { VsCodeUtils, IButtonMessageItem } from "../helpers/vscodeUtils";
interface IAppCenterAuth {
login(appcenterManager: AppCenterExtensionManager): Q.Promise<void>;
logout(appcenterManager: AppCenterExtensionManager): Q.Promise<void>;
whoAmI(appCenterManager: AppCenterExtensionManager): Q.Promise<void>;
}
interface IAppCenterApps {
getCurrentApp(appCenterManager: AppCenterExtensionManager): Q.Promise<void>;
setCurrentApp(client: AppCenterClient, appCenterManager: AppCenterExtensionManager): Q.Promise<void>;
setCurrentDeployment(appCenterManager: AppCenterExtensionManager): Q.Promise<void>;
}
interface IAppCenterCodePush {
showMenu(client: AppCenterClient, appCenterManager: AppCenterExtensionManager): Q.Promise<void>;
releaseReact(client: AppCenterClient, appCenterManager: AppCenterExtensionManager): Q.Promise<void>;
switchIsMandatoryForRelease(appCenterManager: AppCenterExtensionManager): Q.Promise<void>;
setTargetBinaryVersionForRelease(appCenterManager: AppCenterExtensionManager): Q.Promise<void>;
}
export class AppCenterCommandExecutor implements IAppCenterAuth, IAppCenterCodePush, IAppCenterApps {
private logger: ILogger;
constructor(logger: ILogger) {
this.logger = logger;
}
public login(appCenterManager: AppCenterExtensionManager): Q.Promise<void> {
const appCenterLoginOptions: string[] = Object.keys(AppCenterLoginType).filter(k => typeof AppCenterLoginType[k as any] === "number");
vscode.window.showQuickPick(appCenterLoginOptions, { placeHolder: ACStrings.SelectLoginTypeMsg })
.then((loginType) => {
switch (loginType) {
case (AppCenterLoginType[AppCenterLoginType.Interactive]):
const messageItems: IButtonMessageItem[] = [];
const loginUrl = `${SettingsHelper.getAppCenterLoginEndpoint()}?${qs.stringify({ hostname: os.hostname()})}`;
messageItems.push({ title : ACStrings.OkBtnLabel,
url : loginUrl });
return VsCodeUtils.ShowInformationMessage(ACStrings.PleaseLoginViaBrowser, ...messageItems)
.then((selection: IButtonMessageItem | undefined) => {
if (selection) {
return vscode.window.showInputBox({ prompt: ACStrings.PleaseProvideToken, ignoreFocusOut: true })
.then(token => {
this.loginWithToken(token, appCenterManager);
});
} else return Q.resolve(void 0);
});
case (AppCenterLoginType[AppCenterLoginType.Token]):
return vscode.window.showInputBox({ prompt: ACStrings.PleaseProvideToken , ignoreFocusOut: true})
.then(token => {
return this.loginWithToken(token, appCenterManager);
});
default:
// User canel login otherwise
return Q.resolve(void 0);
}
});
return Q.resolve(void 0);
}
public logout(appCenterManager: AppCenterExtensionManager): Q.Promise<void> {
return Auth.doLogout(appCenterManager.projectRootPath).then(() => {
VsCodeUtils.ShowInformationMessage(ACStrings.UserLoggedOutMsg);
return appCenterManager.setupAppCenterStatusBar(null);
}).catch(() => {
this.logger.log("An errro occured on logout", LogLevel.Error);
});
}
public whoAmI(appCenterManager: AppCenterExtensionManager): Q.Promise<void> {
return Auth.getProfile(appCenterManager.projectRootPath).then((profile: Profile | null) => {
if (profile && profile.displayName) {
VsCodeUtils.ShowInformationMessage(ACStrings.YouAreLoggedInMsg(profile.displayName));
} else {
VsCodeUtils.ShowInformationMessage(ACStrings.UserIsNotLoggedInMsg);
}
return Q.resolve(void 0);
});
}
public setCurrentDeployment(appCenterManager: AppCenterExtensionManager): Q.Promise<void> {
this.restoreCurrentApp(appCenterManager.projectRootPath)
.then((currentApp: DefaultApp) => {
if (currentApp && currentApp.currentAppDeployments && currentApp.currentAppDeployments.codePushDeployments) {
const deploymentOptions: string[] = currentApp.currentAppDeployments.codePushDeployments.map((deployment) => {
return deployment.name;
});
vscode.window.showQuickPick(deploymentOptions, { placeHolder: ACStrings.SelectCurrentDeploymentMsg })
.then((deploymentName) => {
if (deploymentName) {
this.saveCurrentApp(
appCenterManager.projectRootPath,
currentApp.identifier,
AppCenterOS[currentApp.os], {
currentDeploymentName: deploymentName,
codePushDeployments: currentApp.currentAppDeployments.codePushDeployments,
},
currentApp.targetBinaryVersion,
currentApp.isMandatory
);
VsCodeUtils.ShowInformationMessage(ACStrings.YourCurrentDeploymentMsg(deploymentName));
}
});
} else {
VsCodeUtils.ShowInformationMessage(ACStrings.NoCurrentAppSetMsg);
}
});
return Q.resolve(void 0);
}
public getCurrentApp(appCenterManager: AppCenterExtensionManager): Q.Promise<void> {
this.restoreCurrentApp(appCenterManager.projectRootPath).then((app: DefaultApp) => {
if (app) {
VsCodeUtils.ShowInformationMessage(ACStrings.YourCurrentAppMsg(app.identifier));
} else {
VsCodeUtils.ShowInformationMessage(ACStrings.NoCurrentAppSetMsg);
}
});
return Q.resolve(void 0);
}
public setCurrentApp(client: AppCenterClient, appCenterManager: AppCenterExtensionManager): Q.Promise<void> {
vscode.window.withProgress({ location: vscode.ProgressLocation.Window, title: "Get Apps"}, p => {
return new Promise((resolve, reject) => {
p.report({message: ACStrings.FetchAppsStatusBarMessage });
getQPromisifiedClientResult(client.account.apps.list()).then((apps: models.AppResponse[]) => {
const appsList: models.AppResponse[] = apps;
const reactNativeApps = appsList.filter(app => app.platform === ACConstants.AppCenterReactNativePlatformName);
resolve(reactNativeApps);
});
});
}).then((rnApps: models.AppResponse[]) => {
let options = rnApps.map(app => {
return {
label: `${app.name} (${app.os})`,
description: app.displayName,
target: app.name,
};
});
vscode.window.showQuickPick(options, { placeHolder: ACStrings.ProvideCurrentAppPromptMsg })
.then((selected: {label: string, description: string, target: string}) => {
if (selected) {
const selectedApps: models.AppResponse[] = rnApps.filter(app => app.name === selected.target);
if (selectedApps && selectedApps.length === 1) {
const selectedApp: models.AppResponse = selectedApps[0];
const selectedAppName: string = `${selectedApp.owner.name}/${selectedApp.name}`;
const OS: AppCenterOS = AppCenterOS[selectedApp.os.toLowerCase()];
vscode.window.withProgress({ location: vscode.ProgressLocation.Window, title: "Get Deployments"}, p => {
return new Promise((resolve, reject) => {
p.report({message: ACStrings.FetchDeploymentsStatusBarMessage });
getQPromisifiedClientResult(client.codepush.codePushDeployments.list(selectedApp.name, selectedApp.owner.name))
.then((deployments: models.Deployment[]) => {
resolve(deployments.sort((a, b): any => {
return a.name < b.name; // sort alphabetically
}));
});
});
})
.then((appDeployments: models.Deployment[]) => {
let currentDeployments: CurrentAppDeployments | null = null;
if (appDeployments.length > 0) {
const deployments: Deployment[] = appDeployments.map((d) => {
return {
name: d.name,
};
});
currentDeployments = {
codePushDeployments: deployments,
currentDeploymentName: appDeployments[0].name, // Select 1st one by default
};
}
this.saveCurrentApp(
appCenterManager.projectRootPath,
selectedAppName,
OS,
currentDeployments,
ACConstants.AppCenterDefaultTargetBinaryVersion,
ACConstants.AppCenterDefaultIsMandatoryParam)
.then((app: DefaultApp | null) => {
if (app) {
return VsCodeUtils.ShowInformationMessage(ACStrings.YourCurrentAppAndDeployemntMsg(selected.target
, app.currentAppDeployments.currentDeploymentName));
} else {
this.logger.error("Failed to save current app");
return Q.resolve(void 0);
}
});
});
}
}
});
});
return Q.resolve(void 0);
}
public releaseReact(client: AppCenterClient, appCenterManager: AppCenterExtensionManager): Q.Promise<void> {
let codePushRelaseParams = <ICodePushReleaseParams>{};
const projectRootPath: string = appCenterManager.projectRootPath;
return Q.Promise<any>((resolve, reject) => {
let updateContentsDirectory: string;
let isMandatory: boolean;
vscode.window.withProgress({ location: vscode.ProgressLocation.Window, title: "Get Apps" }, p => {
return new Promise<DefaultApp>((appResolve, appReject) => {
p.report({ message: ACStrings.GettingAppInfoMessage });
this.restoreCurrentApp(appCenterManager.projectRootPath)
.then((currentApp: DefaultApp) => appResolve(<DefaultApp>currentApp))
.catch(err => appReject(err));
}).then((currentApp: DefaultApp): any => {
p.report({ message: ACStrings.DetectingAppVersionMessage });
if (!currentApp) {
throw new Error(`No current app has been specified.`);
}
if (!currentApp.os || !reactNative.isValidOS(currentApp.os)) {
throw new Error(`OS must be "android", "ios", or "windows".`);
}
codePushRelaseParams.app = currentApp;
codePushRelaseParams.deploymentName = currentApp.currentAppDeployments.currentDeploymentName;
currentApp.os = currentApp.os.toLowerCase();
isMandatory = !!currentApp.isMandatory;
if (currentApp.targetBinaryVersion !== ACConstants.AppCenterDefaultTargetBinaryVersion) {
return currentApp.targetBinaryVersion;
} else {
switch (currentApp.os) {
case "android": return reactNative.getAndroidAppVersion(projectRootPath);
case "ios": return reactNative.getiOSAppVersion(projectRootPath);
case "windows": return reactNative.getWindowsAppVersion(projectRootPath);
default: throw new Error(`OS must be "android", "ios", or "windows".`);
}
}
}).then((appVersion: string) => {
p.report({ message: ACStrings.RunningBundleCommandMessage });
codePushRelaseParams.appVersion = appVersion;
return reactNative.makeUpdateContents(<BundleConfig>{
os: codePushRelaseParams.app.os,
projectRootPath: projectRootPath,
});
}).then((pathToUpdateContents: string) => {
p.report({ message: ACStrings.ArchivingUpdateContentsMessage });
updateContentsDirectory = pathToUpdateContents;
this.logger.log(`CodePush updated contents directory path: ${updateContentsDirectory}`, LogLevel.Debug);
return updateContents.zip(pathToUpdateContents, projectRootPath);
}).then((pathToZippedBundle: string) => {
p.report({ message: ACStrings.ReleasingUpdateContentsMessage });
codePushRelaseParams.updatedContentZipPath = pathToZippedBundle;
codePushRelaseParams.isMandatory = isMandatory;
return new Promise<any>((publishResolve, publishReject) => {
Auth.getProfile(projectRootPath)
.then((profile: Profile) => {
return profile.accessToken;
}).then((token: string) => {
codePushRelaseParams.token = token;
return CodePushRelease.exec(client, codePushRelaseParams, this.logger);
}).then((response: any) => publishResolve(response))
.catch((error: any) => publishReject(error));
});
}).then((response: any) => {
if (response.succeeded && response.result) {
VsCodeUtils.ShowInformationMessage(`Successfully released an update to the "${codePushRelaseParams.deploymentName}" deployment of the "${codePushRelaseParams.app.appName}" app`);
resolve(response.result);
} else {
VsCodeUtils.ShowErrorMessage(response.errorMessage);
}
fileUtils.rmDir(codePushRelaseParams.updatedContentZipPath);
}).catch((error: Error) => {
if (error && error.message) {
VsCodeUtils.ShowErrorMessage(`An error occured on doing Code Push release. ${error.message}`);
} else {
VsCodeUtils.ShowErrorMessage("An error occured on doing Code Push release");
}
fileUtils.rmDir(codePushRelaseParams.updatedContentZipPath);
});
});
});
}
public showMenu(client: AppCenterClient, appCenterManager: AppCenterExtensionManager): Q.Promise<void> {
return Auth.getProfile(appCenterManager.projectRootPath).then((profile: Profile | null) => {
let defaultApp: DefaultApp | null = null;
if (profile && profile.defaultApp) {
defaultApp = profile.defaultApp;
}
let menuPlaceHolederTitle = ACStrings.MenuTitlePlaceholder;
let appCenterMenuOptions = [
{
label: ACStrings.ReleaseReactMenuText(defaultApp),
description: "",
target: ACCommandNames.CodePushReleaseReact,
},
{
label: ACStrings.SetCurrentAppMenuText(defaultApp),
description: "",
target: ACCommandNames.SetCurrentApp,
},
{
label: ACStrings.LogoutMenuLabel,
description: "",
target: ACCommandNames.Logout,
},
];
// This item is avaliable only if we have specified app already
if (defaultApp && defaultApp.currentAppDeployments) {
// Let logout command be always the last one in the list
appCenterMenuOptions.splice(appCenterMenuOptions.length - 1, 0,
{
label: ACStrings.SetCurrentAppDeploymentText(defaultApp),
description: "",
target: ACCommandNames.SetCurrentDeployment,
}
);
appCenterMenuOptions.splice(appCenterMenuOptions.length - 1, 0,
{
label: ACStrings.SetCurrentAppTargetBinaryVersionText(defaultApp),
description: "",
target: ACCommandNames.SetTargetBinaryVersionForRelease,
}
);
appCenterMenuOptions.splice(appCenterMenuOptions.length - 1, 0,
{
label: ACStrings.SetCurrentAppIsMandatoryText(defaultApp),
description: "",
target: ACCommandNames.SwitchMandatoryPropertyForRelease,
}
);
}
return vscode.window.showQuickPick(appCenterMenuOptions, { placeHolder: menuPlaceHolederTitle })
.then((selected: {label: string, description: string, target: string}) => {
if (!selected) {
// user cancel selection
return Q.resolve(void 0);
}
switch (selected.target) {
case (ACCommandNames.SetCurrentApp):
return this.setCurrentApp(client, appCenterManager);
case (ACCommandNames.SetCurrentDeployment):
return this.setCurrentDeployment(appCenterManager);
case (ACCommandNames.CodePushReleaseReact):
return this.releaseReact(client, appCenterManager);
case (ACCommandNames.SetTargetBinaryVersionForRelease):
return this.setTargetBinaryVersionForRelease(appCenterManager);
case (ACCommandNames.SwitchMandatoryPropertyForRelease):
return this.switchIsMandatoryForRelease(appCenterManager);
case (ACCommandNames.Logout):
return this.logout(appCenterManager);
default:
// Ideally shouldn't be there :)
this.logger.error("Unknown appcenter show menu command");
return Q.resolve(void 0);
}
});
});
}
public switchIsMandatoryForRelease(appCenterManager: AppCenterExtensionManager): Q.Promise<void> {
this.restoreCurrentApp(appCenterManager.projectRootPath).then((app: DefaultApp) => {
if (app) {
const newMandatoryValue = !!!app.isMandatory;
const osVal: AppCenterOS = AppCenterOS[app.os];
this.saveCurrentApp(
appCenterManager.projectRootPath,
app.identifier,
osVal, {
currentDeploymentName: app.currentAppDeployments.currentDeploymentName,
codePushDeployments: app.currentAppDeployments.codePushDeployments,
},
app.targetBinaryVersion,
newMandatoryValue
).then(() => {
VsCodeUtils.ShowInformationMessage(`Changed release to ${newMandatoryValue ? "Mandatory" : "NOT Mandatory"}`);
});
} else {
VsCodeUtils.ShowInformationMessage(ACStrings.NoCurrentAppSetMsg);
}
});
return Q.resolve(void 0);
}
public setTargetBinaryVersionForRelease(appCenterManager: AppCenterExtensionManager): Q.Promise<void> {
vscode.window.showInputBox({ prompt: ACStrings.PleaseProvideTargetBinaryVersion, ignoreFocusOut: true })
.then(appVersion => {
if (appVersion === ACConstants.AppCenterDefaultTargetBinaryVersion || (appVersion && !!validRange(appVersion))) {
return this.restoreCurrentApp(appCenterManager.projectRootPath).then((app: DefaultApp) => {
if (app) {
return this.saveCurrentApp(
appCenterManager.projectRootPath,
app.identifier,
AppCenterOS[app.os], {
currentDeploymentName: app.currentAppDeployments.currentDeploymentName,
codePushDeployments: app.currentAppDeployments.codePushDeployments,
},
appVersion,
app.isMandatory
).then(() => {
if (appVersion) {
VsCodeUtils.ShowInformationMessage(`Changed target binary version to '${appVersion}'`);
} else {
VsCodeUtils.ShowInformationMessage(`Changed target binary version to automatically fetched`);
}
});
} else {
VsCodeUtils.ShowInformationMessage(ACStrings.NoCurrentAppSetMsg);
return Q.resolve(void 0);
}
});
} else if (appVersion === undefined) {
// if user press esc do nothing then
return Q.resolve(void 0);
} else {
VsCodeUtils.ShowWarningMessage(ACStrings.InvalidAppVersionParamMsg);
return Q.resolve(void 0);
}
});
return Q.resolve(void 0);
}
private saveCurrentApp(projectRootPath: string,
currentAppName: string,
appOS: AppCenterOS,
currentAppDeployments: CurrentAppDeployments | null,
targetBinaryVersion: string,
isMandatory: boolean): Q.Promise<DefaultApp | null> {
const defaultApp = ACUtils.toDefaultApp(currentAppName, appOS, currentAppDeployments, targetBinaryVersion, isMandatory);
if (!defaultApp) {
VsCodeUtils.ShowWarningMessage(ACStrings.InvalidCurrentAppNameMsg);
return Q.resolve(null);
}
return Auth.getProfile(projectRootPath).then((profile: Profile | null) => {
if (profile) {
profile.defaultApp = defaultApp;
profile.save(projectRootPath);
return Q.resolve(defaultApp);
} else {
// No profile - not logged in?
VsCodeUtils.ShowWarningMessage(ACStrings.UserIsNotLoggedInMsg);
return Q.resolve(null);
}
});
}
private restoreCurrentApp(projectRootPath: string): Q.Promise<DefaultApp | null> {
return Auth.getProfile(projectRootPath).then((profile: Profile | null) => {
if (profile && profile.defaultApp) {
return Q.resolve(profile.defaultApp);
}
return Q.resolve(null);
});
}
private loginWithToken(token: string | undefined, appCenterManager: AppCenterExtensionManager) {
if (!token) {
return;
}
return Auth.doTokenLogin(token, appCenterManager.projectRootPath).then((profile: Profile) => {
if (!profile) {
this.logger.log("Failed to fetch user info from server", LogLevel.Error);
VsCodeUtils.ShowWarningMessage(ACStrings.FailedToExecuteLoginMsg);
return;
}
VsCodeUtils.ShowInformationMessage(ACStrings.YouAreLoggedInMsg(profile.displayName));
return appCenterManager.setupAppCenterStatusBar(profile);
});
}
}

Просмотреть файл

@ -1,30 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import { CurrentAppDeployments } from "../appCenterConstants";
export interface DefaultApp {
ownerName: string;
appName: string;
identifier: string;
targetBinaryVersion: string;
isMandatory: boolean;
os: string;
currentAppDeployments: CurrentAppDeployments;
}
export interface IDefaultCommandParams {
app: DefaultApp;
}
export interface ICodePushReleaseParams extends IDefaultCommandParams {
deploymentName: string;
updatedContentZipPath: string;
appVersion?: string;
description?: string;
isDisabled?: boolean;
isMandatory?: boolean;
label?: string;
packageHash?: string;
rollout?: number;
token?: string;
}

Просмотреть файл

@ -1,48 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
export type CommandResult = CommandSucceededResult | CommandFailedResult;
export interface CommandSucceededResult {
succeeded: boolean;
result?: any;
}
export interface CommandFailedResult {
succeeded: boolean;
errorCode: number;
errorMessage: string;
exception?: Error;
}
export function success(res: any): CommandResult {
return {
succeeded: true,
result: res,
};
}
// Used when there's a failure otherwise
export function failure(errorCode: number, errorMessage: string): CommandResult {
return {
succeeded: false,
errorCode,
errorMessage,
};
}
export enum ErrorCodes {
Succeeded = 0,
// Command given contained illegal characters/names
IllegalCommand,
// Command was legal, but not found
NoSuchCommand,
// Unhandled exception occurred
Exception,
// A parameter is invalid
InvalidParameter,
// Command requires logged in user
NotLoggedIn,
// The requested resource was not found
NotFound,
}

Просмотреть файл

@ -1,77 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
// tslint:disable-next-line:no-var-requires
const opener = require("opener");
// tslint:disable-next-line:no-var-requires
const open = require("open");
import * as Q from "q";
import * as fs from "fs";
import * as path from "path";
import { Package, IPackageInformation } from "../../../common/node/package";
import { ACConstants, AppCenterOS, CurrentAppDeployments } from "../appCenterConstants";
import { DefaultApp } from "../command/commandParams";
export class ACUtils {
private static validApp = /^([a-zA-Z0-9-_.]{1,100})\/([a-zA-Z0-9-_.]{1,100})$/;
// Use open for Windows and Mac, opener for Linux
public static OpenUrl(url: string): void {
switch (process.platform) {
case "win32":
case "darwin":
open(url);
break;
default:
opener(url);
break;
}
}
public static isCodePushProject(projectRoot: string): Q.Promise<boolean> {
if (!projectRoot || !fs.existsSync(path.join(projectRoot, "package.json"))) {
return Q<boolean>(false);
}
return new Package(projectRoot).parsePackageInformation().then((packageInfo: IPackageInformation) => {
if (packageInfo.dependencies && packageInfo.dependencies[ACConstants.CodePushNpmPackageName]) {
return Q<boolean>(true);
} else {
return Q<boolean>(false);
}
});
}
public static formatDeploymentNameForStatusBar(deployment: CurrentAppDeployments): string {
return deployment.currentDeploymentName;
}
public static formatAppName(app: DefaultApp): string | null {
if (app) {
return `${app.appName} (${app.os})`;
}
return null;
}
public static toDefaultApp(app: string,
appOS: AppCenterOS,
appDeployment: CurrentAppDeployments | null,
targetBinaryVersion: string,
isMandatory: boolean): DefaultApp | null {
const matches = app.match(this.validApp);
if (matches !== null) {
return {
ownerName: matches[1],
appName: matches[2],
identifier: `${matches[1]}/${matches[2]}`,
os: appOS,
targetBinaryVersion: targetBinaryVersion,
isMandatory: isMandatory,
currentAppDeployments: appDeployment ? appDeployment : {
codePushDeployments: new Array(),
currentDeploymentName: "",
},
};
}
return null;
}
}

Просмотреть файл

@ -1,90 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
import { MessageTypes, ACConstants } from "../appCenterConstants";
import { commands, StatusBarItem, window, MessageItem } from "vscode";
import { ACUtils } from "./utils";
import * as Q from "q";
export interface IButtonMessageItem {
title: string;
url?: string;
command?: string;
}
export class ButtonMessageItem implements MessageItem, IButtonMessageItem {
public title: string;
public url?: string;
public command?: string;
}
export class VsCodeUtils {
public static setStatusBar(statusBar: StatusBarItem, text: string, tooltip: string, commandOnClick?: string): Q.Promise<void> {
if (statusBar !== undefined) {
statusBar.command = commandOnClick; // undefined clears the command
statusBar.text = text;
statusBar.tooltip = tooltip;
statusBar.color = ACConstants.AppCenterCodePushStatusBarColor;
statusBar.show();
}
return Q.resolve(void 0);
}
public static ShowInformationMessage(message: string, ...urlMessageItem: IButtonMessageItem[]): Q.Promise<IButtonMessageItem | undefined> {
return Q.Promise<IButtonMessageItem | undefined>((resolve, reject) => {
return this.showMessage(message, MessageTypes.Info, ...urlMessageItem).then((res: IButtonMessageItem | undefined) => {
resolve(res);
return;
});
});
}
public static ShowWarningMessage(message: string, ...urlMessageItem: IButtonMessageItem[]): Q.Promise<IButtonMessageItem | undefined> {
return Q.Promise<IButtonMessageItem | undefined>((resolve, reject) => {
return this.showMessage(message, MessageTypes.Warn, ...urlMessageItem).then((res: IButtonMessageItem | undefined) => {
resolve(res);
return;
});
});
}
public static ShowErrorMessage(message: string, ...urlMessageItem: IButtonMessageItem[]): Q.Promise<IButtonMessageItem | undefined> {
return Q.Promise<IButtonMessageItem | undefined>((resolve, reject) => {
return this.showMessage(message, MessageTypes.Error, ...urlMessageItem).then((res: IButtonMessageItem | undefined) => {
resolve(res);
return;
});
});
}
private static async showMessage(messageToDisplay: string, type: MessageTypes, ...urlMessageItem: IButtonMessageItem[]): Promise<IButtonMessageItem | undefined> {
// The following "cast" allows us to pass our own type around (and not reference "vscode" via an import)
const messageItems: ButtonMessageItem[] = <ButtonMessageItem[]>urlMessageItem;
let chosenItem: IButtonMessageItem | undefined;
switch (type) {
case MessageTypes.Error:
chosenItem = await window.showErrorMessage(messageToDisplay, ...messageItems);
break;
case MessageTypes.Info:
chosenItem = await window.showInformationMessage(messageToDisplay, ...messageItems);
break;
case MessageTypes.Warn:
chosenItem = await window.showWarningMessage(messageToDisplay, ...messageItems);
break;
default:
break;
}
if (chosenItem) {
if (chosenItem.url) {
ACUtils.OpenUrl(chosenItem.url);
}
if (chosenItem.command) {
commands.executeCommand<void>(chosenItem.command);
}
}
return chosenItem;
}
}

Просмотреть файл

@ -1,4 +0,0 @@
.DS_Store
node_modules
npm-debug.log
.idea

Просмотреть файл

@ -1,36 +0,0 @@
# Introduction
AppCenter NodeJS client generated by AutoRest and swagger-tools.
# Getting Started
To install use local installation or npm package.
# Build and Test
No building required for this package.
# Contribute
DO NOT contribute to this repo because it contains automatically generated content.
Contribute to https://msmobilecenter.visualstudio.com/Mobile-Center/Build/_git/swagger-tools.
# How to use
1) Simple client usage
```
import { AppCenterClient } from 'app-center-node-client';
const client = new AppCenterClient('api token here');
console.log(client.account.apps.create({
displayName: 'test',
os: 'iOS',
platform: 'mobile'
}));
```
2) Importing models
Import models from `/models` index path.
```
import { FileAsset } from 'app-center-node-client/models';
```

Просмотреть файл

@ -1,23 +0,0 @@
/*
* Code generated by Microsoft (R) SwaggerTools.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
/// <reference path="./models.d.ts" />
/// <reference path="./src/appCenterClient.d.ts" />
/// <reference path="./src/account/accountClient.d.ts" />
/// <reference path="./src/codepush/codepushClient.d.ts" />
import AppCenterClient = require('./src/appCenterClient');
import AccountClient = require('./src/account/accountClient');
import CodepushClient = require('./src/codepush/codepushClient');
export {
AccountClient,
CodepushClient
};
export default AppCenterClient;

Просмотреть файл

@ -1,5 +0,0 @@
const AppCenterClient = require('./src/appCenterClient');
exports.default = AppCenterClient;
exports.AccountClient = require('./src/account/accountClient');
exports.CodepushClient = require('./src/codepush/codepushClient');

Просмотреть файл

@ -1,6 +0,0 @@
/// <reference path="./src/account/models/index.d.ts" />
/// <reference path="./src/codepush/models/index.d.ts" />
export * from './src/account/models/index';
export * from './src/codepush/models/index';

Просмотреть файл

@ -1,7 +0,0 @@
const accountModels = require('./src/account/models');
const codepushModels = require('./src/codepush/models');
exports = Object.assign({},
accountModels,
codepushModels
);

Просмотреть файл

@ -1,9 +0,0 @@
{
"name": "app-center-node-client",
"main": "index.js",
"types": "index.d.ts",
"version": "1.0.0",
"dependencies": {
"ms-rest": "^2.2.5"
}
}

Просмотреть файл

@ -1,47 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
import { ServiceClient, ServiceClientOptions, ServiceClientCredentials } from 'ms-rest';
import * as operations from "./operations";
declare class AccountClient extends ServiceClient {
/**
* @class
* Initializes a new instance of the AccountClient class.
* @constructor
*
* @param {credentials} credentials - Subscription credentials which uniquely identify client subscription.
*
* @param {string} [baseUri] - The base URI of the service.
*
* @param {object} [options] - The parameter options
*
* @param {Array} [options.filters] - Filters to be added to the request pipeline
*
* @param {object} [options.requestOptions] - Options for the underlying request object
* {@link https://github.com/request/request#requestoptions-callback Options doc}
*
* @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
*
*/
constructor(credentials: ServiceClientCredentials, baseUri?: string, options?: ServiceClientOptions);
credentials: ServiceClientCredentials;
// Operation groups
apiTokens: operations.ApiTokens;
apps: operations.Apps;
azureSubscription: operations.AzureSubscription;
distributionGroups: operations.DistributionGroups;
appInvitations: operations.AppInvitations;
users: operations.Users;
organizations: operations.Organizations;
orgInvitations: operations.OrgInvitations;
teams: operations.Teams;
distributionGroupInvitations: operations.DistributionGroupInvitations;
}
export = AccountClient;

Просмотреть файл

@ -1,65 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
/* jshint latedef:false */
/* jshint forin:false */
/* jshint noempty:false */
'use strict';
const msRest = require('ms-rest');
const ServiceClient = msRest.ServiceClient;
const models = require('./models');
const operations = require('./operations');
/** Class representing a AccountClient. */
class AccountClient extends ServiceClient {
/**
* Create a AccountClient.
* @param {credentials} credentials - Subscription credentials which uniquely identify client subscription.
* @param {string} [baseUri] - The base URI of the service.
* @param {object} [options] - The parameter options
* @param {Array} [options.filters] - Filters to be added to the request pipeline
* @param {object} [options.requestOptions] - Options for the underlying request object
* {@link https://github.com/request/request#requestoptions-callback Options doc}
* @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
*/
constructor(credentials, baseUri, options) {
if (credentials === null || credentials === undefined) {
throw new Error('\'credentials\' cannot be null.');
}
if (!options) options = {};
super(credentials, options);
this.baseUri = baseUri;
if (!this.baseUri) {
this.baseUri = 'https://api.appcenter.ms/';
}
this.credentials = credentials;
let packageInfo = this.getPackageJsonInfo(__dirname);
this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`);
this.apiTokens = new operations.ApiTokens(this);
this.apps = new operations.Apps(this);
this.azureSubscription = new operations.AzureSubscription(this);
this.distributionGroups = new operations.DistributionGroups(this);
this.appInvitations = new operations.AppInvitations(this);
this.users = new operations.Users(this);
this.organizations = new operations.Organizations(this);
this.orgInvitations = new operations.OrgInvitations(this);
this.teams = new operations.Teams(this);
this.distributionGroupInvitations = new operations.DistributionGroupInvitations(this);
this.models = models;
msRest.addSerializationMixin(this);
}
}
module.exports = AccountClient;

Просмотреть файл

@ -1,62 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a ApiTokensCreateRequest.
*/
class ApiTokensCreateRequest {
/**
* Create a ApiTokensCreateRequest.
* @member {string} [description] The description of the token
* @member {array} [scope] The scope for this token.
*/
constructor() {
}
/**
* Defines the metadata of ApiTokensCreateRequest
*
* @returns {object} metadata of ApiTokensCreateRequest
*
*/
mapper() {
return {
required: false,
serializedName: 'ApiTokensCreateRequest',
type: {
name: 'Composite',
className: 'ApiTokensCreateRequest',
modelProperties: {
description: {
required: false,
serializedName: 'description',
type: {
name: 'String'
}
},
scope: {
required: false,
serializedName: 'scope',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'StringElementType',
type: {
name: 'String'
}
}
}
}
}
}
};
}
}
module.exports = ApiTokensCreateRequest;

Просмотреть файл

@ -1,87 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a ApiTokensCreateResponse.
*/
class ApiTokensCreateResponse {
/**
* Create a ApiTokensCreateResponse.
* @member {string} id The unique id (UUID) of the api token
* @member {string} apiToken The api token generated will not be accessible
* again
* @member {string} [description] The description of the token
* @member {array} [scope] The scope for this token.
* @member {string} createdAt The creation time
*/
constructor() {
}
/**
* Defines the metadata of ApiTokensCreateResponse
*
* @returns {object} metadata of ApiTokensCreateResponse
*
*/
mapper() {
return {
required: false,
serializedName: 'ApiTokensCreateResponse',
type: {
name: 'Composite',
className: 'ApiTokensCreateResponse',
modelProperties: {
id: {
required: true,
serializedName: 'id',
type: {
name: 'String'
}
},
apiToken: {
required: true,
serializedName: 'api_token',
type: {
name: 'String'
}
},
description: {
required: false,
serializedName: 'description',
type: {
name: 'String'
}
},
scope: {
required: false,
serializedName: 'scope',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'StringElementType',
type: {
name: 'String'
}
}
}
},
createdAt: {
required: true,
serializedName: 'created_at',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = ApiTokensCreateResponse;

Просмотреть файл

@ -1,78 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a ApiTokensGetResponse.
*/
class ApiTokensGetResponse {
/**
* Create a ApiTokensGetResponse.
* @member {string} id The unique id (UUID) of the api token
* @member {string} [description] The description of the token
* @member {array} [scope] The scope for this token.
* @member {string} createdAt The creation time
*/
constructor() {
}
/**
* Defines the metadata of ApiTokensGetResponse
*
* @returns {object} metadata of ApiTokensGetResponse
*
*/
mapper() {
return {
required: false,
serializedName: 'ApiTokensGetResponse',
type: {
name: 'Composite',
className: 'ApiTokensGetResponse',
modelProperties: {
id: {
required: true,
serializedName: 'id',
type: {
name: 'String'
}
},
description: {
required: false,
serializedName: 'description',
type: {
name: 'String'
}
},
scope: {
required: false,
serializedName: 'scope',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'StringElementType',
type: {
name: 'String'
}
}
}
},
createdAt: {
required: true,
serializedName: 'created_at',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = ApiTokensGetResponse;

Просмотреть файл

@ -1,144 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
const models = require('./index');
/**
* Class representing a AppInvitationDetailResponse.
*/
class AppInvitationDetailResponse {
/**
* Create a AppInvitationDetailResponse.
* @member {string} id The unique ID (UUID) of the invitation
* @member {object} app
* @member {string} [app.appSecret] A unique and secret key used to identify
* the app in communication with the ingestion endpoint for crash reporting
* and analytics
* @member {object} [app.azureSubscription]
* @member {string} [app.azureSubscription.subscriptionId] The azure
* subscription id
* @member {string} [app.azureSubscription.tenantId] The tenant id of the
* azure subscription belongs to
* @member {string} [app.azureSubscription.subscriptionName] The name of the
* azure subscription
* @member {boolean} [app.azureSubscription.isBilling] If the subscription is
* used for billing
* @member {boolean} [app.azureSubscription.isBillable] If the subscription
* can be used for billing
* @member {string} [app.platform] The platform of the app. Possible values
* include: 'Java', 'Objective-C-Swift', 'UWP', 'Cordova', 'React-Native',
* 'Unity', 'Xamarin', 'Unknown'
* @member {string} [app.origin] The creation origin of this app. Possible
* values include: 'mobile-center', 'hockeyapp', 'codepush'
* @member {string} [app.createdAt] The created date of this app
* @member {string} [app.updatedAt] The last updated date of this app
* @member {array} [app.memberPermissions] The permissions of the calling
* user
* @member {string} email The email address of the invited user
* @member {string} inviteType The invitation type. Possible values include:
* 'developer', 'tester'
* @member {object} invitedBy
* @member {string} [invitedBy.id] The unique id (UUID) of the user
* @member {string} [invitedBy.avatarUrl] The avatar URL of the user
* @member {boolean} [invitedBy.canChangePassword] User is required to send
* an old password in order to change the password.
* @member {string} [invitedBy.displayName] The full name of the user. Might
* for example be first and last name
* @member {string} [invitedBy.email] The email address of the user
* @member {string} [invitedBy.name] The unique name that is used to identify
* the user.
* @member {array} [invitedBy.permissions] The permissions the user has for
* the app
* @member {string} [invitedBy.origin] The creation origin of this user.
* Possible values include: 'mobile-center', 'hockeyapp', 'codepush'
* @member {boolean} isExistingUser Indicates whether the invited user
* already exists
* @member {array} [permissions] The permissions the user has for the app
*/
constructor() {
}
/**
* Defines the metadata of AppInvitationDetailResponse
*
* @returns {object} metadata of AppInvitationDetailResponse
*
*/
mapper() {
return {
required: false,
serializedName: 'AppInvitationDetailResponse',
type: {
name: 'Composite',
className: 'AppInvitationDetailResponse',
modelProperties: {
id: {
required: true,
serializedName: 'id',
type: {
name: 'String'
}
},
app: {
required: true,
serializedName: 'app',
type: {
name: 'Composite',
className: 'AppResponse'
}
},
email: {
required: true,
serializedName: 'email',
type: {
name: 'String'
}
},
inviteType: {
required: true,
serializedName: 'invite_type',
type: {
name: 'String'
}
},
invitedBy: {
required: true,
serializedName: 'invited_by',
type: {
name: 'Composite',
className: 'UserProfileResponse'
}
},
isExistingUser: {
required: true,
serializedName: 'is_existing_user',
type: {
name: 'Boolean'
}
},
permissions: {
required: false,
serializedName: 'permissions',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'StringElementType',
type: {
name: 'String'
}
}
}
}
}
}
};
}
}
module.exports = AppInvitationDetailResponse;

Просмотреть файл

@ -1,72 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a AppPatchRequest.
*/
class AppPatchRequest {
/**
* Create a AppPatchRequest.
* @member {string} [description] A short text describing the app
* @member {string} [displayName] The display name of the app
* @member {string} [name] The name of the app used in URLs
* @member {string} [iconUrl] The string representation of the URL pointing
* to the app's icon
*/
constructor() {
}
/**
* Defines the metadata of AppPatchRequest
*
* @returns {object} metadata of AppPatchRequest
*
*/
mapper() {
return {
required: false,
serializedName: 'AppPatchRequest',
type: {
name: 'Composite',
className: 'AppPatchRequest',
modelProperties: {
description: {
required: false,
serializedName: 'description',
type: {
name: 'String'
}
},
displayName: {
required: false,
serializedName: 'display_name',
type: {
name: 'String'
}
},
name: {
required: false,
serializedName: 'name',
type: {
name: 'String'
}
},
iconUrl: {
required: false,
serializedName: 'icon_url',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = AppPatchRequest;

Просмотреть файл

@ -1,83 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a AppRequest.
*/
class AppRequest {
/**
* Create a AppRequest.
* @member {string} [description] A short text describing the app
* @member {string} displayName The descriptive name of the app. This can
* contain any characters
* @member {string} [name] The name of the app used in URLs
* @member {string} os The OS the app will be running on. Possible values
* include: 'Android', 'iOS', 'macOS', 'Tizen', 'tvOS', 'Windows'
* @member {string} platform The platform of the app. Possible values
* include: 'Java', 'Objective-C-Swift', 'UWP', 'Cordova', 'React-Native',
* 'Xamarin'
*/
constructor() {
}
/**
* Defines the metadata of AppRequest
*
* @returns {object} metadata of AppRequest
*
*/
mapper() {
return {
required: false,
serializedName: 'AppRequest',
type: {
name: 'Composite',
className: 'AppRequest',
modelProperties: {
description: {
required: false,
serializedName: 'description',
type: {
name: 'String'
}
},
displayName: {
required: true,
serializedName: 'display_name',
type: {
name: 'String'
}
},
name: {
required: false,
serializedName: 'name',
type: {
name: 'String'
}
},
os: {
required: true,
serializedName: 'os',
type: {
name: 'String'
}
},
platform: {
required: true,
serializedName: 'platform',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = AppRequest;

Просмотреть файл

@ -1,172 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
const models = require('./index');
/**
* Class representing a AppResponse.
* @extends models['BasicAppResponse']
*/
class AppResponse extends models['BasicAppResponse'] {
/**
* Create a AppResponse.
* @member {string} [appSecret] A unique and secret key used to identify the
* app in communication with the ingestion endpoint for crash reporting and
* analytics
* @member {object} [azureSubscription]
* @member {string} [azureSubscription.subscriptionId] The azure subscription
* id
* @member {string} [azureSubscription.tenantId] The tenant id of the azure
* subscription belongs to
* @member {string} [azureSubscription.subscriptionName] The name of the
* azure subscription
* @member {boolean} [azureSubscription.isBilling] If the subscription is
* used for billing
* @member {boolean} [azureSubscription.isBillable] If the subscription can
* be used for billing
* @member {string} [platform] The platform of the app. Possible values
* include: 'Java', 'Objective-C-Swift', 'UWP', 'Cordova', 'React-Native',
* 'Unity', 'Xamarin', 'Unknown'
* @member {string} [origin] The creation origin of this app. Possible values
* include: 'mobile-center', 'hockeyapp', 'codepush'
* @member {string} [createdAt] The created date of this app
* @member {string} [updatedAt] The last updated date of this app
* @member {array} [memberPermissions] The permissions of the calling user
*/
constructor() {
super();
}
/**
* Defines the metadata of AppResponse
*
* @returns {object} metadata of AppResponse
*
*/
mapper() {
return {
required: false,
serializedName: 'AppResponse',
type: {
name: 'Composite',
className: 'AppResponse',
modelProperties: {
id: {
required: true,
serializedName: 'id',
type: {
name: 'String'
}
},
description: {
required: false,
serializedName: 'description',
type: {
name: 'String'
}
},
displayName: {
required: true,
serializedName: 'display_name',
type: {
name: 'String'
}
},
iconUrl: {
required: false,
serializedName: 'icon_url',
type: {
name: 'String'
}
},
name: {
required: true,
serializedName: 'name',
type: {
name: 'String'
}
},
os: {
required: true,
serializedName: 'os',
type: {
name: 'String'
}
},
owner: {
required: true,
serializedName: 'owner',
type: {
name: 'Composite',
className: 'Owner'
}
},
appSecret: {
required: false,
serializedName: 'app_secret',
type: {
name: 'String'
}
},
azureSubscription: {
required: false,
serializedName: 'azure_subscription',
type: {
name: 'Composite',
className: 'AzureSubscriptionResponse'
}
},
platform: {
required: false,
serializedName: 'platform',
type: {
name: 'String'
}
},
origin: {
required: false,
serializedName: 'origin',
type: {
name: 'String'
}
},
createdAt: {
required: false,
serializedName: 'created_at',
type: {
name: 'String'
}
},
updatedAt: {
required: false,
serializedName: 'updated_at',
type: {
name: 'String'
}
},
memberPermissions: {
required: false,
serializedName: 'member_permissions',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'StringElementType',
type: {
name: 'String'
}
}
}
}
}
}
};
}
}
module.exports = AppResponse;

Просмотреть файл

@ -1,47 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a AppTeamAddRequest.
*/
class AppTeamAddRequest {
/**
* Create a AppTeamAddRequest.
* @member {string} name The name of the app to be added to the team
*/
constructor() {
}
/**
* Defines the metadata of AppTeamAddRequest
*
* @returns {object} metadata of AppTeamAddRequest
*
*/
mapper() {
return {
required: false,
serializedName: 'AppTeamAddRequest',
type: {
name: 'Composite',
className: 'AppTeamAddRequest',
modelProperties: {
name: {
required: true,
serializedName: 'name',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = AppTeamAddRequest;

Просмотреть файл

@ -1,165 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
const models = require('./index');
/**
* Class representing a AppWithTeamPermissionsResponse.
* @extends models['AppResponse']
*/
class AppWithTeamPermissionsResponse extends models['AppResponse'] {
/**
* Create a AppWithTeamPermissionsResponse.
* @member {array} [teamPermissions] The permissions the team has for the app
*/
constructor() {
super();
}
/**
* Defines the metadata of AppWithTeamPermissionsResponse
*
* @returns {object} metadata of AppWithTeamPermissionsResponse
*
*/
mapper() {
return {
required: false,
serializedName: 'AppWithTeamPermissionsResponse',
type: {
name: 'Composite',
className: 'AppWithTeamPermissionsResponse',
modelProperties: {
id: {
required: true,
serializedName: 'id',
type: {
name: 'String'
}
},
description: {
required: false,
serializedName: 'description',
type: {
name: 'String'
}
},
displayName: {
required: true,
serializedName: 'display_name',
type: {
name: 'String'
}
},
iconUrl: {
required: false,
serializedName: 'icon_url',
type: {
name: 'String'
}
},
name: {
required: true,
serializedName: 'name',
type: {
name: 'String'
}
},
os: {
required: true,
serializedName: 'os',
type: {
name: 'String'
}
},
owner: {
required: true,
serializedName: 'owner',
type: {
name: 'Composite',
className: 'Owner'
}
},
appSecret: {
required: false,
serializedName: 'app_secret',
type: {
name: 'String'
}
},
azureSubscription: {
required: false,
serializedName: 'azure_subscription',
type: {
name: 'Composite',
className: 'AzureSubscriptionResponse'
}
},
platform: {
required: false,
serializedName: 'platform',
type: {
name: 'String'
}
},
origin: {
required: false,
serializedName: 'origin',
type: {
name: 'String'
}
},
createdAt: {
required: false,
serializedName: 'created_at',
type: {
name: 'String'
}
},
updatedAt: {
required: false,
serializedName: 'updated_at',
type: {
name: 'String'
}
},
memberPermissions: {
required: false,
serializedName: 'member_permissions',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'StringElementType',
type: {
name: 'String'
}
}
}
},
teamPermissions: {
required: false,
serializedName: 'team_permissions',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'StringElementType',
type: {
name: 'String'
}
}
}
}
}
}
};
}
}
module.exports = AppWithTeamPermissionsResponse;

Просмотреть файл

@ -1,47 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a AzureSubscriptionAddToAppRequest.
*/
class AzureSubscriptionAddToAppRequest {
/**
* Create a AzureSubscriptionAddToAppRequest.
* @member {string} subscriptionId The azure subscription id
*/
constructor() {
}
/**
* Defines the metadata of AzureSubscriptionAddToAppRequest
*
* @returns {object} metadata of AzureSubscriptionAddToAppRequest
*
*/
mapper() {
return {
required: false,
serializedName: 'AzureSubscriptionAddToAppRequest',
type: {
name: 'Composite',
className: 'AzureSubscriptionAddToAppRequest',
modelProperties: {
subscriptionId: {
required: true,
serializedName: 'subscription_id',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = AzureSubscriptionAddToAppRequest;

Просмотреть файл

@ -1,80 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a AzureSubscriptionResponse.
*/
class AzureSubscriptionResponse {
/**
* Create a AzureSubscriptionResponse.
* @member {string} subscriptionId The azure subscription id
* @member {string} tenantId The tenant id of the azure subscription belongs
* to
* @member {string} subscriptionName The name of the azure subscription
* @member {boolean} [isBilling] If the subscription is used for billing
* @member {boolean} [isBillable] If the subscription can be used for billing
*/
constructor() {
}
/**
* Defines the metadata of AzureSubscriptionResponse
*
* @returns {object} metadata of AzureSubscriptionResponse
*
*/
mapper() {
return {
required: false,
serializedName: 'AzureSubscriptionResponse',
type: {
name: 'Composite',
className: 'AzureSubscriptionResponse',
modelProperties: {
subscriptionId: {
required: true,
serializedName: 'subscription_id',
type: {
name: 'String'
}
},
tenantId: {
required: true,
serializedName: 'tenant_id',
type: {
name: 'String'
}
},
subscriptionName: {
required: true,
serializedName: 'subscription_name',
type: {
name: 'String'
}
},
isBilling: {
required: false,
serializedName: 'is_billing',
type: {
name: 'Boolean'
}
},
isBillable: {
required: false,
serializedName: 'is_billable',
type: {
name: 'Boolean'
}
}
}
}
};
}
}
module.exports = AzureSubscriptionResponse;

Просмотреть файл

@ -1,108 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
const models = require('./index');
/**
* Class representing a BasicAppResponse.
*/
class BasicAppResponse {
/**
* Create a BasicAppResponse.
* @member {string} id The unique ID (UUID) of the app
* @member {string} [description] The description of the app
* @member {string} displayName The display name of the app
* @member {string} [iconUrl] The string representation of the URL pointing
* to the app's icon
* @member {string} name The name of the app used in URLs
* @member {string} os The OS the app will be running on. Possible values
* include: 'Android', 'iOS', 'macOS', 'Tizen', 'tvOS', 'Windows', 'Custom'
* @member {object} owner
* @member {string} [owner.id] The unique id (UUID) of the owner
* @member {string} [owner.avatarUrl] The avatar URL of the owner
* @member {string} [owner.displayName] The owner's display name
* @member {string} [owner.email] The owner's email address
* @member {string} [owner.name] The unique name that used to identify the
* owner
* @member {string} [owner.type] The owner type. Can either be 'org' or
* 'user'. Possible values include: 'org', 'user'
*/
constructor() {
}
/**
* Defines the metadata of BasicAppResponse
*
* @returns {object} metadata of BasicAppResponse
*
*/
mapper() {
return {
required: false,
serializedName: 'BasicAppResponse',
type: {
name: 'Composite',
className: 'BasicAppResponse',
modelProperties: {
id: {
required: true,
serializedName: 'id',
type: {
name: 'String'
}
},
description: {
required: false,
serializedName: 'description',
type: {
name: 'String'
}
},
displayName: {
required: true,
serializedName: 'display_name',
type: {
name: 'String'
}
},
iconUrl: {
required: false,
serializedName: 'icon_url',
type: {
name: 'String'
}
},
name: {
required: true,
serializedName: 'name',
type: {
name: 'String'
}
},
os: {
required: true,
serializedName: 'os',
type: {
name: 'String'
}
},
owner: {
required: true,
serializedName: 'owner',
type: {
name: 'Composite',
className: 'Owner'
}
}
}
}
};
}
}
module.exports = BasicAppResponse;

Просмотреть файл

@ -1,55 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a DistributionGroupPatchRequest.
*/
class DistributionGroupPatchRequest {
/**
* Create a DistributionGroupPatchRequest.
* @member {string} [name] The name of the distribution group
* @member {boolean} [isPublic] Whether the distribution group is public
*/
constructor() {
}
/**
* Defines the metadata of DistributionGroupPatchRequest
*
* @returns {object} metadata of DistributionGroupPatchRequest
*
*/
mapper() {
return {
required: false,
serializedName: 'DistributionGroupPatchRequest',
type: {
name: 'Composite',
className: 'DistributionGroupPatchRequest',
modelProperties: {
name: {
required: false,
serializedName: 'name',
type: {
name: 'String'
}
},
isPublic: {
required: false,
serializedName: 'is_public',
type: {
name: 'Boolean'
}
}
}
}
};
}
}
module.exports = DistributionGroupPatchRequest;

Просмотреть файл

@ -1,47 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a DistributionGroupRequest.
*/
class DistributionGroupRequest {
/**
* Create a DistributionGroupRequest.
* @member {string} name The name of the distribution group
*/
constructor() {
}
/**
* Defines the metadata of DistributionGroupRequest
*
* @returns {object} metadata of DistributionGroupRequest
*
*/
mapper() {
return {
required: false,
serializedName: 'DistributionGroupRequest',
type: {
name: 'Composite',
className: 'DistributionGroupRequest',
modelProperties: {
name: {
required: true,
serializedName: 'name',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = DistributionGroupRequest;

Просмотреть файл

@ -1,72 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a DistributionGroupResponse.
*/
class DistributionGroupResponse {
/**
* Create a DistributionGroupResponse.
* @member {string} id The unique ID of the distribution group
* @member {string} name The name of the distribution group used in URLs
* @member {string} origin The creation origin of this distribution group.
* Possible values include: 'mobile-center', 'hockeyapp'
* @member {boolean} isPublic Whether the distribution group is public
*/
constructor() {
}
/**
* Defines the metadata of DistributionGroupResponse
*
* @returns {object} metadata of DistributionGroupResponse
*
*/
mapper() {
return {
required: false,
serializedName: 'DistributionGroupResponse',
type: {
name: 'Composite',
className: 'DistributionGroupResponse',
modelProperties: {
id: {
required: true,
serializedName: 'id',
type: {
name: 'String'
}
},
name: {
required: true,
serializedName: 'name',
type: {
name: 'String'
}
},
origin: {
required: true,
serializedName: 'origin',
type: {
name: 'String'
}
},
isPublic: {
required: true,
serializedName: 'is_public',
type: {
name: 'Boolean'
}
}
}
}
};
}
}
module.exports = DistributionGroupResponse;

Просмотреть файл

@ -1,71 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a DistributionGroupUserDeleteResponse.
*/
class DistributionGroupUserDeleteResponse {
/**
* Create a DistributionGroupUserDeleteResponse.
* @member {string} [code] The code of the result
* @member {number} [message] The message of the result
* @member {number} status The status code of the result
* @member {string} [userEmail] The email of the user
*/
constructor() {
}
/**
* Defines the metadata of DistributionGroupUserDeleteResponse
*
* @returns {object} metadata of DistributionGroupUserDeleteResponse
*
*/
mapper() {
return {
required: false,
serializedName: 'DistributionGroupUserDeleteResponse',
type: {
name: 'Composite',
className: 'DistributionGroupUserDeleteResponse',
modelProperties: {
code: {
required: false,
serializedName: 'code',
type: {
name: 'String'
}
},
message: {
required: false,
serializedName: 'message',
type: {
name: 'Number'
}
},
status: {
required: true,
serializedName: 'status',
type: {
name: 'Number'
}
},
userEmail: {
required: false,
serializedName: 'user_email',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = DistributionGroupUserDeleteResponse;

Просмотреть файл

@ -1,98 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a DistributionGroupUserGetResponse.
*/
class DistributionGroupUserGetResponse {
/**
* Create a DistributionGroupUserGetResponse.
* @member {string} [id] The unique id (UUID) of the user
* @member {string} [avatarUrl] The avatar URL of the user
* @member {boolean} [canChangePassword] User is required to send an old
* password in order to change the password.
* @member {string} [displayName] The full name of the user. Might for
* example be first and last name
* @member {string} email The email address of the user
* @member {boolean} [invitePending] Whether the has accepted the invite.
* Available when an invite is pending, and the value will be "true".
* @member {string} [name] The unique name that is used to identify the user.
*/
constructor() {
}
/**
* Defines the metadata of DistributionGroupUserGetResponse
*
* @returns {object} metadata of DistributionGroupUserGetResponse
*
*/
mapper() {
return {
required: false,
serializedName: 'DistributionGroupUserGetResponse',
type: {
name: 'Composite',
className: 'DistributionGroupUserGetResponse',
modelProperties: {
id: {
required: false,
serializedName: 'id',
type: {
name: 'String'
}
},
avatarUrl: {
required: false,
serializedName: 'avatar_url',
type: {
name: 'String'
}
},
canChangePassword: {
required: false,
serializedName: 'can_change_password',
type: {
name: 'Boolean'
}
},
displayName: {
required: false,
serializedName: 'display_name',
type: {
name: 'String'
}
},
email: {
required: true,
serializedName: 'email',
type: {
name: 'String'
}
},
invitePending: {
required: false,
serializedName: 'invite_pending',
type: {
name: 'Boolean'
}
},
name: {
required: false,
serializedName: 'name',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = DistributionGroupUserGetResponse;

Просмотреть файл

@ -1,80 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a DistributionGroupUserPostResponse.
*/
class DistributionGroupUserPostResponse {
/**
* Create a DistributionGroupUserPostResponse.
* @member {string} [code] The code of the result
* @member {boolean} [invitePending] Whether the has accepted the invite.
* Available when an invite is pending, and the value will be "true".
* @member {number} [message] The message of the result
* @member {number} status The status code of the result
* @member {string} [userEmail] The email of the user
*/
constructor() {
}
/**
* Defines the metadata of DistributionGroupUserPostResponse
*
* @returns {object} metadata of DistributionGroupUserPostResponse
*
*/
mapper() {
return {
required: false,
serializedName: 'DistributionGroupUserPostResponse',
type: {
name: 'Composite',
className: 'DistributionGroupUserPostResponse',
modelProperties: {
code: {
required: false,
serializedName: 'code',
type: {
name: 'String'
}
},
invitePending: {
required: false,
serializedName: 'invite_pending',
type: {
name: 'Boolean'
}
},
message: {
required: false,
serializedName: 'message',
type: {
name: 'Number'
}
},
status: {
required: true,
serializedName: 'status',
type: {
name: 'Number'
}
},
userEmail: {
required: false,
serializedName: 'user_email',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = DistributionGroupUserPostResponse;

Просмотреть файл

@ -1,54 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a DistributionGroupUserRequest.
*/
class DistributionGroupUserRequest {
/**
* Create a DistributionGroupUserRequest.
* @member {array} [userEmails] The list of emails of the users
*/
constructor() {
}
/**
* Defines the metadata of DistributionGroupUserRequest
*
* @returns {object} metadata of DistributionGroupUserRequest
*
*/
mapper() {
return {
required: false,
serializedName: 'DistributionGroupUserRequest',
type: {
name: 'Composite',
className: 'DistributionGroupUserRequest',
modelProperties: {
userEmails: {
required: false,
serializedName: 'user_emails',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'StringElementType',
type: {
name: 'String'
}
}
}
}
}
}
};
}
}
module.exports = DistributionGroupUserRequest;

Просмотреть файл

@ -1,636 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
import * as moment from "moment";
/**
* @class
* Initializes a new instance of the ApiTokensCreateRequest class.
* @constructor
* @member {string} [description] The description of the token
* @member {array} [scope] The scope for this token.
*/
export interface ApiTokensCreateRequest {
description?: string;
scope?: string[];
}
/**
* @class
* Initializes a new instance of the ApiTokensCreateResponse class.
* @constructor
* @member {string} id The unique id (UUID) of the api token
* @member {string} apiToken The api token generated will not be accessible
* again
* @member {string} [description] The description of the token
* @member {array} [scope] The scope for this token.
* @member {string} createdAt The creation time
*/
export interface ApiTokensCreateResponse {
id: string;
apiToken: string;
description?: string;
scope?: string[];
createdAt: string;
}
/**
* @class
* Initializes a new instance of the ApiTokensGetResponse class.
* @constructor
* @member {string} id The unique id (UUID) of the api token
* @member {string} [description] The description of the token
* @member {array} [scope] The scope for this token.
* @member {string} createdAt The creation time
*/
export interface ApiTokensGetResponse {
id: string;
description?: string;
scope?: string[];
createdAt: string;
}
/**
* @class
* Initializes a new instance of the AzureSubscriptionResponse class.
* @constructor
* @member {string} subscriptionId The azure subscription id
* @member {string} tenantId The tenant id of the azure subscription belongs to
* @member {string} subscriptionName The name of the azure subscription
* @member {boolean} [isBilling] If the subscription is used for billing
* @member {boolean} [isBillable] If the subscription can be used for billing
*/
export interface AzureSubscriptionResponse {
subscriptionId: string;
tenantId: string;
subscriptionName: string;
isBilling?: boolean;
isBillable?: boolean;
}
/**
* @class
* Initializes a new instance of the BasicAppResponse class.
* @constructor
* @member {string} id The unique ID (UUID) of the app
* @member {string} [description] The description of the app
* @member {string} displayName The display name of the app
* @member {string} [iconUrl] The string representation of the URL pointing to
* the app's icon
* @member {string} name The name of the app used in URLs
* @member {string} os The OS the app will be running on. Possible values
* include: 'Android', 'iOS', 'macOS', 'Tizen', 'tvOS', 'Windows', 'Custom'
* @member {object} owner
* @member {string} [owner.id] The unique id (UUID) of the owner
* @member {string} [owner.avatarUrl] The avatar URL of the owner
* @member {string} [owner.displayName] The owner's display name
* @member {string} [owner.email] The owner's email address
* @member {string} [owner.name] The unique name that used to identify the
* owner
* @member {string} [owner.type] The owner type. Can either be 'org' or 'user'.
* Possible values include: 'org', 'user'
*/
export interface BasicAppResponse {
id: string;
description?: string;
displayName: string;
iconUrl?: string;
name: string;
os: string;
owner: Owner;
}
/**
* @class
* Initializes a new instance of the AppResponse class.
* @constructor
* @member {string} [appSecret] A unique and secret key used to identify the
* app in communication with the ingestion endpoint for crash reporting and
* analytics
* @member {object} [azureSubscription]
* @member {string} [azureSubscription.subscriptionId] The azure subscription
* id
* @member {string} [azureSubscription.tenantId] The tenant id of the azure
* subscription belongs to
* @member {string} [azureSubscription.subscriptionName] The name of the azure
* subscription
* @member {boolean} [azureSubscription.isBilling] If the subscription is used
* for billing
* @member {boolean} [azureSubscription.isBillable] If the subscription can be
* used for billing
* @member {string} [platform] The platform of the app. Possible values
* include: 'Java', 'Objective-C-Swift', 'UWP', 'Cordova', 'React-Native',
* 'Unity', 'Xamarin', 'Unknown'
* @member {string} [origin] The creation origin of this app. Possible values
* include: 'mobile-center', 'hockeyapp', 'codepush'
* @member {string} [createdAt] The created date of this app
* @member {string} [updatedAt] The last updated date of this app
* @member {array} [memberPermissions] The permissions of the calling user
*/
export interface AppResponse extends BasicAppResponse {
appSecret?: string;
azureSubscription?: AzureSubscriptionResponse;
platform?: string;
origin?: string;
createdAt?: string;
updatedAt?: string;
memberPermissions?: string[];
}
/**
* @class
* Initializes a new instance of the UserProfileResponse class.
* @constructor
* @member {string} id The unique id (UUID) of the user
* @member {string} [avatarUrl] The avatar URL of the user
* @member {boolean} [canChangePassword] User is required to send an old
* password in order to change the password.
* @member {string} displayName The full name of the user. Might for example be
* first and last name
* @member {string} email The email address of the user
* @member {string} name The unique name that is used to identify the user.
* @member {array} [permissions] The permissions the user has for the app
* @member {string} origin The creation origin of this user. Possible values
* include: 'mobile-center', 'hockeyapp', 'codepush'
*/
export interface UserProfileResponse {
id: string;
avatarUrl?: string;
canChangePassword?: boolean;
displayName: string;
email: string;
name: string;
permissions?: string[];
origin: string;
}
/**
* @class
* Initializes a new instance of the AppInvitationDetailResponse class.
* @constructor
* @member {string} id The unique ID (UUID) of the invitation
* @member {object} app
* @member {string} [app.appSecret] A unique and secret key used to identify
* the app in communication with the ingestion endpoint for crash reporting and
* analytics
* @member {object} [app.azureSubscription]
* @member {string} [app.azureSubscription.subscriptionId] The azure
* subscription id
* @member {string} [app.azureSubscription.tenantId] The tenant id of the azure
* subscription belongs to
* @member {string} [app.azureSubscription.subscriptionName] The name of the
* azure subscription
* @member {boolean} [app.azureSubscription.isBilling] If the subscription is
* used for billing
* @member {boolean} [app.azureSubscription.isBillable] If the subscription can
* be used for billing
* @member {string} [app.platform] The platform of the app. Possible values
* include: 'Java', 'Objective-C-Swift', 'UWP', 'Cordova', 'React-Native',
* 'Unity', 'Xamarin', 'Unknown'
* @member {string} [app.origin] The creation origin of this app. Possible
* values include: 'mobile-center', 'hockeyapp', 'codepush'
* @member {string} [app.createdAt] The created date of this app
* @member {string} [app.updatedAt] The last updated date of this app
* @member {array} [app.memberPermissions] The permissions of the calling user
* @member {string} email The email address of the invited user
* @member {string} inviteType The invitation type. Possible values include:
* 'developer', 'tester'
* @member {object} invitedBy
* @member {string} [invitedBy.id] The unique id (UUID) of the user
* @member {string} [invitedBy.avatarUrl] The avatar URL of the user
* @member {boolean} [invitedBy.canChangePassword] User is required to send an
* old password in order to change the password.
* @member {string} [invitedBy.displayName] The full name of the user. Might
* for example be first and last name
* @member {string} [invitedBy.email] The email address of the user
* @member {string} [invitedBy.name] The unique name that is used to identify
* the user.
* @member {array} [invitedBy.permissions] The permissions the user has for the
* app
* @member {string} [invitedBy.origin] The creation origin of this user.
* Possible values include: 'mobile-center', 'hockeyapp', 'codepush'
* @member {boolean} isExistingUser Indicates whether the invited user already
* exists
* @member {array} [permissions] The permissions the user has for the app
*/
export interface AppInvitationDetailResponse {
id: string;
app: AppResponse;
email: string;
inviteType: string;
invitedBy: UserProfileResponse;
isExistingUser: boolean;
permissions?: string[];
}
/**
* @class
* Initializes a new instance of the AppPatchRequest class.
* @constructor
* @member {string} [description] A short text describing the app
* @member {string} [displayName] The display name of the app
* @member {string} [name] The name of the app used in URLs
* @member {string} [iconUrl] The string representation of the URL pointing to
* the app's icon
*/
export interface AppPatchRequest {
description?: string;
displayName?: string;
name?: string;
iconUrl?: string;
}
/**
* @class
* Initializes a new instance of the AppRequest class.
* @constructor
* @member {string} [description] A short text describing the app
* @member {string} displayName The descriptive name of the app. This can
* contain any characters
* @member {string} [name] The name of the app used in URLs
* @member {string} os The OS the app will be running on. Possible values
* include: 'Android', 'iOS', 'macOS', 'Tizen', 'tvOS', 'Windows'
* @member {string} platform The platform of the app. Possible values include:
* 'Java', 'Objective-C-Swift', 'UWP', 'Cordova', 'React-Native', 'Xamarin'
*/
export interface AppRequest {
description?: string;
displayName: string;
name?: string;
os: string;
platform: string;
}
/**
* @class
* Initializes a new instance of the AppTeamAddRequest class.
* @constructor
* @member {string} name The name of the app to be added to the team
*/
export interface AppTeamAddRequest {
name: string;
}
/**
* @class
* Initializes a new instance of the AppWithTeamPermissionsResponse class.
* @constructor
* @member {array} [teamPermissions] The permissions the team has for the app
*/
export interface AppWithTeamPermissionsResponse extends AppResponse {
teamPermissions?: string[];
}
/**
* @class
* Initializes a new instance of the AzureSubscriptionAddToAppRequest class.
* @constructor
* @member {string} subscriptionId The azure subscription id
*/
export interface AzureSubscriptionAddToAppRequest {
subscriptionId: string;
}
/**
* @class
* Initializes a new instance of the Owner class.
* @constructor
* The information about the app's owner
*
* @member {string} id The unique id (UUID) of the owner
* @member {string} [avatarUrl] The avatar URL of the owner
* @member {string} displayName The owner's display name
* @member {string} [email] The owner's email address
* @member {string} name The unique name that used to identify the owner
* @member {string} type The owner type. Can either be 'org' or 'user'.
* Possible values include: 'org', 'user'
*/
export interface Owner {
id: string;
avatarUrl?: string;
displayName: string;
email?: string;
name: string;
type: string;
}
/**
* @class
* Initializes a new instance of the DistributionGroupPatchRequest class.
* @constructor
* @member {string} [name] The name of the distribution group
* @member {boolean} [isPublic] Whether the distribution group is public
*/
export interface DistributionGroupPatchRequest {
name?: string;
isPublic?: boolean;
}
/**
* @class
* Initializes a new instance of the DistributionGroupRequest class.
* @constructor
* @member {string} name The name of the distribution group
*/
export interface DistributionGroupRequest {
name: string;
}
/**
* @class
* Initializes a new instance of the DistributionGroupResponse class.
* @constructor
* @member {string} id The unique ID of the distribution group
* @member {string} name The name of the distribution group used in URLs
* @member {string} origin The creation origin of this distribution group.
* Possible values include: 'mobile-center', 'hockeyapp'
* @member {boolean} isPublic Whether the distribution group is public
*/
export interface DistributionGroupResponse {
id: string;
name: string;
origin: string;
isPublic: boolean;
}
/**
* @class
* Initializes a new instance of the DistributionGroupUserDeleteResponse class.
* @constructor
* @member {string} [code] The code of the result
* @member {number} [message] The message of the result
* @member {number} status The status code of the result
* @member {string} [userEmail] The email of the user
*/
export interface DistributionGroupUserDeleteResponse {
code?: string;
message?: number;
status: number;
userEmail?: string;
}
/**
* @class
* Initializes a new instance of the DistributionGroupUserGetResponse class.
* @constructor
* @member {string} [id] The unique id (UUID) of the user
* @member {string} [avatarUrl] The avatar URL of the user
* @member {boolean} [canChangePassword] User is required to send an old
* password in order to change the password.
* @member {string} [displayName] The full name of the user. Might for example
* be first and last name
* @member {string} email The email address of the user
* @member {boolean} [invitePending] Whether the has accepted the invite.
* Available when an invite is pending, and the value will be "true".
* @member {string} [name] The unique name that is used to identify the user.
*/
export interface DistributionGroupUserGetResponse {
id?: string;
avatarUrl?: string;
canChangePassword?: boolean;
displayName?: string;
email: string;
invitePending?: boolean;
name?: string;
}
/**
* @class
* Initializes a new instance of the DistributionGroupUserPostResponse class.
* @constructor
* @member {string} [code] The code of the result
* @member {boolean} [invitePending] Whether the has accepted the invite.
* Available when an invite is pending, and the value will be "true".
* @member {number} [message] The message of the result
* @member {number} status The status code of the result
* @member {string} [userEmail] The email of the user
*/
export interface DistributionGroupUserPostResponse {
code?: string;
invitePending?: boolean;
message?: number;
status: number;
userEmail?: string;
}
/**
* @class
* Initializes a new instance of the DistributionGroupUserRequest class.
* @constructor
* @member {array} [userEmails] The list of emails of the users
*/
export interface DistributionGroupUserRequest {
userEmails?: string[];
}
/**
* @class
* Initializes a new instance of the OrganizationInvitationSimpleDetailResponse class.
* @constructor
* @member {string} id The unique ID (UUID) of the invitation
* @member {string} email The email address of the invited user
*/
export interface OrganizationInvitationSimpleDetailResponse {
id: string;
email: string;
}
/**
* @class
* Initializes a new instance of the OrganizationPatchRequest class.
* @constructor
* @member {string} [displayName] The full (friendly) name of the organization.
* @member {string} [name] The name of the organization used in URLs
*/
export interface OrganizationPatchRequest {
displayName?: string;
name?: string;
}
/**
* @class
* Initializes a new instance of the OrganizationRequest class.
* @constructor
* @member {string} [displayName] The display name of the organization
* @member {string} [name] The name of the organization used in URLs
*/
export interface OrganizationRequest {
displayName?: string;
name?: string;
}
/**
* @class
* Initializes a new instance of the OrganizationResponse class.
* @constructor
* @member {string} id The internal unique id (UUID) of the organization.
* @member {string} displayName The display name of the organization
* @member {string} name The slug name of the organization
* @member {string} origin The creation origin of this organization. Possible
* values include: 'mobile-center', 'hockeyapp'
*/
export interface OrganizationResponse {
id: string;
displayName: string;
name: string;
origin: string;
}
/**
* @class
* Initializes a new instance of the OrganizationUserPatchRequest class.
* @constructor
* @member {string} [role] The user's role in the organizatiion. Possible
* values include: 'admin', 'collaborator'
*/
export interface OrganizationUserPatchRequest {
role?: string;
}
/**
* @class
* Initializes a new instance of the OrganizationUserResponse class.
* @constructor
* @member {string} email The email address of the user
* @member {string} displayName The full name of the user. Might for example be
* first and last name
* @member {string} joinedAt The date when the user joined the organization
* @member {string} name The unique name that is used to identify the user.
* @member {string} role The role the user has within the organization
*/
export interface OrganizationUserResponse {
email: string;
displayName: string;
joinedAt: string;
name: string;
role: string;
}
/**
* @class
* Initializes a new instance of the TeamResponse class.
* @constructor
* @member {string} id The internal unique id (UUID) of the team.
* @member {string} name The name of the team
* @member {string} displayName The display name of the team
* @member {string} [description] The description of the team
*/
export interface TeamResponse {
id: string;
name: string;
displayName: string;
description?: string;
}
/**
* @class
* Initializes a new instance of the TeamAppResponse class.
* @constructor
* @member {array} [permissions] The permissions the team has for the app
*/
export interface TeamAppResponse extends TeamResponse {
permissions?: string[];
}
/**
* @class
* Initializes a new instance of the TeamAppUpdateRequest class.
* @constructor
* @member {array} permissions The permissions all members of the team have on
* the app
*/
export interface TeamAppUpdateRequest {
permissions: string[];
}
/**
* @class
* Initializes a new instance of the TeamRequest class.
* @constructor
* @member {string} displayName The display name of the team
* @member {string} [name] The name of the team
* @member {string} [description] The description of the team
*/
export interface TeamRequest {
displayName: string;
name?: string;
description?: string;
}
/**
* @class
* Initializes a new instance of the TeamUserResponse class.
* @constructor
* @member {string} email The email address of the user
* @member {string} displayName The full name of the user. Might for example be
* first and last name
* @member {string} name The unique name that is used to identify the user.
* @member {object} role The role of the user has within the team
*/
export interface TeamUserResponse {
email: string;
displayName: string;
name: string;
role: any;
}
/**
* @class
* Initializes a new instance of the UserAppPermissionsUpdateRequest class.
* @constructor
* @member {array} permissions The permissions the user has for the app
*/
export interface UserAppPermissionsUpdateRequest {
permissions: string[];
}
/**
* @class
* Initializes a new instance of the UserEmailRequest class.
* @constructor
* @member {string} userEmail The user's email address'
*/
export interface UserEmailRequest {
userEmail: string;
}
/**
* @class
* Initializes a new instance of the UserInvitationPermissionsUpdateRequest class.
* @constructor
* @member {array} permissions The permissions the user has for the app in the
* invitation
*/
export interface UserInvitationPermissionsUpdateRequest {
permissions: string[];
}
/**
* @class
* Initializes a new instance of the UserUpdateRequest class.
* @constructor
* @member {string} [displayName] The full name of the user. Might for example
* be first and last name
*/
export interface UserUpdateRequest {
displayName?: string;
}
/**
* @class
* Initializes a new instance of the ListOKResponseItem class.
* @constructor
* @member {string} [displayName] The display name of the organization
* @member {string} [name] The slug name of the organization
* @member {string} [origin] The creation origin of this organization. Possible
* values include: 'mobile-center', 'hockeyapp'
*/
export interface ListOKResponseItem {
displayName?: string;
name?: string;
origin?: string;
}

Просмотреть файл

@ -1,49 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
/* jshint latedef:false */
/* jshint forin:false */
/* jshint noempty:false */
'use strict';
exports.ApiTokensCreateRequest = require('./apiTokensCreateRequest');
exports.ApiTokensCreateResponse = require('./apiTokensCreateResponse');
exports.ApiTokensGetResponse = require('./apiTokensGetResponse');
exports.AzureSubscriptionResponse = require('./azureSubscriptionResponse');
exports.BasicAppResponse = require('./basicAppResponse');
exports.AppResponse = require('./appResponse');
exports.UserProfileResponse = require('./userProfileResponse');
exports.AppInvitationDetailResponse = require('./appInvitationDetailResponse');
exports.AppPatchRequest = require('./appPatchRequest');
exports.AppRequest = require('./appRequest');
exports.AppTeamAddRequest = require('./appTeamAddRequest');
exports.AppWithTeamPermissionsResponse = require('./appWithTeamPermissionsResponse');
exports.AzureSubscriptionAddToAppRequest = require('./azureSubscriptionAddToAppRequest');
exports.Owner = require('./owner');
exports.DistributionGroupPatchRequest = require('./distributionGroupPatchRequest');
exports.DistributionGroupRequest = require('./distributionGroupRequest');
exports.DistributionGroupResponse = require('./distributionGroupResponse');
exports.DistributionGroupUserDeleteResponse = require('./distributionGroupUserDeleteResponse');
exports.DistributionGroupUserGetResponse = require('./distributionGroupUserGetResponse');
exports.DistributionGroupUserPostResponse = require('./distributionGroupUserPostResponse');
exports.DistributionGroupUserRequest = require('./distributionGroupUserRequest');
exports.OrganizationInvitationSimpleDetailResponse = require('./organizationInvitationSimpleDetailResponse');
exports.OrganizationPatchRequest = require('./organizationPatchRequest');
exports.OrganizationRequest = require('./organizationRequest');
exports.OrganizationResponse = require('./organizationResponse');
exports.OrganizationUserPatchRequest = require('./organizationUserPatchRequest');
exports.OrganizationUserResponse = require('./organizationUserResponse');
exports.TeamResponse = require('./teamResponse');
exports.TeamAppResponse = require('./teamAppResponse');
exports.TeamAppUpdateRequest = require('./teamAppUpdateRequest');
exports.TeamRequest = require('./teamRequest');
exports.TeamUserResponse = require('./teamUserResponse');
exports.UserAppPermissionsUpdateRequest = require('./userAppPermissionsUpdateRequest');
exports.UserEmailRequest = require('./userEmailRequest');
exports.UserInvitationPermissionsUpdateRequest = require('./userInvitationPermissionsUpdateRequest');
exports.UserUpdateRequest = require('./userUpdateRequest');
exports.ListOKResponseItem = require('./listOKResponseItem');

Просмотреть файл

@ -1,64 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a ListOKResponseItem.
*/
class ListOKResponseItem {
/**
* Create a ListOKResponseItem.
* @member {string} [displayName] The display name of the organization
* @member {string} [name] The slug name of the organization
* @member {string} [origin] The creation origin of this organization.
* Possible values include: 'mobile-center', 'hockeyapp'
*/
constructor() {
}
/**
* Defines the metadata of ListOKResponseItem
*
* @returns {object} metadata of ListOKResponseItem
*
*/
mapper() {
return {
required: false,
serializedName: 'ListOKResponseItem',
type: {
name: 'Composite',
className: 'ListOKResponseItem',
modelProperties: {
displayName: {
required: false,
serializedName: 'display_name',
type: {
name: 'String'
}
},
name: {
required: false,
serializedName: 'name',
type: {
name: 'String'
}
},
origin: {
required: false,
serializedName: 'origin',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = ListOKResponseItem;

Просмотреть файл

@ -1,55 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a OrganizationInvitationSimpleDetailResponse.
*/
class OrganizationInvitationSimpleDetailResponse {
/**
* Create a OrganizationInvitationSimpleDetailResponse.
* @member {string} id The unique ID (UUID) of the invitation
* @member {string} email The email address of the invited user
*/
constructor() {
}
/**
* Defines the metadata of OrganizationInvitationSimpleDetailResponse
*
* @returns {object} metadata of OrganizationInvitationSimpleDetailResponse
*
*/
mapper() {
return {
required: false,
serializedName: 'OrganizationInvitationSimpleDetailResponse',
type: {
name: 'Composite',
className: 'OrganizationInvitationSimpleDetailResponse',
modelProperties: {
id: {
required: true,
serializedName: 'id',
type: {
name: 'String'
}
},
email: {
required: true,
serializedName: 'email',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = OrganizationInvitationSimpleDetailResponse;

Просмотреть файл

@ -1,56 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a OrganizationPatchRequest.
*/
class OrganizationPatchRequest {
/**
* Create a OrganizationPatchRequest.
* @member {string} [displayName] The full (friendly) name of the
* organization.
* @member {string} [name] The name of the organization used in URLs
*/
constructor() {
}
/**
* Defines the metadata of OrganizationPatchRequest
*
* @returns {object} metadata of OrganizationPatchRequest
*
*/
mapper() {
return {
required: false,
serializedName: 'OrganizationPatchRequest',
type: {
name: 'Composite',
className: 'OrganizationPatchRequest',
modelProperties: {
displayName: {
required: false,
serializedName: 'display_name',
type: {
name: 'String'
}
},
name: {
required: false,
serializedName: 'name',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = OrganizationPatchRequest;

Просмотреть файл

@ -1,55 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a OrganizationRequest.
*/
class OrganizationRequest {
/**
* Create a OrganizationRequest.
* @member {string} [displayName] The display name of the organization
* @member {string} [name] The name of the organization used in URLs
*/
constructor() {
}
/**
* Defines the metadata of OrganizationRequest
*
* @returns {object} metadata of OrganizationRequest
*
*/
mapper() {
return {
required: false,
serializedName: 'OrganizationRequest',
type: {
name: 'Composite',
className: 'OrganizationRequest',
modelProperties: {
displayName: {
required: false,
serializedName: 'display_name',
type: {
name: 'String'
}
},
name: {
required: false,
serializedName: 'name',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = OrganizationRequest;

Просмотреть файл

@ -1,72 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a OrganizationResponse.
*/
class OrganizationResponse {
/**
* Create a OrganizationResponse.
* @member {string} id The internal unique id (UUID) of the organization.
* @member {string} displayName The display name of the organization
* @member {string} name The slug name of the organization
* @member {string} origin The creation origin of this organization. Possible
* values include: 'mobile-center', 'hockeyapp'
*/
constructor() {
}
/**
* Defines the metadata of OrganizationResponse
*
* @returns {object} metadata of OrganizationResponse
*
*/
mapper() {
return {
required: false,
serializedName: 'OrganizationResponse',
type: {
name: 'Composite',
className: 'OrganizationResponse',
modelProperties: {
id: {
required: true,
serializedName: 'id',
type: {
name: 'String'
}
},
displayName: {
required: true,
serializedName: 'display_name',
type: {
name: 'String'
}
},
name: {
required: true,
serializedName: 'name',
type: {
name: 'String'
}
},
origin: {
required: true,
serializedName: 'origin',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = OrganizationResponse;

Просмотреть файл

@ -1,48 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a OrganizationUserPatchRequest.
*/
class OrganizationUserPatchRequest {
/**
* Create a OrganizationUserPatchRequest.
* @member {string} [role] The user's role in the organizatiion. Possible
* values include: 'admin', 'collaborator'
*/
constructor() {
}
/**
* Defines the metadata of OrganizationUserPatchRequest
*
* @returns {object} metadata of OrganizationUserPatchRequest
*
*/
mapper() {
return {
required: false,
serializedName: 'OrganizationUserPatchRequest',
type: {
name: 'Composite',
className: 'OrganizationUserPatchRequest',
modelProperties: {
role: {
required: false,
serializedName: 'role',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = OrganizationUserPatchRequest;

Просмотреть файл

@ -1,80 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a OrganizationUserResponse.
*/
class OrganizationUserResponse {
/**
* Create a OrganizationUserResponse.
* @member {string} email The email address of the user
* @member {string} displayName The full name of the user. Might for example
* be first and last name
* @member {string} joinedAt The date when the user joined the organization
* @member {string} name The unique name that is used to identify the user.
* @member {string} role The role the user has within the organization
*/
constructor() {
}
/**
* Defines the metadata of OrganizationUserResponse
*
* @returns {object} metadata of OrganizationUserResponse
*
*/
mapper() {
return {
required: false,
serializedName: 'OrganizationUserResponse',
type: {
name: 'Composite',
className: 'OrganizationUserResponse',
modelProperties: {
email: {
required: true,
serializedName: 'email',
type: {
name: 'String'
}
},
displayName: {
required: true,
serializedName: 'display_name',
type: {
name: 'String'
}
},
joinedAt: {
required: true,
serializedName: 'joined_at',
type: {
name: 'String'
}
},
name: {
required: true,
serializedName: 'name',
type: {
name: 'String'
}
},
role: {
required: true,
serializedName: 'role',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = OrganizationUserResponse;

Просмотреть файл

@ -1,89 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* The information about the app's owner
*
*/
class Owner {
/**
* Create a Owner.
* @member {string} id The unique id (UUID) of the owner
* @member {string} [avatarUrl] The avatar URL of the owner
* @member {string} displayName The owner's display name
* @member {string} [email] The owner's email address
* @member {string} name The unique name that used to identify the owner
* @member {string} type The owner type. Can either be 'org' or 'user'.
* Possible values include: 'org', 'user'
*/
constructor() {
}
/**
* Defines the metadata of Owner
*
* @returns {object} metadata of Owner
*
*/
mapper() {
return {
required: false,
serializedName: 'Owner',
type: {
name: 'Composite',
className: 'Owner',
modelProperties: {
id: {
required: true,
serializedName: 'id',
type: {
name: 'String'
}
},
avatarUrl: {
required: false,
serializedName: 'avatar_url',
type: {
name: 'String'
}
},
displayName: {
required: true,
serializedName: 'display_name',
type: {
name: 'String'
}
},
email: {
required: false,
serializedName: 'email',
type: {
name: 'String'
}
},
name: {
required: true,
serializedName: 'name',
type: {
name: 'String'
}
},
type: {
required: true,
serializedName: 'type',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = Owner;

Просмотреть файл

@ -1,86 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
const models = require('./index');
/**
* Class representing a TeamAppResponse.
* @extends models['TeamResponse']
*/
class TeamAppResponse extends models['TeamResponse'] {
/**
* Create a TeamAppResponse.
* @member {array} [permissions] The permissions the team has for the app
*/
constructor() {
super();
}
/**
* Defines the metadata of TeamAppResponse
*
* @returns {object} metadata of TeamAppResponse
*
*/
mapper() {
return {
required: false,
serializedName: 'TeamAppResponse',
type: {
name: 'Composite',
className: 'TeamAppResponse',
modelProperties: {
id: {
required: true,
serializedName: 'id',
type: {
name: 'String'
}
},
name: {
required: true,
serializedName: 'name',
type: {
name: 'String'
}
},
displayName: {
required: true,
serializedName: 'display_name',
type: {
name: 'String'
}
},
description: {
required: false,
serializedName: 'description',
type: {
name: 'String'
}
},
permissions: {
required: false,
serializedName: 'permissions',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'StringElementType',
type: {
name: 'String'
}
}
}
}
}
}
};
}
}
module.exports = TeamAppResponse;

Просмотреть файл

@ -1,55 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a TeamAppUpdateRequest.
*/
class TeamAppUpdateRequest {
/**
* Create a TeamAppUpdateRequest.
* @member {array} permissions The permissions all members of the team have
* on the app
*/
constructor() {
}
/**
* Defines the metadata of TeamAppUpdateRequest
*
* @returns {object} metadata of TeamAppUpdateRequest
*
*/
mapper() {
return {
required: false,
serializedName: 'TeamAppUpdateRequest',
type: {
name: 'Composite',
className: 'TeamAppUpdateRequest',
modelProperties: {
permissions: {
required: true,
serializedName: 'permissions',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'StringElementType',
type: {
name: 'String'
}
}
}
}
}
}
};
}
}
module.exports = TeamAppUpdateRequest;

Просмотреть файл

@ -1,63 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a TeamRequest.
*/
class TeamRequest {
/**
* Create a TeamRequest.
* @member {string} displayName The display name of the team
* @member {string} [name] The name of the team
* @member {string} [description] The description of the team
*/
constructor() {
}
/**
* Defines the metadata of TeamRequest
*
* @returns {object} metadata of TeamRequest
*
*/
mapper() {
return {
required: false,
serializedName: 'TeamRequest',
type: {
name: 'Composite',
className: 'TeamRequest',
modelProperties: {
displayName: {
required: true,
serializedName: 'display_name',
type: {
name: 'String'
}
},
name: {
required: false,
serializedName: 'name',
type: {
name: 'String'
}
},
description: {
required: false,
serializedName: 'description',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = TeamRequest;

Просмотреть файл

@ -1,71 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a TeamResponse.
*/
class TeamResponse {
/**
* Create a TeamResponse.
* @member {string} id The internal unique id (UUID) of the team.
* @member {string} name The name of the team
* @member {string} displayName The display name of the team
* @member {string} [description] The description of the team
*/
constructor() {
}
/**
* Defines the metadata of TeamResponse
*
* @returns {object} metadata of TeamResponse
*
*/
mapper() {
return {
required: false,
serializedName: 'TeamResponse',
type: {
name: 'Composite',
className: 'TeamResponse',
modelProperties: {
id: {
required: true,
serializedName: 'id',
type: {
name: 'String'
}
},
name: {
required: true,
serializedName: 'name',
type: {
name: 'String'
}
},
displayName: {
required: true,
serializedName: 'display_name',
type: {
name: 'String'
}
},
description: {
required: false,
serializedName: 'description',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = TeamResponse;

Просмотреть файл

@ -1,72 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a TeamUserResponse.
*/
class TeamUserResponse {
/**
* Create a TeamUserResponse.
* @member {string} email The email address of the user
* @member {string} displayName The full name of the user. Might for example
* be first and last name
* @member {string} name The unique name that is used to identify the user.
* @member {object} role The role of the user has within the team
*/
constructor() {
}
/**
* Defines the metadata of TeamUserResponse
*
* @returns {object} metadata of TeamUserResponse
*
*/
mapper() {
return {
required: false,
serializedName: 'TeamUserResponse',
type: {
name: 'Composite',
className: 'TeamUserResponse',
modelProperties: {
email: {
required: true,
serializedName: 'email',
type: {
name: 'String'
}
},
displayName: {
required: true,
serializedName: 'display_name',
type: {
name: 'String'
}
},
name: {
required: true,
serializedName: 'name',
type: {
name: 'String'
}
},
role: {
required: true,
serializedName: 'role',
type: {
name: 'Object'
}
}
}
}
};
}
}
module.exports = TeamUserResponse;

Просмотреть файл

@ -1,54 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a UserAppPermissionsUpdateRequest.
*/
class UserAppPermissionsUpdateRequest {
/**
* Create a UserAppPermissionsUpdateRequest.
* @member {array} permissions The permissions the user has for the app
*/
constructor() {
}
/**
* Defines the metadata of UserAppPermissionsUpdateRequest
*
* @returns {object} metadata of UserAppPermissionsUpdateRequest
*
*/
mapper() {
return {
required: false,
serializedName: 'UserAppPermissionsUpdateRequest',
type: {
name: 'Composite',
className: 'UserAppPermissionsUpdateRequest',
modelProperties: {
permissions: {
required: true,
serializedName: 'permissions',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'StringElementType',
type: {
name: 'String'
}
}
}
}
}
}
};
}
}
module.exports = UserAppPermissionsUpdateRequest;

Просмотреть файл

@ -1,47 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a UserEmailRequest.
*/
class UserEmailRequest {
/**
* Create a UserEmailRequest.
* @member {string} userEmail The user's email address'
*/
constructor() {
}
/**
* Defines the metadata of UserEmailRequest
*
* @returns {object} metadata of UserEmailRequest
*
*/
mapper() {
return {
required: false,
serializedName: 'UserEmailRequest',
type: {
name: 'Composite',
className: 'UserEmailRequest',
modelProperties: {
userEmail: {
required: true,
serializedName: 'user_email',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = UserEmailRequest;

Просмотреть файл

@ -1,55 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a UserInvitationPermissionsUpdateRequest.
*/
class UserInvitationPermissionsUpdateRequest {
/**
* Create a UserInvitationPermissionsUpdateRequest.
* @member {array} permissions The permissions the user has for the app in
* the invitation
*/
constructor() {
}
/**
* Defines the metadata of UserInvitationPermissionsUpdateRequest
*
* @returns {object} metadata of UserInvitationPermissionsUpdateRequest
*
*/
mapper() {
return {
required: false,
serializedName: 'UserInvitationPermissionsUpdateRequest',
type: {
name: 'Composite',
className: 'UserInvitationPermissionsUpdateRequest',
modelProperties: {
permissions: {
required: true,
serializedName: 'permissions',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'StringElementType',
type: {
name: 'String'
}
}
}
}
}
}
};
}
}
module.exports = UserInvitationPermissionsUpdateRequest;

Просмотреть файл

@ -1,113 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a UserProfileResponse.
*/
class UserProfileResponse {
/**
* Create a UserProfileResponse.
* @member {string} id The unique id (UUID) of the user
* @member {string} [avatarUrl] The avatar URL of the user
* @member {boolean} [canChangePassword] User is required to send an old
* password in order to change the password.
* @member {string} displayName The full name of the user. Might for example
* be first and last name
* @member {string} email The email address of the user
* @member {string} name The unique name that is used to identify the user.
* @member {array} [permissions] The permissions the user has for the app
* @member {string} origin The creation origin of this user. Possible values
* include: 'mobile-center', 'hockeyapp', 'codepush'
*/
constructor() {
}
/**
* Defines the metadata of UserProfileResponse
*
* @returns {object} metadata of UserProfileResponse
*
*/
mapper() {
return {
required: false,
serializedName: 'UserProfileResponse',
type: {
name: 'Composite',
className: 'UserProfileResponse',
modelProperties: {
id: {
required: true,
serializedName: 'id',
type: {
name: 'String'
}
},
avatarUrl: {
required: false,
serializedName: 'avatar_url',
type: {
name: 'String'
}
},
canChangePassword: {
required: false,
serializedName: 'can_change_password',
type: {
name: 'Boolean'
}
},
displayName: {
required: true,
serializedName: 'display_name',
type: {
name: 'String'
}
},
email: {
required: true,
serializedName: 'email',
type: {
name: 'String'
}
},
name: {
required: true,
serializedName: 'name',
type: {
name: 'String'
}
},
permissions: {
required: false,
serializedName: 'permissions',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'StringElementType',
type: {
name: 'String'
}
}
}
},
origin: {
required: true,
serializedName: 'origin',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = UserProfileResponse;

Просмотреть файл

@ -1,48 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Class representing a UserUpdateRequest.
*/
class UserUpdateRequest {
/**
* Create a UserUpdateRequest.
* @member {string} [displayName] The full name of the user. Might for
* example be first and last name
*/
constructor() {
}
/**
* Defines the metadata of UserUpdateRequest
*
* @returns {object} metadata of UserUpdateRequest
*
*/
mapper() {
return {
required: false,
serializedName: 'UserUpdateRequest',
type: {
name: 'Composite',
className: 'UserUpdateRequest',
modelProperties: {
displayName: {
required: false,
serializedName: 'display_name',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = UserUpdateRequest;

Просмотреть файл

@ -1,619 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
const msRest = require('ms-rest');
const WebResource = msRest.WebResource;
/**
* Returns api tokens for the authenticated user
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @param {function} callback - The callback.
*
* @returns {function} callback(err, result, request, response)
*
* {Error} err - The Error object if an error occurred, null otherwise.
*
* {array} [result] - The deserialized result object if an error did not occur.
*
* {object} [request] - The HTTP Request object if an error did not occur.
*
* {stream} [response] - The HTTP Response stream if an error did not occur.
*/
function _list(options, callback) {
/* jshint validthis: true */
let client = this.client;
if(!callback && typeof options === 'function') {
callback = options;
options = null;
}
if (!callback) {
throw new Error('callback cannot be null.');
}
// Construct URL
let baseUrl = this.client.baseUri;
let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'v0.1/api_tokens';
// Create HTTP transport objects
let httpRequest = new WebResource();
httpRequest.method = 'GET';
httpRequest.url = requestUrl;
httpRequest.headers = {};
// Set Headers
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
if(options) {
for(let headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
httpRequest.headers[headerName] = options['customHeaders'][headerName];
}
}
}
httpRequest.body = null;
// Send Request
return client.pipeline(httpRequest, (err, response, responseBody) => {
if (err) {
return callback(err);
}
let statusCode = response.statusCode;
if (statusCode !== 200) {
let error = new Error(responseBody);
error.statusCode = response.statusCode;
error.request = msRest.stripRequest(httpRequest);
error.response = msRest.stripResponse(response);
if (responseBody === '') responseBody = null;
let parsedErrorResponse;
try {
parsedErrorResponse = JSON.parse(responseBody);
if (parsedErrorResponse) {
let internalError = null;
if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
error.code = internalError ? internalError.code : parsedErrorResponse.code;
error.message = internalError ? internalError.message : parsedErrorResponse.message;
}
} catch (defaultError) {
error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
`- "${responseBody}" for the default response.`;
return callback(error);
}
return callback(error);
}
// Create Result
let result = null;
if (responseBody === '') responseBody = null;
// Deserialize Response
if (statusCode === 200) {
let parsedResponse = null;
try {
parsedResponse = JSON.parse(responseBody);
result = JSON.parse(responseBody);
if (parsedResponse !== null && parsedResponse !== undefined) {
let resultMapper = {
required: false,
serializedName: 'parsedResponse',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'ApiTokensGetResponseElementType',
type: {
name: 'Composite',
className: 'ApiTokensGetResponse'
}
}
}
};
result = client.deserialize(resultMapper, parsedResponse, 'result');
}
} catch (error) {
let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
deserializationError.request = msRest.stripRequest(httpRequest);
deserializationError.response = msRest.stripResponse(response);
return callback(deserializationError);
}
}
return callback(null, result, httpRequest, response);
});
}
/**
* Creates a new API token
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.description] Description of the token
*
* @param {string} [options.description.description] The description of the
* token
*
* @param {array} [options.description.scope] The scope for this token.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @param {function} callback - The callback.
*
* @returns {function} callback(err, result, request, response)
*
* {Error} err - The Error object if an error occurred, null otherwise.
*
* {object} [result] - The deserialized result object if an error did not occur.
* See {@link ApiTokensCreateResponse} for more
* information.
*
* {object} [request] - The HTTP Request object if an error did not occur.
*
* {stream} [response] - The HTTP Response stream if an error did not occur.
*/
function _newMethod(options, callback) {
/* jshint validthis: true */
let client = this.client;
if(!callback && typeof options === 'function') {
callback = options;
options = null;
}
if (!callback) {
throw new Error('callback cannot be null.');
}
let description = (options && options.description !== undefined) ? options.description : undefined;
// Construct URL
let baseUrl = this.client.baseUri;
let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'v0.1/api_tokens';
// Create HTTP transport objects
let httpRequest = new WebResource();
httpRequest.method = 'POST';
httpRequest.url = requestUrl;
httpRequest.headers = {};
// Set Headers
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
if(options) {
for(let headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
httpRequest.headers[headerName] = options['customHeaders'][headerName];
}
}
}
// Serialize Request
let requestContent = null;
let requestModel = null;
try {
if (description !== null && description !== undefined) {
let requestModelMapper = new client.models['ApiTokensCreateRequest']().mapper();
requestModel = client.serialize(requestModelMapper, description, 'description');
requestContent = JSON.stringify(requestModel);
}
} catch (error) {
let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
`payload - ${JSON.stringify(description, null, 2)}.`);
return callback(serializationError);
}
httpRequest.body = requestContent;
// Send Request
return client.pipeline(httpRequest, (err, response, responseBody) => {
if (err) {
return callback(err);
}
let statusCode = response.statusCode;
if (statusCode !== 201) {
let error = new Error(responseBody);
error.statusCode = response.statusCode;
error.request = msRest.stripRequest(httpRequest);
error.response = msRest.stripResponse(response);
if (responseBody === '') responseBody = null;
let parsedErrorResponse;
try {
parsedErrorResponse = JSON.parse(responseBody);
if (parsedErrorResponse) {
let internalError = null;
if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
error.code = internalError ? internalError.code : parsedErrorResponse.code;
error.message = internalError ? internalError.message : parsedErrorResponse.message;
}
} catch (defaultError) {
error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
`- "${responseBody}" for the default response.`;
return callback(error);
}
return callback(error);
}
// Create Result
let result = null;
if (responseBody === '') responseBody = null;
// Deserialize Response
if (statusCode === 201) {
let parsedResponse = null;
try {
parsedResponse = JSON.parse(responseBody);
result = JSON.parse(responseBody);
if (parsedResponse !== null && parsedResponse !== undefined) {
let resultMapper = new client.models['ApiTokensCreateResponse']().mapper();
result = client.deserialize(resultMapper, parsedResponse, 'result');
}
} catch (error) {
let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
deserializationError.request = msRest.stripRequest(httpRequest);
deserializationError.response = msRest.stripResponse(response);
return callback(deserializationError);
}
}
return callback(null, result, httpRequest, response);
});
}
/**
* Delete the api_token object with the specific id
*
* @param {string} apiTokenId The unique ID (UUID) of the api token
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @param {function} callback - The callback.
*
* @returns {function} callback(err, result, request, response)
*
* {Error} err - The Error object if an error occurred, null otherwise.
*
* {null} [result] - The deserialized result object if an error did not occur.
*
* {object} [request] - The HTTP Request object if an error did not occur.
*
* {stream} [response] - The HTTP Response stream if an error did not occur.
*/
function _deleteMethod(apiTokenId, options, callback) {
/* jshint validthis: true */
let client = this.client;
if(!callback && typeof options === 'function') {
callback = options;
options = null;
}
if (!callback) {
throw new Error('callback cannot be null.');
}
// Validate
try {
if (apiTokenId === null || apiTokenId === undefined || typeof apiTokenId.valueOf() !== 'string') {
throw new Error('apiTokenId cannot be null or undefined and it must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
let baseUrl = this.client.baseUri;
let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'v0.1/api_tokens/{api_token_id}';
requestUrl = requestUrl.replace('{api_token_id}', encodeURIComponent(apiTokenId));
// Create HTTP transport objects
let httpRequest = new WebResource();
httpRequest.method = 'DELETE';
httpRequest.url = requestUrl;
httpRequest.headers = {};
// Set Headers
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
if(options) {
for(let headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
httpRequest.headers[headerName] = options['customHeaders'][headerName];
}
}
}
httpRequest.body = null;
// Send Request
return client.pipeline(httpRequest, (err, response, responseBody) => {
if (err) {
return callback(err);
}
let statusCode = response.statusCode;
if (statusCode < 200 || statusCode >= 300) {
let error = new Error(responseBody);
error.statusCode = response.statusCode;
error.request = msRest.stripRequest(httpRequest);
error.response = msRest.stripResponse(response);
if (responseBody === '') responseBody = null;
let parsedErrorResponse;
try {
parsedErrorResponse = JSON.parse(responseBody);
if (parsedErrorResponse) {
let internalError = null;
if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
error.code = internalError ? internalError.code : parsedErrorResponse.code;
error.message = internalError ? internalError.message : parsedErrorResponse.message;
}
} catch (defaultError) {
error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
`- "${responseBody}" for the default response.`;
return callback(error);
}
return callback(error);
}
// Create Result
let result = null;
if (responseBody === '') responseBody = null;
return callback(null, result, httpRequest, response);
});
}
/** Class representing a ApiTokens. */
class ApiTokens {
/**
* Create a ApiTokens.
* @param {AccountClient} client Reference to the service client.
*/
constructor(client) {
this.client = client;
this._list = _list;
this._newMethod = _newMethod;
this._deleteMethod = _deleteMethod;
}
/**
* Returns api tokens for the authenticated user
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse<Array>} - The deserialized result object.
*
* @reject {Error} - The error object.
*/
listWithHttpOperationResponse(options) {
let client = this.client;
let self = this;
return new Promise((resolve, reject) => {
self._list(options, (err, result, request, response) => {
let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
httpOperationResponse.body = result;
if (err) { reject(err); }
else { resolve(httpOperationResponse); }
return;
});
});
}
/**
* Returns api tokens for the authenticated user
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @param {function} [optionalCallback] - The optional callback.
*
* @returns {function|Promise} If a callback was passed as the last parameter
* then it returns the callback else returns a Promise.
*
* {Promise} A promise is returned
*
* @resolve {Array} - The deserialized result object.
*
* @reject {Error} - The error object.
*
* {function} optionalCallback(err, result, request, response)
*
* {Error} err - The Error object if an error occurred, null otherwise.
*
* {array} [result] - The deserialized result object if an error did not occur.
*
* {object} [request] - The HTTP Request object if an error did not occur.
*
* {stream} [response] - The HTTP Response stream if an error did not occur.
*/
list(options, optionalCallback) {
let client = this.client;
let self = this;
if (!optionalCallback && typeof options === 'function') {
optionalCallback = options;
options = null;
}
if (!optionalCallback) {
return new Promise((resolve, reject) => {
self._list(options, (err, result, request, response) => {
if (err) { reject(err); }
else { resolve(result); }
return;
});
});
} else {
return self._list(options, optionalCallback);
}
}
/**
* Creates a new API token
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.description] Description of the token
*
* @param {string} [options.description.description] The description of the
* token
*
* @param {array} [options.description.scope] The scope for this token.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse<ApiTokensCreateResponse>} - The deserialized result object.
*
* @reject {Error} - The error object.
*/
newMethodWithHttpOperationResponse(options) {
let client = this.client;
let self = this;
return new Promise((resolve, reject) => {
self._newMethod(options, (err, result, request, response) => {
let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
httpOperationResponse.body = result;
if (err) { reject(err); }
else { resolve(httpOperationResponse); }
return;
});
});
}
/**
* Creates a new API token
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.description] Description of the token
*
* @param {string} [options.description.description] The description of the
* token
*
* @param {array} [options.description.scope] The scope for this token.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @param {function} [optionalCallback] - The optional callback.
*
* @returns {function|Promise} If a callback was passed as the last parameter
* then it returns the callback else returns a Promise.
*
* {Promise} A promise is returned
*
* @resolve {ApiTokensCreateResponse} - The deserialized result object.
*
* @reject {Error} - The error object.
*
* {function} optionalCallback(err, result, request, response)
*
* {Error} err - The Error object if an error occurred, null otherwise.
*
* {object} [result] - The deserialized result object if an error did not occur.
* See {@link ApiTokensCreateResponse} for more
* information.
*
* {object} [request] - The HTTP Request object if an error did not occur.
*
* {stream} [response] - The HTTP Response stream if an error did not occur.
*/
newMethod(options, optionalCallback) {
let client = this.client;
let self = this;
if (!optionalCallback && typeof options === 'function') {
optionalCallback = options;
options = null;
}
if (!optionalCallback) {
return new Promise((resolve, reject) => {
self._newMethod(options, (err, result, request, response) => {
if (err) { reject(err); }
else { resolve(result); }
return;
});
});
} else {
return self._newMethod(options, optionalCallback);
}
}
/**
* Delete the api_token object with the specific id
*
* @param {string} apiTokenId The unique ID (UUID) of the api token
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse<null>} - The deserialized result object.
*
* @reject {Error} - The error object.
*/
deleteMethodWithHttpOperationResponse(apiTokenId, options) {
let client = this.client;
let self = this;
return new Promise((resolve, reject) => {
self._deleteMethod(apiTokenId, options, (err, result, request, response) => {
let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
httpOperationResponse.body = result;
if (err) { reject(err); }
else { resolve(httpOperationResponse); }
return;
});
});
}
/**
* Delete the api_token object with the specific id
*
* @param {string} apiTokenId The unique ID (UUID) of the api token
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @param {function} [optionalCallback] - The optional callback.
*
* @returns {function|Promise} If a callback was passed as the last parameter
* then it returns the callback else returns a Promise.
*
* {Promise} A promise is returned
*
* @resolve {null} - The deserialized result object.
*
* @reject {Error} - The error object.
*
* {function} optionalCallback(err, result, request, response)
*
* {Error} err - The Error object if an error occurred, null otherwise.
*
* {null} [result] - The deserialized result object if an error did not occur.
*
* {object} [request] - The HTTP Request object if an error did not occur.
*
* {stream} [response] - The HTTP Response stream if an error did not occur.
*/
deleteMethod(apiTokenId, options, optionalCallback) {
let client = this.client;
let self = this;
if (!optionalCallback && typeof options === 'function') {
optionalCallback = options;
options = null;
}
if (!optionalCallback) {
return new Promise((resolve, reject) => {
self._deleteMethod(apiTokenId, options, (err, result, request, response) => {
if (err) { reject(err); }
else { resolve(result); }
return;
});
});
} else {
return self._deleteMethod(apiTokenId, options, optionalCallback);
}
}
}
module.exports = ApiTokens;

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,191 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
const msRest = require('ms-rest');
const WebResource = msRest.WebResource;
/**
* Accepts all pending invitations to distribution groups for the specified
* user
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @param {function} callback - The callback.
*
* @returns {function} callback(err, result, request, response)
*
* {Error} err - The Error object if an error occurred, null otherwise.
*
* {null} [result] - The deserialized result object if an error did not occur.
*
* {object} [request] - The HTTP Request object if an error did not occur.
*
* {stream} [response] - The HTTP Response stream if an error did not occur.
*/
function _acceptAll(options, callback) {
/* jshint validthis: true */
let client = this.client;
if(!callback && typeof options === 'function') {
callback = options;
options = null;
}
if (!callback) {
throw new Error('callback cannot be null.');
}
// Construct URL
let baseUrl = this.client.baseUri;
let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'v0.1/user/invitations/distribution_groups/accept';
// Create HTTP transport objects
let httpRequest = new WebResource();
httpRequest.method = 'POST';
httpRequest.url = requestUrl;
httpRequest.headers = {};
// Set Headers
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
if(options) {
for(let headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
httpRequest.headers[headerName] = options['customHeaders'][headerName];
}
}
}
httpRequest.body = null;
// Send Request
return client.pipeline(httpRequest, (err, response, responseBody) => {
if (err) {
return callback(err);
}
let statusCode = response.statusCode;
if (statusCode < 200 || statusCode >= 300) {
let error = new Error(responseBody);
error.statusCode = response.statusCode;
error.request = msRest.stripRequest(httpRequest);
error.response = msRest.stripResponse(response);
if (responseBody === '') responseBody = null;
let parsedErrorResponse;
try {
parsedErrorResponse = JSON.parse(responseBody);
if (parsedErrorResponse) {
let internalError = null;
if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
error.code = internalError ? internalError.code : parsedErrorResponse.code;
error.message = internalError ? internalError.message : parsedErrorResponse.message;
}
} catch (defaultError) {
error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
`- "${responseBody}" for the default response.`;
return callback(error);
}
return callback(error);
}
// Create Result
let result = null;
if (responseBody === '') responseBody = null;
return callback(null, result, httpRequest, response);
});
}
/** Class representing a DistributionGroupInvitations. */
class DistributionGroupInvitations {
/**
* Create a DistributionGroupInvitations.
* @param {AccountClient} client Reference to the service client.
*/
constructor(client) {
this.client = client;
this._acceptAll = _acceptAll;
}
/**
* Accepts all pending invitations to distribution groups for the specified
* user
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse<null>} - The deserialized result object.
*
* @reject {Error} - The error object.
*/
acceptAllWithHttpOperationResponse(options) {
let client = this.client;
let self = this;
return new Promise((resolve, reject) => {
self._acceptAll(options, (err, result, request, response) => {
let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
httpOperationResponse.body = result;
if (err) { reject(err); }
else { resolve(httpOperationResponse); }
return;
});
});
}
/**
* Accepts all pending invitations to distribution groups for the specified
* user
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @param {function} [optionalCallback] - The optional callback.
*
* @returns {function|Promise} If a callback was passed as the last parameter
* then it returns the callback else returns a Promise.
*
* {Promise} A promise is returned
*
* @resolve {null} - The deserialized result object.
*
* @reject {Error} - The error object.
*
* {function} optionalCallback(err, result, request, response)
*
* {Error} err - The Error object if an error occurred, null otherwise.
*
* {null} [result] - The deserialized result object if an error did not occur.
*
* {object} [request] - The HTTP Request object if an error did not occur.
*
* {stream} [response] - The HTTP Response stream if an error did not occur.
*/
acceptAll(options, optionalCallback) {
let client = this.client;
let self = this;
if (!optionalCallback && typeof options === 'function') {
optionalCallback = options;
options = null;
}
if (!optionalCallback) {
return new Promise((resolve, reject) => {
self._acceptAll(options, (err, result, request, response) => {
if (err) { reject(err); }
else { resolve(result); }
return;
});
});
} else {
return self._acceptAll(options, optionalCallback);
}
}
}
module.exports = DistributionGroupInvitations;

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,22 +0,0 @@
/*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
/* jshint latedef:false */
/* jshint forin:false */
/* jshint noempty:false */
'use strict';
exports.ApiTokens = require('./apiTokens');
exports.Apps = require('./apps');
exports.AzureSubscription = require('./azureSubscription');
exports.DistributionGroups = require('./distributionGroups');
exports.AppInvitations = require('./appInvitations');
exports.Users = require('./users');
exports.Organizations = require('./organizations');
exports.OrgInvitations = require('./orgInvitations');
exports.Teams = require('./teams');
exports.DistributionGroupInvitations = require('./distributionGroupInvitations');

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше