google-api-nodejs-client

Move/rename folder in Google Cloud Storage using nodejs gcloud api

廉价感情. 提交于 2020-08-19 07:06:21
问题 I am trying to rename or move a folder in google cloud storage using the gcloud api. A similar question explains how to delete a folder: Delete folder in Google Cloud Storage using nodejs gcloud api But how can one rename a folder? or move to another path? 回答1: You can try something like this: 'use strict' var async = require('async') var storage = require('@google-cloud/storage')() var bucket = storage.bucket('stephen-has-a-new-bucket') bucket.renameFolder = function(source, dest, callback)

Move/rename folder in Google Cloud Storage using nodejs gcloud api

China☆狼群 提交于 2020-08-19 07:05:31
问题 I am trying to rename or move a folder in google cloud storage using the gcloud api. A similar question explains how to delete a folder: Delete folder in Google Cloud Storage using nodejs gcloud api But how can one rename a folder? or move to another path? 回答1: You can try something like this: 'use strict' var async = require('async') var storage = require('@google-cloud/storage')() var bucket = storage.bucket('stephen-has-a-new-bucket') bucket.renameFolder = function(source, dest, callback)

google cloud authentication with bearer token via nodejs

我怕爱的太早我们不能终老 提交于 2020-06-29 04:05:23
问题 My client has a GraphQL API running on Google cloud run. I have recieved a service account for authentication as well as access to the gcloud command line tool. When using gcloud command line like so: gcloud auth print-identity-token I can generate a token that can be used to make post requests to the api. This works and I can make successful post requests to the api from postman, insomnia and from my nodejs app. However, when I use JWT authentication with "googleapis" or "google-auth" npm

Send large attachments (> 5 MB) with the Gmail API Node.js client

社会主义新天地 提交于 2020-05-29 10:55:10
问题 When I use the Gmail API Node.js client to send an email with an attachment larger than 5 MB I get an error "413 Request Entity Too Large". I first create a string mimeMessage which contains a MIME message of type multipart/mixed. One part of this message is a base64 encoded attachment with a size > 5 MB. Then I try to send it: gmail = google.gmail({ version: 'v1', auth: authentication }); encodedMimeMessage = Buffer.from(mimeMessage) .toString('base64') .replace(/\+/g, '-') .replace(/\//g, '

Gmail API not respecting UTF encoding in subject

二次信任 提交于 2020-02-23 12:24:37
问题 In an app I'm helping develop we've added in the ability for a user to invite other users and personalize the invitation email, and then send it via Gmail's APIs. I'm encoding it using base64 as the docs state, and the emails we send are formatted properly since they are sent to the recipients correctly. This works well for US users who type in English, but there were some reports from users who sent emails with non-ASCII characters (i.e. in Hebrew) having their emails garbled when sent. I

Upload Youtube Video is successful but no video on youtube channel

两盒软妹~` 提交于 2020-01-07 03:54:05
问题 Last week I was able to upload a video on my youtube channel. Today I've tried doing the same thing without any success. Code wise I'm not getting any errors whatsoever. Here is the result for my yt.videos.insert({/* video info here and media*/}, function(err, res){ console.log(err); console.log(res); }); For the console.log(err) I get "null" and for the console.log(res) I get: I20151130-14:25:26.474(1)? { kind: 'youtube#video', I20151130-14:25:26.474(1)? etag: '"mPrpS7Nrk6Ggi_P7VJ8-KsEOiIw

Reply to a thread (mail) with attachment being sent as a new mail in sender account - gmail api

佐手、 提交于 2020-01-06 08:31:10
问题 I am trying to send reply to a thread (mail) with attachment using gmail api. But it is being sent as a new mail in senders account, but in receiver account it is seen in same thread. This mail should be in same thread for both sender and receiver sides as well. I am using node js and request-promise module for achieving this. Here is my piece of code. Please have a look and let me know where I am wrong. let from = req.body.email; let mailString = ''; for (let i in req.files) { mailString +=

Update user using google admin directory api returns 200 but does not update. Malformed request body?

风流意气都作罢 提交于 2020-01-06 07:58:35
问题 I have a user in my google admin console with the email dog@jopfre.com. I can auth successfully and add and delete users using the api. Now I am trying to update the user using the api. Here is a simplified version of my code: const admin = google.admin({version: 'directory_v1', auth}); admin.users.update({ userKey: "dog@jopfre.com", requestBody: { primaryEmail: "cat@jopfre.com" } },(err, data) => { console.log(err || data); }); This returns json of the request and a 200 status. The nearest