Skip to content

Commit

Permalink
Modify the structure.
Browse files Browse the repository at this point in the history
- the generated code will now export a function, which returns
  grpc and API class upon specified authentication context.
- v1beta1 also exports as a function, which builds API classes.
  (currently it's same as LanguageServiceApi itself, because
  language API is a single-service API).

The new usage would be:
```
var language = require('@google-cloud/language');
var v1beta1 = language.v1beta1({keyFile: ...});
var api = v1beta1.LanguageServiceApi();
api.annotateText({type: v1beta1.grpc.Document.Type.PLAIN_TEXT, ...});
```
  • Loading branch information
jmuk committed Aug 11, 2016
1 parent 5ee1fc4 commit 1f0e8a1
Show file tree
Hide file tree
Showing 3 changed files with 197 additions and 206 deletions.
2 changes: 1 addition & 1 deletion packages/language/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"arguejs": "^0.2.3",
"arrify": "^1.0.1",
"extend": "^3.0.0",
"google-gax": "^0.5.2",
"google-gax": "^0.6.0",
"google-proto-files": "^0.4.0",
"is": "^3.0.1",
"propprop": "^0.3.1",
Expand Down
9 changes: 6 additions & 3 deletions packages/language/src/v1beta1/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

var languageServiceApi = require('./language_service_api');

exports.grpc = function(optGrpc) {
return languageServiceApi.grpc(optGrpc).google.cloud.language.v1beta1;
function v1beta1(options) {
return languageServiceApi(options);
};
exports.languageServiceApi = languageServiceApi.LanguageServiceApi;

v1beta1.SERVICE_ADDRESS = languageServiceApi.SERVICE_ADDRESS;
v1beta1.ALL_SCOPES = languageServiceApi.ALL_SCOPES;
module.exports = v1beta1;
Loading

0 comments on commit 1f0e8a1

Please sign in to comment.