lib/functions/remoteCreateProject.js
function remoteCreateProject(auth, name) {
    return new Promise((resolve, reject) => {
        const drive = google.drive('v3');
        const options = {
            auth,
            resource: {
                name,
                mimeType: constants.MIME_GAS_JSON,
            },
            media: {
                mimeType: constants.MIME_GAS_JSON,
                body: JSON.stringify(files),
            },
        };

        drive.files.create(options, (err, result) => {
            if (err) {
                triageGoogleError(err, 'remoteCreateProject').then((triaged) => {
                    reject(triaged);
                }).catch((notTriaged) => {
                    reject(notTriaged);
                });
            } else {
                resolve(result.data);
                return;
            }
            return;
        });
    });
}
function remoteCreateProject(auth, name) {
    return new Promise((resolve, reject) => {
        const drive = google.drive('v3');
        const options = {
            auth,
            resource: {
                name,
                mimeType: constants.MIME_GAS_JSON,
            },
            media: {
                mimeType: constants.MIME_GAS_JSON,
                body: JSON.stringify(files),
            },
        };

        drive.files.create(options, (err, result) => {
            if (err) {
                triageGoogleError(err, 'remoteCreateProject').then((triaged) => {
                    reject(triaged);
                }).catch((notTriaged) => {
                    reject(notTriaged);
                });
            } else {
                resolve(result.data);
                return;
            }
            return;
        });
    });
}
function remoteCreateProject ( auth , name ) { return new Promise ( ( resolve , reject ) => { const drive = google . drive ( 'v3' ) ; const options = { auth , resource : { name , mimeType : constants . MIME_GAS_JSON , } , media : { mimeType : constants . MIME_GAS_JSON , body : JSON . stringify ( files ) , } , } ; drive . files . create ( options , ( err , result ) => { if ( err ) { triageGoogleError ( err , 'remoteCreateProject' ) . then ( ( triaged ) => { reject ( triaged ) ; } ) . catch ( ( notTriaged ) => { reject ( notTriaged ) ; } ) ; } else { resolve ( result . data ) ; return ; } return ; } ) ; } ) ; }
Create a new remote script file

@param {google.auth.OAuth2} auth - An authorized OAuth2 client.
@param {String} name - Name to give to the new Google Apps Script file.
@returns {Promise} - A promise resolving the metadata of the newly created project
Create a new remote script file