ballerinax/googleapis.people Ballerina library

1.0.1

Overview

Ballerina connector for Google People API connects the Google People API via Ballerina language with ease. It provides capability to perform operations related to contacts and contact groups in Google Contacts.

This module supports Google People API v1.0.

Prerequisites

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

Quickstart

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

Step 1: Import connector

Import the ballerinax/googleapis.people module into the Ballerina project.

Copy
import ballerinax/googleapis.people as people;

Step 2: Create a new connector instance

Enter the credentials in the Google People API client configuration, and create the Google People API client by passing the configuration.

Copy
people:GoogleContactsConfiguration googleContactConfig = {
    oauth2Config: {
        clientId: "<CLIENT_ID>",
        clientSecret: <CLIENT_SECRET>,
        refreshUrl: people:REFRESH_URL,
        refreshToken: <REFRESH_TOKEN>
    }
};

people:Client googleContactClient = check new (googleContactConfig);

Step 3: Invoke connector operation

  1. Create a contact via the createContact method by passing a Person record and FieldMask[] as parameters.

    Copy
    people:Person person = {
        emailAddresses: [],
        names: [{
            familyName: "Hardy",
            givenName: "Jason",
            unstructuredName: "Jason Hardy"
        }]
    };
    people:FieldMask[] personFields = [people:NAME, people:PHONE_NUMBER, people:EMAIL_ADDRESS];
    people:PersonResponse createContact = check googleContactClient->createContact(person, personFields);
  2. Use bal run command to compile and run the Ballerina program.

You can find more samples here

Import

import ballerinax/googleapis.people;Copy

Metadata

Released date: over 2 years ago

Version: 1.0.1

License: Apache-2.0


Compatibility

Platform: any

Ballerina version: slbeta2

GraalVM compatible: Yes


Pull count

Total: 1984

Current verison: 0


Weekly downloads


Source repository


Keywords

google

people

contact


Contributors

Other versions

See more...