├── ExampleApp
├── .watchmanconfig
├── .gitattributes
├── .babelrc
├── app.json
├── android
│ ├── app
│ │ ├── src
│ │ │ └── main
│ │ │ │ ├── res
│ │ │ │ ├── values
│ │ │ │ │ ├── strings.xml
│ │ │ │ │ └── styles.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ └── mipmap-xxhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── exampleapp
│ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ └── MainApplication.java
│ │ │ │ └── AndroidManifest.xml
│ │ ├── BUCK
│ │ ├── proguard-rules.pro
│ │ └── build.gradle
│ ├── keystores
│ │ ├── debug.keystore.properties
│ │ └── BUCK
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── settings.gradle
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradlew.bat
│ └── gradlew
├── .buckconfig
├── jsconfig.json
├── ios
│ ├── ExampleApp.xcworkspace
│ │ └── contents.xcworkspacedata
│ ├── Podfile
│ ├── ExampleApp
│ │ ├── AppDelegate.h
│ │ ├── main.m
│ │ ├── Images.xcassets
│ │ │ └── AppIcon.appiconset
│ │ │ │ └── Contents.json
│ │ ├── AppDelegate.m
│ │ ├── Info.plist
│ │ └── Base.lproj
│ │ │ └── LaunchScreen.xib
│ ├── ExampleAppTests
│ │ ├── Info.plist
│ │ └── ExampleAppTests.m
│ ├── ExampleApp-tvOSTests
│ │ └── Info.plist
│ ├── ExampleApp-tvOS
│ │ └── Info.plist
│ ├── Podfile.lock
│ └── ExampleApp.xcodeproj
│ │ └── xcshareddata
│ │ └── xcschemes
│ │ ├── ExampleApp.xcscheme
│ │ └── ExampleApp-tvOS.xcscheme
├── __tests__
│ ├── index.ios.js
│ └── index.android.js
├── package.json
├── .gitignore
├── index.android.js
├── index.ios.js
├── .flowconfig
└── Speech.js
├── android
├── src
│ └── main
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ └── com
│ │ └── reactlibrary
│ │ ├── RNGoogleSpeechApiModule.java
│ │ └── RNGoogleSpeechApiPackage.java
└── build.gradle
├── ios
├── google
│ ├── rpc
│ │ ├── README.md
│ │ ├── Code.pbobjc.m
│ │ ├── status.proto
│ │ ├── Status.pbobjc.m
│ │ ├── Status.pbobjc.h
│ │ ├── error_details.proto
│ │ └── code.proto
│ ├── longrunning
│ │ ├── README.md
│ │ ├── Operations.pbrpc.h
│ │ ├── Operations.pbrpc.m
│ │ ├── operations.proto
│ │ └── Operations.pbobjc.h
│ ├── api
│ │ ├── annotations.proto
│ │ ├── label.proto
│ │ ├── Annotations.pbobjc.h
│ │ ├── Annotations.pbobjc.m
│ │ ├── monitored_resource.proto
│ │ ├── Label.pbobjc.h
│ │ ├── MonitoredResource.pbobjc.h
│ │ ├── Label.pbobjc.m
│ │ ├── MonitoredResource.pbobjc.m
│ │ └── HTTP.pbobjc.m
│ └── cloud
│ │ └── speech
│ │ └── v1
│ │ ├── CloudSpeech.pbrpc.h
│ │ └── CloudSpeech.pbrpc.m
├── RNGoogleSpeechApi.h
├── AudioController.h
├── SpeechRecognitionService.h
├── googleapis.podspec
├── SpeechRecognitionService.m
└── RNGoogleSpeechApi.m
├── windows
├── RNGoogleSpeechApi
│ ├── project.json
│ ├── RNGoogleSpeechApiModule.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ └── RNGoogleSpeechApi.rd.xml
│ ├── RNGoogleSpeechApiPackage.cs
│ └── RNGoogleSpeechApi.csproj
├── .npmignore
└── RNGoogleSpeechApi.sln
├── package.json
├── .gitignore
├── LICENSE
├── README.md
└── index.js
/ExampleApp/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/ExampleApp/.gitattributes:
--------------------------------------------------------------------------------
1 | *.pbxproj -text
2 |
--------------------------------------------------------------------------------
/ExampleApp/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["react-native"]
3 | }
4 |
--------------------------------------------------------------------------------
/ExampleApp/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ExampleApp",
3 | "displayName": "ExampleApp"
4 | }
--------------------------------------------------------------------------------
/ExampleApp/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ExampleApp
3 |
4 |
--------------------------------------------------------------------------------
/ExampleApp/.buckconfig:
--------------------------------------------------------------------------------
1 |
2 | [android]
3 | target = Google Inc.:Google APIs:23
4 |
5 | [maven_repositories]
6 | central = https://repo1.maven.org/maven2
7 |
--------------------------------------------------------------------------------
/ExampleApp/android/keystores/debug.keystore.properties:
--------------------------------------------------------------------------------
1 | key.store=debug.keystore
2 | key.alias=androiddebugkey
3 | key.store.password=android
4 | key.alias.password=android
5 |
--------------------------------------------------------------------------------
/ExampleApp/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hayanmind/react-native-google-speech-api/HEAD/ExampleApp/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ExampleApp/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hayanmind/react-native-google-speech-api/HEAD/ExampleApp/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ExampleApp/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hayanmind/react-native-google-speech-api/HEAD/ExampleApp/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ExampleApp/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hayanmind/react-native-google-speech-api/HEAD/ExampleApp/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ExampleApp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hayanmind/react-native-google-speech-api/HEAD/ExampleApp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ExampleApp/jsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "allowJs": true,
4 | "allowSyntheticDefaultImports": true
5 | },
6 | "exclude": [
7 | "node_modules"
8 | ]
9 | }
--------------------------------------------------------------------------------
/ExampleApp/android/keystores/BUCK:
--------------------------------------------------------------------------------
1 | keystore(
2 | name = "debug",
3 | properties = "debug.keystore.properties",
4 | store = "debug.keystore",
5 | visibility = [
6 | "PUBLIC",
7 | ],
8 | )
9 |
--------------------------------------------------------------------------------
/ios/google/rpc/README.md:
--------------------------------------------------------------------------------
1 | # Google RPC
2 |
3 | This package contains type definitions for general RPC systems. While
4 | [gRPC](https://github.com/grpc) is using these defintions, but they
5 | are not designed specifically to support gRPC.
6 |
--------------------------------------------------------------------------------
/ios/google/longrunning/README.md:
--------------------------------------------------------------------------------
1 | # Google Long Running Operations API
2 | This package contains the definition of an abstract interface that
3 | manages long running operations with API services. See
4 | [google.longrunning.Operations][] for details.
5 |
--------------------------------------------------------------------------------
/ios/RNGoogleSpeechApi.h:
--------------------------------------------------------------------------------
1 |
2 | #import
3 | #import
4 |
5 | @interface RNGoogleSpeechApi : RCTEventEmitter
6 |
7 | - (void)recordAudio;
8 | - (void)stopAudio;
9 |
10 | @end
11 |
12 |
--------------------------------------------------------------------------------
/ExampleApp/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ExampleApp/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
6 |
--------------------------------------------------------------------------------
/ExampleApp/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'ExampleApp'
2 | include ':react-native-google-speech-api'
3 | project(':react-native-google-speech-api').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-google-speech-api/android')
4 |
5 | include ':app'
6 |
--------------------------------------------------------------------------------
/ExampleApp/ios/ExampleApp.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ExampleApp/__tests__/index.ios.js:
--------------------------------------------------------------------------------
1 | import 'react-native';
2 | import React from 'react';
3 | import Index from '../index.ios.js';
4 |
5 | // Note: test renderer must be required after react-native.
6 | import renderer from 'react-test-renderer';
7 |
8 | it('renders correctly', () => {
9 | const tree = renderer.create(
10 |
11 | );
12 | });
13 |
--------------------------------------------------------------------------------
/ExampleApp/__tests__/index.android.js:
--------------------------------------------------------------------------------
1 | import 'react-native';
2 | import React from 'react';
3 | import Index from '../index.android.js';
4 |
5 | // Note: test renderer must be required after react-native.
6 | import renderer from 'react-test-renderer';
7 |
8 | it('renders correctly', () => {
9 | const tree = renderer.create(
10 |
11 | );
12 | });
13 |
--------------------------------------------------------------------------------
/windows/RNGoogleSpeechApi/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0"
4 | },
5 | "frameworks": {
6 | "uap10.0": {}
7 | },
8 | "runtimes": {
9 | "win10-arm": {},
10 | "win10-arm-aot": {},
11 | "win10-x86": {},
12 | "win10-x86-aot": {},
13 | "win10-x64": {},
14 | "win10-x64-aot": {}
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/ExampleApp/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment the next line to define a global platform for your project
2 | # platform :ios, '9.0'
3 |
4 | target 'ExampleApp' do
5 | # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
6 | # use_frameworks!
7 |
8 | # Pods for ExampleApp
9 | pod 'googleapis', :path => '../node_modules/react-native-google-speech-api/ios'
10 |
11 | end
12 |
--------------------------------------------------------------------------------
/ExampleApp/android/app/src/main/java/com/exampleapp/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.exampleapp;
2 |
3 | import com.facebook.react.ReactActivity;
4 |
5 | public class MainActivity extends ReactActivity {
6 |
7 | /**
8 | * Returns the name of the main component registered from JavaScript.
9 | * This is used to schedule rendering of the component.
10 | */
11 | @Override
12 | protected String getMainComponentName() {
13 | return "ExampleApp";
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/ExampleApp/ios/ExampleApp/AppDelegate.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | */
9 |
10 | #import
11 |
12 | @interface AppDelegate : UIResponder
13 |
14 | @property (nonatomic, strong) UIWindow *window;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/ExampleApp/ios/ExampleApp/main.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | */
9 |
10 | #import
11 |
12 | #import "AppDelegate.h"
13 |
14 | int main(int argc, char * argv[]) {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/ExampleApp/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ExampleApp",
3 | "version": "0.0.1",
4 | "private": true,
5 | "scripts": {
6 | "start": "node node_modules/react-native/local-cli/cli.js start",
7 | "test": "jest"
8 | },
9 | "dependencies": {
10 | "fbemitter": "^2.1.1",
11 | "react": "16.0.0-alpha.12",
12 | "react-native": "0.48.4",
13 | "react-native-google-speech-api": "./../"
14 | },
15 | "devDependencies": {
16 | "babel-jest": "21.2.0",
17 | "babel-preset-react-native": "4.0.0",
18 | "jest": "21.2.1",
19 | "react-test-renderer": "16.0.0-alpha.12"
20 | },
21 | "jest": {
22 | "preset": "react-native"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 |
2 | buildscript {
3 | repositories {
4 | jcenter()
5 | }
6 |
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.3.1'
9 | }
10 | }
11 |
12 | apply plugin: 'com.android.library'
13 |
14 | android {
15 | compileSdkVersion 23
16 | buildToolsVersion "23.0.1"
17 |
18 | defaultConfig {
19 | minSdkVersion 16
20 | targetSdkVersion 22
21 | versionCode 1
22 | versionName "1.0"
23 | }
24 | lintOptions {
25 | abortOnError false
26 | }
27 | }
28 |
29 | repositories {
30 | mavenCentral()
31 | }
32 |
33 | dependencies {
34 | compile 'com.facebook.react:react-native:+'
35 | }
36 |
--------------------------------------------------------------------------------
/android/src/main/java/com/reactlibrary/RNGoogleSpeechApiModule.java:
--------------------------------------------------------------------------------
1 |
2 | package com.reactlibrary;
3 |
4 | import com.facebook.react.bridge.ReactApplicationContext;
5 | import com.facebook.react.bridge.ReactContextBaseJavaModule;
6 | import com.facebook.react.bridge.ReactMethod;
7 | import com.facebook.react.bridge.Callback;
8 |
9 | public class RNGoogleSpeechApiModule extends ReactContextBaseJavaModule {
10 |
11 | private final ReactApplicationContext reactContext;
12 |
13 | public RNGoogleSpeechApiModule(ReactApplicationContext reactContext) {
14 | super(reactContext);
15 | this.reactContext = reactContext;
16 | }
17 |
18 | @Override
19 | public String getName() {
20 | return "RNGoogleSpeechApi";
21 | }
22 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-google-speech-api",
3 | "version": "1.0.0",
4 | "description": "## Getting started",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "repository": {
10 | "type": "git",
11 | "url": "git+https://github.com/hayanmind/react-native-google-speech-api.git"
12 | },
13 | "author": "",
14 | "license": "ISC",
15 | "bugs": {
16 | "url": "https://github.com/hayanmind/react-native-google-speech-api/issues"
17 | },
18 | "homepage": "https://github.com/hayanmind/react-native-google-speech-api#readme",
19 | "files": [
20 | "android/*",
21 | "ios/*",
22 | "index.js",
23 | "package.json",
24 | "README.md"
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/ExampleApp/android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.2.3'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | mavenLocal()
18 | jcenter()
19 | maven {
20 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
21 | url "$rootDir/../node_modules/react-native/android"
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/ExampleApp/ios/ExampleAppTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/ExampleApp/ios/ExampleApp-tvOSTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/windows/RNGoogleSpeechApi/RNGoogleSpeechApiModule.cs:
--------------------------------------------------------------------------------
1 | using ReactNative.Bridge;
2 | using System;
3 | using System.Collections.Generic;
4 | using Windows.ApplicationModel.Core;
5 | using Windows.UI.Core;
6 |
7 | namespace Com.Reactlibrary.RNGoogleSpeechApi
8 | {
9 | ///
10 | /// A module that allows JS to share data.
11 | ///
12 | class RNGoogleSpeechApiModule : NativeModuleBase
13 | {
14 | ///
15 | /// Instantiates the .
16 | ///
17 | internal RNGoogleSpeechApiModule()
18 | {
19 |
20 | }
21 |
22 | ///
23 | /// The name of the native module.
24 | ///
25 | public override string Name
26 | {
27 | get
28 | {
29 | return "RNGoogleSpeechApi";
30 | }
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/ExampleApp/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
20 | android.useDeprecatedNdk=true
21 |
--------------------------------------------------------------------------------
/ios/google/api/annotations.proto:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2015, Google Inc.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package google.api;
18 |
19 | import "google/api/http.proto";
20 | import "google/protobuf/descriptor.proto";
21 |
22 | option java_multiple_files = true;
23 | option java_outer_classname = "AnnotationsProto";
24 | option java_package = "com.google.api";
25 |
26 | extend google.protobuf.MethodOptions {
27 | // See `HttpRule`.
28 | HttpRule http = 72295728;
29 | }
30 |
--------------------------------------------------------------------------------
/android/src/main/java/com/reactlibrary/RNGoogleSpeechApiPackage.java:
--------------------------------------------------------------------------------
1 |
2 | package com.reactlibrary;
3 |
4 | import java.util.Arrays;
5 | import java.util.Collections;
6 | import java.util.List;
7 |
8 | import com.facebook.react.ReactPackage;
9 | import com.facebook.react.bridge.NativeModule;
10 | import com.facebook.react.bridge.ReactApplicationContext;
11 | import com.facebook.react.uimanager.ViewManager;
12 | import com.facebook.react.bridge.JavaScriptModule;
13 | public class RNGoogleSpeechApiPackage implements ReactPackage {
14 | @Override
15 | public List createNativeModules(ReactApplicationContext reactContext) {
16 | return Arrays.asList(new RNGoogleSpeechApiModule(reactContext));
17 | }
18 |
19 | // Deprecated in RN 0.47.0
20 | public List> createJSModules() {
21 | return Collections.emptyList();
22 | }
23 |
24 | @Override
25 | public List createViewManagers(ReactApplicationContext reactContext) {
26 | return Collections.emptyList();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/windows/.npmignore:
--------------------------------------------------------------------------------
1 | *AppPackages*
2 | *BundleArtifacts*
3 | *ReactAssets*
4 |
5 | #OS junk files
6 | [Tt]humbs.db
7 | *.DS_Store
8 |
9 | #Visual Studio files
10 | *.[Oo]bj
11 | *.user
12 | *.aps
13 | *.pch
14 | *.vspscc
15 | *.vssscc
16 | *_i.c
17 | *_p.c
18 | *.ncb
19 | *.suo
20 | *.tlb
21 | *.tlh
22 | *.bak
23 | *.[Cc]ache
24 | *.ilk
25 | *.log
26 | *.lib
27 | *.sbr
28 | *.sdf
29 | *.opensdf
30 | *.opendb
31 | *.unsuccessfulbuild
32 | ipch/
33 | [Oo]bj/
34 | [Bb]in
35 | [Dd]ebug*/
36 | [Rr]elease*/
37 | Ankh.NoLoad
38 |
39 | #MonoDevelop
40 | *.pidb
41 | *.userprefs
42 |
43 | #Tooling
44 | _ReSharper*/
45 | *.resharper
46 | [Tt]est[Rr]esult*
47 | *.sass-cache
48 |
49 | #Project files
50 | [Bb]uild/
51 |
52 | #Subversion files
53 | .svn
54 |
55 | # Office Temp Files
56 | ~$*
57 |
58 | # vim Temp Files
59 | *~
60 |
61 | #NuGet
62 | packages/
63 | *.nupkg
64 |
65 | #ncrunch
66 | *ncrunch*
67 | *crunch*.local.xml
68 |
69 | # visual studio database projects
70 | *.dbmdl
71 |
72 | #Test files
73 | *.testsettings
74 |
75 | #Other files
76 | *.DotSettings
77 | .vs/
78 | *project.lock.json
79 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # OSX
2 | #
3 | .DS_Store
4 |
5 | # Xcode
6 | #
7 | build/
8 | *.pbxuser
9 | !default.pbxuser
10 | *.mode1v3
11 | !default.mode1v3
12 | *.mode2v3
13 | !default.mode2v3
14 | *.perspectivev3
15 | !default.perspectivev3
16 | xcuserdata
17 | *.xccheckout
18 | *.moved-aside
19 | DerivedData
20 | *.hmap
21 | *.ipa
22 | *.xcuserstate
23 | project.xcworkspace
24 | ios/Pods/
25 |
26 | # Android/IntelliJ
27 | #
28 | build/
29 | .idea
30 | .gradle
31 | local.properties
32 | *.iml
33 | android/app/bin/
34 |
35 | # node.js
36 | #
37 | node_modules/
38 | npm-debug.log
39 | yarn-error.log
40 |
41 | # BUCK
42 | buck-out/
43 | \.buckd/
44 | android/app/libs
45 | *.keystore
46 |
47 | # eslint
48 | .eslintcache
49 |
50 | # fastlane
51 | #
52 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
53 | # screenshots whenever they are needed.
54 | # For more information about the recommended setup visit:
55 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
56 |
57 | fastlane/report.xml
58 | fastlane/Preview.html
59 | fastlane/screenshots
--------------------------------------------------------------------------------
/ExampleApp/.gitignore:
--------------------------------------------------------------------------------
1 | # OSX
2 | #
3 | .DS_Store
4 |
5 | # Xcode
6 | #
7 | build/
8 | *.pbxuser
9 | !default.pbxuser
10 | *.mode1v3
11 | !default.mode1v3
12 | *.mode2v3
13 | !default.mode2v3
14 | *.perspectivev3
15 | !default.perspectivev3
16 | xcuserdata
17 | *.xccheckout
18 | *.moved-aside
19 | DerivedData
20 | *.hmap
21 | *.ipa
22 | *.xcuserstate
23 | project.xcworkspace
24 | ios/Pods/
25 |
26 | # Android/IntelliJ
27 | #
28 | build/
29 | .idea
30 | .gradle
31 | local.properties
32 | *.iml
33 | android/app/bin/
34 |
35 | # node.js
36 | #
37 | node_modules/
38 | npm-debug.log
39 | yarn-error.log
40 |
41 | # BUCK
42 | buck-out/
43 | \.buckd/
44 | android/app/libs
45 | *.keystore
46 |
47 | # eslint
48 | .eslintcache
49 |
50 | # fastlane
51 | #
52 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
53 | # screenshots whenever they are needed.
54 | # For more information about the recommended setup visit:
55 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
56 |
57 | fastlane/report.xml
58 | fastlane/Preview.html
59 | fastlane/screenshots
--------------------------------------------------------------------------------
/ExampleApp/ios/ExampleApp/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "60x60",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "3x"
42 | },
43 | {
44 | "idiom" : "ios-marketing",
45 | "size" : "1024x1024",
46 | "scale" : "1x"
47 | }
48 | ],
49 | "info" : {
50 | "version" : 1,
51 | "author" : "xcode"
52 | }
53 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 HayanMind
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/ios/AudioController.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2016 Google Inc. All Rights Reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | #import
18 |
19 | @protocol AudioControllerDelegate
20 |
21 | - (void) processSampleData:(NSData *) data;
22 |
23 | @end
24 |
25 | @interface AudioController : NSObject
26 |
27 | + (instancetype) sharedInstance;
28 |
29 | @property (nonatomic, weak) id delegate;
30 |
31 | - (OSStatus) prepareWithSampleRate:(double) sampleRate;
32 | - (OSStatus) start;
33 | - (OSStatus) stop;
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/windows/RNGoogleSpeechApi/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("RNGoogleSpeechApi")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("RNGoogleSpeechApi")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Version information for an assembly consists of the following four values:
18 | //
19 | // Major Version
20 | // Minor Version
21 | // Build Number
22 | // Revision
23 | //
24 | // You can specify all the values or you can default the Build and Revision Numbers
25 | // by using the '*' as shown below:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.0.0.0")]
28 | [assembly: AssemblyFileVersion("1.0.0.0")]
29 | [assembly: ComVisible(false)]
30 |
--------------------------------------------------------------------------------
/ExampleApp/android/app/src/main/java/com/exampleapp/MainApplication.java:
--------------------------------------------------------------------------------
1 | package com.exampleapp;
2 |
3 | import android.app.Application;
4 |
5 | import com.facebook.react.ReactApplication;
6 | import com.reactlibrary.RNGoogleSpeechApiPackage;
7 | import com.facebook.react.ReactNativeHost;
8 | import com.facebook.react.ReactPackage;
9 | import com.facebook.react.shell.MainReactPackage;
10 | import com.facebook.soloader.SoLoader;
11 |
12 | import java.util.Arrays;
13 | import java.util.List;
14 |
15 | public class MainApplication extends Application implements ReactApplication {
16 |
17 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
18 | @Override
19 | public boolean getUseDeveloperSupport() {
20 | return BuildConfig.DEBUG;
21 | }
22 |
23 | @Override
24 | protected List getPackages() {
25 | return Arrays.asList(
26 | new MainReactPackage(),
27 | new RNGoogleSpeechApiPackage()
28 | );
29 | }
30 | };
31 |
32 | @Override
33 | public ReactNativeHost getReactNativeHost() {
34 | return mReactNativeHost;
35 | }
36 |
37 | @Override
38 | public void onCreate() {
39 | super.onCreate();
40 | SoLoader.init(this, /* native exopackage */ false);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/ExampleApp/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
12 |
13 |
19 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/ios/SpeechRecognitionService.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2016 Google Inc. All Rights Reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | #import
18 | #import "google/cloud/speech/v1/CloudSpeech.pbrpc.h"
19 |
20 | typedef void (^SpeechRecognitionCompletionHandler)(StreamingRecognizeResponse *object, NSError *error);
21 |
22 | @interface SpeechRecognitionService : NSObject
23 |
24 | + (instancetype) sharedInstance;
25 |
26 | - (void) streamAudioData:(NSData *) audioData
27 | withCompletion:(SpeechRecognitionCompletionHandler)completion;
28 |
29 | - (void) stopStreaming;
30 |
31 | - (BOOL) isStreaming;
32 |
33 | @property (nonatomic, assign) double sampleRate;
34 | @property (nonatomic, copy) NSString* apiKey;
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/ExampleApp/index.android.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Sample React Native App
3 | * https://github.com/facebook/react-native
4 | * @flow
5 | */
6 |
7 | import React, { Component } from 'react';
8 | import {
9 | AppRegistry,
10 | StyleSheet,
11 | Text,
12 | View
13 | } from 'react-native';
14 |
15 | export default class ExampleApp extends Component {
16 | render() {
17 | return (
18 |
19 |
20 | Welcome to React Native!
21 |
22 |
23 | To get started, edit index.android.js
24 |
25 |
26 | Double tap R on your keyboard to reload,{'\n'}
27 | Shake or press menu button for dev menu
28 |
29 |
30 | );
31 | }
32 | }
33 |
34 | const styles = StyleSheet.create({
35 | container: {
36 | flex: 1,
37 | justifyContent: 'center',
38 | alignItems: 'center',
39 | backgroundColor: '#F5FCFF',
40 | },
41 | welcome: {
42 | fontSize: 20,
43 | textAlign: 'center',
44 | margin: 10,
45 | },
46 | instructions: {
47 | textAlign: 'center',
48 | color: '#333333',
49 | marginBottom: 5,
50 | },
51 | });
52 |
53 | AppRegistry.registerComponent('ExampleApp', () => ExampleApp);
54 |
--------------------------------------------------------------------------------
/ExampleApp/index.ios.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Sample React Native App
3 | * https://github.com/facebook/react-native
4 | * @flow
5 | */
6 |
7 | import React, { Component } from 'react';
8 | import {
9 | AppRegistry,
10 | StyleSheet,
11 | Text,
12 | View,
13 | TouchableOpacity,
14 | } from 'react-native';
15 | import Speech from './Speech';
16 |
17 | Speech.setApiKey('AIzaSyBqYtZ7yL9B_mX4OfIIkus6qlLwP6st81o');
18 |
19 | export default class ExampleApp extends Component {
20 | componentDidMount() {
21 | Speech.setEventListener(Speech.Event.SPEECH_RESULT_RECEIVED, async (result) => {
22 | console.log('ASR result:', result);
23 | });
24 | Speech.setEventListener(Speech.Event.SPEECH_PARTIAL_RESULT_RECEIVED, async (result) => {
25 | console.log('ASR partial result:', result);
26 | });
27 | Speech.setEventListener(Speech.Event.ERROR_RECEIVED, async (error) => {
28 | console.log('ASR error:', error); // eslint-disable-line no-console
29 | });
30 | }
31 | render() {
32 | return (
33 |
34 | Speech.start('en')}>
35 | Start
36 |
37 | Speech.cancel()}>
38 | Stop
39 |
40 |
41 | );
42 | }
43 | }
44 |
45 | AppRegistry.registerComponent('ExampleApp', () => ExampleApp);
46 |
--------------------------------------------------------------------------------
/ios/google/api/label.proto:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2015, Google Inc.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package google.api;
18 |
19 | option java_multiple_files = true;
20 | option java_outer_classname = "LabelProto";
21 | option java_package = "com.google.api";
22 |
23 |
24 | // A description of a label.
25 | message LabelDescriptor {
26 | // Value types that can be used as label values.
27 | enum ValueType {
28 | // A variable-length string. This is the default.
29 | STRING = 0;
30 |
31 | // Boolean; true or false.
32 | BOOL = 1;
33 |
34 | // A 64-bit signed integer.
35 | INT64 = 2;
36 | }
37 |
38 | // The label key.
39 | string key = 1;
40 |
41 | // The type of data that can be assigned to the label.
42 | ValueType value_type = 2;
43 |
44 | // A human-readable description for the label.
45 | string description = 3;
46 | }
47 |
--------------------------------------------------------------------------------
/ExampleApp/ios/ExampleApp/AppDelegate.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | */
9 |
10 | #import "AppDelegate.h"
11 |
12 | #import
13 | #import
14 |
15 | @implementation AppDelegate
16 |
17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
18 | {
19 | NSURL *jsCodeLocation;
20 |
21 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
22 |
23 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
24 | moduleName:@"ExampleApp"
25 | initialProperties:nil
26 | launchOptions:launchOptions];
27 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
28 |
29 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
30 | UIViewController *rootViewController = [UIViewController new];
31 | rootViewController.view = rootView;
32 | self.window.rootViewController = rootViewController;
33 | [self.window makeKeyAndVisible];
34 | return YES;
35 | }
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/ExampleApp/.flowconfig:
--------------------------------------------------------------------------------
1 | [ignore]
2 | ; We fork some components by platform
3 | .*/*[.]android.js
4 |
5 | ; Ignore "BUCK" generated dirs
6 | /\.buckd/
7 |
8 | ; Ignore unexpected extra "@providesModule"
9 | .*/node_modules/.*/node_modules/fbjs/.*
10 |
11 | ; Ignore duplicate module providers
12 | ; For RN Apps installed via npm, "Libraries" folder is inside
13 | ; "node_modules/react-native" but in the source repo it is in the root
14 | .*/Libraries/react-native/React.js
15 | .*/Libraries/react-native/ReactNative.js
16 |
17 | [include]
18 |
19 | [libs]
20 | node_modules/react-native/Libraries/react-native/react-native-interface.js
21 | node_modules/react-native/flow
22 | flow/
23 |
24 | [options]
25 | emoji=true
26 |
27 | module.system=haste
28 |
29 | munge_underscores=true
30 |
31 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
32 |
33 | suppress_type=$FlowIssue
34 | suppress_type=$FlowFixMe
35 | suppress_type=$FixMe
36 |
37 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-9]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
38 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-9]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
39 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
40 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
41 |
42 | unsafe.enable_getters_and_setters=true
43 |
44 | [version]
45 | ^0.49.1
46 |
--------------------------------------------------------------------------------
/ios/google/api/Annotations.pbobjc.h:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: google/api/annotations.proto
3 |
4 | // This CPP symbol can be defined to use imports that match up to the framework
5 | // imports needed when using CocoaPods.
6 | #if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
7 | #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
8 | #endif
9 |
10 | #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
11 | #import
12 | #else
13 | #import "GPBProtocolBuffers.h"
14 | #endif
15 |
16 | #if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001
17 | #error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
18 | #endif
19 |
20 | // @@protoc_insertion_point(imports)
21 |
22 | #pragma clang diagnostic push
23 | #pragma clang diagnostic ignored "-Wdeprecated-declarations"
24 |
25 | CF_EXTERN_C_BEGIN
26 |
27 | NS_ASSUME_NONNULL_BEGIN
28 |
29 | #pragma mark - AnnotationsRoot
30 |
31 | /**
32 | * Exposes the extension registry for this file.
33 | *
34 | * The base class provides:
35 | * @code
36 | * + (GPBExtensionRegistry *)extensionRegistry;
37 | * @endcode
38 | * which is a @c GPBExtensionRegistry that includes all the extensions defined by
39 | * this file and all files that it depends on.
40 | **/
41 | @interface AnnotationsRoot : GPBRootObject
42 | @end
43 |
44 | @interface AnnotationsRoot (DynamicMethods)
45 | /** See `HttpRule`. */
46 | + (GPBExtensionDescriptor *)HTTP;
47 | @end
48 |
49 | NS_ASSUME_NONNULL_END
50 |
51 | CF_EXTERN_C_END
52 |
53 | #pragma clang diagnostic pop
54 |
55 | // @@protoc_insertion_point(global_scope)
56 |
--------------------------------------------------------------------------------
/windows/RNGoogleSpeechApi/Properties/RNGoogleSpeechApi.rd.xml:
--------------------------------------------------------------------------------
1 |
2 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/ExampleApp/ios/ExampleApp-tvOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UIViewControllerBasedStatusBarAppearance
38 |
39 | NSLocationWhenInUseUsageDescription
40 |
41 | NSAppTransportSecurity
42 |
43 |
44 | NSExceptionDomains
45 |
46 | localhost
47 |
48 | NSExceptionAllowsInsecureHTTPLoads
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/ExampleApp/android/app/BUCK:
--------------------------------------------------------------------------------
1 | # To learn about Buck see [Docs](https://buckbuild.com/).
2 | # To run your application with Buck:
3 | # - install Buck
4 | # - `npm start` - to start the packager
5 | # - `cd android`
6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8 | # - `buck install -r android/app` - compile, install and run application
9 | #
10 |
11 | lib_deps = []
12 |
13 | for jarfile in glob(['libs/*.jar']):
14 | name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
15 | lib_deps.append(':' + name)
16 | prebuilt_jar(
17 | name = name,
18 | binary_jar = jarfile,
19 | )
20 |
21 | for aarfile in glob(['libs/*.aar']):
22 | name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
23 | lib_deps.append(':' + name)
24 | android_prebuilt_aar(
25 | name = name,
26 | aar = aarfile,
27 | )
28 |
29 | android_library(
30 | name = "all-libs",
31 | exported_deps = lib_deps,
32 | )
33 |
34 | android_library(
35 | name = "app-code",
36 | srcs = glob([
37 | "src/main/java/**/*.java",
38 | ]),
39 | deps = [
40 | ":all-libs",
41 | ":build_config",
42 | ":res",
43 | ],
44 | )
45 |
46 | android_build_config(
47 | name = "build_config",
48 | package = "com.exampleapp",
49 | )
50 |
51 | android_resource(
52 | name = "res",
53 | package = "com.exampleapp",
54 | res = "src/main/res",
55 | )
56 |
57 | android_binary(
58 | name = "app",
59 | keystore = "//android/keystores:debug",
60 | manifest = "src/main/AndroidManifest.xml",
61 | package_type = "debug",
62 | deps = [
63 | ":app-code",
64 | ],
65 | )
66 |
--------------------------------------------------------------------------------
/ExampleApp/ios/ExampleApp/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ExampleApp
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | LSRequiresIPhoneOS
26 |
27 | NSAppTransportSecurity
28 |
29 | NSExceptionDomains
30 |
31 | localhost
32 |
33 | NSExceptionAllowsInsecureHTTPLoads
34 |
35 |
36 |
37 |
38 | NSLocationWhenInUseUsageDescription
39 |
40 | NSMicrophoneUsageDescription
41 | This sample uses the microphone to record your speech and convert it to text.
42 | UIBackgroundModes
43 |
44 | audio
45 | fetch
46 |
47 | UILaunchStoryboardName
48 | LaunchScreen
49 | UIRequiredDeviceCapabilities
50 |
51 | armv7
52 |
53 | UISupportedInterfaceOrientations
54 |
55 | UIInterfaceOrientationPortrait
56 | UIInterfaceOrientationLandscapeLeft
57 | UIInterfaceOrientationLandscapeRight
58 |
59 | UIViewControllerBasedStatusBarAppearance
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/windows/RNGoogleSpeechApi/RNGoogleSpeechApiPackage.cs:
--------------------------------------------------------------------------------
1 | using ReactNative.Bridge;
2 | using ReactNative.Modules.Core;
3 | using ReactNative.UIManager;
4 | using System;
5 | using System.Collections.Generic;
6 |
7 | namespace Com.Reactlibrary.RNGoogleSpeechApi
8 | {
9 | ///
10 | /// Package defining core framework modules (e.g., ).
11 | /// It should be used for modules that require special integration with
12 | /// other framework parts (e.g., with the list of packages to load view
13 | /// managers from).
14 | ///
15 | public class RNGoogleSpeechApiPackage : IReactPackage
16 | {
17 | ///
18 | /// Creates the list of native modules to register with the react
19 | /// instance.
20 | ///
21 | /// The react application context.
22 | /// The list of native modules.
23 | public IReadOnlyList CreateNativeModules(ReactContext reactContext)
24 | {
25 | return new List
26 | {
27 | new RNGoogleSpeechApiModule(),
28 | };
29 | }
30 |
31 | ///
32 | /// Creates the list of JavaScript modules to register with the
33 | /// react instance.
34 | ///
35 | /// The list of JavaScript modules.
36 | public IReadOnlyList CreateJavaScriptModulesConfig()
37 | {
38 | return new List(0);
39 | }
40 |
41 | ///
42 | /// Creates the list of view managers that should be registered with
43 | /// the .
44 | ///
45 | /// The react application context.
46 | /// The list of view managers.
47 | public IReadOnlyList CreateViewManagers(
48 | ReactContext reactContext)
49 | {
50 | return new List(0);
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # react-native-google-speech-api
3 |
4 | ## Getting started
5 |
6 | `$ npm install react-native-google-speech-api --save`
7 |
8 | ### Mostly automatic installation
9 |
10 | `$ react-native link react-native-google-speech-api`
11 |
12 | ### Manual installation
13 |
14 |
15 | #### iOS
16 |
17 | 1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
18 | 2. Go to `node_modules` ➜ `react-native-google-speech-api` and add `RNGoogleSpeechApi.xcodeproj`
19 | 3. In XCode, in the project navigator, select your project. Add `libRNGoogleSpeechApi.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`
20 | 4. Run your project (`Cmd+R`)<
21 |
22 | #### Android
23 |
24 | 1. Open up `android/app/src/main/java/[...]/MainActivity.java`
25 | - Add `import com.reactlibrary.RNGoogleSpeechApiPackage;` to the imports at the top of the file
26 | - Add `new RNGoogleSpeechApiPackage()` to the list returned by the `getPackages()` method
27 | 2. Append the following lines to `android/settings.gradle`:
28 | ```
29 | include ':react-native-google-speech-api'
30 | project(':react-native-google-speech-api').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-google-speech-api/android')
31 | ```
32 | 3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
33 | ```
34 | compile project(':react-native-google-speech-api')
35 | ```
36 |
37 | #### Windows
38 | [Read it! :D](https://github.com/ReactWindows/react-native)
39 |
40 | 1. In Visual Studio add the `RNGoogleSpeechApi.sln` in `node_modules/react-native-google-speech-api/windows/RNGoogleSpeechApi.sln` folder to their solution, reference from their app.
41 | 2. Open up your `MainPage.cs` app
42 | - Add `using Com.Reactlibrary.RNGoogleSpeechApi;` to the usings at the top of the file
43 | - Add `new RNGoogleSpeechApiPackage()` to the `List` returned by the `Packages` method
44 |
45 |
46 | ## Usage
47 | ```javascript
48 | import RNGoogleSpeechApi from 'react-native-google-speech-api';
49 |
50 | // TODO: What to do with the module?
51 | RNGoogleSpeechApi;
52 | ```
53 |
--------------------------------------------------------------------------------
/ExampleApp/ios/ExampleAppTests/ExampleAppTests.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | */
9 |
10 | #import
11 | #import
12 |
13 | #import
14 | #import
15 |
16 | #define TIMEOUT_SECONDS 600
17 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
18 |
19 | @interface ExampleAppTests : XCTestCase
20 |
21 | @end
22 |
23 | @implementation ExampleAppTests
24 |
25 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
26 | {
27 | if (test(view)) {
28 | return YES;
29 | }
30 | for (UIView *subview in [view subviews]) {
31 | if ([self findSubviewInView:subview matching:test]) {
32 | return YES;
33 | }
34 | }
35 | return NO;
36 | }
37 |
38 | - (void)testRendersWelcomeScreen
39 | {
40 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
41 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
42 | BOOL foundElement = NO;
43 |
44 | __block NSString *redboxError = nil;
45 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
46 | if (level >= RCTLogLevelError) {
47 | redboxError = message;
48 | }
49 | });
50 |
51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
54 |
55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
57 | return YES;
58 | }
59 | return NO;
60 | }];
61 | }
62 |
63 | RCTSetLogFunction(RCTDefaultLogFunction);
64 |
65 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
66 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
67 | }
68 |
69 |
70 | @end
71 |
--------------------------------------------------------------------------------
/ios/google/api/Annotations.pbobjc.m:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: google/api/annotations.proto
3 |
4 | // This CPP symbol can be defined to use imports that match up to the framework
5 | // imports needed when using CocoaPods.
6 | #if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
7 | #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
8 | #endif
9 |
10 | #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
11 | #import
12 | #else
13 | #import "GPBProtocolBuffers_RuntimeSupport.h"
14 | #endif
15 |
16 | #import "google/api/Annotations.pbobjc.h"
17 | #import "google/api/HTTP.pbobjc.h"
18 | #import "google/protobuf/Descriptor.pbobjc.h"
19 | // @@protoc_insertion_point(imports)
20 |
21 | #pragma clang diagnostic push
22 | #pragma clang diagnostic ignored "-Wdeprecated-declarations"
23 |
24 | #pragma mark - AnnotationsRoot
25 |
26 | @implementation AnnotationsRoot
27 |
28 | + (GPBExtensionRegistry*)extensionRegistry {
29 | // This is called by +initialize so there is no need to worry
30 | // about thread safety and initialization of registry.
31 | static GPBExtensionRegistry* registry = nil;
32 | if (!registry) {
33 | GPBDebugCheckRuntimeVersion();
34 | registry = [[GPBExtensionRegistry alloc] init];
35 | static GPBExtensionDescription descriptions[] = {
36 | {
37 | .defaultValue.valueMessage = nil,
38 | .singletonName = GPBStringifySymbol(AnnotationsRoot_HTTP),
39 | .extendedClass = GPBStringifySymbol(GPBMethodOptions),
40 | .messageOrGroupClassName = GPBStringifySymbol(HttpRule),
41 | .enumDescriptorFunc = NULL,
42 | .fieldNumber = 72295728,
43 | .dataType = GPBDataTypeMessage,
44 | .options = 0,
45 | },
46 | };
47 | for (size_t i = 0; i < sizeof(descriptions) / sizeof(descriptions[0]); ++i) {
48 | GPBExtensionDescriptor *extension =
49 | [[GPBExtensionDescriptor alloc] initWithExtensionDescription:&descriptions[i]];
50 | [registry addExtension:extension];
51 | [self globallyRegisterExtension:extension];
52 | [extension release];
53 | }
54 | [registry addExtensions:[HTTPRoot extensionRegistry]];
55 | [registry addExtensions:[GPBDescriptorRoot extensionRegistry]];
56 | }
57 | return registry;
58 | }
59 |
60 | @end
61 |
62 |
63 | #pragma clang diagnostic pop
64 |
65 | // @@protoc_insertion_point(global_scope)
66 |
--------------------------------------------------------------------------------
/ExampleApp/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - '!ProtoCompiler (3.4.0)':
3 | - Protobuf (~> 3.0)
4 | - '!ProtoCompiler-gRPCPlugin (1.6.5)':
5 | - '!ProtoCompiler (= 3.4.0)'
6 | - gRPC-ProtoRPC (= 1.6.5)
7 | - BoringSSL (9.0):
8 | - BoringSSL/Implementation (= 9.0)
9 | - BoringSSL/Interface (= 9.0)
10 | - BoringSSL/Implementation (9.0):
11 | - BoringSSL/Interface (= 9.0)
12 | - BoringSSL/Interface (9.0)
13 | - googleapis (0.0.1):
14 | - '!ProtoCompiler-gRPCPlugin (~> 1.6)'
15 | - googleapis/Messages (= 0.0.1)
16 | - googleapis/Services (= 0.0.1)
17 | - googleapis/Messages (0.0.1):
18 | - '!ProtoCompiler-gRPCPlugin (~> 1.6)'
19 | - Protobuf
20 | - googleapis/Services (0.0.1):
21 | - '!ProtoCompiler-gRPCPlugin (~> 1.6)'
22 | - googleapis/Messages
23 | - gRPC-ProtoRPC
24 | - gRPC (1.6.5):
25 | - gRPC-Core (= 1.6.5)
26 | - gRPC-RxLibrary (= 1.6.5)
27 | - gRPC-Core (1.6.5):
28 | - gRPC-Core/Implementation (= 1.6.5)
29 | - gRPC-Core/Interface (= 1.6.5)
30 | - gRPC-Core/Implementation (1.6.5):
31 | - BoringSSL (~> 9.0)
32 | - gRPC-Core/Interface (= 1.6.5)
33 | - nanopb (~> 0.3)
34 | - gRPC-Core/Interface (1.6.5)
35 | - gRPC-ProtoRPC (1.6.5):
36 | - gRPC (= 1.6.5)
37 | - gRPC-RxLibrary (= 1.6.5)
38 | - Protobuf (~> 3.0)
39 | - gRPC-RxLibrary (1.6.5)
40 | - nanopb (0.3.8):
41 | - nanopb/decode (= 0.3.8)
42 | - nanopb/encode (= 0.3.8)
43 | - nanopb/decode (0.3.8)
44 | - nanopb/encode (0.3.8)
45 | - Protobuf (3.4.0)
46 |
47 | DEPENDENCIES:
48 | - googleapis (from `../node_modules/react-native-google-speech-api/ios`)
49 |
50 | EXTERNAL SOURCES:
51 | googleapis:
52 | :path: ../node_modules/react-native-google-speech-api/ios
53 |
54 | SPEC CHECKSUMS:
55 | '!ProtoCompiler': 07d0c441bc00e7f01e84debf7c53794683fbca7c
56 | '!ProtoCompiler-gRPCPlugin': dfc8eead3e132b22750b0ec7f5fe4774ef98362a
57 | BoringSSL: 19083b821ef3ae0f758fae15482e183003b1e265
58 | googleapis: a6170b59f92b79a20bc8aff3f140900d9dc5054c
59 | gRPC: 42f915ce322b1abc5241621acc776f2fdb0a2039
60 | gRPC-Core: 54211a073d238ec8569be06e1a939a72f081a3e9
61 | gRPC-ProtoRPC: 4299db62f86df58c88844ccb50f5c48993e704f6
62 | gRPC-RxLibrary: 1b1c9c9cf666709ad7714cb0e0f3c44dc0cbfb0b
63 | nanopb: 5601e6bca2dbf1ed831b519092ec110f66982ca3
64 | Protobuf: 03eef2ee0b674770735cf79d9c4d3659cf6908e8
65 |
66 | PODFILE CHECKSUM: 92543e723efecbadde5f7ca864e81eaa6006204b
67 |
68 | COCOAPODS: 1.2.1
69 |
--------------------------------------------------------------------------------
/ios/googleapis.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = 'googleapis'
3 | s.version = '0.0.1'
4 | s.license = 'Apache 2.0'
5 | s.authors = { 'Google Inc.' => 'timburks@google.com'}
6 | s.homepage = 'http://github.com/GoogleCloudPlatform/ios-docs-samples'
7 | s.source = { :git => 'https://github.com/GoogleCloudPlatform/ios-docs-samples.git',
8 | :tag => '0.0.1' }
9 | s.summary = 'Service definitions for Google Cloud Platform APIs'
10 |
11 | s.ios.deployment_target = '7.1'
12 | s.osx.deployment_target = '10.9'
13 |
14 | # Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients.
15 | s.dependency "!ProtoCompiler-gRPCPlugin", "~> 1.6"
16 |
17 | # Pods directory corresponding to this app's Podfile, relative to the location of this podspec.
18 | pods_root = './../../../ios/Pods'
19 |
20 | # Path where Cocoapods downloads protoc and the gRPC plugin.
21 | protoc_dir = "#{pods_root}/!ProtoCompiler"
22 | protoc = "#{protoc_dir}/protoc"
23 | plugin = "#{pods_root}/!ProtoCompiler-gRPCPlugin/grpc_objective_c_plugin"
24 |
25 | # Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients.
26 | # You can run this command manually if you later change your protos and need to regenerate.
27 | s.prepare_command = <<-CMD
28 | #{protoc} \
29 | --plugin=protoc-gen-grpc=#{plugin} \
30 | --objc_out=. \
31 | --grpc_out=. \
32 | -I . \
33 | -I #{protoc_dir} \
34 | google/*/*.proto google/*/*/*/*.proto
35 | CMD
36 |
37 | # The --objc_out plugin generates a pair of .pbobjc.h/.pbobjc.m files for each .proto file.
38 | s.subspec "Messages" do |ms|
39 | ms.source_files = "google/**/*.pbobjc.{h,m}"
40 | ms.header_mappings_dir = "."
41 | ms.requires_arc = false
42 | ms.dependency "Protobuf"
43 | end
44 |
45 | # The --objcgrpc_out plugin generates a pair of .pbrpc.h/.pbrpc.m files for each .proto file with
46 | # a service defined.
47 | s.subspec "Services" do |ss|
48 | ss.source_files = "google/**/*.pbrpc.{h,m}"
49 | ss.header_mappings_dir = "."
50 | ss.requires_arc = true
51 | ss.dependency "gRPC-ProtoRPC"
52 | ss.dependency "#{s.name}/Messages"
53 | end
54 |
55 | s.pod_target_xcconfig = {
56 | 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1',
57 | 'USER_HEADER_SEARCH_PATHS' => '$SRCROOT/..'
58 | }
59 |
60 | end
61 |
62 |
--------------------------------------------------------------------------------
/ExampleApp/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/ExampleApp/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Disabling obfuscation is useful if you collect stack traces from production crashes
20 | # (unless you are using a system that supports de-obfuscate the stack traces).
21 | -dontobfuscate
22 |
23 | # React Native
24 |
25 | # Keep our interfaces so they can be used by other ProGuard rules.
26 | # See http://sourceforge.net/p/proguard/bugs/466/
27 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
28 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
29 | -keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip
30 |
31 | # Do not strip any method/class that is annotated with @DoNotStrip
32 | -keep @com.facebook.proguard.annotations.DoNotStrip class *
33 | -keep @com.facebook.common.internal.DoNotStrip class *
34 | -keepclassmembers class * {
35 | @com.facebook.proguard.annotations.DoNotStrip *;
36 | @com.facebook.common.internal.DoNotStrip *;
37 | }
38 |
39 | -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
40 | void set*(***);
41 | *** get*();
42 | }
43 |
44 | -keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
45 | -keep class * extends com.facebook.react.bridge.NativeModule { *; }
46 | -keepclassmembers,includedescriptorclasses class * { native ; }
47 | -keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; }
48 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; }
49 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; }
50 |
51 | -dontwarn com.facebook.react.**
52 |
53 | # TextLayoutBuilder uses a non-public Android constructor within StaticLayout.
54 | # See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details.
55 | -dontwarn android.text.StaticLayout
56 |
57 | # okhttp
58 |
59 | -keepattributes Signature
60 | -keepattributes *Annotation*
61 | -keep class okhttp3.** { *; }
62 | -keep interface okhttp3.** { *; }
63 | -dontwarn okhttp3.**
64 |
65 | # okio
66 |
67 | -keep class sun.misc.Unsafe { *; }
68 | -dontwarn java.nio.file.*
69 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
70 | -dontwarn okio.**
71 |
--------------------------------------------------------------------------------
/ios/google/api/monitored_resource.proto:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2015, Google Inc.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package google.api;
18 |
19 | import "google/api/label.proto";
20 |
21 | option java_multiple_files = true;
22 | option java_outer_classname = "MonitoredResourceProto";
23 | option java_package = "com.google.api";
24 |
25 |
26 | // A descriptor that describes the schema of [MonitoredResource][google.api.MonitoredResource].
27 | message MonitoredResourceDescriptor {
28 | // The monitored resource type. For example, the type `"cloudsql_database"`
29 | // represents databases in Google Cloud SQL.
30 | string type = 1;
31 |
32 | // A concise name for the monitored resource type that can be displayed in
33 | // user interfaces. For example, `"Google Cloud SQL Database"`.
34 | string display_name = 2;
35 |
36 | // A detailed description of the monitored resource type that can be used in
37 | // documentation.
38 | string description = 3;
39 |
40 | // A set of labels that can be used to describe instances of this monitored
41 | // resource type. For example, Google Cloud SQL databases can be labeled with
42 | // their `"database_id"` and their `"zone"`.
43 | repeated LabelDescriptor labels = 4;
44 | }
45 |
46 | // A monitored resource describes a resource that can be used for monitoring
47 | // purpose. It can also be used for logging, billing, and other purposes. Each
48 | // resource has a `type` and a set of `labels`. The labels contain information
49 | // that identifies the resource and describes attributes of it. For example,
50 | // you can use monitored resource to describe a normal file, where the resource
51 | // has `type` as `"file"`, the label `path` identifies the file, and the label
52 | // `size` describes the file size. The monitoring system can use a set of
53 | // monitored resources of files to generate file size distribution.
54 | message MonitoredResource {
55 | // The monitored resource type. This field must match the corresponding
56 | // [MonitoredResourceDescriptor.type][google.api.MonitoredResourceDescriptor.type] to this resource.. For example,
57 | // `"cloudsql_database"` represents Cloud SQL databases.
58 | string type = 1;
59 |
60 | // Values for some or all of the labels listed in the associated monitored
61 | // resource descriptor. For example, you specify a specific Cloud SQL database
62 | // by supplying values for both the `"database_id"` and `"zone"` labels.
63 | map labels = 2;
64 | }
65 |
--------------------------------------------------------------------------------
/ios/google/rpc/Code.pbobjc.m:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: google/rpc/code.proto
3 |
4 | // This CPP symbol can be defined to use imports that match up to the framework
5 | // imports needed when using CocoaPods.
6 | #if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
7 | #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
8 | #endif
9 |
10 | #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
11 | #import
12 | #else
13 | #import "GPBProtocolBuffers_RuntimeSupport.h"
14 | #endif
15 |
16 | #import "google/rpc/Code.pbobjc.h"
17 | // @@protoc_insertion_point(imports)
18 |
19 | #pragma clang diagnostic push
20 | #pragma clang diagnostic ignored "-Wdeprecated-declarations"
21 |
22 | #pragma mark - CodeRoot
23 |
24 | @implementation CodeRoot
25 |
26 | @end
27 |
28 | #pragma mark - Enum Code
29 |
30 | GPBEnumDescriptor *Code_EnumDescriptor(void) {
31 | static GPBEnumDescriptor *descriptor = NULL;
32 | if (!descriptor) {
33 | static const char *valueNames =
34 | "Ok\000Cancelled\000Unknown\000InvalidArgument\000Dea"
35 | "dlineExceeded\000NotFound\000AlreadyExists\000Per"
36 | "missionDenied\000Unauthenticated\000ResourceEx"
37 | "hausted\000FailedPrecondition\000Aborted\000OutOf"
38 | "Range\000Unimplemented\000Internal\000Unavailable"
39 | "\000DataLoss\000";
40 | static const int32_t values[] = {
41 | Code_Ok,
42 | Code_Cancelled,
43 | Code_Unknown,
44 | Code_InvalidArgument,
45 | Code_DeadlineExceeded,
46 | Code_NotFound,
47 | Code_AlreadyExists,
48 | Code_PermissionDenied,
49 | Code_Unauthenticated,
50 | Code_ResourceExhausted,
51 | Code_FailedPrecondition,
52 | Code_Aborted,
53 | Code_OutOfRange,
54 | Code_Unimplemented,
55 | Code_Internal,
56 | Code_Unavailable,
57 | Code_DataLoss,
58 | };
59 | GPBEnumDescriptor *worker =
60 | [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(Code)
61 | valueNames:valueNames
62 | values:values
63 | count:(uint32_t)(sizeof(values) / sizeof(int32_t))
64 | enumVerifier:Code_IsValidValue];
65 | if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) {
66 | [worker release];
67 | }
68 | }
69 | return descriptor;
70 | }
71 |
72 | BOOL Code_IsValidValue(int32_t value__) {
73 | switch (value__) {
74 | case Code_Ok:
75 | case Code_Cancelled:
76 | case Code_Unknown:
77 | case Code_InvalidArgument:
78 | case Code_DeadlineExceeded:
79 | case Code_NotFound:
80 | case Code_AlreadyExists:
81 | case Code_PermissionDenied:
82 | case Code_Unauthenticated:
83 | case Code_ResourceExhausted:
84 | case Code_FailedPrecondition:
85 | case Code_Aborted:
86 | case Code_OutOfRange:
87 | case Code_Unimplemented:
88 | case Code_Internal:
89 | case Code_Unavailable:
90 | case Code_DataLoss:
91 | return YES;
92 | default:
93 | return NO;
94 | }
95 | }
96 |
97 |
98 | #pragma clang diagnostic pop
99 |
100 | // @@protoc_insertion_point(global_scope)
101 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | import React, {
3 | NativeModules,
4 | NativeEventEmitter
5 | } from 'react-native';
6 |
7 | const { RNGoogleSpeechApi } = NativeModules;
8 | const googleSpeechApiEmitter = new NativeEventEmitter(RNGoogleSpeechApi);
9 |
10 | class RCTGoogleSpeechApi {
11 | constructor() {
12 | this._loaded = false;
13 | this._listeners = null;
14 | this._events = {
15 | // 'onSpeechStart': this._onSpeechStart.bind(this),
16 | // 'onSpeechRecognized': this._onSpeechRecognized.bind(this),
17 | // 'onSpeechEnd': this._onSpeechEnd.bind(this),
18 | 'onSpeechError': this._onSpeechError.bind(this),
19 | 'onSpeechResults': this._onSpeechResults.bind(this),
20 | 'onSpeechPartialResults': this._onSpeechPartialResults.bind(this),
21 | // 'onSpeechVolumeChanged': this._onSpeechVolumeChanged.bind(this)
22 | };
23 | }
24 | setApiKey(apiKey) {
25 | RNGoogleSpeechApi.setApiKey(apiKey);
26 | }
27 | destroy() {
28 | return RNGoogleSpeechApi.destroySpeech((error) => {
29 | if (error) {
30 | return error;
31 | }
32 | if (this._listeners) {
33 | this._listeners.map((listener, index) => listener.remove());
34 | this._listeners = null;
35 | }
36 | return null;
37 | });
38 | }
39 | start(locale) {
40 | if (!this._loaded && !this._listeners) {
41 | this._listeners = Object.keys(this._events)
42 | .map((key, index) => googleSpeechApiEmitter.addListener(key, this._events[key]));
43 | }
44 | return new Promise((resolve, reject) => {
45 | RNGoogleSpeechApi.startSpeech(locale);
46 | resolve();
47 | });
48 | }
49 | stop() {
50 | return new Promise((resolve, reject) => {
51 | RNGoogleSpeechApi.stopSpeech((error) => {
52 | if (error) {
53 | reject(new Error(error));
54 | } else {
55 | resolve();
56 | }
57 | });
58 | });
59 | }
60 | cancel() {
61 | return new Promise((resolve, reject) => {
62 | RNGoogleSpeechApi.cancelSpeech();
63 | resolve();
64 | });
65 | }
66 | isAvailable() {
67 | return new Promise((resolve, reject) => {
68 | RNGoogleSpeechApi.isSpeechAvailable((isAvailable, error) => {
69 | if (error) {
70 | reject(new Error(error));
71 | } else {
72 | resolve(isAvailable);
73 | }
74 | });
75 | });
76 | }
77 | isRecognizing() {
78 | return new Promise((resolve, reject) => {
79 | RNGoogleSpeechApi.isRecognizing(isRecognizing => resolve(isRecognizing));
80 | });
81 | }
82 | _onSpeechStart(e) {
83 | if (this.onSpeechStart) {
84 | this.onSpeechStart(e);
85 | }
86 | }
87 | _onSpeechRecognized(e) {
88 | if (this.onSpeechRecognized) {
89 | this.onSpeechRecognized(e);
90 | }
91 | }
92 | _onSpeechEnd(e) {
93 | if (this.onSpeechEnd) {
94 | this.onSpeechEnd(e);
95 | }
96 | }
97 | _onSpeechError(e) {
98 | if (this.onSpeechError) {
99 | this.onSpeechError(e);
100 | }
101 | }
102 | _onSpeechResults(e) {
103 | if (this.onSpeechResults) {
104 | this.onSpeechResults(e);
105 | }
106 | }
107 | _onSpeechPartialResults(e) {
108 | if (this.onSpeechPartialResults) {
109 | this.onSpeechPartialResults(e);
110 | }
111 | }
112 | _onSpeechVolumeChanged(e) {
113 | if (this.onSpeechVolumeChanged) {
114 | this.onSpeechVolumeChanged(e);
115 | }
116 | }
117 | }
118 |
119 | module.exports = new RCTGoogleSpeechApi();
120 |
--------------------------------------------------------------------------------
/ios/google/cloud/speech/v1/CloudSpeech.pbrpc.h:
--------------------------------------------------------------------------------
1 | #import "google/cloud/speech/v1/CloudSpeech.pbobjc.h"
2 |
3 | #import
4 | #import
5 | #import
6 |
7 | #import "google/api/Annotations.pbobjc.h"
8 | #import "google/longrunning/Operations.pbobjc.h"
9 | #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
10 | #import
11 | #else
12 | #import "google/protobuf/Any.pbobjc.h"
13 | #endif
14 | #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
15 | #import
16 | #else
17 | #import "google/protobuf/Duration.pbobjc.h"
18 | #endif
19 | #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
20 | #import
21 | #else
22 | #import "google/protobuf/Timestamp.pbobjc.h"
23 | #endif
24 | #import "google/rpc/Status.pbobjc.h"
25 |
26 |
27 | NS_ASSUME_NONNULL_BEGIN
28 |
29 | @protocol Speech
30 |
31 | #pragma mark Recognize(RecognizeRequest) returns (RecognizeResponse)
32 |
33 | /**
34 | * Performs synchronous speech recognition: receive results after all audio
35 | * has been sent and processed.
36 | */
37 | - (void)recognizeWithRequest:(RecognizeRequest *)request handler:(void(^)(RecognizeResponse *_Nullable response, NSError *_Nullable error))handler;
38 |
39 | /**
40 | * Performs synchronous speech recognition: receive results after all audio
41 | * has been sent and processed.
42 | */
43 | - (GRPCProtoCall *)RPCToRecognizeWithRequest:(RecognizeRequest *)request handler:(void(^)(RecognizeResponse *_Nullable response, NSError *_Nullable error))handler;
44 |
45 |
46 | #pragma mark LongRunningRecognize(LongRunningRecognizeRequest) returns (Operation)
47 |
48 | /**
49 | * Performs asynchronous speech recognition: receive results via the
50 | * google.longrunning.Operations interface. Returns either an
51 | * `Operation.error` or an `Operation.response` which contains
52 | * a `LongRunningRecognizeResponse` message.
53 | */
54 | - (void)longRunningRecognizeWithRequest:(LongRunningRecognizeRequest *)request handler:(void(^)(Operation *_Nullable response, NSError *_Nullable error))handler;
55 |
56 | /**
57 | * Performs asynchronous speech recognition: receive results via the
58 | * google.longrunning.Operations interface. Returns either an
59 | * `Operation.error` or an `Operation.response` which contains
60 | * a `LongRunningRecognizeResponse` message.
61 | */
62 | - (GRPCProtoCall *)RPCToLongRunningRecognizeWithRequest:(LongRunningRecognizeRequest *)request handler:(void(^)(Operation *_Nullable response, NSError *_Nullable error))handler;
63 |
64 |
65 | #pragma mark StreamingRecognize(stream StreamingRecognizeRequest) returns (stream StreamingRecognizeResponse)
66 |
67 | /**
68 | * Performs bidirectional streaming speech recognition: receive results while
69 | * sending audio. This method is only available via the gRPC API (not REST).
70 | */
71 | - (void)streamingRecognizeWithRequestsWriter:(GRXWriter *)requestWriter eventHandler:(void(^)(BOOL done, StreamingRecognizeResponse *_Nullable response, NSError *_Nullable error))eventHandler;
72 |
73 | /**
74 | * Performs bidirectional streaming speech recognition: receive results while
75 | * sending audio. This method is only available via the gRPC API (not REST).
76 | */
77 | - (GRPCProtoCall *)RPCToStreamingRecognizeWithRequestsWriter:(GRXWriter *)requestWriter eventHandler:(void(^)(BOOL done, StreamingRecognizeResponse *_Nullable response, NSError *_Nullable error))eventHandler;
78 |
79 |
80 | @end
81 |
82 | /**
83 | * Basic service implementation, over gRPC, that only does
84 | * marshalling and parsing.
85 | */
86 | @interface Speech : GRPCProtoService
87 | - (instancetype)initWithHost:(NSString *)host NS_DESIGNATED_INITIALIZER;
88 | + (instancetype)serviceWithHost:(NSString *)host;
89 | @end
90 |
91 | NS_ASSUME_NONNULL_END
92 |
--------------------------------------------------------------------------------
/ExampleApp/ios/ExampleApp/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
21 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/ios/google/api/Label.pbobjc.h:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: google/api/label.proto
3 |
4 | // This CPP symbol can be defined to use imports that match up to the framework
5 | // imports needed when using CocoaPods.
6 | #if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
7 | #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
8 | #endif
9 |
10 | #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
11 | #import
12 | #else
13 | #import "GPBProtocolBuffers.h"
14 | #endif
15 |
16 | #if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001
17 | #error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
18 | #endif
19 |
20 | // @@protoc_insertion_point(imports)
21 |
22 | #pragma clang diagnostic push
23 | #pragma clang diagnostic ignored "-Wdeprecated-declarations"
24 |
25 | CF_EXTERN_C_BEGIN
26 |
27 | NS_ASSUME_NONNULL_BEGIN
28 |
29 | #pragma mark - Enum LabelDescriptor_ValueType
30 |
31 | /** Value types that can be used as label values. */
32 | typedef GPB_ENUM(LabelDescriptor_ValueType) {
33 | /**
34 | * Value used if any message's field encounters a value that is not defined
35 | * by this enum. The message will also have C functions to get/set the rawValue
36 | * of the field.
37 | **/
38 | LabelDescriptor_ValueType_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue,
39 | /** A variable-length string. This is the default. */
40 | LabelDescriptor_ValueType_String = 0,
41 |
42 | /** Boolean; true or false. */
43 | LabelDescriptor_ValueType_Bool = 1,
44 |
45 | /** A 64-bit signed integer. */
46 | LabelDescriptor_ValueType_Int64 = 2,
47 | };
48 |
49 | GPBEnumDescriptor *LabelDescriptor_ValueType_EnumDescriptor(void);
50 |
51 | /**
52 | * Checks to see if the given value is defined by the enum or was not known at
53 | * the time this source was generated.
54 | **/
55 | BOOL LabelDescriptor_ValueType_IsValidValue(int32_t value);
56 |
57 | #pragma mark - LabelRoot
58 |
59 | /**
60 | * Exposes the extension registry for this file.
61 | *
62 | * The base class provides:
63 | * @code
64 | * + (GPBExtensionRegistry *)extensionRegistry;
65 | * @endcode
66 | * which is a @c GPBExtensionRegistry that includes all the extensions defined by
67 | * this file and all files that it depends on.
68 | **/
69 | @interface LabelRoot : GPBRootObject
70 | @end
71 |
72 | #pragma mark - LabelDescriptor
73 |
74 | typedef GPB_ENUM(LabelDescriptor_FieldNumber) {
75 | LabelDescriptor_FieldNumber_Key = 1,
76 | LabelDescriptor_FieldNumber_ValueType = 2,
77 | LabelDescriptor_FieldNumber_Description_p = 3,
78 | };
79 |
80 | /**
81 | * A description of a label.
82 | **/
83 | @interface LabelDescriptor : GPBMessage
84 |
85 | /** The label key. */
86 | @property(nonatomic, readwrite, copy, null_resettable) NSString *key;
87 |
88 | /** The type of data that can be assigned to the label. */
89 | @property(nonatomic, readwrite) LabelDescriptor_ValueType valueType;
90 |
91 | /** A human-readable description for the label. */
92 | @property(nonatomic, readwrite, copy, null_resettable) NSString *description_p;
93 |
94 | @end
95 |
96 | /**
97 | * Fetches the raw value of a @c LabelDescriptor's @c valueType property, even
98 | * if the value was not defined by the enum at the time the code was generated.
99 | **/
100 | int32_t LabelDescriptor_ValueType_RawValue(LabelDescriptor *message);
101 | /**
102 | * Sets the raw value of an @c LabelDescriptor's @c valueType property, allowing
103 | * it to be set to a value that was not defined by the enum at the time the code
104 | * was generated.
105 | **/
106 | void SetLabelDescriptor_ValueType_RawValue(LabelDescriptor *message, int32_t value);
107 |
108 | NS_ASSUME_NONNULL_END
109 |
110 | CF_EXTERN_C_END
111 |
112 | #pragma clang diagnostic pop
113 |
114 | // @@protoc_insertion_point(global_scope)
115 |
--------------------------------------------------------------------------------
/ios/SpeechRecognitionService.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2016 Google Inc. All Rights Reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | #import "SpeechRecognitionService.h"
18 |
19 | #import
20 | #import
21 | #import
22 |
23 | // #define API_KEY @"AIzaSyBqYtZ7yL9B_mX4OfIIkus6qlLwP6st81o"
24 | #define HOST @"speech.googleapis.com"
25 |
26 | @interface SpeechRecognitionService ()
27 |
28 | @property (nonatomic, assign) BOOL streaming;
29 | @property (nonatomic, strong) Speech *client;
30 | @property (nonatomic, strong) GRXBufferedPipe *writer;
31 | @property (nonatomic, strong) GRPCProtoCall *call;
32 |
33 | @end
34 |
35 | @implementation SpeechRecognitionService
36 |
37 | + (instancetype) sharedInstance {
38 | static SpeechRecognitionService *instance = nil;
39 | if (!instance) {
40 | instance = [[self alloc] init];
41 | instance.sampleRate = 16000.0; // default value
42 | }
43 | return instance;
44 | }
45 |
46 | - (void) streamAudioData:(NSData *) audioData
47 | withCompletion:(SpeechRecognitionCompletionHandler)completion {
48 |
49 | if (!_streaming) {
50 | // if we aren't already streaming, set up a gRPC connection
51 | _client = [[Speech alloc] initWithHost:HOST];
52 | _writer = [[GRXBufferedPipe alloc] init];
53 | _call = [_client RPCToStreamingRecognizeWithRequestsWriter:_writer
54 | eventHandler:^(BOOL done, StreamingRecognizeResponse *response, NSError *error) {
55 | completion(response, error);
56 | }];
57 |
58 | // authenticate using an API key obtained from the Google Cloud Console
59 | _call.requestHeaders[@"X-Goog-Api-Key"] = self.apiKey;
60 | // if the API key has a bundle ID restriction, specify the bundle ID like this
61 | _call.requestHeaders[@"X-Ios-Bundle-Identifier"] = [[NSBundle mainBundle] bundleIdentifier];
62 |
63 | NSLog(@"HEADERS: %@", _call.requestHeaders);
64 |
65 | [_call start];
66 | _streaming = YES;
67 |
68 | // send an initial request message to configure the service
69 | RecognitionConfig *recognitionConfig = [RecognitionConfig message];
70 | recognitionConfig.encoding = RecognitionConfig_AudioEncoding_Linear16;
71 | recognitionConfig.sampleRateHertz = self.sampleRate;
72 | recognitionConfig.languageCode = @"en-US";
73 | recognitionConfig.maxAlternatives = 30;
74 |
75 | StreamingRecognitionConfig *streamingRecognitionConfig = [StreamingRecognitionConfig message];
76 | streamingRecognitionConfig.config = recognitionConfig;
77 | streamingRecognitionConfig.singleUtterance = NO;
78 | streamingRecognitionConfig.interimResults = YES;
79 |
80 | StreamingRecognizeRequest *streamingRecognizeRequest = [StreamingRecognizeRequest message];
81 | streamingRecognizeRequest.streamingConfig = streamingRecognitionConfig;
82 |
83 | [_writer writeValue:streamingRecognizeRequest];
84 | }
85 |
86 | // send a request message containing the audio data
87 | StreamingRecognizeRequest *streamingRecognizeRequest = [StreamingRecognizeRequest message];
88 | streamingRecognizeRequest.audioContent = audioData;
89 | [_writer writeValue:streamingRecognizeRequest];
90 | }
91 |
92 | - (void) stopStreaming {
93 | if (!_streaming) {
94 | return;
95 | }
96 | [_writer finishWithError:nil];
97 | _streaming = NO;
98 | }
99 |
100 | - (BOOL) isStreaming {
101 | return _streaming;
102 | }
103 |
104 | @end
105 |
--------------------------------------------------------------------------------
/ios/google/rpc/status.proto:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2015, Google Inc.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package google.rpc;
18 |
19 | import "google/protobuf/any.proto";
20 |
21 | option java_multiple_files = true;
22 | option java_outer_classname = "StatusProto";
23 | option java_package = "com.google.rpc";
24 |
25 |
26 | // The `Status` type defines a logical error model that is suitable for different
27 | // programming environments, including REST APIs and RPC APIs. It is used by
28 | // [gRPC](https://github.com/grpc). The error model is designed to be:
29 | //
30 | // - Simple to use and understand for most users
31 | // - Flexible enough to meet unexpected needs
32 | //
33 | // # Overview
34 | //
35 | // The `Status` message contains three pieces of data: error code, error message,
36 | // and error details. The error code should be an enum value of
37 | // [google.rpc.Code][google.rpc.Code], but it may accept additional error codes if needed. The
38 | // error message should be a developer-facing English message that helps
39 | // developers *understand* and *resolve* the error. If a localized user-facing
40 | // error message is needed, put the localized message in the error details or
41 | // localize it in the client. The optional error details may contain arbitrary
42 | // information about the error. There is a predefined set of error detail types
43 | // in the package `google.rpc` which can be used for common error conditions.
44 | //
45 | // # Language mapping
46 | //
47 | // The `Status` message is the logical representation of the error model, but it
48 | // is not necessarily the actual wire format. When the `Status` message is
49 | // exposed in different client libraries and different wire protocols, it can be
50 | // mapped differently. For example, it will likely be mapped to some exceptions
51 | // in Java, but more likely mapped to some error codes in C.
52 | //
53 | // # Other uses
54 | //
55 | // The error model and the `Status` message can be used in a variety of
56 | // environments, either with or without APIs, to provide a
57 | // consistent developer experience across different environments.
58 | //
59 | // Example uses of this error model include:
60 | //
61 | // - Partial errors. If a service needs to return partial errors to the client,
62 | // it may embed the `Status` in the normal response to indicate the partial
63 | // errors.
64 | //
65 | // - Workflow errors. A typical workflow has multiple steps. Each step may
66 | // have a `Status` message for error reporting purpose.
67 | //
68 | // - Batch operations. If a client uses batch request and batch response, the
69 | // `Status` message should be used directly inside batch response, one for
70 | // each error sub-response.
71 | //
72 | // - Asynchronous operations. If an API call embeds asynchronous operation
73 | // results in its response, the status of those operations should be
74 | // represented directly using the `Status` message.
75 | //
76 | // - Logging. If some API errors are stored in logs, the message `Status` could
77 | // be used directly after any stripping needed for security/privacy reasons.
78 | message Status {
79 | // The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
80 | int32 code = 1;
81 |
82 | // A developer-facing error message, which should be in English. Any
83 | // user-facing error message should be localized and sent in the
84 | // [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
85 | string message = 2;
86 |
87 | // A list of messages that carry the error details. There will be a
88 | // common set of message types for APIs to use.
89 | repeated google.protobuf.Any details = 3;
90 | }
91 |
--------------------------------------------------------------------------------
/ExampleApp/Speech.js:
--------------------------------------------------------------------------------
1 | import Voice from 'react-native-google-speech-api';
2 | import { EventEmitter } from 'fbemitter';
3 |
4 | class Speech {
5 | constructor() {
6 | this.Event = {
7 | RECOGNITION_STARTED: 'event/recognitionStarted',
8 | RECOGNITION_ENDED: 'event/recognitinoEnded',
9 | SPEECH_RESULT_RECEIVED: 'event/speechResultReceived',
10 | SPEECH_PARTIAL_RESULT_RECEIVED: 'event/speechPartialResultReceived',
11 | ERROR_RECEIVED: 'event/errorReceived',
12 | };
13 |
14 | this.recognizing = false;
15 | this.emitter = new EventEmitter();
16 | this.prevPartialResult = '';
17 | this.lastPartialResultAtPrevNumberOfBreakingSetence = '';
18 | /*
19 | 'numberOfBreakingSentenece'
20 | How many user stop speaking between Voice.start() and Voice.stop() in Android
21 | */
22 | this.prevNumberOfBreakingSentence = -1;
23 |
24 | Voice.onSpeechStart = (event) => {
25 | console.log(event);
26 | this.emitter.emit(this.Event.RECOGNITION_STARTED);
27 | };
28 | Voice.onSpeechEnd = (event) => {
29 | console.log(event);
30 | this.emitter.emit(this.Event.RECOGNITION_ENDED);
31 | };
32 | Voice.onSpeechResults = (event) => {
33 | console.log(event);
34 | this.emitter.emit(this.Event.SPEECH_RESULT_RECEIVED, { text: event.value[0] });
35 | };
36 | Voice.onSpeechPartialResults = (event) => {
37 | console.log(event);
38 | const { value, numberOfBreakingSentence } = event;
39 | // When user stop speaking, speech result(event.value) is initialized
40 | if (this.prevNumberOfBreakingSentence !== numberOfBreakingSentence) {
41 | this.lastPartialResultAtPrevNumberOfBreakingSetence =
42 | `${this.lastPartialResultAtPrevNumberOfBreakingSetence} ${this.prevPartialResult}`;
43 | }
44 | const text = this.lastPartialResultAtPrevNumberOfBreakingSetence + value[0];
45 | this.emitter.emit(this.Event.SPEECH_PARTIAL_RESULT_RECEIVED, { text });
46 |
47 | this.prevPartialResult = value[0];
48 | this.prevNumberOfBreakingSentence = numberOfBreakingSentence;
49 | };
50 | Voice.onSpeechError = (event) => {
51 | console.log(event);
52 | this.emitter.emit(this.Event.ERROR_RECEIVED, new Error(event.error.message));
53 | };
54 | }
55 |
56 | setApiKey(apiKey) {
57 | Voice.setApiKey(apiKey);
58 | }
59 |
60 | // eslint-disable-next-line class-methods-use-this
61 | start(language) {
62 | console.log('Voice.start()'); // eslint-disable-line no-console
63 |
64 | if (this.recognizing) {
65 | return Promise.reject(new Error('Already recognizing'));
66 | }
67 |
68 | this.prevPartialResult = '';
69 | this.lastPartialResultAtPrevNumberOfBreakingSetence = '';
70 | this.prevNumberOfBreakingSentence = -1;
71 |
72 | this.recognizing = true;
73 | return Voice.start(language);
74 | }
75 |
76 | // eslint-disable-next-line class-methods-use-this
77 | stop() {
78 | console.log('Voice.stop()'); // eslint-disable-line no-console
79 |
80 | if (!this.recognizing) {
81 | return Promise.reject(new Error('Recognizer does not start'));
82 | }
83 |
84 | this.recognizing = false;
85 | return Voice.stop();
86 | }
87 |
88 | // eslint-disable-next-line class-methods-use-this
89 | cancel() {
90 | console.log('Voice.cancel()'); // eslint-disable-line no-console
91 |
92 | if (!this.recognizing) {
93 | return Promise.reject(new Error('Recognizer does not start'));
94 | }
95 |
96 | this.recognizing = false;
97 | return Voice.cancel();
98 | }
99 |
100 | // eslint-disable-next-line class-methods-use-this
101 | release() {
102 | console.log('Voice.release()'); // eslint-disable-line no-console
103 |
104 | this.emitter.removeAllListeners();
105 |
106 | if (this.recognizing) {
107 | this.recognizing = false;
108 | Voice.destroy();
109 | }
110 | }
111 |
112 | setEventListener(eventName, listener) {
113 | if (Object.values(this.Event).indexOf(eventName) === -1) {
114 | // eslint-disable-next-line no-console
115 | console.warn('Event name is invalid: ', eventName);
116 | } else {
117 | this.emitter.addListener(eventName, listener);
118 | console.log(`Voice is now listening to : ${eventName}`);
119 | }
120 | }
121 | }
122 |
123 | export default new Speech(); // Singleton module
124 |
--------------------------------------------------------------------------------
/ios/google/cloud/speech/v1/CloudSpeech.pbrpc.m:
--------------------------------------------------------------------------------
1 | #import "google/cloud/speech/v1/CloudSpeech.pbrpc.h"
2 |
3 | #import
4 | #import
5 |
6 | @implementation Speech
7 |
8 | // Designated initializer
9 | - (instancetype)initWithHost:(NSString *)host {
10 | return (self = [super initWithHost:host packageName:@"google.cloud.speech.v1" serviceName:@"Speech"]);
11 | }
12 |
13 | // Override superclass initializer to disallow different package and service names.
14 | - (instancetype)initWithHost:(NSString *)host
15 | packageName:(NSString *)packageName
16 | serviceName:(NSString *)serviceName {
17 | return [self initWithHost:host];
18 | }
19 |
20 | + (instancetype)serviceWithHost:(NSString *)host {
21 | return [[self alloc] initWithHost:host];
22 | }
23 |
24 |
25 | #pragma mark Recognize(RecognizeRequest) returns (RecognizeResponse)
26 |
27 | /**
28 | * Performs synchronous speech recognition: receive results after all audio
29 | * has been sent and processed.
30 | */
31 | - (void)recognizeWithRequest:(RecognizeRequest *)request handler:(void(^)(RecognizeResponse *_Nullable response, NSError *_Nullable error))handler{
32 | [[self RPCToRecognizeWithRequest:request handler:handler] start];
33 | }
34 | // Returns a not-yet-started RPC object.
35 | /**
36 | * Performs synchronous speech recognition: receive results after all audio
37 | * has been sent and processed.
38 | */
39 | - (GRPCProtoCall *)RPCToRecognizeWithRequest:(RecognizeRequest *)request handler:(void(^)(RecognizeResponse *_Nullable response, NSError *_Nullable error))handler{
40 | return [self RPCToMethod:@"Recognize"
41 | requestsWriter:[GRXWriter writerWithValue:request]
42 | responseClass:[RecognizeResponse class]
43 | responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]];
44 | }
45 | #pragma mark LongRunningRecognize(LongRunningRecognizeRequest) returns (Operation)
46 |
47 | /**
48 | * Performs asynchronous speech recognition: receive results via the
49 | * google.longrunning.Operations interface. Returns either an
50 | * `Operation.error` or an `Operation.response` which contains
51 | * a `LongRunningRecognizeResponse` message.
52 | */
53 | - (void)longRunningRecognizeWithRequest:(LongRunningRecognizeRequest *)request handler:(void(^)(Operation *_Nullable response, NSError *_Nullable error))handler{
54 | [[self RPCToLongRunningRecognizeWithRequest:request handler:handler] start];
55 | }
56 | // Returns a not-yet-started RPC object.
57 | /**
58 | * Performs asynchronous speech recognition: receive results via the
59 | * google.longrunning.Operations interface. Returns either an
60 | * `Operation.error` or an `Operation.response` which contains
61 | * a `LongRunningRecognizeResponse` message.
62 | */
63 | - (GRPCProtoCall *)RPCToLongRunningRecognizeWithRequest:(LongRunningRecognizeRequest *)request handler:(void(^)(Operation *_Nullable response, NSError *_Nullable error))handler{
64 | return [self RPCToMethod:@"LongRunningRecognize"
65 | requestsWriter:[GRXWriter writerWithValue:request]
66 | responseClass:[Operation class]
67 | responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]];
68 | }
69 | #pragma mark StreamingRecognize(stream StreamingRecognizeRequest) returns (stream StreamingRecognizeResponse)
70 |
71 | /**
72 | * Performs bidirectional streaming speech recognition: receive results while
73 | * sending audio. This method is only available via the gRPC API (not REST).
74 | */
75 | - (void)streamingRecognizeWithRequestsWriter:(GRXWriter *)requestWriter eventHandler:(void(^)(BOOL done, StreamingRecognizeResponse *_Nullable response, NSError *_Nullable error))eventHandler{
76 | [[self RPCToStreamingRecognizeWithRequestsWriter:requestWriter eventHandler:eventHandler] start];
77 | }
78 | // Returns a not-yet-started RPC object.
79 | /**
80 | * Performs bidirectional streaming speech recognition: receive results while
81 | * sending audio. This method is only available via the gRPC API (not REST).
82 | */
83 | - (GRPCProtoCall *)RPCToStreamingRecognizeWithRequestsWriter:(GRXWriter *)requestWriter eventHandler:(void(^)(BOOL done, StreamingRecognizeResponse *_Nullable response, NSError *_Nullable error))eventHandler{
84 | return [self RPCToMethod:@"StreamingRecognize"
85 | requestsWriter:requestWriter
86 | responseClass:[StreamingRecognizeResponse class]
87 | responsesWriteable:[GRXWriteable writeableWithEventHandler:eventHandler]];
88 | }
89 | @end
90 |
--------------------------------------------------------------------------------
/ios/google/rpc/Status.pbobjc.m:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: google/rpc/status.proto
3 |
4 | // This CPP symbol can be defined to use imports that match up to the framework
5 | // imports needed when using CocoaPods.
6 | #if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
7 | #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
8 | #endif
9 |
10 | #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
11 | #import
12 | #else
13 | #import "GPBProtocolBuffers_RuntimeSupport.h"
14 | #endif
15 |
16 | #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
17 | #import
18 | #else
19 | #import "google/protobuf/Any.pbobjc.h"
20 | #endif
21 |
22 | #import "google/rpc/Status.pbobjc.h"
23 | // @@protoc_insertion_point(imports)
24 |
25 | #pragma clang diagnostic push
26 | #pragma clang diagnostic ignored "-Wdeprecated-declarations"
27 |
28 | #pragma mark - StatusRoot
29 |
30 | @implementation StatusRoot
31 |
32 | + (GPBExtensionRegistry*)extensionRegistry {
33 | // This is called by +initialize so there is no need to worry
34 | // about thread safety and initialization of registry.
35 | static GPBExtensionRegistry* registry = nil;
36 | if (!registry) {
37 | GPBDebugCheckRuntimeVersion();
38 | registry = [[GPBExtensionRegistry alloc] init];
39 | [registry addExtensions:[GPBAnyRoot extensionRegistry]];
40 | }
41 | return registry;
42 | }
43 |
44 | @end
45 |
46 | #pragma mark - StatusRoot_FileDescriptor
47 |
48 | static GPBFileDescriptor *StatusRoot_FileDescriptor(void) {
49 | // This is called by +initialize so there is no need to worry
50 | // about thread safety of the singleton.
51 | static GPBFileDescriptor *descriptor = NULL;
52 | if (!descriptor) {
53 | GPBDebugCheckRuntimeVersion();
54 | descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.rpc"
55 | syntax:GPBFileSyntaxProto3];
56 | }
57 | return descriptor;
58 | }
59 |
60 | #pragma mark - Status
61 |
62 | @implementation Status
63 |
64 | @dynamic code;
65 | @dynamic message;
66 | @dynamic detailsArray, detailsArray_Count;
67 |
68 | typedef struct Status__storage_ {
69 | uint32_t _has_storage_[1];
70 | int32_t code;
71 | NSString *message;
72 | NSMutableArray *detailsArray;
73 | } Status__storage_;
74 |
75 | // This method is threadsafe because it is initially called
76 | // in +initialize for each subclass.
77 | + (GPBDescriptor *)descriptor {
78 | static GPBDescriptor *descriptor = nil;
79 | if (!descriptor) {
80 | static GPBMessageFieldDescription fields[] = {
81 | {
82 | .name = "code",
83 | .dataTypeSpecific.className = NULL,
84 | .number = Status_FieldNumber_Code,
85 | .hasIndex = 0,
86 | .offset = (uint32_t)offsetof(Status__storage_, code),
87 | .flags = GPBFieldOptional,
88 | .dataType = GPBDataTypeInt32,
89 | },
90 | {
91 | .name = "message",
92 | .dataTypeSpecific.className = NULL,
93 | .number = Status_FieldNumber_Message,
94 | .hasIndex = 1,
95 | .offset = (uint32_t)offsetof(Status__storage_, message),
96 | .flags = GPBFieldOptional,
97 | .dataType = GPBDataTypeString,
98 | },
99 | {
100 | .name = "detailsArray",
101 | .dataTypeSpecific.className = GPBStringifySymbol(GPBAny),
102 | .number = Status_FieldNumber_DetailsArray,
103 | .hasIndex = GPBNoHasBit,
104 | .offset = (uint32_t)offsetof(Status__storage_, detailsArray),
105 | .flags = GPBFieldRepeated,
106 | .dataType = GPBDataTypeMessage,
107 | },
108 | };
109 | GPBDescriptor *localDescriptor =
110 | [GPBDescriptor allocDescriptorForClass:[Status class]
111 | rootClass:[StatusRoot class]
112 | file:StatusRoot_FileDescriptor()
113 | fields:fields
114 | fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
115 | storageSize:sizeof(Status__storage_)
116 | flags:0];
117 | NSAssert(descriptor == nil, @"Startup recursed!");
118 | descriptor = localDescriptor;
119 | }
120 | return descriptor;
121 | }
122 |
123 | @end
124 |
125 |
126 | #pragma clang diagnostic pop
127 |
128 | // @@protoc_insertion_point(global_scope)
129 |
--------------------------------------------------------------------------------
/ios/google/longrunning/Operations.pbrpc.h:
--------------------------------------------------------------------------------
1 | #import "google/longrunning/Operations.pbobjc.h"
2 |
3 | #import
4 | #import
5 | #import
6 |
7 | #import "google/api/Annotations.pbobjc.h"
8 | #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
9 | #import
10 | #else
11 | #import "google/protobuf/Any.pbobjc.h"
12 | #endif
13 | #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
14 | #import
15 | #else
16 | #import "google/protobuf/Empty.pbobjc.h"
17 | #endif
18 | #import "google/rpc/Status.pbobjc.h"
19 |
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | @protocol Operations
24 |
25 | #pragma mark GetOperation(GetOperationRequest) returns (Operation)
26 |
27 | /**
28 | * Gets the latest state of a long-running operation. Clients may use this
29 | * method to poll the operation result at intervals as recommended by the API
30 | * service.
31 | */
32 | - (void)getOperationWithRequest:(GetOperationRequest *)request handler:(void(^)(Operation *_Nullable response, NSError *_Nullable error))handler;
33 |
34 | /**
35 | * Gets the latest state of a long-running operation. Clients may use this
36 | * method to poll the operation result at intervals as recommended by the API
37 | * service.
38 | */
39 | - (GRPCProtoCall *)RPCToGetOperationWithRequest:(GetOperationRequest *)request handler:(void(^)(Operation *_Nullable response, NSError *_Nullable error))handler;
40 |
41 |
42 | #pragma mark ListOperations(ListOperationsRequest) returns (ListOperationsResponse)
43 |
44 | /**
45 | * Lists operations that match the specified filter in the request. If the
46 | * server doesn't support this method, it returns
47 | * `google.rpc.Code.UNIMPLEMENTED`.
48 | */
49 | - (void)listOperationsWithRequest:(ListOperationsRequest *)request handler:(void(^)(ListOperationsResponse *_Nullable response, NSError *_Nullable error))handler;
50 |
51 | /**
52 | * Lists operations that match the specified filter in the request. If the
53 | * server doesn't support this method, it returns
54 | * `google.rpc.Code.UNIMPLEMENTED`.
55 | */
56 | - (GRPCProtoCall *)RPCToListOperationsWithRequest:(ListOperationsRequest *)request handler:(void(^)(ListOperationsResponse *_Nullable response, NSError *_Nullable error))handler;
57 |
58 |
59 | #pragma mark CancelOperation(CancelOperationRequest) returns (Empty)
60 |
61 | /**
62 | * Starts asynchronous cancellation on a long-running operation. The server
63 | * makes a best effort to cancel the operation, but success is not
64 | * guaranteed. If the server doesn't support this method, it returns
65 | * `google.rpc.Code.UNIMPLEMENTED`. Clients may use
66 | * [Operations.GetOperation] or other methods to check whether the
67 | * cancellation succeeded or the operation completed despite cancellation.
68 | */
69 | - (void)cancelOperationWithRequest:(CancelOperationRequest *)request handler:(void(^)(GPBEmpty *_Nullable response, NSError *_Nullable error))handler;
70 |
71 | /**
72 | * Starts asynchronous cancellation on a long-running operation. The server
73 | * makes a best effort to cancel the operation, but success is not
74 | * guaranteed. If the server doesn't support this method, it returns
75 | * `google.rpc.Code.UNIMPLEMENTED`. Clients may use
76 | * [Operations.GetOperation] or other methods to check whether the
77 | * cancellation succeeded or the operation completed despite cancellation.
78 | */
79 | - (GRPCProtoCall *)RPCToCancelOperationWithRequest:(CancelOperationRequest *)request handler:(void(^)(GPBEmpty *_Nullable response, NSError *_Nullable error))handler;
80 |
81 |
82 | #pragma mark DeleteOperation(DeleteOperationRequest) returns (Empty)
83 |
84 | /**
85 | * Deletes a long-running operation. It indicates the client is no longer
86 | * interested in the operation result. It does not cancel the operation.
87 | */
88 | - (void)deleteOperationWithRequest:(DeleteOperationRequest *)request handler:(void(^)(GPBEmpty *_Nullable response, NSError *_Nullable error))handler;
89 |
90 | /**
91 | * Deletes a long-running operation. It indicates the client is no longer
92 | * interested in the operation result. It does not cancel the operation.
93 | */
94 | - (GRPCProtoCall *)RPCToDeleteOperationWithRequest:(DeleteOperationRequest *)request handler:(void(^)(GPBEmpty *_Nullable response, NSError *_Nullable error))handler;
95 |
96 |
97 | @end
98 |
99 | /**
100 | * Basic service implementation, over gRPC, that only does
101 | * marshalling and parsing.
102 | */
103 | @interface Operations : GRPCProtoService
104 | - (instancetype)initWithHost:(NSString *)host NS_DESIGNATED_INITIALIZER;
105 | + (instancetype)serviceWithHost:(NSString *)host;
106 | @end
107 |
108 | NS_ASSUME_NONNULL_END
109 |
--------------------------------------------------------------------------------
/ios/RNGoogleSpeechApi.m:
--------------------------------------------------------------------------------
1 | // DO NOT something to effect to global AVAudioSession like setCategory.
2 | // It is highly recommended to do this in JS to avoid conflict with other native modules.
3 |
4 | #import
5 |
6 | #import "RNGoogleSpeechApi.h"
7 | #import "AudioController.h"
8 | #import "SpeechRecognitionService.h"
9 | #import "google/cloud/speech/v1/CloudSpeech.pbrpc.h"
10 |
11 | #define SAMPLE_RATE 16000.0f
12 |
13 | @interface RNGoogleSpeechApi ()
14 | @property (nonatomic, strong) NSMutableData *audioData;
15 | @end
16 |
17 | @implementation RNGoogleSpeechApi
18 |
19 | RCT_EXPORT_MODULE();
20 |
21 | - (dispatch_queue_t)methodQueue {
22 | return dispatch_get_main_queue();
23 | }
24 |
25 | - (NSArray *)supportedEvents
26 | {
27 | return @[@"onSpeechPartialResults", @"onSpeechResults", @"onSpeechError"];
28 | }
29 |
30 | - (void) recordAudio {
31 | _audioData = [[NSMutableData alloc] init];
32 | [[AudioController sharedInstance] prepareWithSampleRate:SAMPLE_RATE];
33 | [[SpeechRecognitionService sharedInstance] setSampleRate:SAMPLE_RATE];
34 | [[AudioController sharedInstance] start];
35 | }
36 |
37 | - (void) stopAudio {
38 | [[AudioController sharedInstance] stop];
39 | [[SpeechRecognitionService sharedInstance] stopStreaming];
40 | }
41 |
42 | - (void) processSampleData:(NSData *)data
43 | {
44 | [self.audioData appendData:data];
45 | NSInteger frameCount = [data length] / 2;
46 | int16_t *samples = (int16_t *) [data bytes];
47 | int64_t sum = 0;
48 | for (int i = 0; i < frameCount; i++) {
49 | sum += abs(samples[i]);
50 | }
51 | NSLog(@"audio %d %d", (int) frameCount, (int) (sum * 1.0 / frameCount));
52 |
53 | // We recommend sending samples in 100ms chunks
54 | int chunk_size = 0.1 /* seconds/chunk */ * SAMPLE_RATE * 2 /* bytes/sample */ ; /* bytes/chunk */
55 |
56 | if ([self.audioData length] > chunk_size) {
57 | NSLog(@"SENDING");
58 | [[SpeechRecognitionService sharedInstance] streamAudioData:self.audioData
59 | withCompletion:^(StreamingRecognizeResponse *response, NSError *error) {
60 | if (error) {
61 | NSLog(@"ERROR: %@", error);
62 | NSString *errorMessage = [NSString stringWithFormat:@"%ld/%@", error.code, [error localizedDescription]];
63 | [self sendEventWithName:@"onSpeechError" body:@{@"error": errorMessage}];
64 | [self stopAudio];
65 | } else if (response) {
66 | BOOL finished = NO;
67 | NSLog(@"RESPONSE: %@", response);
68 | NSMutableArray *transcriptArray = [NSMutableArray array];
69 | for (StreamingRecognitionResult *result in response.resultsArray) {
70 | NSLog(@"RESULT: %@", result);
71 | [transcriptArray addObject:result.alternativesArray[0].transcript];
72 | if (result.isFinal) {
73 | finished = YES;
74 | }
75 | }
76 | if (finished) {
77 | [self sendEventWithName:@"onSpeechResults" body:@{@"value": transcriptArray}];
78 | } else {
79 | [self sendEventWithName:@"onSpeechPartialResults" body:@{@"value": transcriptArray}];
80 | }
81 | }
82 | }
83 | ];
84 | self.audioData = [[NSMutableData alloc] init];
85 | }
86 | }
87 |
88 | RCT_EXPORT_METHOD(setApiKey:(NSString *)apiKey) {
89 | NSLog(@"setApiKey: %@", apiKey);
90 | [AudioController sharedInstance].delegate = self;
91 | [[SpeechRecognitionService sharedInstance] setApiKey:apiKey];
92 | }
93 |
94 | RCT_EXPORT_METHOD(startSpeech:(NSString*)localeStr) {
95 | [self recordAudio];
96 | }
97 |
98 | RCT_EXPORT_METHOD(cancelSpeech) {
99 | [self stopAudio];
100 | }
101 |
102 | @end
103 |
--------------------------------------------------------------------------------
/windows/RNGoogleSpeechApi.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 12.00
2 | # Visual Studio 14
3 | VisualStudioVersion = 14.0.25123.0
4 | MinimumVisualStudioVersion = 10.0.40219.1
5 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RNGoogleSpeechApi", "RNGoogleSpeechApi\RNGoogleSpeechApi.csproj", "{CF85D3A0-A4CB-11E7-96F5-393F801E4804}"
6 | EndProject
7 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactNative", "..\node_modules\react-native-windows\ReactWindows\ReactNative\ReactNative.csproj", "{C7673AD5-E3AA-468C-A5FD-FA38154E205C}"
8 | EndProject
9 | Global
10 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
11 | Debug|Any CPU = Debug|Any CPU
12 | Debug|ARM = Debug|ARM
13 | Debug|x64 = Debug|x64
14 | Debug|x86 = Debug|x86
15 | Development|Any CPU = Development|Any CPU
16 | Development|ARM = Development|ARM
17 | Development|x64 = Development|x64
18 | Development|x86 = Development|x86
19 | Release|Any CPU = Release|Any CPU
20 | Release|ARM = Release|ARM
21 | Release|x64 = Release|x64
22 | Release|x86 = Release|x86
23 | EndGlobalSection
24 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
25 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
26 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Debug|Any CPU.Build.0 = Debug|Any CPU
27 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Debug|ARM.ActiveCfg = Debug|ARM
28 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Debug|ARM.Build.0 = Debug|ARM
29 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Debug|x64.ActiveCfg = Debug|x64
30 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Debug|x64.Build.0 = Debug|x64
31 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Debug|x86.ActiveCfg = Debug|x86
32 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Debug|x86.Build.0 = Debug|x86
33 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Development|Any CPU.ActiveCfg = Development|Any CPU
34 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Development|Any CPU.Build.0 = Development|Any CPU
35 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Development|ARM.ActiveCfg = Development|ARM
36 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Development|ARM.Build.0 = Development|ARM
37 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Development|x64.ActiveCfg = Development|x64
38 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Development|x64.Build.0 = Development|x64
39 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Development|x86.ActiveCfg = Development|x86
40 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Development|x86.Build.0 = Development|x86
41 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Release|Any CPU.ActiveCfg = Release|Any CPU
42 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Release|Any CPU.Build.0 = Release|Any CPU
43 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Release|ARM.ActiveCfg = Release|ARM
44 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Release|ARM.Build.0 = Release|ARM
45 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Release|x64.ActiveCfg = Release|x64
46 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Release|x64.Build.0 = Release|x64
47 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Release|x86.ActiveCfg = Release|x86
48 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}.Release|x86.Build.0 = Release|x86
49 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
50 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|Any CPU.Build.0 = Debug|Any CPU
51 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|ARM.ActiveCfg = Debug|ARM
52 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|ARM.Build.0 = Debug|ARM
53 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x64.ActiveCfg = Debug|x64
54 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x64.Build.0 = Debug|x64
55 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x86.ActiveCfg = Debug|x86
56 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x86.Build.0 = Debug|x86
57 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|Any CPU.ActiveCfg = Debug|Any CPU
58 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|Any CPU.Build.0 = Debug|Any CPU
59 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|ARM.ActiveCfg = Debug|ARM
60 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|ARM.Build.0 = Debug|ARM
61 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x64.ActiveCfg = Debug|x64
62 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x64.Build.0 = Debug|x64
63 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x86.ActiveCfg = Debug|x86
64 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x86.Build.0 = Debug|x86
65 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|Any CPU.ActiveCfg = Release|Any CPU
66 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|Any CPU.Build.0 = Release|Any CPU
67 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|ARM.ActiveCfg = Release|ARM
68 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|ARM.Build.0 = Release|ARM
69 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x64.ActiveCfg = Release|x64
70 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x64.Build.0 = Release|x64
71 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x86.ActiveCfg = Release|x86
72 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x86.Build.0 = Release|x86
73 | EndGlobalSection
74 | GlobalSection(SolutionProperties) = preSolution
75 | HideSolutionNode = FALSE
76 | EndGlobalSection
77 | EndGlobal
78 |
--------------------------------------------------------------------------------
/ios/google/api/MonitoredResource.pbobjc.h:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: google/api/monitored_resource.proto
3 |
4 | // This CPP symbol can be defined to use imports that match up to the framework
5 | // imports needed when using CocoaPods.
6 | #if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
7 | #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
8 | #endif
9 |
10 | #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
11 | #import
12 | #else
13 | #import "GPBProtocolBuffers.h"
14 | #endif
15 |
16 | #if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001
17 | #error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
18 | #endif
19 |
20 | // @@protoc_insertion_point(imports)
21 |
22 | #pragma clang diagnostic push
23 | #pragma clang diagnostic ignored "-Wdeprecated-declarations"
24 |
25 | CF_EXTERN_C_BEGIN
26 |
27 | @class LabelDescriptor;
28 |
29 | NS_ASSUME_NONNULL_BEGIN
30 |
31 | #pragma mark - MonitoredResourceRoot
32 |
33 | /**
34 | * Exposes the extension registry for this file.
35 | *
36 | * The base class provides:
37 | * @code
38 | * + (GPBExtensionRegistry *)extensionRegistry;
39 | * @endcode
40 | * which is a @c GPBExtensionRegistry that includes all the extensions defined by
41 | * this file and all files that it depends on.
42 | **/
43 | @interface MonitoredResourceRoot : GPBRootObject
44 | @end
45 |
46 | #pragma mark - MonitoredResourceDescriptor
47 |
48 | typedef GPB_ENUM(MonitoredResourceDescriptor_FieldNumber) {
49 | MonitoredResourceDescriptor_FieldNumber_Type = 1,
50 | MonitoredResourceDescriptor_FieldNumber_DisplayName = 2,
51 | MonitoredResourceDescriptor_FieldNumber_Description_p = 3,
52 | MonitoredResourceDescriptor_FieldNumber_LabelsArray = 4,
53 | };
54 |
55 | /**
56 | * A descriptor that describes the schema of [MonitoredResource][google.api.MonitoredResource].
57 | **/
58 | @interface MonitoredResourceDescriptor : GPBMessage
59 |
60 | /**
61 | * The monitored resource type. For example, the type `"cloudsql_database"`
62 | * represents databases in Google Cloud SQL.
63 | **/
64 | @property(nonatomic, readwrite, copy, null_resettable) NSString *type;
65 |
66 | /**
67 | * A concise name for the monitored resource type that can be displayed in
68 | * user interfaces. For example, `"Google Cloud SQL Database"`.
69 | **/
70 | @property(nonatomic, readwrite, copy, null_resettable) NSString *displayName;
71 |
72 | /**
73 | * A detailed description of the monitored resource type that can be used in
74 | * documentation.
75 | **/
76 | @property(nonatomic, readwrite, copy, null_resettable) NSString *description_p;
77 |
78 | /**
79 | * A set of labels that can be used to describe instances of this monitored
80 | * resource type. For example, Google Cloud SQL databases can be labeled with
81 | * their `"database_id"` and their `"zone"`.
82 | **/
83 | @property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *labelsArray;
84 | /** The number of items in @c labelsArray without causing the array to be created. */
85 | @property(nonatomic, readonly) NSUInteger labelsArray_Count;
86 |
87 | @end
88 |
89 | #pragma mark - MonitoredResource
90 |
91 | typedef GPB_ENUM(MonitoredResource_FieldNumber) {
92 | MonitoredResource_FieldNumber_Type = 1,
93 | MonitoredResource_FieldNumber_Labels = 2,
94 | };
95 |
96 | /**
97 | * A monitored resource describes a resource that can be used for monitoring
98 | * purpose. It can also be used for logging, billing, and other purposes. Each
99 | * resource has a `type` and a set of `labels`. The labels contain information
100 | * that identifies the resource and describes attributes of it. For example,
101 | * you can use monitored resource to describe a normal file, where the resource
102 | * has `type` as `"file"`, the label `path` identifies the file, and the label
103 | * `size` describes the file size. The monitoring system can use a set of
104 | * monitored resources of files to generate file size distribution.
105 | **/
106 | @interface MonitoredResource : GPBMessage
107 |
108 | /**
109 | * The monitored resource type. This field must match the corresponding
110 | * [MonitoredResourceDescriptor.type][google.api.MonitoredResourceDescriptor.type] to this resource.. For example,
111 | * `"cloudsql_database"` represents Cloud SQL databases.
112 | **/
113 | @property(nonatomic, readwrite, copy, null_resettable) NSString *type;
114 |
115 | /**
116 | * Values for some or all of the labels listed in the associated monitored
117 | * resource descriptor. For example, you specify a specific Cloud SQL database
118 | * by supplying values for both the `"database_id"` and `"zone"` labels.
119 | **/
120 | @property(nonatomic, readwrite, strong, null_resettable) NSMutableDictionary *labels;
121 | /** The number of items in @c labels without causing the array to be created. */
122 | @property(nonatomic, readonly) NSUInteger labels_Count;
123 |
124 | @end
125 |
126 | NS_ASSUME_NONNULL_END
127 |
128 | CF_EXTERN_C_END
129 |
130 | #pragma clang diagnostic pop
131 |
132 | // @@protoc_insertion_point(global_scope)
133 |
--------------------------------------------------------------------------------
/ios/google/rpc/Status.pbobjc.h:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: google/rpc/status.proto
3 |
4 | // This CPP symbol can be defined to use imports that match up to the framework
5 | // imports needed when using CocoaPods.
6 | #if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
7 | #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
8 | #endif
9 |
10 | #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
11 | #import
12 | #else
13 | #import "GPBProtocolBuffers.h"
14 | #endif
15 |
16 | #if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001
17 | #error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
18 | #endif
19 |
20 | // @@protoc_insertion_point(imports)
21 |
22 | #pragma clang diagnostic push
23 | #pragma clang diagnostic ignored "-Wdeprecated-declarations"
24 |
25 | CF_EXTERN_C_BEGIN
26 |
27 | @class GPBAny;
28 |
29 | NS_ASSUME_NONNULL_BEGIN
30 |
31 | #pragma mark - StatusRoot
32 |
33 | /**
34 | * Exposes the extension registry for this file.
35 | *
36 | * The base class provides:
37 | * @code
38 | * + (GPBExtensionRegistry *)extensionRegistry;
39 | * @endcode
40 | * which is a @c GPBExtensionRegistry that includes all the extensions defined by
41 | * this file and all files that it depends on.
42 | **/
43 | @interface StatusRoot : GPBRootObject
44 | @end
45 |
46 | #pragma mark - Status
47 |
48 | typedef GPB_ENUM(Status_FieldNumber) {
49 | Status_FieldNumber_Code = 1,
50 | Status_FieldNumber_Message = 2,
51 | Status_FieldNumber_DetailsArray = 3,
52 | };
53 |
54 | /**
55 | * The `Status` type defines a logical error model that is suitable for different
56 | * programming environments, including REST APIs and RPC APIs. It is used by
57 | * [gRPC](https://github.com/grpc). The error model is designed to be:
58 | *
59 | * - Simple to use and understand for most users
60 | * - Flexible enough to meet unexpected needs
61 | *
62 | * # Overview
63 | *
64 | * The `Status` message contains three pieces of data: error code, error message,
65 | * and error details. The error code should be an enum value of
66 | * [google.rpc.Code][google.rpc.Code], but it may accept additional error codes if needed. The
67 | * error message should be a developer-facing English message that helps
68 | * developers *understand* and *resolve* the error. If a localized user-facing
69 | * error message is needed, put the localized message in the error details or
70 | * localize it in the client. The optional error details may contain arbitrary
71 | * information about the error. There is a predefined set of error detail types
72 | * in the package `google.rpc` which can be used for common error conditions.
73 | *
74 | * # Language mapping
75 | *
76 | * The `Status` message is the logical representation of the error model, but it
77 | * is not necessarily the actual wire format. When the `Status` message is
78 | * exposed in different client libraries and different wire protocols, it can be
79 | * mapped differently. For example, it will likely be mapped to some exceptions
80 | * in Java, but more likely mapped to some error codes in C.
81 | *
82 | * # Other uses
83 | *
84 | * The error model and the `Status` message can be used in a variety of
85 | * environments, either with or without APIs, to provide a
86 | * consistent developer experience across different environments.
87 | *
88 | * Example uses of this error model include:
89 | *
90 | * - Partial errors. If a service needs to return partial errors to the client,
91 | * it may embed the `Status` in the normal response to indicate the partial
92 | * errors.
93 | *
94 | * - Workflow errors. A typical workflow has multiple steps. Each step may
95 | * have a `Status` message for error reporting purpose.
96 | *
97 | * - Batch operations. If a client uses batch request and batch response, the
98 | * `Status` message should be used directly inside batch response, one for
99 | * each error sub-response.
100 | *
101 | * - Asynchronous operations. If an API call embeds asynchronous operation
102 | * results in its response, the status of those operations should be
103 | * represented directly using the `Status` message.
104 | *
105 | * - Logging. If some API errors are stored in logs, the message `Status` could
106 | * be used directly after any stripping needed for security/privacy reasons.
107 | **/
108 | @interface Status : GPBMessage
109 |
110 | /** The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. */
111 | @property(nonatomic, readwrite) int32_t code;
112 |
113 | /**
114 | * A developer-facing error message, which should be in English. Any
115 | * user-facing error message should be localized and sent in the
116 | * [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
117 | **/
118 | @property(nonatomic, readwrite, copy, null_resettable) NSString *message;
119 |
120 | /**
121 | * A list of messages that carry the error details. There will be a
122 | * common set of message types for APIs to use.
123 | **/
124 | @property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *detailsArray;
125 | /** The number of items in @c detailsArray without causing the array to be created. */
126 | @property(nonatomic, readonly) NSUInteger detailsArray_Count;
127 |
128 | @end
129 |
130 | NS_ASSUME_NONNULL_END
131 |
132 | CF_EXTERN_C_END
133 |
134 | #pragma clang diagnostic pop
135 |
136 | // @@protoc_insertion_point(global_scope)
137 |
--------------------------------------------------------------------------------
/ExampleApp/ios/ExampleApp.xcodeproj/xcshareddata/xcschemes/ExampleApp.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
43 |
49 |
50 |
51 |
52 |
53 |
59 |
60 |
62 |
68 |
69 |
70 |
71 |
72 |
78 |
79 |
80 |
81 |
82 |
83 |
94 |
96 |
102 |
103 |
104 |
105 |
106 |
107 |
113 |
115 |
121 |
122 |
123 |
124 |
126 |
127 |
130 |
131 |
132 |
--------------------------------------------------------------------------------
/ExampleApp/ios/ExampleApp.xcodeproj/xcshareddata/xcschemes/ExampleApp-tvOS.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
43 |
49 |
50 |
51 |
52 |
53 |
58 |
59 |
61 |
67 |
68 |
69 |
70 |
71 |
77 |
78 |
79 |
80 |
81 |
82 |
92 |
94 |
100 |
101 |
102 |
103 |
104 |
105 |
111 |
113 |
119 |
120 |
121 |
122 |
124 |
125 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/ExampleApp/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/ios/google/longrunning/Operations.pbrpc.m:
--------------------------------------------------------------------------------
1 | #import "google/longrunning/Operations.pbrpc.h"
2 |
3 | #import
4 | #import
5 |
6 | @implementation Operations
7 |
8 | // Designated initializer
9 | - (instancetype)initWithHost:(NSString *)host {
10 | return (self = [super initWithHost:host packageName:@"google.longrunning" serviceName:@"Operations"]);
11 | }
12 |
13 | // Override superclass initializer to disallow different package and service names.
14 | - (instancetype)initWithHost:(NSString *)host
15 | packageName:(NSString *)packageName
16 | serviceName:(NSString *)serviceName {
17 | return [self initWithHost:host];
18 | }
19 |
20 | + (instancetype)serviceWithHost:(NSString *)host {
21 | return [[self alloc] initWithHost:host];
22 | }
23 |
24 |
25 | #pragma mark GetOperation(GetOperationRequest) returns (Operation)
26 |
27 | /**
28 | * Gets the latest state of a long-running operation. Clients may use this
29 | * method to poll the operation result at intervals as recommended by the API
30 | * service.
31 | */
32 | - (void)getOperationWithRequest:(GetOperationRequest *)request handler:(void(^)(Operation *_Nullable response, NSError *_Nullable error))handler{
33 | [[self RPCToGetOperationWithRequest:request handler:handler] start];
34 | }
35 | // Returns a not-yet-started RPC object.
36 | /**
37 | * Gets the latest state of a long-running operation. Clients may use this
38 | * method to poll the operation result at intervals as recommended by the API
39 | * service.
40 | */
41 | - (GRPCProtoCall *)RPCToGetOperationWithRequest:(GetOperationRequest *)request handler:(void(^)(Operation *_Nullable response, NSError *_Nullable error))handler{
42 | return [self RPCToMethod:@"GetOperation"
43 | requestsWriter:[GRXWriter writerWithValue:request]
44 | responseClass:[Operation class]
45 | responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]];
46 | }
47 | #pragma mark ListOperations(ListOperationsRequest) returns (ListOperationsResponse)
48 |
49 | /**
50 | * Lists operations that match the specified filter in the request. If the
51 | * server doesn't support this method, it returns
52 | * `google.rpc.Code.UNIMPLEMENTED`.
53 | */
54 | - (void)listOperationsWithRequest:(ListOperationsRequest *)request handler:(void(^)(ListOperationsResponse *_Nullable response, NSError *_Nullable error))handler{
55 | [[self RPCToListOperationsWithRequest:request handler:handler] start];
56 | }
57 | // Returns a not-yet-started RPC object.
58 | /**
59 | * Lists operations that match the specified filter in the request. If the
60 | * server doesn't support this method, it returns
61 | * `google.rpc.Code.UNIMPLEMENTED`.
62 | */
63 | - (GRPCProtoCall *)RPCToListOperationsWithRequest:(ListOperationsRequest *)request handler:(void(^)(ListOperationsResponse *_Nullable response, NSError *_Nullable error))handler{
64 | return [self RPCToMethod:@"ListOperations"
65 | requestsWriter:[GRXWriter writerWithValue:request]
66 | responseClass:[ListOperationsResponse class]
67 | responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]];
68 | }
69 | #pragma mark CancelOperation(CancelOperationRequest) returns (Empty)
70 |
71 | /**
72 | * Starts asynchronous cancellation on a long-running operation. The server
73 | * makes a best effort to cancel the operation, but success is not
74 | * guaranteed. If the server doesn't support this method, it returns
75 | * `google.rpc.Code.UNIMPLEMENTED`. Clients may use
76 | * [Operations.GetOperation] or other methods to check whether the
77 | * cancellation succeeded or the operation completed despite cancellation.
78 | */
79 | - (void)cancelOperationWithRequest:(CancelOperationRequest *)request handler:(void(^)(GPBEmpty *_Nullable response, NSError *_Nullable error))handler{
80 | [[self RPCToCancelOperationWithRequest:request handler:handler] start];
81 | }
82 | // Returns a not-yet-started RPC object.
83 | /**
84 | * Starts asynchronous cancellation on a long-running operation. The server
85 | * makes a best effort to cancel the operation, but success is not
86 | * guaranteed. If the server doesn't support this method, it returns
87 | * `google.rpc.Code.UNIMPLEMENTED`. Clients may use
88 | * [Operations.GetOperation] or other methods to check whether the
89 | * cancellation succeeded or the operation completed despite cancellation.
90 | */
91 | - (GRPCProtoCall *)RPCToCancelOperationWithRequest:(CancelOperationRequest *)request handler:(void(^)(GPBEmpty *_Nullable response, NSError *_Nullable error))handler{
92 | return [self RPCToMethod:@"CancelOperation"
93 | requestsWriter:[GRXWriter writerWithValue:request]
94 | responseClass:[GPBEmpty class]
95 | responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]];
96 | }
97 | #pragma mark DeleteOperation(DeleteOperationRequest) returns (Empty)
98 |
99 | /**
100 | * Deletes a long-running operation. It indicates the client is no longer
101 | * interested in the operation result. It does not cancel the operation.
102 | */
103 | - (void)deleteOperationWithRequest:(DeleteOperationRequest *)request handler:(void(^)(GPBEmpty *_Nullable response, NSError *_Nullable error))handler{
104 | [[self RPCToDeleteOperationWithRequest:request handler:handler] start];
105 | }
106 | // Returns a not-yet-started RPC object.
107 | /**
108 | * Deletes a long-running operation. It indicates the client is no longer
109 | * interested in the operation result. It does not cancel the operation.
110 | */
111 | - (GRPCProtoCall *)RPCToDeleteOperationWithRequest:(DeleteOperationRequest *)request handler:(void(^)(GPBEmpty *_Nullable response, NSError *_Nullable error))handler{
112 | return [self RPCToMethod:@"DeleteOperation"
113 | requestsWriter:[GRXWriter writerWithValue:request]
114 | responseClass:[GPBEmpty class]
115 | responsesWriteable:[GRXWriteable writeableWithSingleHandler:handler]];
116 | }
117 | @end
118 |
--------------------------------------------------------------------------------
/ios/google/api/Label.pbobjc.m:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: google/api/label.proto
3 |
4 | // This CPP symbol can be defined to use imports that match up to the framework
5 | // imports needed when using CocoaPods.
6 | #if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
7 | #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
8 | #endif
9 |
10 | #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
11 | #import
12 | #else
13 | #import "GPBProtocolBuffers_RuntimeSupport.h"
14 | #endif
15 |
16 | #import "google/api/Label.pbobjc.h"
17 | // @@protoc_insertion_point(imports)
18 |
19 | #pragma clang diagnostic push
20 | #pragma clang diagnostic ignored "-Wdeprecated-declarations"
21 |
22 | #pragma mark - LabelRoot
23 |
24 | @implementation LabelRoot
25 |
26 | @end
27 |
28 | #pragma mark - LabelRoot_FileDescriptor
29 |
30 | static GPBFileDescriptor *LabelRoot_FileDescriptor(void) {
31 | // This is called by +initialize so there is no need to worry
32 | // about thread safety of the singleton.
33 | static GPBFileDescriptor *descriptor = NULL;
34 | if (!descriptor) {
35 | GPBDebugCheckRuntimeVersion();
36 | descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.api"
37 | syntax:GPBFileSyntaxProto3];
38 | }
39 | return descriptor;
40 | }
41 |
42 | #pragma mark - LabelDescriptor
43 |
44 | @implementation LabelDescriptor
45 |
46 | @dynamic key;
47 | @dynamic valueType;
48 | @dynamic description_p;
49 |
50 | typedef struct LabelDescriptor__storage_ {
51 | uint32_t _has_storage_[1];
52 | LabelDescriptor_ValueType valueType;
53 | NSString *key;
54 | NSString *description_p;
55 | } LabelDescriptor__storage_;
56 |
57 | // This method is threadsafe because it is initially called
58 | // in +initialize for each subclass.
59 | + (GPBDescriptor *)descriptor {
60 | static GPBDescriptor *descriptor = nil;
61 | if (!descriptor) {
62 | static GPBMessageFieldDescription fields[] = {
63 | {
64 | .name = "key",
65 | .dataTypeSpecific.className = NULL,
66 | .number = LabelDescriptor_FieldNumber_Key,
67 | .hasIndex = 0,
68 | .offset = (uint32_t)offsetof(LabelDescriptor__storage_, key),
69 | .flags = GPBFieldOptional,
70 | .dataType = GPBDataTypeString,
71 | },
72 | {
73 | .name = "valueType",
74 | .dataTypeSpecific.enumDescFunc = LabelDescriptor_ValueType_EnumDescriptor,
75 | .number = LabelDescriptor_FieldNumber_ValueType,
76 | .hasIndex = 1,
77 | .offset = (uint32_t)offsetof(LabelDescriptor__storage_, valueType),
78 | .flags = GPBFieldOptional | GPBFieldHasEnumDescriptor,
79 | .dataType = GPBDataTypeEnum,
80 | },
81 | {
82 | .name = "description_p",
83 | .dataTypeSpecific.className = NULL,
84 | .number = LabelDescriptor_FieldNumber_Description_p,
85 | .hasIndex = 2,
86 | .offset = (uint32_t)offsetof(LabelDescriptor__storage_, description_p),
87 | .flags = GPBFieldOptional,
88 | .dataType = GPBDataTypeString,
89 | },
90 | };
91 | GPBDescriptor *localDescriptor =
92 | [GPBDescriptor allocDescriptorForClass:[LabelDescriptor class]
93 | rootClass:[LabelRoot class]
94 | file:LabelRoot_FileDescriptor()
95 | fields:fields
96 | fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
97 | storageSize:sizeof(LabelDescriptor__storage_)
98 | flags:0];
99 | NSAssert(descriptor == nil, @"Startup recursed!");
100 | descriptor = localDescriptor;
101 | }
102 | return descriptor;
103 | }
104 |
105 | @end
106 |
107 | int32_t LabelDescriptor_ValueType_RawValue(LabelDescriptor *message) {
108 | GPBDescriptor *descriptor = [LabelDescriptor descriptor];
109 | GPBFieldDescriptor *field = [descriptor fieldWithNumber:LabelDescriptor_FieldNumber_ValueType];
110 | return GPBGetMessageInt32Field(message, field);
111 | }
112 |
113 | void SetLabelDescriptor_ValueType_RawValue(LabelDescriptor *message, int32_t value) {
114 | GPBDescriptor *descriptor = [LabelDescriptor descriptor];
115 | GPBFieldDescriptor *field = [descriptor fieldWithNumber:LabelDescriptor_FieldNumber_ValueType];
116 | GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax);
117 | }
118 |
119 | #pragma mark - Enum LabelDescriptor_ValueType
120 |
121 | GPBEnumDescriptor *LabelDescriptor_ValueType_EnumDescriptor(void) {
122 | static GPBEnumDescriptor *descriptor = NULL;
123 | if (!descriptor) {
124 | static const char *valueNames =
125 | "String\000Bool\000Int64\000";
126 | static const int32_t values[] = {
127 | LabelDescriptor_ValueType_String,
128 | LabelDescriptor_ValueType_Bool,
129 | LabelDescriptor_ValueType_Int64,
130 | };
131 | GPBEnumDescriptor *worker =
132 | [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(LabelDescriptor_ValueType)
133 | valueNames:valueNames
134 | values:values
135 | count:(uint32_t)(sizeof(values) / sizeof(int32_t))
136 | enumVerifier:LabelDescriptor_ValueType_IsValidValue];
137 | if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) {
138 | [worker release];
139 | }
140 | }
141 | return descriptor;
142 | }
143 |
144 | BOOL LabelDescriptor_ValueType_IsValidValue(int32_t value__) {
145 | switch (value__) {
146 | case LabelDescriptor_ValueType_String:
147 | case LabelDescriptor_ValueType_Bool:
148 | case LabelDescriptor_ValueType_Int64:
149 | return YES;
150 | default:
151 | return NO;
152 | }
153 | }
154 |
155 |
156 | #pragma clang diagnostic pop
157 |
158 | // @@protoc_insertion_point(global_scope)
159 |
--------------------------------------------------------------------------------
/ExampleApp/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "com.android.application"
2 |
3 | import com.android.build.OutputFile
4 |
5 | /**
6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7 | * and bundleReleaseJsAndAssets).
8 | * These basically call `react-native bundle` with the correct arguments during the Android build
9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10 | * bundle directly from the development server. Below you can see all the possible configurations
11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the
12 | * `apply from: "../../node_modules/react-native/react.gradle"` line.
13 | *
14 | * project.ext.react = [
15 | * // the name of the generated asset file containing your JS bundle
16 | * bundleAssetName: "index.android.bundle",
17 | *
18 | * // the entry file for bundle generation
19 | * entryFile: "index.android.js",
20 | *
21 | * // whether to bundle JS and assets in debug mode
22 | * bundleInDebug: false,
23 | *
24 | * // whether to bundle JS and assets in release mode
25 | * bundleInRelease: true,
26 | *
27 | * // whether to bundle JS and assets in another build variant (if configured).
28 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
29 | * // The configuration property can be in the following formats
30 | * // 'bundleIn${productFlavor}${buildType}'
31 | * // 'bundleIn${buildType}'
32 | * // bundleInFreeDebug: true,
33 | * // bundleInPaidRelease: true,
34 | * // bundleInBeta: true,
35 | *
36 | * // whether to disable dev mode in custom build variants (by default only disabled in release)
37 | * // for example: to disable dev mode in the staging build type (if configured)
38 | * devDisabledInStaging: true,
39 | * // The configuration property can be in the following formats
40 | * // 'devDisabledIn${productFlavor}${buildType}'
41 | * // 'devDisabledIn${buildType}'
42 | *
43 | * // the root of your project, i.e. where "package.json" lives
44 | * root: "../../",
45 | *
46 | * // where to put the JS bundle asset in debug mode
47 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
48 | *
49 | * // where to put the JS bundle asset in release mode
50 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release",
51 | *
52 | * // where to put drawable resources / React Native assets, e.g. the ones you use via
53 | * // require('./image.png')), in debug mode
54 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
55 | *
56 | * // where to put drawable resources / React Native assets, e.g. the ones you use via
57 | * // require('./image.png')), in release mode
58 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
59 | *
60 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means
61 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
62 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle
63 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
64 | * // for example, you might want to remove it from here.
65 | * inputExcludes: ["android/**", "ios/**"],
66 | *
67 | * // override which node gets called and with what additional arguments
68 | * nodeExecutableAndArgs: ["node"],
69 | *
70 | * // supply additional arguments to the packager
71 | * extraPackagerArgs: []
72 | * ]
73 | */
74 |
75 | apply from: "../../node_modules/react-native/react.gradle"
76 |
77 | /**
78 | * Set this to true to create two separate APKs instead of one:
79 | * - An APK that only works on ARM devices
80 | * - An APK that only works on x86 devices
81 | * The advantage is the size of the APK is reduced by about 4MB.
82 | * Upload all the APKs to the Play Store and people will download
83 | * the correct one based on the CPU architecture of their device.
84 | */
85 | def enableSeparateBuildPerCPUArchitecture = false
86 |
87 | /**
88 | * Run Proguard to shrink the Java bytecode in release builds.
89 | */
90 | def enableProguardInReleaseBuilds = false
91 |
92 | android {
93 | compileSdkVersion 23
94 | buildToolsVersion "23.0.1"
95 |
96 | defaultConfig {
97 | applicationId "com.exampleapp"
98 | minSdkVersion 16
99 | targetSdkVersion 22
100 | versionCode 1
101 | versionName "1.0"
102 | ndk {
103 | abiFilters "armeabi-v7a", "x86"
104 | }
105 | }
106 | splits {
107 | abi {
108 | reset()
109 | enable enableSeparateBuildPerCPUArchitecture
110 | universalApk false // If true, also generate a universal APK
111 | include "armeabi-v7a", "x86"
112 | }
113 | }
114 | buildTypes {
115 | release {
116 | minifyEnabled enableProguardInReleaseBuilds
117 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
118 | }
119 | }
120 | // applicationVariants are e.g. debug, release
121 | applicationVariants.all { variant ->
122 | variant.outputs.each { output ->
123 | // For each separate APK per architecture, set a unique version code as described here:
124 | // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
125 | def versionCodes = ["armeabi-v7a":1, "x86":2]
126 | def abi = output.getFilter(OutputFile.ABI)
127 | if (abi != null) { // null for the universal-debug, universal-release variants
128 | output.versionCodeOverride =
129 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
130 | }
131 | }
132 | }
133 | }
134 |
135 | dependencies {
136 | compile project(':react-native-google-speech-api')
137 | compile fileTree(dir: "libs", include: ["*.jar"])
138 | compile "com.android.support:appcompat-v7:23.0.1"
139 | compile "com.facebook.react:react-native:+" // From node_modules
140 | }
141 |
142 | // Run this once to be able to run the application with BUCK
143 | // puts all compile dependencies into folder libs for BUCK to use
144 | task copyDownloadableDepsToLibs(type: Copy) {
145 | from configurations.compile
146 | into 'libs'
147 | }
148 |
--------------------------------------------------------------------------------
/ios/google/longrunning/operations.proto:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2015, Google Inc.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package google.longrunning;
18 |
19 | import "google/api/annotations.proto";
20 | import "google/protobuf/any.proto";
21 | import "google/protobuf/empty.proto";
22 | import "google/rpc/status.proto";
23 |
24 | option java_multiple_files = true;
25 | option java_outer_classname = "OperationsProto";
26 | option java_package = "com.google.longrunning";
27 |
28 |
29 | // Manages long-running operations with an API service.
30 | //
31 | // When an API method normally takes long time to complete, it can be designed
32 | // to return [Operation][google.longrunning.Operation] to the client, and the client can use this
33 | // interface to receive the real response asynchronously by polling the
34 | // operation resource, or using `google.watcher.v1.Watcher` interface to watch
35 | // the response, or pass the operation resource to another API (such as Google
36 | // Cloud Pub/Sub API) to receive the response. Any API service that returns
37 | // long-running operations should implement the `Operations` interface so
38 | // developers can have a consistent client experience.
39 | service Operations {
40 | // Gets the latest state of a long-running operation. Clients may use this
41 | // method to poll the operation result at intervals as recommended by the API
42 | // service.
43 | rpc GetOperation(GetOperationRequest) returns (Operation) {
44 | option (google.api.http) = { get: "/v1/{name=operations/**}" };
45 | }
46 |
47 | // Lists operations that match the specified filter in the request. If the
48 | // server doesn't support this method, it returns
49 | // `google.rpc.Code.UNIMPLEMENTED`.
50 | rpc ListOperations(ListOperationsRequest) returns (ListOperationsResponse) {
51 | option (google.api.http) = { get: "/v1/{name=operations}" };
52 | }
53 |
54 | // Starts asynchronous cancellation on a long-running operation. The server
55 | // makes a best effort to cancel the operation, but success is not
56 | // guaranteed. If the server doesn't support this method, it returns
57 | // `google.rpc.Code.UNIMPLEMENTED`. Clients may use
58 | // [Operations.GetOperation] or other methods to check whether the
59 | // cancellation succeeded or the operation completed despite cancellation.
60 | rpc CancelOperation(CancelOperationRequest) returns (google.protobuf.Empty) {
61 | option (google.api.http) = { post: "/v1/{name=operations/**}:cancel" body: "*" };
62 | }
63 |
64 | // Deletes a long-running operation. It indicates the client is no longer
65 | // interested in the operation result. It does not cancel the operation.
66 | rpc DeleteOperation(DeleteOperationRequest) returns (google.protobuf.Empty) {
67 | option (google.api.http) = { delete: "/v1/{name=operations/**}" };
68 | }
69 | }
70 |
71 | // This resource represents a long-running operation that is the result of a
72 | // network API call.
73 | message Operation {
74 | // The name of the operation resource, which is only unique within the same
75 | // service that originally returns it.
76 | string name = 1;
77 |
78 | // Some service-specific metadata associated with the operation. It typically
79 | // contains progress information and common metadata such as create time.
80 | // Some services may not provide such metadata. Any method that returns a
81 | // long-running operation should document the metadata type, if any.
82 | google.protobuf.Any metadata = 2;
83 |
84 | // If the value is false, it means the operation is still in progress.
85 | // If true, the operation is completed and the `result` is available.
86 | bool done = 3;
87 |
88 | oneof result {
89 | // The error result of the operation in case of failure.
90 | google.rpc.Status error = 4;
91 |
92 | // The normal response of the operation in case of success. If the original
93 | // method returns no data on success, such as `Delete`, the response will be
94 | // `google.protobuf.Empty`. If the original method is standard
95 | // `Get`/`Create`/`Update`, the response should be the resource. For other
96 | // methods, the response should have the type `XxxResponse`, where `Xxx`
97 | // is the original method name. For example, if the original method name
98 | // is `TakeSnapshot()`, the inferred response type will be
99 | // `TakeSnapshotResponse`.
100 | google.protobuf.Any response = 5;
101 | }
102 | }
103 |
104 | // The request message for [Operations.GetOperation][google.longrunning.Operations.GetOperation].
105 | message GetOperationRequest {
106 | // The name of the operation resource.
107 | string name = 1;
108 | }
109 |
110 | // The request message for [Operations.ListOperations][google.longrunning.Operations.ListOperations].
111 | message ListOperationsRequest {
112 | // The name of the operation collection.
113 | string name = 4;
114 |
115 | // The standard List filter.
116 | string filter = 1;
117 |
118 | // The standard List page size.
119 | int32 page_size = 2;
120 |
121 | // The standard List page token.
122 | string page_token = 3;
123 | }
124 |
125 | // The response message for [Operations.ListOperations][google.longrunning.Operations.ListOperations].
126 | message ListOperationsResponse {
127 | // A list of operations that match the specified filter in the request.
128 | repeated Operation operations = 1;
129 |
130 | // The standard List next-page token.
131 | string next_page_token = 2;
132 | }
133 |
134 | // The request message for [Operations.CancelOperation][google.longrunning.Operations.CancelOperation].
135 | message CancelOperationRequest {
136 | // The name of the operation resource to be cancelled.
137 | string name = 1;
138 | }
139 |
140 | // The request message for [Operations.DeleteOperation][google.longrunning.Operations.DeleteOperation].
141 | message DeleteOperationRequest {
142 | // The name of the operation resource to be deleted.
143 | string name = 1;
144 | }
145 |
--------------------------------------------------------------------------------
/ios/google/rpc/error_details.proto:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2015, Google Inc.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package google.rpc;
18 |
19 | import "google/protobuf/duration.proto";
20 |
21 | option java_multiple_files = true;
22 | option java_outer_classname = "ErrorDetailsProto";
23 | option java_package = "com.google.rpc";
24 |
25 |
26 | // Describes when the clients can retry a failed request. Clients could ignore
27 | // the recommendation here or retry when this information is missing from error
28 | // responses.
29 | //
30 | // It's always recommended that clients should use exponential backoff when
31 | // retrying.
32 | //
33 | // Clients should wait until `retry_delay` amount of time has passed since
34 | // receiving the error response before retrying. If retrying requests also
35 | // fail, clients should use an exponential backoff scheme to gradually increase
36 | // the delay between retries based on `retry_delay`, until either a maximum
37 | // number of retires have been reached or a maximum retry delay cap has been
38 | // reached.
39 | message RetryInfo {
40 | // Clients should wait at least this long between retrying the same request.
41 | google.protobuf.Duration retry_delay = 1;
42 | }
43 |
44 | // Describes additional debugging info.
45 | message DebugInfo {
46 | // The stack trace entries indicating where the error occurred.
47 | repeated string stack_entries = 1;
48 |
49 | // Additional debugging information provided by the server.
50 | string detail = 2;
51 | }
52 |
53 | // Describes how a quota check failed.
54 | //
55 | // For example if a daily limit was exceeded for the calling project,
56 | // a service could respond with a QuotaFailure detail containing the project
57 | // id and the description of the quota limit that was exceeded. If the
58 | // calling project hasn't enabled the service in the developer console, then
59 | // a service could respond with the project id and set `service_disabled`
60 | // to true.
61 | //
62 | // Also see RetryDetail and Help types for other details about handling a
63 | // quota failure.
64 | message QuotaFailure {
65 | // A message type used to describe a single quota violation. For example, a
66 | // daily quota or a custom quota that was exceeded.
67 | message Violation {
68 | // The subject on which the quota check failed.
69 | // For example, "clientip:" or "project:".
71 | string subject = 1;
72 |
73 | // A description of how the quota check failed. Clients can use this
74 | // description to find more about the quota configuration in the service's
75 | // public documentation, or find the relevant quota limit to adjust through
76 | // developer console.
77 | //
78 | // For example: "Service disabled" or "Daily Limit for read operations
79 | // exceeded".
80 | string description = 2;
81 | }
82 |
83 | // Describes all quota violations.
84 | repeated Violation violations = 1;
85 | }
86 |
87 | // Describes violations in a client request. This error type focuses on the
88 | // syntactic aspects of the request.
89 | message BadRequest {
90 | // A message type used to describe a single bad request field.
91 | message FieldViolation {
92 | // A path leading to a field in the request body. The value will be a
93 | // sequence of dot-separated identifiers that identify a protocol buffer
94 | // field. E.g., "violations.field" would identify this field.
95 | string field = 1;
96 |
97 | // A description of why the request element is bad.
98 | string description = 2;
99 | }
100 |
101 | // Describes all violations in a client request.
102 | repeated FieldViolation field_violations = 1;
103 | }
104 |
105 | // Contains metadata about the request that clients can attach when filing a bug
106 | // or providing other forms of feedback.
107 | message RequestInfo {
108 | // An opaque string that should only be interpreted by the service generating
109 | // it. For example, it can be used to identify requests in the service's logs.
110 | string request_id = 1;
111 |
112 | // Any data that was used to serve this request. For example, an encrypted
113 | // stack trace that can be sent back to the service provider for debugging.
114 | string serving_data = 2;
115 | }
116 |
117 | // Describes the resource that is being accessed.
118 | message ResourceInfo {
119 | // A name for the type of resource being accessed, e.g. "sql table",
120 | // "cloud storage bucket", "file", "Google calendar"; or the type URL
121 | // of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic".
122 | string resource_type = 1;
123 |
124 | // The name of the resource being accessed. For example, a shared calendar
125 | // name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current
126 | // error is [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED].
127 | string resource_name = 2;
128 |
129 | // The owner of the resource (optional).
130 | // For example, "user:" or "project:".
132 | string owner = 3;
133 |
134 | // Describes what error is encountered when accessing this resource.
135 | // For example, updating a cloud project may require the `writer` permission
136 | // on the developer console project.
137 | string description = 4;
138 | }
139 |
140 | // Provides links to documentation or for performing an out of band action.
141 | //
142 | // For example, if a quota check failed with an error indicating the calling
143 | // project hasn't enabled the accessed service, this can contain a URL pointing
144 | // directly to the right place in the developer console to flip the bit.
145 | message Help {
146 | // Describes a URL link.
147 | message Link {
148 | // Describes what the link offers.
149 | string description = 1;
150 |
151 | // The URL of the link.
152 | string url = 2;
153 | }
154 |
155 | // URL(s) pointing to additional information on handling the current error.
156 | repeated Link links = 1;
157 | }
158 |
--------------------------------------------------------------------------------
/ios/google/api/MonitoredResource.pbobjc.m:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: google/api/monitored_resource.proto
3 |
4 | // This CPP symbol can be defined to use imports that match up to the framework
5 | // imports needed when using CocoaPods.
6 | #if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
7 | #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
8 | #endif
9 |
10 | #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
11 | #import
12 | #else
13 | #import "GPBProtocolBuffers_RuntimeSupport.h"
14 | #endif
15 |
16 | #import "google/api/MonitoredResource.pbobjc.h"
17 | #import "google/api/Label.pbobjc.h"
18 | // @@protoc_insertion_point(imports)
19 |
20 | #pragma clang diagnostic push
21 | #pragma clang diagnostic ignored "-Wdeprecated-declarations"
22 |
23 | #pragma mark - MonitoredResourceRoot
24 |
25 | @implementation MonitoredResourceRoot
26 |
27 | + (GPBExtensionRegistry*)extensionRegistry {
28 | // This is called by +initialize so there is no need to worry
29 | // about thread safety and initialization of registry.
30 | static GPBExtensionRegistry* registry = nil;
31 | if (!registry) {
32 | GPBDebugCheckRuntimeVersion();
33 | registry = [[GPBExtensionRegistry alloc] init];
34 | [registry addExtensions:[LabelRoot extensionRegistry]];
35 | }
36 | return registry;
37 | }
38 |
39 | @end
40 |
41 | #pragma mark - MonitoredResourceRoot_FileDescriptor
42 |
43 | static GPBFileDescriptor *MonitoredResourceRoot_FileDescriptor(void) {
44 | // This is called by +initialize so there is no need to worry
45 | // about thread safety of the singleton.
46 | static GPBFileDescriptor *descriptor = NULL;
47 | if (!descriptor) {
48 | GPBDebugCheckRuntimeVersion();
49 | descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.api"
50 | syntax:GPBFileSyntaxProto3];
51 | }
52 | return descriptor;
53 | }
54 |
55 | #pragma mark - MonitoredResourceDescriptor
56 |
57 | @implementation MonitoredResourceDescriptor
58 |
59 | @dynamic type;
60 | @dynamic displayName;
61 | @dynamic description_p;
62 | @dynamic labelsArray, labelsArray_Count;
63 |
64 | typedef struct MonitoredResourceDescriptor__storage_ {
65 | uint32_t _has_storage_[1];
66 | NSString *type;
67 | NSString *displayName;
68 | NSString *description_p;
69 | NSMutableArray *labelsArray;
70 | } MonitoredResourceDescriptor__storage_;
71 |
72 | // This method is threadsafe because it is initially called
73 | // in +initialize for each subclass.
74 | + (GPBDescriptor *)descriptor {
75 | static GPBDescriptor *descriptor = nil;
76 | if (!descriptor) {
77 | static GPBMessageFieldDescription fields[] = {
78 | {
79 | .name = "type",
80 | .dataTypeSpecific.className = NULL,
81 | .number = MonitoredResourceDescriptor_FieldNumber_Type,
82 | .hasIndex = 0,
83 | .offset = (uint32_t)offsetof(MonitoredResourceDescriptor__storage_, type),
84 | .flags = GPBFieldOptional,
85 | .dataType = GPBDataTypeString,
86 | },
87 | {
88 | .name = "displayName",
89 | .dataTypeSpecific.className = NULL,
90 | .number = MonitoredResourceDescriptor_FieldNumber_DisplayName,
91 | .hasIndex = 1,
92 | .offset = (uint32_t)offsetof(MonitoredResourceDescriptor__storage_, displayName),
93 | .flags = GPBFieldOptional,
94 | .dataType = GPBDataTypeString,
95 | },
96 | {
97 | .name = "description_p",
98 | .dataTypeSpecific.className = NULL,
99 | .number = MonitoredResourceDescriptor_FieldNumber_Description_p,
100 | .hasIndex = 2,
101 | .offset = (uint32_t)offsetof(MonitoredResourceDescriptor__storage_, description_p),
102 | .flags = GPBFieldOptional,
103 | .dataType = GPBDataTypeString,
104 | },
105 | {
106 | .name = "labelsArray",
107 | .dataTypeSpecific.className = GPBStringifySymbol(LabelDescriptor),
108 | .number = MonitoredResourceDescriptor_FieldNumber_LabelsArray,
109 | .hasIndex = GPBNoHasBit,
110 | .offset = (uint32_t)offsetof(MonitoredResourceDescriptor__storage_, labelsArray),
111 | .flags = GPBFieldRepeated,
112 | .dataType = GPBDataTypeMessage,
113 | },
114 | };
115 | GPBDescriptor *localDescriptor =
116 | [GPBDescriptor allocDescriptorForClass:[MonitoredResourceDescriptor class]
117 | rootClass:[MonitoredResourceRoot class]
118 | file:MonitoredResourceRoot_FileDescriptor()
119 | fields:fields
120 | fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
121 | storageSize:sizeof(MonitoredResourceDescriptor__storage_)
122 | flags:0];
123 | NSAssert(descriptor == nil, @"Startup recursed!");
124 | descriptor = localDescriptor;
125 | }
126 | return descriptor;
127 | }
128 |
129 | @end
130 |
131 | #pragma mark - MonitoredResource
132 |
133 | @implementation MonitoredResource
134 |
135 | @dynamic type;
136 | @dynamic labels, labels_Count;
137 |
138 | typedef struct MonitoredResource__storage_ {
139 | uint32_t _has_storage_[1];
140 | NSString *type;
141 | NSMutableDictionary *labels;
142 | } MonitoredResource__storage_;
143 |
144 | // This method is threadsafe because it is initially called
145 | // in +initialize for each subclass.
146 | + (GPBDescriptor *)descriptor {
147 | static GPBDescriptor *descriptor = nil;
148 | if (!descriptor) {
149 | static GPBMessageFieldDescription fields[] = {
150 | {
151 | .name = "type",
152 | .dataTypeSpecific.className = NULL,
153 | .number = MonitoredResource_FieldNumber_Type,
154 | .hasIndex = 0,
155 | .offset = (uint32_t)offsetof(MonitoredResource__storage_, type),
156 | .flags = GPBFieldOptional,
157 | .dataType = GPBDataTypeString,
158 | },
159 | {
160 | .name = "labels",
161 | .dataTypeSpecific.className = NULL,
162 | .number = MonitoredResource_FieldNumber_Labels,
163 | .hasIndex = GPBNoHasBit,
164 | .offset = (uint32_t)offsetof(MonitoredResource__storage_, labels),
165 | .flags = GPBFieldMapKeyString,
166 | .dataType = GPBDataTypeString,
167 | },
168 | };
169 | GPBDescriptor *localDescriptor =
170 | [GPBDescriptor allocDescriptorForClass:[MonitoredResource class]
171 | rootClass:[MonitoredResourceRoot class]
172 | file:MonitoredResourceRoot_FileDescriptor()
173 | fields:fields
174 | fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
175 | storageSize:sizeof(MonitoredResource__storage_)
176 | flags:0];
177 | NSAssert(descriptor == nil, @"Startup recursed!");
178 | descriptor = localDescriptor;
179 | }
180 | return descriptor;
181 | }
182 |
183 | @end
184 |
185 |
186 | #pragma clang diagnostic pop
187 |
188 | // @@protoc_insertion_point(global_scope)
189 |
--------------------------------------------------------------------------------
/ios/google/longrunning/Operations.pbobjc.h:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: google/longrunning/operations.proto
3 |
4 | // This CPP symbol can be defined to use imports that match up to the framework
5 | // imports needed when using CocoaPods.
6 | #if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
7 | #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
8 | #endif
9 |
10 | #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
11 | #import
12 | #else
13 | #import "GPBProtocolBuffers.h"
14 | #endif
15 |
16 | #if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001
17 | #error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
18 | #endif
19 |
20 | // @@protoc_insertion_point(imports)
21 |
22 | #pragma clang diagnostic push
23 | #pragma clang diagnostic ignored "-Wdeprecated-declarations"
24 |
25 | CF_EXTERN_C_BEGIN
26 |
27 | @class GPBAny;
28 | @class Operation;
29 | @class Status;
30 |
31 | NS_ASSUME_NONNULL_BEGIN
32 |
33 | #pragma mark - OperationsRoot
34 |
35 | /**
36 | * Exposes the extension registry for this file.
37 | *
38 | * The base class provides:
39 | * @code
40 | * + (GPBExtensionRegistry *)extensionRegistry;
41 | * @endcode
42 | * which is a @c GPBExtensionRegistry that includes all the extensions defined by
43 | * this file and all files that it depends on.
44 | **/
45 | @interface OperationsRoot : GPBRootObject
46 | @end
47 |
48 | #pragma mark - Operation
49 |
50 | typedef GPB_ENUM(Operation_FieldNumber) {
51 | Operation_FieldNumber_Name = 1,
52 | Operation_FieldNumber_Metadata = 2,
53 | Operation_FieldNumber_Done = 3,
54 | Operation_FieldNumber_Error = 4,
55 | Operation_FieldNumber_Response = 5,
56 | };
57 |
58 | typedef GPB_ENUM(Operation_Result_OneOfCase) {
59 | Operation_Result_OneOfCase_GPBUnsetOneOfCase = 0,
60 | Operation_Result_OneOfCase_Error = 4,
61 | Operation_Result_OneOfCase_Response = 5,
62 | };
63 |
64 | /**
65 | * This resource represents a long-running operation that is the result of a
66 | * network API call.
67 | **/
68 | @interface Operation : GPBMessage
69 |
70 | /**
71 | * The name of the operation resource, which is only unique within the same
72 | * service that originally returns it.
73 | **/
74 | @property(nonatomic, readwrite, copy, null_resettable) NSString *name;
75 |
76 | /**
77 | * Some service-specific metadata associated with the operation. It typically
78 | * contains progress information and common metadata such as create time.
79 | * Some services may not provide such metadata. Any method that returns a
80 | * long-running operation should document the metadata type, if any.
81 | **/
82 | @property(nonatomic, readwrite, strong, null_resettable) GPBAny *metadata;
83 | /** Test to see if @c metadata has been set. */
84 | @property(nonatomic, readwrite) BOOL hasMetadata;
85 |
86 | /**
87 | * If the value is false, it means the operation is still in progress.
88 | * If true, the operation is completed and the `result` is available.
89 | **/
90 | @property(nonatomic, readwrite) BOOL done;
91 |
92 | @property(nonatomic, readonly) Operation_Result_OneOfCase resultOneOfCase;
93 |
94 | /** The error result of the operation in case of failure. */
95 | @property(nonatomic, readwrite, strong, null_resettable) Status *error;
96 |
97 | /**
98 | * The normal response of the operation in case of success. If the original
99 | * method returns no data on success, such as `Delete`, the response will be
100 | * `google.protobuf.Empty`. If the original method is standard
101 | * `Get`/`Create`/`Update`, the response should be the resource. For other
102 | * methods, the response should have the type `XxxResponse`, where `Xxx`
103 | * is the original method name. For example, if the original method name
104 | * is `TakeSnapshot()`, the inferred response type will be
105 | * `TakeSnapshotResponse`.
106 | **/
107 | @property(nonatomic, readwrite, strong, null_resettable) GPBAny *response;
108 |
109 | @end
110 |
111 | /**
112 | * Clears whatever value was set for the oneof 'result'.
113 | **/
114 | void Operation_ClearResultOneOfCase(Operation *message);
115 |
116 | #pragma mark - GetOperationRequest
117 |
118 | typedef GPB_ENUM(GetOperationRequest_FieldNumber) {
119 | GetOperationRequest_FieldNumber_Name = 1,
120 | };
121 |
122 | /**
123 | * The request message for [Operations.GetOperation][google.longrunning.Operations.GetOperation].
124 | **/
125 | @interface GetOperationRequest : GPBMessage
126 |
127 | /** The name of the operation resource. */
128 | @property(nonatomic, readwrite, copy, null_resettable) NSString *name;
129 |
130 | @end
131 |
132 | #pragma mark - ListOperationsRequest
133 |
134 | typedef GPB_ENUM(ListOperationsRequest_FieldNumber) {
135 | ListOperationsRequest_FieldNumber_Filter = 1,
136 | ListOperationsRequest_FieldNumber_PageSize = 2,
137 | ListOperationsRequest_FieldNumber_PageToken = 3,
138 | ListOperationsRequest_FieldNumber_Name = 4,
139 | };
140 |
141 | /**
142 | * The request message for [Operations.ListOperations][google.longrunning.Operations.ListOperations].
143 | **/
144 | @interface ListOperationsRequest : GPBMessage
145 |
146 | /** The name of the operation collection. */
147 | @property(nonatomic, readwrite, copy, null_resettable) NSString *name;
148 |
149 | /** The standard List filter. */
150 | @property(nonatomic, readwrite, copy, null_resettable) NSString *filter;
151 |
152 | /** The standard List page size. */
153 | @property(nonatomic, readwrite) int32_t pageSize;
154 |
155 | /** The standard List page token. */
156 | @property(nonatomic, readwrite, copy, null_resettable) NSString *pageToken;
157 |
158 | @end
159 |
160 | #pragma mark - ListOperationsResponse
161 |
162 | typedef GPB_ENUM(ListOperationsResponse_FieldNumber) {
163 | ListOperationsResponse_FieldNumber_OperationsArray = 1,
164 | ListOperationsResponse_FieldNumber_NextPageToken = 2,
165 | };
166 |
167 | /**
168 | * The response message for [Operations.ListOperations][google.longrunning.Operations.ListOperations].
169 | **/
170 | @interface ListOperationsResponse : GPBMessage
171 |
172 | /** A list of operations that match the specified filter in the request. */
173 | @property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *operationsArray;
174 | /** The number of items in @c operationsArray without causing the array to be created. */
175 | @property(nonatomic, readonly) NSUInteger operationsArray_Count;
176 |
177 | /** The standard List next-page token. */
178 | @property(nonatomic, readwrite, copy, null_resettable) NSString *nextPageToken;
179 |
180 | @end
181 |
182 | #pragma mark - CancelOperationRequest
183 |
184 | typedef GPB_ENUM(CancelOperationRequest_FieldNumber) {
185 | CancelOperationRequest_FieldNumber_Name = 1,
186 | };
187 |
188 | /**
189 | * The request message for [Operations.CancelOperation][google.longrunning.Operations.CancelOperation].
190 | **/
191 | @interface CancelOperationRequest : GPBMessage
192 |
193 | /** The name of the operation resource to be cancelled. */
194 | @property(nonatomic, readwrite, copy, null_resettable) NSString *name;
195 |
196 | @end
197 |
198 | #pragma mark - DeleteOperationRequest
199 |
200 | typedef GPB_ENUM(DeleteOperationRequest_FieldNumber) {
201 | DeleteOperationRequest_FieldNumber_Name = 1,
202 | };
203 |
204 | /**
205 | * The request message for [Operations.DeleteOperation][google.longrunning.Operations.DeleteOperation].
206 | **/
207 | @interface DeleteOperationRequest : GPBMessage
208 |
209 | /** The name of the operation resource to be deleted. */
210 | @property(nonatomic, readwrite, copy, null_resettable) NSString *name;
211 |
212 | @end
213 |
214 | NS_ASSUME_NONNULL_END
215 |
216 | CF_EXTERN_C_END
217 |
218 | #pragma clang diagnostic pop
219 |
220 | // @@protoc_insertion_point(global_scope)
221 |
--------------------------------------------------------------------------------
/ios/google/rpc/code.proto:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2015, Google Inc.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package google.rpc;
18 |
19 | option java_multiple_files = true;
20 | option java_outer_classname = "CodeProto";
21 | option java_package = "com.google.rpc";
22 |
23 |
24 | // The canonical error codes for Google APIs.
25 | // Warnings:
26 | //
27 | // - Do not change any numeric assignments.
28 | // - Changes to this list should be made only if there is a compelling
29 | // need that can't be satisfied in another way.
30 | //
31 | // Sometimes multiple error codes may apply. Services should return
32 | // the most specific error code that applies. For example, prefer
33 | // `OUT_OF_RANGE` over `FAILED_PRECONDITION` if both codes apply.
34 | // Similarly prefer `NOT_FOUND` or `ALREADY_EXISTS` over `FAILED_PRECONDITION`.
35 | enum Code {
36 | // Not an error; returned on success
37 | //
38 | // HTTP Mapping: 200 OK
39 | OK = 0;
40 |
41 | // The operation was cancelled, typically by the caller.
42 | //
43 | // HTTP Mapping: 499 Client Closed Request
44 | CANCELLED = 1;
45 |
46 | // Unknown error. For example, this error may be returned when
47 | // a `Status` value received from another address space belongs to
48 | // an error space that is not known in this address space. Also
49 | // errors raised by APIs that do not return enough error information
50 | // may be converted to this error.
51 | //
52 | // HTTP Mapping: 500 Internal Server Error
53 | UNKNOWN = 2;
54 |
55 | // The client specified an invalid argument. Note that this differs
56 | // from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments
57 | // that are problematic regardless of the state of the system
58 | // (e.g., a malformed file name).
59 | //
60 | // HTTP Mapping: 400 Bad Request
61 | INVALID_ARGUMENT = 3;
62 |
63 | // The deadline expired before the operation could complete. For operations
64 | // that change the state of the system, this error may be returned
65 | // even if the operation has completed successfully. For example, a
66 | // successful response from a server could have been delayed long
67 | // enough for the deadline to expire.
68 | //
69 | // HTTP Mapping: 504 Gateway Timeout
70 | DEADLINE_EXCEEDED = 4;
71 |
72 | // Some requested entity (e.g., file or directory) was not found.
73 | // For privacy reasons, this code *might* be returned when the client
74 | // does not have the access rights to the entity.
75 | //
76 | // HTTP Mapping: 404 Not Found
77 | NOT_FOUND = 5;
78 |
79 | // The entity that a client attempted to create (e.g., file or directory)
80 | // already exists.
81 | //
82 | // HTTP Mapping: 409 Conflict
83 | ALREADY_EXISTS = 6;
84 |
85 | // The caller does not have permission to execute the specified
86 | // operation. `PERMISSION_DENIED` must not be used for rejections
87 | // caused by exhausting some resource (use `RESOURCE_EXHAUSTED`
88 | // instead for those errors). `PERMISSION_DENIED` must not be
89 | // used if the caller can not be identified (use `UNAUTHENTICATED`
90 | // instead for those errors).
91 | //
92 | // HTTP Mapping: 403 Forbidden
93 | PERMISSION_DENIED = 7;
94 |
95 | // The request does not have valid authentication credentials for the
96 | // operation.
97 | //
98 | // HTTP Mapping: 401 Unauthorized
99 | UNAUTHENTICATED = 16;
100 |
101 | // Some resource has been exhausted, perhaps a per-user quota, or
102 | // perhaps the entire file system is out of space.
103 | //
104 | // HTTP Mapping: 429 Too Many Requests
105 | RESOURCE_EXHAUSTED = 8;
106 |
107 | // The operation was rejected because the system is not in a state
108 | // required for the operation's execution. For example, the directory
109 | // to be deleted is non-empty, an rmdir operation is applied to
110 | // a non-directory, etc.
111 | //
112 | // Service implementors can use the following guidelines to decide
113 | // between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`:
114 | // (a) Use `UNAVAILABLE` if the client can retry just the failing call.
115 | // (b) Use `ABORTED` if the client should retry at a higher level
116 | // (e.g., restarting a read-modify-write sequence).
117 | // (c) Use `FAILED_PRECONDITION` if the client should not retry until
118 | // the system state has been explicitly fixed. E.g., if an "rmdir"
119 | // fails because the directory is non-empty, `FAILED_PRECONDITION`
120 | // should be returned since the client should not retry unless
121 | // the files are deleted from the directory.
122 | // (d) Use `FAILED_PRECONDITION` if the client performs conditional
123 | // REST Get/Update/Delete on a resource and the resource on the
124 | // server does not match the condition. E.g., conflicting
125 | // read-modify-write on the same resource.
126 | //
127 | // HTTP Mapping: 400 Bad Request
128 | //
129 | // NOTE: HTTP spec says `412 Precondition Failed` should be used only if
130 | // the request contains Etag-related headers. So if the server does see
131 | // Etag-related headers in the request, it may choose to return 412
132 | // instead of 400 for this error code.
133 | FAILED_PRECONDITION = 9;
134 |
135 | // The operation was aborted, typically due to a concurrency issue such as
136 | // a sequencer check failure or transaction abort.
137 | //
138 | // See the guidelines above for deciding between `FAILED_PRECONDITION`,
139 | // `ABORTED`, and `UNAVAILABLE`.
140 | //
141 | // HTTP Mapping: 409 Conflict
142 | ABORTED = 10;
143 |
144 | // The operation was attempted past the valid range. E.g., seeking or
145 | // reading past end-of-file.
146 | //
147 | // Unlike `INVALID_ARGUMENT`, this error indicates a problem that may
148 | // be fixed if the system state changes. For example, a 32-bit file
149 | // system will generate `INVALID_ARGUMENT` if asked to read at an
150 | // offset that is not in the range [0,2^32-1], but it will generate
151 | // `OUT_OF_RANGE` if asked to read from an offset past the current
152 | // file size.
153 | //
154 | // There is a fair bit of overlap between `FAILED_PRECONDITION` and
155 | // `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific
156 | // error) when it applies so that callers who are iterating through
157 | // a space can easily look for an `OUT_OF_RANGE` error to detect when
158 | // they are done.
159 | //
160 | // HTTP Mapping: 400 Bad Request
161 | OUT_OF_RANGE = 11;
162 |
163 | // The operation is not implemented or is not supported/enabled in this
164 | // service.
165 | //
166 | // HTTP Mapping: 501 Not Implemented
167 | UNIMPLEMENTED = 12;
168 |
169 | // Internal errors. This means that some invariants expected by the
170 | // underlying system have been broken. This error code is reserved
171 | // for serious errors.
172 | //
173 | // HTTP Mapping: 500 Internal Server Error
174 | INTERNAL = 13;
175 |
176 | // The service is currently unavailable. This is most likely a
177 | // transient condition, which can be corrected by retrying with
178 | // a backoff.
179 | //
180 | // See the guidelines above for deciding between `FAILED_PRECONDITION`,
181 | // `ABORTED`, and `UNAVAILABLE`.
182 | //
183 | // HTTP Mapping: 503 Service Unavailable
184 | UNAVAILABLE = 14;
185 |
186 | // Unrecoverable data loss or corruption.
187 | //
188 | // HTTP Mapping: 500 Internal Server Error
189 | DATA_LOSS = 15;
190 | }
191 |
--------------------------------------------------------------------------------
/ios/google/api/HTTP.pbobjc.m:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: google/api/http.proto
3 |
4 | // This CPP symbol can be defined to use imports that match up to the framework
5 | // imports needed when using CocoaPods.
6 | #if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
7 | #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
8 | #endif
9 |
10 | #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
11 | #import
12 | #else
13 | #import "GPBProtocolBuffers_RuntimeSupport.h"
14 | #endif
15 |
16 | #import "google/api/HTTP.pbobjc.h"
17 | // @@protoc_insertion_point(imports)
18 |
19 | #pragma clang diagnostic push
20 | #pragma clang diagnostic ignored "-Wdeprecated-declarations"
21 | #pragma clang diagnostic ignored "-Wdirect-ivar-access"
22 |
23 | #pragma mark - HTTPRoot
24 |
25 | @implementation HTTPRoot
26 |
27 | @end
28 |
29 | #pragma mark - HTTPRoot_FileDescriptor
30 |
31 | static GPBFileDescriptor *HTTPRoot_FileDescriptor(void) {
32 | // This is called by +initialize so there is no need to worry
33 | // about thread safety of the singleton.
34 | static GPBFileDescriptor *descriptor = NULL;
35 | if (!descriptor) {
36 | GPBDebugCheckRuntimeVersion();
37 | descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.api"
38 | syntax:GPBFileSyntaxProto3];
39 | }
40 | return descriptor;
41 | }
42 |
43 | #pragma mark - HttpRule
44 |
45 | @implementation HttpRule
46 |
47 | @dynamic patternOneOfCase;
48 | @dynamic get;
49 | @dynamic put;
50 | @dynamic post;
51 | @dynamic delete_p;
52 | @dynamic patch;
53 | @dynamic custom;
54 | @dynamic body;
55 | @dynamic additionalBindingsArray, additionalBindingsArray_Count;
56 |
57 | typedef struct HttpRule__storage_ {
58 | uint32_t _has_storage_[2];
59 | NSString *get;
60 | NSString *put;
61 | NSString *post;
62 | NSString *delete_p;
63 | NSString *patch;
64 | NSString *body;
65 | CustomHttpPattern *custom;
66 | NSMutableArray *additionalBindingsArray;
67 | } HttpRule__storage_;
68 |
69 | // This method is threadsafe because it is initially called
70 | // in +initialize for each subclass.
71 | + (GPBDescriptor *)descriptor {
72 | static GPBDescriptor *descriptor = nil;
73 | if (!descriptor) {
74 | static GPBMessageFieldDescription fields[] = {
75 | {
76 | .name = "get",
77 | .dataTypeSpecific.className = NULL,
78 | .number = HttpRule_FieldNumber_Get,
79 | .hasIndex = -1,
80 | .offset = (uint32_t)offsetof(HttpRule__storage_, get),
81 | .flags = GPBFieldOptional,
82 | .dataType = GPBDataTypeString,
83 | },
84 | {
85 | .name = "put",
86 | .dataTypeSpecific.className = NULL,
87 | .number = HttpRule_FieldNumber_Put,
88 | .hasIndex = -1,
89 | .offset = (uint32_t)offsetof(HttpRule__storage_, put),
90 | .flags = GPBFieldOptional,
91 | .dataType = GPBDataTypeString,
92 | },
93 | {
94 | .name = "post",
95 | .dataTypeSpecific.className = NULL,
96 | .number = HttpRule_FieldNumber_Post,
97 | .hasIndex = -1,
98 | .offset = (uint32_t)offsetof(HttpRule__storage_, post),
99 | .flags = GPBFieldOptional,
100 | .dataType = GPBDataTypeString,
101 | },
102 | {
103 | .name = "delete_p",
104 | .dataTypeSpecific.className = NULL,
105 | .number = HttpRule_FieldNumber_Delete_p,
106 | .hasIndex = -1,
107 | .offset = (uint32_t)offsetof(HttpRule__storage_, delete_p),
108 | .flags = GPBFieldOptional,
109 | .dataType = GPBDataTypeString,
110 | },
111 | {
112 | .name = "patch",
113 | .dataTypeSpecific.className = NULL,
114 | .number = HttpRule_FieldNumber_Patch,
115 | .hasIndex = -1,
116 | .offset = (uint32_t)offsetof(HttpRule__storage_, patch),
117 | .flags = GPBFieldOptional,
118 | .dataType = GPBDataTypeString,
119 | },
120 | {
121 | .name = "body",
122 | .dataTypeSpecific.className = NULL,
123 | .number = HttpRule_FieldNumber_Body,
124 | .hasIndex = 0,
125 | .offset = (uint32_t)offsetof(HttpRule__storage_, body),
126 | .flags = GPBFieldOptional,
127 | .dataType = GPBDataTypeString,
128 | },
129 | {
130 | .name = "custom",
131 | .dataTypeSpecific.className = GPBStringifySymbol(CustomHttpPattern),
132 | .number = HttpRule_FieldNumber_Custom,
133 | .hasIndex = -1,
134 | .offset = (uint32_t)offsetof(HttpRule__storage_, custom),
135 | .flags = GPBFieldOptional,
136 | .dataType = GPBDataTypeMessage,
137 | },
138 | {
139 | .name = "additionalBindingsArray",
140 | .dataTypeSpecific.className = GPBStringifySymbol(HttpRule),
141 | .number = HttpRule_FieldNumber_AdditionalBindingsArray,
142 | .hasIndex = GPBNoHasBit,
143 | .offset = (uint32_t)offsetof(HttpRule__storage_, additionalBindingsArray),
144 | .flags = GPBFieldRepeated,
145 | .dataType = GPBDataTypeMessage,
146 | },
147 | };
148 | GPBDescriptor *localDescriptor =
149 | [GPBDescriptor allocDescriptorForClass:[HttpRule class]
150 | rootClass:[HTTPRoot class]
151 | file:HTTPRoot_FileDescriptor()
152 | fields:fields
153 | fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
154 | storageSize:sizeof(HttpRule__storage_)
155 | flags:0];
156 | static const char *oneofs[] = {
157 | "pattern",
158 | };
159 | [localDescriptor setupOneofs:oneofs
160 | count:(uint32_t)(sizeof(oneofs) / sizeof(char*))
161 | firstHasIndex:-1];
162 | NSAssert(descriptor == nil, @"Startup recursed!");
163 | descriptor = localDescriptor;
164 | }
165 | return descriptor;
166 | }
167 |
168 | @end
169 |
170 | void HttpRule_ClearPatternOneOfCase(HttpRule *message) {
171 | GPBDescriptor *descriptor = [message descriptor];
172 | GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0];
173 | GPBMaybeClearOneof(message, oneof, -1, 0);
174 | }
175 | #pragma mark - CustomHttpPattern
176 |
177 | @implementation CustomHttpPattern
178 |
179 | @dynamic kind;
180 | @dynamic path;
181 |
182 | typedef struct CustomHttpPattern__storage_ {
183 | uint32_t _has_storage_[1];
184 | NSString *kind;
185 | NSString *path;
186 | } CustomHttpPattern__storage_;
187 |
188 | // This method is threadsafe because it is initially called
189 | // in +initialize for each subclass.
190 | + (GPBDescriptor *)descriptor {
191 | static GPBDescriptor *descriptor = nil;
192 | if (!descriptor) {
193 | static GPBMessageFieldDescription fields[] = {
194 | {
195 | .name = "kind",
196 | .dataTypeSpecific.className = NULL,
197 | .number = CustomHttpPattern_FieldNumber_Kind,
198 | .hasIndex = 0,
199 | .offset = (uint32_t)offsetof(CustomHttpPattern__storage_, kind),
200 | .flags = GPBFieldOptional,
201 | .dataType = GPBDataTypeString,
202 | },
203 | {
204 | .name = "path",
205 | .dataTypeSpecific.className = NULL,
206 | .number = CustomHttpPattern_FieldNumber_Path,
207 | .hasIndex = 1,
208 | .offset = (uint32_t)offsetof(CustomHttpPattern__storage_, path),
209 | .flags = GPBFieldOptional,
210 | .dataType = GPBDataTypeString,
211 | },
212 | };
213 | GPBDescriptor *localDescriptor =
214 | [GPBDescriptor allocDescriptorForClass:[CustomHttpPattern class]
215 | rootClass:[HTTPRoot class]
216 | file:HTTPRoot_FileDescriptor()
217 | fields:fields
218 | fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
219 | storageSize:sizeof(CustomHttpPattern__storage_)
220 | flags:0];
221 | NSAssert(descriptor == nil, @"Startup recursed!");
222 | descriptor = localDescriptor;
223 | }
224 | return descriptor;
225 | }
226 |
227 | @end
228 |
229 |
230 | #pragma clang diagnostic pop
231 |
232 | // @@protoc_insertion_point(global_scope)
233 |
--------------------------------------------------------------------------------
/windows/RNGoogleSpeechApi/RNGoogleSpeechApi.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {CF85D3A0-A4CB-11E7-96F5-393F801E4804}
8 | Library
9 | Properties
10 | RNGoogleSpeechApi
11 | RNGoogleSpeechApi
12 | en-US
13 | UAP
14 | 10.0.10586.0
15 | 10.0.10240.0
16 | 14
17 | 512
18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
19 | ..\..\node_modules
20 |
21 |
22 | ..\..
23 |
24 |
25 | AnyCPU
26 | true
27 | full
28 | false
29 | bin\Debug\
30 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
31 | prompt
32 | 4
33 |
34 |
35 | AnyCPU
36 | pdbonly
37 | true
38 | bin\Release\
39 | TRACE;NETFX_CORE;WINDOWS_UWP
40 | prompt
41 | 4
42 |
43 |
44 | x86
45 | true
46 | bin\x86\Debug\
47 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
48 | ;2008
49 | full
50 | x86
51 | false
52 | prompt
53 |
54 |
55 | x86
56 | bin\x86\Release\
57 | TRACE;NETFX_CORE;WINDOWS_UWP
58 | true
59 | ;2008
60 | pdbonly
61 | x86
62 | false
63 | prompt
64 |
65 |
66 | ARM
67 | true
68 | bin\ARM\Debug\
69 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
70 | ;2008
71 | full
72 | ARM
73 | false
74 | prompt
75 |
76 |
77 | ARM
78 | bin\ARM\Release\
79 | TRACE;NETFX_CORE;WINDOWS_UWP
80 | true
81 | ;2008
82 | pdbonly
83 | ARM
84 | false
85 | prompt
86 |
87 |
88 | x64
89 | true
90 | bin\x64\Debug\
91 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
92 | ;2008
93 | full
94 | x64
95 | false
96 | prompt
97 |
98 |
99 | x64
100 | bin\x64\Release\
101 | TRACE;NETFX_CORE;WINDOWS_UWP
102 | true
103 | ;2008
104 | pdbonly
105 | x64
106 | false
107 | prompt
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 | {c7673ad5-e3aa-468c-a5fd-fa38154e205c}
122 | ReactNative
123 |
124 |
125 |
126 | 14.0
127 |
128 |
129 | true
130 | bin\Development\
131 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
132 | true
133 | full
134 | AnyCPU
135 | false
136 | prompt
137 | MinimumRecommendedRules.ruleset
138 |
139 |
140 | true
141 | bin\x86\Development\
142 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
143 | ;2008
144 | true
145 | full
146 | x86
147 | false
148 | prompt
149 | MinimumRecommendedRules.ruleset
150 |
151 |
152 | true
153 | bin\ARM\Development\
154 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
155 | ;2008
156 | true
157 | full
158 | ARM
159 | false
160 | prompt
161 | MinimumRecommendedRules.ruleset
162 |
163 |
164 | true
165 | bin\x64\Development\
166 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
167 | ;2008
168 | true
169 | full
170 | x64
171 | false
172 | prompt
173 | MinimumRecommendedRules.ruleset
174 |
175 |
176 |
183 |
184 |
--------------------------------------------------------------------------------