Swiftpack.co - Package - vapor-community/GoogleCloudKit

GoogleCloudKit

Swift NIO

This project aims to bring over as many Google Cloud Platform APIs as possible to server side swift projects built on top of Swift NIO.

Because the products and API's are so vast this will start slowly and over time add more API's as time goes on.

Quickstart

Before you begin note that this package only supports using Service accounts to authenticate to the various Google Cloud Platform APIs using OAuth2.

  1. Select or create a Cloud Platform project.

Go to the projects page

  1. Enable billing for your project.

Enable billing

  1. Enable the Google Cloud Storage API.

Enable the API

  1. Set up authentication with a service account so you can access the API from your local workstation.

To begin using GogleCloudKit in your project you'll need to setup the initial configuration.

In your Package.swift file, add the following

.package(url: "https://github.com/vapor-community/GoogleCloudKit.git", from: "1.0.0-alpha.1")

Now setup the configuration.

 import GoogleCloudKit
 
 let credentialsConfig = GoogleCloudCredentialsConfiguration(project: "myprojectid-12345", credentialsFile: "~/path/to/service-account.json")

Optionally, you can register an empty GoogleCloudCredentialsConfiguration() and configure the following environment variables:

export PROJECT_ID=myprojectid-12345
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/service-account.json

Additionally, you can copy and paste the contents of your Service Account JSON file as the value for the GOOGLE_APPLICATION_CREDENTIALS environment variable:

export GOOGLE_APPLICATION_CREDENTIALS=[Valid Pasted JSON]

Currently the following API's are implemented and you can follow the setup guides for each specific API to integrate with your Vapor project.

Github

link
Stars: 1
Help us keep the lights on

Releases

1.0.0-alpha.3.0.1 - Nov 3, 2019

Fixed a but with shutting down the http client when no project id is set.

1.0.0-alpha.3.0.0 - Nov 2, 2019

This release makes the library modular and sets up the package to be flexible in which APIs you use.

for example instead of just importing GoogleCloudKit and having to compile every API that's implemented, you can specifically import the API you're looking to use

import GoogleCloudKit // Compiles CloudStorage library, PubSub library, etc...
import Storage // Only compiles CloudStorage

1.0.0-alpha.2.1.1 - Oct 6, 2019

Fixes an issue where we weren't shutting down the AsyncHTTPClient on deinit

1.0.0-alpha.2.1 - Oct 1, 2019

Added a fix for an empty 404 response that may be returned by google.

1.0.0-alpha.2 - Aug 23, 2019

Updated to use latest version of AsyncHTTPClient Made StorageClient initializer take an eventloop Fixed storage upload URL Updated README