This page shows how to get started with the Cloud Client Libraries for the Customer Engagement Suite API. Client libraries make it easier to access Google Cloud APIs from a supported language. Although you can use Google Cloud APIs directly by making raw requests to the server, client libraries provide simplifications that significantly reduce the amount of code you need to write.
Read more about the Cloud Client Libraries and the older Google API Client Libraries in Client libraries explained.
Install the client library
C#
Download google-cloud-ces-v1-csharp.tar.gz.
Download google-cloud-ces-v1beta-csharp.tar.gz.
Talk to your Google Account contact for instructions.
For more information, see Setting Up a C# Development Environment.
Go
Download gapi-cloud-ces-v1-go.tar.gz.
Download gapi-cloud-ces-v1beta-go.tar.gz.
Clone cloud.google.com/go and capture the path like so:
git clone https://github.com/googleapis/google-cloud-go
export CLOUD_GO=`pwd`/google-cloud-go
Unpack the tar file: tar -xzpf gapi-cloud-ces-v1-go.tar.gz. Then, copy
the sources to the CLOUD_GO directory.
cp -r ./cloud.google.com/go/gapi-cloud-ces-v1-go $CLOUD_GO
From the root directory of a Go module utilizing the client, replace the client dependency with the local clone.
Note: If this is not a brand new module, and a submodule has been published to
CLOUD_GO, then target that module dependency with the following command
instead.
go mod edit -replace=cloud.google.com/go=$CLOUD_GO
Now the locally generated client library is ready for use.
For more information, see Setting Up a Go Development Environment.
Java
Download google-cloud-ces-v1-java.tar.gz.
Download google-cloud-ces-v1beta-java.tar.gz.
You may choose one of the two possible options:
Option 1 (recommended): Install the client in a local maven cache:
cd /path/to/library ./gradlew clean publishToMavenLocal
After that the client can be consumed from any Gradle or Maven project in a conventional way. See the following for an example of adding the locally built Java client library to a Maven project:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>gapic-google-cloud-ces-v1-java</artifactId>
<version>0.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-bom</artifactId>
<version>${gax-bom.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>gapic-google-cloud-ces-v1-java</artifactId>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax</artifactId>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-grpc</artifactId>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-httpjson</artifactId>
</dependency>
</dependencies>
Option 2: Just build the client jar and pull all of its dependencies in a single folder:
./gradlew clean allJars
After that check the all-jars folder, it should contain all the jars needed to
run the client (i.e. the client itself and all of its direct and transitive
dependencies).
For more information, see Setting Up a Java Development Environment.
Node.js
Download ces-v1-nodejs.tar.gz.
Download ces-v1beta-nodejs.tar.gz.
NPM supports local installs using the tar file produced by npm pack.
First, unpack the file produced by Bazel:
tar xzf path/to/ces-v1-nodejs.tar.gz
cd ces-v1-nodejs
In the unpacked folder, run npm install to compile the library and npm pack
to pack the result into the .tgz file to be consumed by npm:
npm install
npm pack
The resulting file can be
passed to npm install:
npm install RESULTING_FILE
It can also be distributed within the project.
For more information, see Setting Up a Node.js Development Environment.
PHP
Download google-cloud-ces-v1-php.tar.gz.
Download google-cloud-ces-v1beta-php.tar.gz.
Unpack this into a folder in your project, for example:
tar xvf path/to/LIBRARY.tar.gz
This will unpack the client library to a local the folder.
Move this folder into the root of your project, and
add the following to your project's composer.json (or create one if it doesn't
exist):
{
"require": {
"google/gax": "^1.34"
},
"autoload": {
"classmap": [
"LIBRARY/src",
"LIBRARY/proto/src"
]
}
}
This adds the google/gax dependency, and identifies the directories where
the class files can be found and autoloaded by composer.
Run composer install, include vendor/autoload.php in your code, and you're ready to go.
For more information, see Using PHP on Google Cloud.
Python
Download ces-v1beta-py.tar.gz.
Set up a virtual environment first:
python3 -m venv env
source env/bin/activate
Then install the library from the tar file:
pip install ces-v1-py.tar.gz
For more information, see Setting Up a Python Development Environment.
Ruby
Download google-cloud-ces-v1-ruby.tar.gz.
Download google-cloud-ces-v1beta-ruby.tar.gz.
Talk to your Google Account contact for instructions.
For more information, see Setting Up a Ruby Development Environment.
Set up authentication
To authenticate calls to Google Cloud APIs, client libraries support Application Default Credentials (ADC); the libraries look for credentials in a set of defined locations and use those credentials to authenticate requests to the API. With ADC, you can make credentials available to your application in a variety of environments, such as local development or production, without needing to modify your application code.For production environments, the way you set up ADC depends on the service and context. For more information, see Set up Application Default Credentials.
For a local development environment, you can set up ADC with the credentials that are associated with your Google Account:
-
Install the Google Cloud CLI. After installation, initialize the Google Cloud CLI by running the following command:
gcloud initIf you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
A sign-in screen appears. After you sign in, your credentials are stored in the local credential file used by ADC.
Additional resources
C#
The following list contains links to more resources related to the client library for C#:
Go
The following list contains links to more resources related to the client library for Go:
Java
The following list contains links to more resources related to the client library for Java:
Node.js
The following list contains links to more resources related to the client library for Node.js:
PHP
The following list contains links to more resources related to the client library for PHP:
Python
The following list contains links to more resources related to the client library for Python:
Ruby
The following list contains links to more resources related to the client library for Ruby: