ballerinax/googleapis.drive

3.1.0

Overview

The connector provides the capability to programmatically manage files and folders in the Google Drive.

This module supports Google Drive API v3.

Prerequisites

Before using this connector in your Ballerina application, complete the following:

Quickstart

To use the Google Drive connector in your Ballerina application, update the .bal file as follows:

Step 1: Import the connector

Import the ballerinax/googleapis.drive module into the Ballerina projects shown below.

Copy

All the actions return a valid response or error. If the action is a success, then the requested resource is returned. If not, an error is returned.

Step 2: Create a new connector instance

Create a drive:ConnectionConfig with the OAuth2 tokens obtained, and initialize the connector with it.

Copy

Step 3: Invoke the connector operation

  1. Now you can use the operations available within the connector. Note that they are in the form of remote operations.

    Following is an example on how to retrieve a file using the connector.

    Get file with given file ID

    Copy
  2. Use bal run command to compile and run the Ballerina program.

You can find a list of samples here

Other versions

See more...