Skip to content

Commit

Permalink
[AutoPR] cognitiveservices/resource-manager (#448)
Browse files Browse the repository at this point in the history
* Generated from 167c81a0548ec8c460cd99b07b9ab6556333a981 (#441)

fixing sample names in cognitive services

* Regenerated "@azure/arm-cognitiveservices" SDK.
  • Loading branch information
AutorestCI authored and kpajdzik committed Nov 9, 2018
1 parent 5ede64a commit 8d4a24a
Show file tree
Hide file tree
Showing 11 changed files with 172 additions and 257 deletions.
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

[![Build Status](https://dev.azure.com/azure-public/adx/_apis/build/status/public.Azure.azure-sdk-for-js)](https://dev.azure.com/azure-public/adx/_build/latest?definitionId=2)

This project provides an isomorphic Javascript package with TypeScript definitions that makes it easy to consume and manage
This project provides a Javascript package that makes it easy to consume and manage
Microsoft Azure Services.
It supports SDKs for:
- ARM services (control plane) (packages with the naming convention of `@azure/arm-<servicename>`)
- data plane of some Azure services (packages with the naming convention of `@azure/<servicename>`).
- ARM services (packages with the naming convention of `azure-arm-<servicename>`)
- data plane of some Azure services (packages with the naming convention of `azure-<servicename>`).

## Documentation

Documentation of the supported SDKs can be found here:
- https://docs.microsoft.com/en-us/javascript/azure - This website primarily provides SDK documentation for
- ARM based services (`@azure/arm-<serviceName>`)
- data plane SDKs like `@azure/batch`, `@azure/graph`, etc.
- ARM based services (`azure-arm-<serviceName>`)
- data plane SDKs like `azure-batch`, `azure-graph`, etc.

## Authentication
- For Node.js-based authentication, look at [ms-rest-nodeauth](https://npmjs.com/package/ms-rest-nodeauth).
Expand All @@ -28,8 +28,9 @@ Documentation of the supported SDKs can be found here:

## License

This project is licensed under MIT.
- "MIT" license is usually used for the client libraries generated using [Autorest.TypeScript](https://github.com/azure/autorest.typescript) that are targeting ARM (V2 version of Azure REST API). The license can be found in "LICENSE.MIT.txt" file in this repository.
This project is licensed under MIT and Apache-2.0.
- "MIT" license is usually used for the client libraries generated using [Autorest](https://github.com/Azure/Autorest) that are targeting ARM (V2 version of Azure REST API). The license can be found in "LICENSE.MIT.txt" file in this repository.
- "Apache-2.0" license is usually used for the client libraries generated using an internal code generator that are targeting ASM (V1 version of Azure REST API). The license can be found in "LICENSE.Apache.txt" file in this repository.

## Contribute

Expand Down
42 changes: 21 additions & 21 deletions packages/@azure/arm-cognitiveservices/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
The MIT License (MIT)

Copyright (c) 2018 Microsoft

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
The MIT License (MIT)
Copyright (c) 2018 Microsoft
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
162 changes: 81 additions & 81 deletions packages/@azure/arm-cognitiveservices/README.md
Original file line number Diff line number Diff line change
@@ -1,81 +1,81 @@
# Azure CognitiveServicesManagementClient SDK for JavaScript
This package contains an isomorphic SDK for CognitiveServicesManagementClient.

## Currently supported environments
- Node.js version 6.x.x or higher
- Browser JavaScript

## How to Install
```
npm install @azure/arm-cognitiveservices
```


## How to use

### nodejs - Authentication, client creation and getProperties accounts as an example written in TypeScript.

```ts
import * as msRest from "ms-rest-js";
import * as msRestAzure from "ms-rest-azure-js";
import * as msRestNodeAuth from "ms-rest-nodeauth";
import { CognitiveServicesManagementClient, CognitiveServicesManagementModels, CognitiveServicesManagementMappers } from "@azure/arm-cognitiveservices";
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
const client = new CognitiveServicesManagementClient(creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const accountName = "testaccountName";
client.accounts.getProperties(resourceGroupName, accountName).then((result) => {
console.log("The result is:");
console.log(result);
});
}).catch((err) => {
console.error(err);
});
```

### browser - Authentication, client creation and getProperties accounts as an example written in JavaScript.
See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.

- index.html
```html
<!DOCTYPE html>
<html lang="en">
<head>
<title>@azure/arm-cognitiveservices sample</title>
<script src="node_modules/ms-rest-js/dist/msRest.browser.js"></script>
<script src="node_modules/ms-rest-azure-js/dist/msRestAzure.js"></script>
<script src="node_modules/ms-rest-browserauth/dist/msAuth.js"></script>
<script src="node_modules/@azure/arm-cognitiveservices/dist/arm-cognitiveservices.js"></script>
<script>
const subscriptionId = "<Subscription_Id>";
const authManager = new msAuth.AuthManager({
clientId: "<client id for your Azure AD app>",
tenant: "<optional tenant for your organization>"
});
authManager.finalizeLogin().then((res) => {
if (!res.isLoggedIn) {
// may cause redirects
authManager.login();
}
const client = new Azure.ArmCognitiveservices.CognitiveServicesManagementClient(res.creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const accountName = "testaccountName";
client.accounts.getProperties(resourceGroupName, accountName).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log('An error occurred:');
console.error(err);
});
});
</script>
</head>
<body>
</body>
</html>
```

# Related projects
- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
# Azure CognitiveServicesManagementClient SDK for JavaScript
This package contains an isomorphic SDK for CognitiveServicesManagementClient.

## Currently supported environments
- Node.js version 6.x.x or higher
- Browser JavaScript

## How to Install
```
npm install @azure/arm-cognitiveservices
```


## How to use

### nodejs - Authentication, client creation and getProperties accounts as an example written in TypeScript.

```ts
import * as msRest from "ms-rest-js";
import * as msRestAzure from "ms-rest-azure-js";
import * as msRestNodeAuth from "ms-rest-nodeauth";
import { CognitiveServicesManagementClient, CognitiveServicesManagementModels, CognitiveServicesManagementMappers } from "@azure/arm-cognitiveservices";
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
const client = new CognitiveServicesManagementClient(creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const accountName = "testaccountName";
client.accounts.getProperties(resourceGroupName, accountName).then((result) => {
console.log("The result is:");
console.log(result);
});
}).catch((err) => {
console.error(err);
});
```

### browser - Authentication, client creation and getProperties accounts as an example written in JavaScript.
See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.

- index.html
```html
<!DOCTYPE html>
<html lang="en">
<head>
<title>@azure/arm-cognitiveservices sample</title>
<script src="node_modules/ms-rest-js/dist/msRest.browser.js"></script>
<script src="node_modules/ms-rest-azure-js/dist/msRestAzure.js"></script>
<script src="node_modules/ms-rest-browserauth/dist/msAuth.js"></script>
<script src="node_modules/@azure/arm-cognitiveservices/dist/arm-cognitiveservices.js"></script>
<script>
const subscriptionId = "<Subscription_Id>";
const authManager = new msAuth.AuthManager({
clientId: "<client id for your Azure AD app>",
tenant: "<optional tenant for your organization>"
});
authManager.finalizeLogin().then((res) => {
if (!res.isLoggedIn) {
// may cause redirects
authManager.login();
}
const client = new Azure.ArmCognitiveservices.CognitiveServicesManagementClient(res.creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const accountName = "testaccountName";
client.accounts.getProperties(resourceGroupName, accountName).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log("An error occurred:");
console.error(err);
});
});
</script>
</head>
<body>
</body>
</html>
```

# Related projects
- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,12 @@ import * as msRest from "ms-rest-js";
import * as msRestAzure from "ms-rest-azure-js";

const packageName = "@azure/arm-cognitiveservices";
const packageVersion = "1.0.0";
const packageVersion = "0.1.0";

export class CognitiveServicesManagementClientContext extends msRestAzure.AzureServiceClient {

credentials: msRest.ServiceClientCredentials;

subscriptionId: string;

apiVersion: string;

acceptLanguage: string;

longRunningOperationRetryTimeout: number;
apiVersion?: string;

/**
* Initializes a new instance of the CognitiveServicesManagementClient class.
Expand All @@ -44,6 +37,11 @@ export class CognitiveServicesManagementClientContext extends msRestAzure.AzureS
if (!options) {
options = {};
}
if(!options.userAgent) {
const defaultUserAgent = msRestAzure.getDefaultUserAgentValue();
options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`;
}

super(credentials, options);

this.apiVersion = '2017-04-18';
Expand All @@ -54,7 +52,6 @@ export class CognitiveServicesManagementClientContext extends msRestAzure.AzureS
this.credentials = credentials;
this.subscriptionId = subscriptionId;

this.addUserAgentInfo(`${packageName}/${packageVersion}`);
if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) {
this.acceptLanguage = options.acceptLanguage;
}
Expand Down
Loading

0 comments on commit 8d4a24a

Please sign in to comment.