Skip to content

Commit

Permalink
fix: enable REST numeric enums (#1829)
Browse files Browse the repository at this point in the history
* feat(typescript): enable REST transport

To use REST transport, pass {fallback: "rest"} to the client constructor.

PiperOrigin-RevId: 512747300

Source-Link: googleapis/googleapis@b0f2af1

Source-Link: googleapis/googleapis-gen@c986984
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzk4Njk4NDkwZWFiNzYwMzJkMjA2MDZlMjE0ZDMxMDM5NGU3OTMwZSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix(deps): bump google-gax to ^3.5.7

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Alexander Fenster <fenster@google.com>
  • Loading branch information
3 people committed Feb 28, 2023
1 parent a7e4212 commit 3737696
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 2 deletions.
72 changes: 72 additions & 0 deletions dev/protos/google/api/launch_stage.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright 2015 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.api;

option go_package = "google.golang.org/genproto/googleapis/api;api";
option java_multiple_files = true;
option java_outer_classname = "LaunchStageProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";

// The launch stage as defined by [Google Cloud Platform
// Launch Stages](https://cloud.google.com/terms/launch-stages).
enum LaunchStage {
// Do not use this default value.
LAUNCH_STAGE_UNSPECIFIED = 0;

// The feature is not yet implemented. Users can not use it.
UNIMPLEMENTED = 6;

// Prelaunch features are hidden from users and are only visible internally.
PRELAUNCH = 7;

// Early Access features are limited to a closed group of testers. To use
// these features, you must sign up in advance and sign a Trusted Tester
// agreement (which includes confidentiality provisions). These features may
// be unstable, changed in backward-incompatible ways, and are not
// guaranteed to be released.
EARLY_ACCESS = 1;

// Alpha is a limited availability test for releases before they are cleared
// for widespread use. By Alpha, all significant design issues are resolved
// and we are in the process of verifying functionality. Alpha customers
// need to apply for access, agree to applicable terms, and have their
// projects allowlisted. Alpha releases don't have to be feature complete,
// no SLAs are provided, and there are no technical support obligations, but
// they will be far enough along that customers can actually use them in
// test environments or for limited-use tests -- just like they would in
// normal production cases.
ALPHA = 2;

// Beta is the point at which we are ready to open a release for any
// customer to use. There are no SLA or technical support obligations in a
// Beta release. Products will be complete from a feature perspective, but
// may have some open outstanding issues. Beta releases are suitable for
// limited production use cases.
BETA = 3;

// GA features are open to all developers and are considered stable and
// fully qualified for production use.
GA = 4;

// Deprecated features are scheduled to be shut down and removed. For more
// information, see the "Deprecation Policy" section of our [Terms of
// Service](https://cloud.google.com/terms/)
// and the [Google Cloud Platform Subject to the Deprecation
// Policy](https://cloud.google.com/terms/deprecation) documentation.
DEPRECATED = 5;
}
2 changes: 1 addition & 1 deletion dev/protos/google/protobuf/struct.proto
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ message Value {
// `NullValue` is a singleton enumeration to represent the null value for the
// `Value` type union.
//
// The JSON representation for `NullValue` is JSON `null`.
// The JSON representation for `NullValue` is JSON `null`.
enum NullValue {
// Null value.
NULL_VALUE = 0;
Expand Down
3 changes: 3 additions & 0 deletions dev/src/v1/firestore_admin_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ export class FirestoreAdminClient {
(typeof window !== 'undefined' && typeof window?.fetch === 'function');
opts = Object.assign({servicePath, port, clientConfig, fallback}, opts);

// Request numeric enum values if REST transport is used.
opts.numericEnums = true;

// If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) {
opts['scopes'] = staticMembers.scopes;
Expand Down
3 changes: 3 additions & 0 deletions dev/src/v1/firestore_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ export class FirestoreClient {
(typeof window !== 'undefined' && typeof window?.fetch === 'function');
opts = Object.assign({servicePath, port, clientConfig, fallback}, opts);

// Request numeric enum values if REST transport is used.
opts.numericEnums = true;

// If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) {
opts['scopes'] = staticMembers.scopes;
Expand Down
3 changes: 3 additions & 0 deletions dev/src/v1beta1/firestore_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ export class FirestoreClient {
(typeof window !== 'undefined' && typeof window?.fetch === 'function');
opts = Object.assign({servicePath, port, clientConfig, fallback}, opts);

// Request numeric enum values if REST transport is used.
opts.numericEnums = true;

// If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) {
opts['scopes'] = staticMembers.scopes;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"dependencies": {
"fast-deep-equal": "^3.1.1",
"functional-red-black-tree": "^1.0.1",
"google-gax": "^3.5.3",
"google-gax": "^3.5.7",
"protobufjs": "^7.0.0"
},
"devDependencies": {
Expand Down

0 comments on commit 3737696

Please sign in to comment.