Tim Burks 82c0ca8325 Update Natural Language example to use Google Application Default Credentials 8 éve
..
Sources 82c0ca8325 Update Natural Language example to use Google Application Default Credentials 8 éve
protoc ba6eb58aeb Add sample calling the Google Cloud Natural Language API. 8 éve
Makefile ba6eb58aeb Add sample calling the Google Cloud Natural Language API. 8 éve
Package.swift 82c0ca8325 Update Natural Language example to use Google Application Default Credentials 8 éve
README.md 82c0ca8325 Update Natural Language example to use Google Application Default Credentials 8 éve
RUNME ba6eb58aeb Add sample calling the Google Cloud Natural Language API. 8 éve
roots.pem ba6eb58aeb Add sample calling the Google Cloud Natural Language API. 8 éve

README.md

Calling the Google Cloud Natural Language API

This directory contains a very simple sample that calls the Google Cloud Natural Language API. Calls are made directly to the Cloud Natural Language RPC interface. In practice, these would be wrapped in idiomatic code.

Use RUNME to generate the necessary Protocol Buffer and gRPC support code. It uses protoc and the Swift Protocol Buffer and gRPC plugins, so please be sure these are in your path. The plugins can be built by running make in the top-level Plugins directory.

Calls require a Google project ID and service account credentials.

To create a project ID, visit the Google Cloud Console.

Service account support is provided by Google's Auth Library for Swift. After enabling the Cloud Natural Language API for your project, create and download service account credentials. Then set the GOOGLE_APPLICATION_CREDENTIALS environment variable to point to the file containing these credentials.