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/NewsSearch #718

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-newssearch/README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,26 @@
## An isomorphic javascript sdk for - NewsSearchAPIClient
# An isomorphic javascript sdk for - NewsSearchAPIClient
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 NewsSearchAPIClient.

### Currently supported environments

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

### How to Install
## How to Install

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

### How to use

#### nodejs - Authentication, client creation and search news 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-newssearch/dist/cognitiveservices-newssearch.js"></script>
```

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

### nodejs - Authentication, client creation and search news 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 { NewsSearchAPIClient, NewsSearchAPIModels, NewsSearchAPIMappers } from "@azure/cognitiveservices-newssearch";
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

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

#### browser - Authentication, client creation and search news 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 news as an example written in javascript.

- index.html
```html
<!DOCTYPE html>
<html lang="en">
<head>
<title>@azure/cognitiveservices-newssearch 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-newssearch/dist/cognitiveservices-newssearch.js"></script>
<script type="text/javascript">
const subscriptionId = "<Subscription_Id>";
Expand Down Expand Up @@ -119,10 +102,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,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
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 @@ -101,6 +101,8 @@ export const Thing: msRest.CompositeMapper = {
serializedName: "image",
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "ImageObject"
}
},
Expand Down Expand Up @@ -153,6 +155,8 @@ export const CreativeWork: msRest.CompositeMapper = {
element: {
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "Thing"
}
}
Expand All @@ -170,6 +174,8 @@ export const CreativeWork: msRest.CompositeMapper = {
serializedName: "video",
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "VideoObject"
}
}
Expand Down Expand Up @@ -228,6 +234,8 @@ export const NewsArticle: msRest.CompositeMapper = {
element: {
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "NewsArticle"
}
}
Expand Down Expand Up @@ -300,6 +308,8 @@ export const News: msRest.CompositeMapper = {
element: {
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "NewsArticle"
}
}
Expand Down Expand Up @@ -364,6 +374,8 @@ export const ImageObject: msRest.CompositeMapper = {
serializedName: "thumbnail",
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "ImageObject"
}
}
Expand Down Expand Up @@ -410,6 +422,8 @@ export const Query: msRest.CompositeMapper = {
serializedName: "thumbnail",
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "ImageObject"
}
}
Expand Down Expand Up @@ -469,6 +483,8 @@ export const TrendingTopics: msRest.CompositeMapper = {
element: {
type: {
name: "Composite",
polymorphicDiscriminator: ResponseBase.type.polymorphicDiscriminator,
uberParent: "ResponseBase",
className: "NewsTopic"
}
}
Expand Down Expand Up @@ -527,6 +543,8 @@ export const VideoObject: msRest.CompositeMapper = {
serializedName: "thumbnail",
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/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-newssearch";
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/newsOperationsMappers";
import * as Parameters from "../models/parameters";
Expand Down Expand Up @@ -74,10 +74,10 @@ export class NewsOperations {
}

/**
* @summary The News Category API lets lets you search on Bing and get back a list of top news
* articles by category. This section provides technical details about the query parameters and
* headers that you use to request news and the JSON response objects that contain them. For
* examples that show how to make requests, see [Searching the web for
* @summary The News Category API lets you search on Bing and get back a list of top news articles
* by category. This section provides technical details about the query parameters and headers that
* you use to request news and the JSON response objects that contain them. For examples that show
* how to make requests, see [Searching the web for
* news](https://docs.microsoft.com/en-us/azure/cognitive-services/bing-news-search/search-the-web).
* @param [options] The optional parameters
* @returns Promise<Models.NewsCategoryResponse>
Expand All @@ -102,11 +102,10 @@ export class NewsOperations {
}

/**
* @summary The News Trending Topics API lets lets you search on Bing and get back a list of
* trending news topics that are currently trending on Bing. This section provides technical
* details about the query parameters and headers that you use to request news and the JSON
* response objects that contain them. For examples that show how to make requests, see [Searching
* the web for
* @summary The News Trending Topics API lets you search on Bing and get back a list of trending
* news topics that are currently trending on Bing. This section provides technical details about
* the query parameters and headers that you use to request news and the JSON response objects that
* contain them. For examples that show how to make requests, see [Searching the web for
* news](https://docs.microsoft.com/en-us/azure/cognitive-services/bing-news-search/search-the-web).
* @param [options] The optional parameters
* @returns Promise<Models.NewsTrendingResponse>
Expand Down
2 changes: 1 addition & 1 deletion packages/@azure/cognitiveservices-newssearch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "NewsSearchAPIClient 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
6 changes: 3 additions & 3 deletions packages/@azure/cognitiveservices-newssearch/rollup.config.js
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/newsSearchAPIClient.js',
external: ["@azure/ms-rest-js", "@azure/ms-rest-azure-js"],
external: ["ms-rest-js", "ms-rest-azure-js"],
output: {
file: "./dist/cognitiveservices-newssearch.js",
format: "umd",
name: "Azure.CognitiveservicesNewssearch",
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
2 changes: 1 addition & 1 deletion packages/@azure/cognitiveservices-newssearch/tsconfig.json
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"]
}