Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR] cognitiveservices/data-plane/ImageSearch #696

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 21 additions & 38 deletions packages/@azure/cognitiveservices-imagesearch/README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,26 @@
## An isomorphic javascript sdk for - ImageSearchAPIClient
# An isomorphic javascript sdk for - ImageSearchAPIClient
This project provides an isomorphic javascript package. Right now it supports:
- node.js version 6.x.x or higher
- browser javascript

This package contains an isomorphic SDK for ImageSearchAPIClient.

### Currently supported environments

- Node.js version 6.x.x or higher
- Browser JavaScript

### How to Install
## How to Install

- nodejs
```
npm install @azure/cognitiveservices-imagesearch
```

### How to use

#### nodejs - Authentication, client creation and search images as an example written in TypeScript.

##### Install @azure/ms-rest-nodeauth

```
npm install @azure/ms-rest-nodeauth
- browser
```html
<script type="text/javascript" src="@azure/cognitiveservices-imagesearch/dist/cognitiveservices-imagesearch.js"></script>
```

##### Sample code
## How to use

### nodejs - Authentication, client creation and search images as an example written in TypeScript.

```ts
import * as msRest from "@azure/ms-rest-js";
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
import * as msRest from "ms-rest-js";
import * as msRestNodeAuth from "ms-rest-nodeauth";
import { ImageSearchAPIClient, ImageSearchAPIModels, ImageSearchAPIMappers } from "@azure/cognitiveservices-imagesearch";
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

Expand Down Expand Up @@ -70,26 +63,16 @@ msRestNodeAuth.interactiveLogin().then((creds) => {
});
```

#### browser - Authentication, client creation and search images as an example written in JavaScript.

##### Install @azure/ms-rest-browserauth

```
npm install @azure/ms-rest-browserauth
```

##### Sample code

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

- index.html
```html
<!DOCTYPE html>
<html lang="en">
<head>
<title>@azure/cognitiveservices-imagesearch sample</title>
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
<script src="node_modules/ms-rest-js/dist/msRest.browser.js"></script>
<script src="node_modules/ms-rest-browserauth/dist/msAuth.js"></script>
<script src="node_modules/@azure/cognitiveservices-imagesearch/dist/cognitiveservices-imagesearch.js"></script>
<script type="text/javascript">
const subscriptionId = "<Subscription_Id>";
Expand Down Expand Up @@ -141,10 +124,10 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to
});
</script>
</head>
<body></body>
<body>
</body>
</html>
```

## Related projects

- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
# 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 @@ -8,7 +8,7 @@
* regenerated.
*/

import * as msRest from "@azure/ms-rest-js";
import * as msRest from "ms-rest-js";
import * as Models from "./models";
import * as Mappers from "./models/mappers";
import * as operations from "./operations";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* regenerated.
*/

import * as msRest from "@azure/ms-rest-js";
import * as msRest from "ms-rest-js";
import * as Models from "./models";

const packageName = "@azure/cognitiveservices-imagesearch";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
* regenerated.
*/

import { ServiceClientOptions } from "@azure/ms-rest-js";
import * as msRest from "@azure/ms-rest-js";
import { ServiceClientOptions } from "ms-rest-js";
import * as msRest from "ms-rest-js";


/**
Expand Down Expand Up @@ -1045,7 +1045,7 @@ export interface ImageObject {
* of the number of websites where you can buy an apple pie. To indicate the
* number of offers in your UX, include badging such as a shopping cart icon
* that contains the count. When the user clicks on the icon, use
* imageInisghtsToken to get the list of websites.
* imageInsightsToken to get the list of websites.
* **NOTE: This property will not be serialized. It can only be populated by
* the server.**
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* regenerated.
*/

import * as msRest from "@azure/ms-rest-js";
import * as msRest from "ms-rest-js";


export const ResponseBase: msRest.CompositeMapper = {
Expand Down Expand Up @@ -108,6 +108,8 @@ export const Thing: msRest.CompositeMapper = {
serializedName: "image",
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "ImageObject"
}
},
Expand Down Expand Up @@ -239,6 +241,8 @@ export const Offer: msRest.CompositeMapper = {
serializedName: "seller",
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "Organization"
}
},
Expand Down Expand Up @@ -269,6 +273,8 @@ export const Offer: msRest.CompositeMapper = {
serializedName: "aggregateRating",
type: {
name: "Composite",
polymorphicDiscriminator: PropertiesItem.type.polymorphicDiscriminator,
uberParent: "PropertiesItem",
className: "AggregateRating"
}
},
Expand Down Expand Up @@ -300,6 +306,8 @@ export const AggregateOffer: msRest.CompositeMapper = {
element: {
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "Offer"
}
}
Expand Down Expand Up @@ -334,6 +342,8 @@ export const ImagesImageMetadata: msRest.CompositeMapper = {
serializedName: "aggregateOffer",
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "AggregateOffer"
}
}
Expand Down Expand Up @@ -365,6 +375,8 @@ export const CreativeWork: msRest.CompositeMapper = {
element: {
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "Thing"
}
}
Expand Down Expand Up @@ -464,6 +476,8 @@ export const ImageObject: msRest.CompositeMapper = {
serializedName: "thumbnail",
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "ImageObject"
}
},
Expand Down Expand Up @@ -546,6 +560,8 @@ export const Query: msRest.CompositeMapper = {
serializedName: "thumbnail",
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "ImageObject"
}
}
Expand Down Expand Up @@ -640,6 +656,8 @@ export const Images: msRest.CompositeMapper = {
element: {
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "ImageObject"
}
}
Expand Down Expand Up @@ -878,6 +896,8 @@ export const RelatedCollectionsModule: msRest.CompositeMapper = {
element: {
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "ImageGallery"
}
}
Expand All @@ -901,6 +921,8 @@ export const ImagesModule: msRest.CompositeMapper = {
element: {
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "ImageObject"
}
}
Expand Down Expand Up @@ -981,6 +1003,8 @@ export const RecipesModule: msRest.CompositeMapper = {
element: {
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "Recipe"
}
}
Expand Down Expand Up @@ -1071,6 +1095,8 @@ export const RecognizedEntity: msRest.CompositeMapper = {
serializedName: "entity",
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "Thing"
}
},
Expand Down Expand Up @@ -1099,6 +1125,8 @@ export const RecognizedEntityRegion: msRest.CompositeMapper = {
serializedName: "region",
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "NormalizedRectangle"
}
},
Expand All @@ -1110,6 +1138,8 @@ export const RecognizedEntityRegion: msRest.CompositeMapper = {
element: {
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "RecognizedEntity"
}
}
Expand All @@ -1133,6 +1163,8 @@ export const RecognizedEntityGroup: msRest.CompositeMapper = {
element: {
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "RecognizedEntityRegion"
}
}
Expand Down Expand Up @@ -1265,6 +1297,8 @@ export const ImageInsights: msRest.CompositeMapper = {
serializedName: "shoppingSources",
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "AggregateOffer"
}
},
Expand Down Expand Up @@ -1339,6 +1373,8 @@ export const TrendingImagesTile: msRest.CompositeMapper = {
serializedName: "image",
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "ImageObject"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* regenerated.
*/

import * as msRest from "@azure/ms-rest-js";
import * as msRest from "ms-rest-js";

export const acceptLanguage: msRest.OperationParameter = {
parameterPath: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* regenerated.
*/

import * as msRest from "@azure/ms-rest-js";
import * as msRest from "ms-rest-js";
import * as Models from "../models";
import * as Mappers from "../models/imagesOperationsMappers";
import * as Parameters from "../models/parameters";
Expand Down
2 changes: 1 addition & 1 deletion packages/@azure/cognitiveservices-imagesearch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "ImageSearchAPIClient Library with typescript type definitions for node.js and browser.",
"version": "0.1.0",
"dependencies": {
"@azure/ms-rest-js": "^1.1.0",
"ms-rest-js": "^1.0.460",
"tslib": "^1.9.3"
},
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import nodeResolve from "rollup-plugin-node-resolve";
*/
const config = {
input: './esm/imageSearchAPIClient.js',
external: ["@azure/ms-rest-js", "@azure/ms-rest-azure-js"],
external: ["ms-rest-js", "ms-rest-azure-js"],
output: {
file: "./dist/cognitiveservices-imagesearch.js",
format: "umd",
name: "Azure.CognitiveservicesImagesearch",
sourcemap: true,
globals: {
"@azure/ms-rest-js": "msRest",
"@azure/ms-rest-azure-js": "msRestAzure"
"ms-rest-js": "msRest",
"ms-rest-azure-js": "msRestAzure"
},
banner: `/*
* Copyright (c) Microsoft Corporation. All rights reserved.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"outDir": "./esm",
"importHelpers": true
},
"include": ["./lib/**/*.ts"],
"include": ["./lib/**/*"],
"exclude": ["node_modules"]
}