Skip to content

Commit

Permalink
Add smoke test and update version number
Browse files Browse the repository at this point in the history
  • Loading branch information
swcloud committed Jun 30, 2017
1 parent 557cb28 commit c94df10
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 18 deletions.
26 changes: 25 additions & 1 deletion packages/language/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Node.js Client for Google Cloud Natural Language API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-node#versioning))
# Node.js Client for Google Cloud Natural Language API ([Beta](https://github.com/GoogleCloudPlatform/google-cloud-node#versioning))

[Google Cloud Natural Language API][Product Documentation]: Google Cloud Natural Language API provides natural language understanding technologies to developers. Examples include sentiment analysis, entity recognition, and text annotations.
- [Client Library Documentation][]
Expand All @@ -16,6 +16,30 @@ In order to use this library, you first need to go through the following steps:
$ npm install --save @google-cloud/language
```

### Preview
#### LanguageServiceClient
```js
var language = require('@google-cloud/language');

var client = language({
// optional auth parameters.
});

var content = 'Hello, world!';
var type = language.v1.types.Document.Type.PLAIN_TEXT;
var document = {
content : content,
type : type
};
client.analyzeSentiment({document: document}).then(function(responses) {
var response = responses[0];
// doThingsWith(response)
})
.catch(function(err) {
console.error(err);
});
```

### Next Steps
- Read the [Client Library Documentation][] for Google Cloud Natural Language API to see other available methods on the client.
- Read the [Google Cloud Natural Language API Product documentation][Product Documentation] to learn more about the product and see How-to Guides.
Expand Down
8 changes: 4 additions & 4 deletions packages/language/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"repository": "GoogleCloudPlatform/google-cloud-node",
"name": "@google-cloud/language",
"version": "0.7.1",
"version": "0.11.0",
"author": "Google Inc",
"description": "Google Cloud Natural Language API client for Node.js",
"main": "src/index.js",
"files": [
"src",
"AUTHORS",
"CONTRIBUTING",
"COPYING"
],
"keywords": [
Expand All @@ -34,8 +33,9 @@
"through2": "^2.0.3"
},
"scripts": {
"test": "mocha",
"publish-module": "node ../../scripts/publish.js language"
"publish-module": "node ../../scripts/publish.js language",
"smoke-test": "mocha smoke-test/*.js --timeout 5000",
"test": "mocha test/*.js"
},
"license": "Apache-2.0",
"engines": {
Expand Down
40 changes: 40 additions & 0 deletions packages/language/smoke-test/language_service_smoke_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright 2017, Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';

describe('LanguageServiceSmokeTest', function() {

it('successfully makes a call to the service', function(done) {
var language = require('../src');

var client = language.v1({
// optional auth parameters.
});

var content = 'Hello, world!';
var type = language.v1.types.Document.Type.PLAIN_TEXT;
var document = {
content : content,
type : type
};
client.analyzeSentiment({document: document}).then(function(responses) {
var response = responses[0];
console.log(response);
})
.then(done)
.catch(done);
});
});
2 changes: 1 addition & 1 deletion packages/language/src/v1/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function v1(options) {
return languageServiceClient(gaxGrpc);
}

v1.GAPIC_VERSION = '0.7.1';
v1.GAPIC_VERSION = '0.11.0';
v1.SERVICE_ADDRESS = languageServiceClient.SERVICE_ADDRESS;
v1.ALL_SCOPES = languageServiceClient.ALL_SCOPES;

Expand Down
14 changes: 9 additions & 5 deletions packages/language/src/v1/language_service_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ LanguageServiceClient.prototype.getProjectId = function(callback) {
* client.analyzeSentiment({document: document}).then(function(responses) {
* var response = responses[0];
* // doThingsWith(response)
* }).catch(function(err) {
* })
* .catch(function(err) {
* console.error(err);
* });
*/
Expand Down Expand Up @@ -209,7 +210,8 @@ LanguageServiceClient.prototype.analyzeSentiment = function(request, options, ca
* client.analyzeEntities(request).then(function(responses) {
* var response = responses[0];
* // doThingsWith(response)
* }).catch(function(err) {
* })
* .catch(function(err) {
* console.error(err);
* });
*/
Expand Down Expand Up @@ -268,7 +270,8 @@ LanguageServiceClient.prototype.analyzeEntities = function(request, options, cal
* client.analyzeSyntax(request).then(function(responses) {
* var response = responses[0];
* // doThingsWith(response)
* }).catch(function(err) {
* })
* .catch(function(err) {
* console.error(err);
* });
*/
Expand Down Expand Up @@ -332,7 +335,8 @@ LanguageServiceClient.prototype.analyzeSyntax = function(request, options, callb
* client.annotateText(request).then(function(responses) {
* var response = responses[0];
* // doThingsWith(response)
* }).catch(function(err) {
* })
* .catch(function(err) {
* console.error(err);
* });
*/
Expand Down Expand Up @@ -381,4 +385,4 @@ function LanguageServiceClientBuilder(gaxGrpc) {
}
module.exports = LanguageServiceClientBuilder;
module.exports.SERVICE_ADDRESS = SERVICE_ADDRESS;
module.exports.ALL_SCOPES = ALL_SCOPES;
module.exports.ALL_SCOPES = ALL_SCOPES;
2 changes: 1 addition & 1 deletion packages/language/src/v1beta2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function v1beta2(options) {
return languageServiceClient(gaxGrpc);
}

v1beta2.GAPIC_VERSION = '0.7.1';
v1beta2.GAPIC_VERSION = '0.11.0';
v1beta2.SERVICE_ADDRESS = languageServiceClient.SERVICE_ADDRESS;
v1beta2.ALL_SCOPES = languageServiceClient.ALL_SCOPES;

Expand Down
17 changes: 11 additions & 6 deletions packages/language/src/v1beta2/language_service_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ LanguageServiceClient.prototype.getProjectId = function(callback) {
* client.analyzeSentiment({document: document}).then(function(responses) {
* var response = responses[0];
* // doThingsWith(response)
* }).catch(function(err) {
* })
* .catch(function(err) {
* console.error(err);
* });
*/
Expand Down Expand Up @@ -211,7 +212,8 @@ LanguageServiceClient.prototype.analyzeSentiment = function(request, options, ca
* client.analyzeEntities(request).then(function(responses) {
* var response = responses[0];
* // doThingsWith(response)
* }).catch(function(err) {
* })
* .catch(function(err) {
* console.error(err);
* });
*/
Expand Down Expand Up @@ -269,7 +271,8 @@ LanguageServiceClient.prototype.analyzeEntities = function(request, options, cal
* client.analyzeEntitySentiment(request).then(function(responses) {
* var response = responses[0];
* // doThingsWith(response)
* }).catch(function(err) {
* })
* .catch(function(err) {
* console.error(err);
* });
*/
Expand Down Expand Up @@ -328,7 +331,8 @@ LanguageServiceClient.prototype.analyzeEntitySentiment = function(request, optio
* client.analyzeSyntax(request).then(function(responses) {
* var response = responses[0];
* // doThingsWith(response)
* }).catch(function(err) {
* })
* .catch(function(err) {
* console.error(err);
* });
*/
Expand Down Expand Up @@ -392,7 +396,8 @@ LanguageServiceClient.prototype.analyzeSyntax = function(request, options, callb
* client.annotateText(request).then(function(responses) {
* var response = responses[0];
* // doThingsWith(response)
* }).catch(function(err) {
* })
* .catch(function(err) {
* console.error(err);
* });
*/
Expand Down Expand Up @@ -441,4 +446,4 @@ function LanguageServiceClientBuilder(gaxGrpc) {
}
module.exports = LanguageServiceClientBuilder;
module.exports.SERVICE_ADDRESS = SERVICE_ADDRESS;
module.exports.ALL_SCOPES = ALL_SCOPES;
module.exports.ALL_SCOPES = ALL_SCOPES;

0 comments on commit c94df10

Please sign in to comment.