Browse Source

Updated READMEs for broader audiences, removed API keys and client credentials.

The deleted credentials were disabled and do not work now.

To get new API keys and client credentials for calling Google APIs,
visit http://console.cloud.google.com

Credentials are only needed for the Speech and Datastore examples.
Tim Burks 9 years ago
parent
commit
7ceec3fe2d

+ 2 - 2
Examples/Datastore/Datastore/OAuthClient.swift

@@ -52,8 +52,8 @@ class OAuthClient {
   public var token : String? = nil
 
   init () {
-    clientID = "885917370891-n3r74v6miibn2969estdofr68ggqa1sn.apps.googleusercontent.com"
-    clientSecret = "_JDxU8iGdHYfeeER9AAEaHbn"
+    clientID = "YOUR_CLIENT_ID"
+    clientSecret = "YOUR_CLIENT_SECRET"
     redirectURIs = ["http://localhost"]
     authURI  = "https://accounts.google.com/o/oauth2/auth"
     tokenURI = "https://accounts.google.com/o/oauth2/token"

+ 3 - 0
Examples/Datastore/README.md

@@ -0,0 +1,3 @@
+This directory contains a Mac app that makes VERY a preliminary
+call to the Datastore API. It includes HTTP-based OAuth authentication
+to obtain credentials for the gRPC calls.

+ 2 - 0
Examples/Echo/README.md

@@ -15,4 +15,6 @@ the address field in the Echo window.
 When the Go server and Mac app are running on the same machine,
 both clients can be used to connect to both servers.
 
+Also, for comparison, the Objective-C directory contains an iOS
+client that connects to gRPC echo servers.
 

+ 1 - 1
Examples/Speech/Speech/SpeechRecognitionService.swift

@@ -15,7 +15,7 @@
 //
 import Foundation
 
-let API_KEY : String = "AIzaSyAZSuTl9SvDuuU2jc1Ajw5WEoa_O6ttlCo"
+let API_KEY : String = "YOUR_API_KEY"
 let HOST = "speech.googleapis.com"
 
 typealias SpeechRecognitionCompletionHandler = (Any?, NSError?) -> (Void)

+ 5 - 0
Examples/StickyNotes/README.md

@@ -0,0 +1,5 @@
+This directory contains a Mac app that implements a simple
+"Stickynotes" server and client. The Stickynotes service takes
+a text message as input and returns an image of the drawn text.
+
+Both client and server are embedded in the app.

+ 12 - 0
QuickProto/Samples/maps/CLEANUP

@@ -0,0 +1,12 @@
+#/bin/sh
+
+echo "Removing compiled files"
+rm -rf writer go/bin go/pkg
+
+echo "Removing downloaded dependencies" 
+rm -rf go/src/github.com/ go/src/golang.org/ go/src/google.golang.org/
+
+echo "Removing generated files"
+rm -rf go/src/sample/sample.pb.go
+
+

+ 33 - 0
QuickProto/Samples/maps/SETUP

@@ -0,0 +1,33 @@
+#!/bin/sh
+
+echo "0. Ensure that protoc is installed."
+
+if which protoc; then 
+  echo "OK"
+else 
+  echo "Please install protoc and be sure that it is in your search path."
+  exit
+fi
+
+echo "1. Set gopath and search path"
+
+export GOPATH=`pwd`/go
+export PATH=$GOPATH/bin:$PATH
+
+echo "2. Get the Go plugin for protoc"
+
+go get -a github.com/golang/protobuf/protoc-gen-go
+
+echo "3. Run protoc to generate the test API code"
+
+mkdir -p go/src/maps
+protoc maps.proto --proto_path=. --go_out=plugins=grpc:go/src/maps -omaps.out
+
+echo "4. Get the writer dependencies"
+
+go get writer
+
+echo "5. Build the writer"
+
+go build writer
+

+ 77 - 0
QuickProto/Samples/maps/go/src/maps/maps.pb.go

@@ -0,0 +1,77 @@
+// Code generated by protoc-gen-go.
+// source: maps.proto
+// DO NOT EDIT!
+
+/*
+Package test is a generated protocol buffer package.
+
+It is generated from these files:
+	maps.proto
+
+It has these top-level messages:
+	MapTest
+*/
+package test
+
+import proto "github.com/golang/protobuf/proto"
+import fmt "fmt"
+import math "math"
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
+
+type MapTest struct {
+	Name              string            `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+	Properties        map[string]string `protobuf:"bytes,2,rep,name=properties" json:"properties,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
+	IntegerProperties map[int32]int32   `protobuf:"bytes,3,rep,name=integer_properties,json=integerProperties" json:"integer_properties,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
+}
+
+func (m *MapTest) Reset()                    { *m = MapTest{} }
+func (m *MapTest) String() string            { return proto.CompactTextString(m) }
+func (*MapTest) ProtoMessage()               {}
+func (*MapTest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+
+func (m *MapTest) GetProperties() map[string]string {
+	if m != nil {
+		return m.Properties
+	}
+	return nil
+}
+
+func (m *MapTest) GetIntegerProperties() map[int32]int32 {
+	if m != nil {
+		return m.IntegerProperties
+	}
+	return nil
+}
+
+func init() {
+	proto.RegisterType((*MapTest)(nil), "test.MapTest")
+}
+
+func init() { proto.RegisterFile("maps.proto", fileDescriptor0) }
+
+var fileDescriptor0 = []byte{
+	// 195 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0xca, 0x4d, 0x2c, 0x28,
+	0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x29, 0x49, 0x2d, 0x2e, 0x51, 0xda, 0xc6, 0xc4,
+	0xc5, 0xee, 0x9b, 0x58, 0x10, 0x02, 0x64, 0x0b, 0x09, 0x71, 0xb1, 0xe4, 0x25, 0xe6, 0xa6, 0x4a,
+	0x30, 0x2a, 0x30, 0x6a, 0x70, 0x06, 0x81, 0xd9, 0x42, 0xb6, 0x5c, 0x5c, 0x40, 0xe5, 0x05, 0xa9,
+	0x45, 0x25, 0x99, 0xa9, 0xc5, 0x12, 0x4c, 0x0a, 0xcc, 0x1a, 0xdc, 0x46, 0xb2, 0x7a, 0x20, 0xad,
+	0x7a, 0x50, 0x6d, 0x7a, 0x01, 0x70, 0x79, 0xd7, 0xbc, 0x92, 0xa2, 0xca, 0x20, 0x24, 0x0d, 0x42,
+	0xc1, 0x5c, 0x42, 0x99, 0x79, 0x25, 0xa9, 0xe9, 0xa9, 0x45, 0xf1, 0x48, 0xc6, 0x30, 0x83, 0x8d,
+	0x51, 0x41, 0x35, 0xc6, 0x13, 0xa2, 0x0e, 0xdd, 0x34, 0xc1, 0x4c, 0x74, 0x71, 0x29, 0x5b, 0x2e,
+	0x7e, 0x34, 0x55, 0x42, 0x02, 0x5c, 0xcc, 0xd9, 0xa9, 0x95, 0x50, 0x97, 0x83, 0x98, 0x42, 0x22,
+	0x5c, 0xac, 0x65, 0x89, 0x39, 0xa5, 0xa9, 0x40, 0x37, 0x83, 0xc4, 0x20, 0x1c, 0x2b, 0x26, 0x0b,
+	0x46, 0x29, 0x17, 0x2e, 0x31, 0xec, 0x76, 0x21, 0x9b, 0xc2, 0x8a, 0xc5, 0x14, 0x56, 0x24, 0x53,
+	0x92, 0xd8, 0xc0, 0xa1, 0x68, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x76, 0x99, 0xbd, 0xf3, 0x53,
+	0x01, 0x00, 0x00,
+}

+ 32 - 0
QuickProto/Samples/maps/go/src/writer/writer.go

@@ -0,0 +1,32 @@
+package main
+
+import (
+	"github.com/golang/protobuf/proto"
+	"io/ioutil"
+	pb "maps"
+)
+
+func main() {
+	message := pb.MapTest{}
+	message.Name = "hello"
+	message.Properties = map[string]string{
+		"A": "AAAAAAAAAAAAAAAA",
+		"B": "BBBBBBBBBBBBBBBB",
+		"C": "CCCCCCCCCCCCCCCC",
+	}
+	message.IntegerProperties = map[int32]int32 {
+		1 : 100,
+		2 : 200,
+		3 : 300,
+		4 : 400,
+  	}
+
+	data, err := proto.Marshal(&message)
+	if err != nil {
+		panic(err)
+	}
+	err = ioutil.WriteFile("maptest.bin", data, 0644)
+	if err != nil {
+		panic(err)
+	}
+}

+ 16 - 0
QuickProto/Samples/maps/maps.out

@@ -0,0 +1,16 @@
+
+Ó
+
+maps.prototest"¶
+MapTest
+name (	Rname=
+
+properties (2.test.MapTest.PropertiesEntryR
+propertiesS
+integer_properties (2$.test.MapTest.IntegerPropertiesEntryRintegerProperties=
+PropertiesEntry
+key (	Rkey
+value (	Rvalue:8D
+IntegerPropertiesEntry
+key (Rkey
+value (Rvalue:8bproto3

+ 23 - 0
QuickProto/Samples/maps/maps.proto

@@ -0,0 +1,23 @@
+// Copyright (c) 2016, Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+syntax = "proto3";
+
+package test;
+
+message MapTest {
+  string name = 1;
+  map<string, string> properties = 2;
+  map<int32, int32> integer_properties = 3;
+}

+ 5 - 0
QuickProto/Samples/maps/maptest.bin

@@ -0,0 +1,5 @@
+
+hello
+BBBBBBBBBBBBBBBBB
+CCCCCCCCCCCCCCCCC
+AAAAAAAAAAAAAAAAA¬�dÈ

+ 6 - 5
README.md

@@ -2,12 +2,12 @@
 
 This repository contains an experimental Swift gRPC API.
 
-Currently not intended for production use, it provides low-level
+Not yet intended for production use, it provides low-level
 Swift wrappers for the C gRPC API that can be used to build
 higher-level structures supporting streaming and nonstreaming
 gRPC APIs. 
 
-Preliminary protocol buffer support is provided in the QuickProto
+Temporary protocol buffer support is provided in the QuickProto
 library. This simple Swift library provides an API for building and
 parsing protocol buffers with no generated code.
 
@@ -24,6 +24,7 @@ Other examples include [Sessions](Examples/Sessions),
 
 Swift Package Manager builds are demonstrated on Linux using 
 the instructions in the [Packages](Packages) directory.
-
-
-
+(Linux builds are currently untested and were presumed broken
+by the addition of Grand Central Dispatch APIs for streaming
+API support; they will be fixed when threading-related 
+incompatibilities between Linux and Darwin are resolved).