-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Publish an NPM package #432
Comments
It should. That's the established way to do it. |
This comment has been minimized.
This comment has been minimized.
It is possible to |
The library referenced by StevenEWright seems to be Google's official API client for NodeJS. It's not a perfect copy of this library; class hierarchies and call signatures differ pretty strongly from this library's. Its documentation is also challenging to figure out, particularly as it lacks examples. On the plus side, it has submodules for specific libraries, which this library does not have. It has the same capabilities as this library (apart from the fact that this library only works in browsers and the Node library also works in Node), is reasonably intuitive and logical to use and works well as far as I can tell. It is probably the closest thing Google will ever make to a Node-compatible and NPM-installable version of this library. The downvotes look undeserved as far as I can tell, and I am curious as to their motivation. |
I've look at this. With the way the client is written, it's impossible to make the client public without a full rewrite. The At best, I could make an effort to mirror a few read-only files that would have the internal comments stripped. |
@grant it might be helpful, can you share those files? I'm trying to make Google Sheets API for JavaScript more TypeScript-friendly: DefinitelyTyped/DefinitelyTyped#37847 And I'm having issues with POST requests, such as batchUpdate. The problem is that I'm not sure how JavaScript library expects this parameter. // NodeJS docs example
batchUpdate({
spreadsheetId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
resource: {
requests: [ ],
},
}); // JavaScript docs example
batchUpdate({
spreadsheetId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
}, {
requests: [ ],
}); I've found that NodJS library uses this to get check request body: const resource = params.requestBody ? params.requestBody : params.resource; And now I wonder what are valid ways to pass request body in JavaScript library. I want to know the implementation to define all valid ways of passing the request body. I'll try to look into minified sources, but it's quite challenging. UPDATE: // over-simplified version
var prepareRequest = function (
currentRequestSchema, // docs discovery batchUpdate info
commonRequestSchema, // docs discovery common info
arg1, // batchUpdate first argument
arg2, // batchUpdate second argument
) {
let body;
// ...
arg1 = deleteAllKnownParameters(arg1, currentRequestSchema.parameters, commonRequestSchema.parameters); // extracts all known parameters from arg1 and leaves only unknown ones
// ...
if (
Object.keys(arg1).length == 1 // if arg1 has exactly one unknown property
&& arg1.hasOwnProperty('resource') // and this property is "resource"
) {
body = arg1.resource; // use it as a request body
}
if (body == null) {
body = arg2; // if arg1 was null, use second argument
}
}; So, basically both approaches are supported by the library. And I can't find any other approach (like using |
Hi there, Closing this out as won't fix, because we do not plan to support an NPM package for gapi in its current form. For posterity: As Grant stated above we can't easily support a NPM package for gapi because it's designed to be dynamically loaded via its own loading mechanism. We do have a few other related libraries available via NPM, and if they support your use cases they are likely a better fit:
|
Hi, is this project scheduled to be published as an NPM package?
The text was updated successfully, but these errors were encountered: