Skip to content

Instantly share code, notes, and snippets.

View vchudnov-g's full-sized avatar

Victor Chudnovsky vchudnov-g

View GitHub Profile
@vchudnov-g
vchudnov-g / . Simplest gRPC API with working generated client libraries & samples .md
Created October 31, 2018 13:55 — forked from beccasaurus/. gRPC Dogs API – with GAPIC generated libraries 🐕 .md
Simplest gRPC API with working generated client libraries & samples – # codelab

🦑 G.A.P.I.C 🖥 codelab 🎓

.
├── artman_dogs.yaml
├── dogs.proto
├── dogs_gapic.yaml
├── dogs_server.js
├── dogs_service.yaml
└── generate-and-run.sh

🖋 GAPIC :: Library Partials

So you want to write a partial helper, eh?

Hand-written code adds all kinds of functionality on top of generated GAPIC client libraries!

Let's look at the most common type of hand-written extension:

>> Helper Methods added to service object which wraps call to 1 rpc method <<

@vchudnov-g
vchudnov-g / analyze_entity_sentiment_request_entity_sentiment_file.py
Created January 14, 2019 22:29
Generated entity-sentiment samples with response handling
# -*- coding: utf-8 -*-
#
# Copyright 2018 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
@vchudnov-g
vchudnov-g / analyze_entity_sentiment_request_entity_sentiment_text_simple.py
Created January 14, 2019 22:31
Generated entity-sentiment samples with NO response handling
# -*- coding: utf-8 -*-
#
# Copyright 2018 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
type: manifest/samples
schema_version: 3
base: &common
env: 'java'
bin: 'echo mvn exec:java -q -D{sample} -Dexec.args=@args'
chdir: '{@manifest_dir}/../..'
basepath: '.'
samples:
- <<: *common
path: '{basepath}/src/main/java/com/google/cloud/examples/speech/v1/SpeechTranscribeAsyncWordTimeOffsetsGcs.java'
type: manifest/samples
schema_version: 3
base: &common
env: 'java'
chdir: '{@manifest_dir}/../..'
basepath: '/tmp'
samples:
- <<: *common
path: '{basepath}/echo-me'
sample: 'first'