Skip to content

Commit

Permalink
feat(fdc): Upgrade to v1beta endpoint (#13373)
Browse files Browse the repository at this point in the history
  • Loading branch information
maneesht authored Sep 25, 2024
1 parent ff1e5f6 commit 77ded00
Show file tree
Hide file tree
Showing 17 changed files with 151 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@ mutation addDirectorToMovie($personId: Person_Key, $movieId: UUID)
@auth(level: PUBLIC) {
directedBy_insert(data: { directedby: $personId, movieId: $movieId })
}
mutation seedMovies @auth(level: PUBLIC) {
the_matrix: movie_insert(
data: {
title: "The Matrix"
releaseYear: 1999
genre: "Sci-Fi"
rating: 5.0
description: "When a beautiful stranger leads computer hacker Neo to a forbidding underworld, he discovers the shocking truth--the life he knows is the elaborate deception of an evil cyber-intelligence."
}
)
jurassic_park: movie_insert(
data: {
title: "Jurassic Park"
releaseYear: 1993
genre: "Adventure"
rating: 5.0
description: "An industrialist invites some experts to visit his theme park of cloned dinosaurs. After a power failure, the creatures run loose, putting everyone's lives, including his grandchildren's, in danger."
}
)
}
mutation createMovie(
$title: String!
$releaseYear: Int!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ part 'add_person.dart';

part 'add_director_to_movie.dart';

part 'seed_movies.dart';

part 'create_movie.dart';

part 'delete_movie.dart';
Expand All @@ -38,6 +40,10 @@ class MoviesConnector {
return AddDirectorToMovie(dataConnect: dataConnect);
}

SeedMovies get seedMovies {
return SeedMovies(dataConnect: dataConnect);
}

CreateMovie get createMovie {
return CreateMovie(dataConnect: dataConnect);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
part of movies;

class SeedMovies {
String name = "seedMovies";
SeedMovies({required this.dataConnect});

Deserializer<SeedMoviesResponse> dataDeserializer = (String json) =>
SeedMoviesResponse.fromJson(jsonDecode(json) as Map<String, dynamic>);

MutationRef<SeedMoviesResponse, void> ref() {
return dataConnect.mutation(
this.name, dataDeserializer, emptySerializer, null);
}

FirebaseDataConnect dataConnect;
}

class SeedMoviesTheMatrix {
late String id;

SeedMoviesTheMatrix.fromJson(Map<String, dynamic> json) : id = json['id'] {}

// TODO(mtewani): Fix up to create a map on the fly
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};

json['id'] = id;

return json;
}

SeedMoviesTheMatrix({
required this.id,
}) {
// TODO(mtewani): Only show this if there are optional fields.
}
}

class SeedMoviesJurassicPark {
late String id;

SeedMoviesJurassicPark.fromJson(Map<String, dynamic> json)
: id = json['id'] {}

// TODO(mtewani): Fix up to create a map on the fly
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};

json['id'] = id;

return json;
}

SeedMoviesJurassicPark({
required this.id,
}) {
// TODO(mtewani): Only show this if there are optional fields.
}
}

class SeedMoviesResponse {
late SeedMoviesTheMatrix the_matrix;

late SeedMoviesJurassicPark jurassic_park;

SeedMoviesResponse.fromJson(Map<String, dynamic> json)
: the_matrix = SeedMoviesTheMatrix.fromJson(json['the_matrix']),
jurassic_park =
SeedMoviesJurassicPark.fromJson(json['jurassic_park']) {}

// TODO(mtewani): Fix up to create a map on the fly
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};

json['the_matrix'] = the_matrix.toJson();

json['jurassic_park'] = jurassic_park.toJson();

return json;
}

SeedMoviesResponse({
required this.the_matrix,
required this.jurassic_park,
}) {
// TODO(mtewani): Only show this if there are optional fields.
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2024, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

//
// Generated code. Do not modify.
// source: connector_service.proto
Expand Down Expand Up @@ -50,7 +49,7 @@ class ExecuteQueryRequest extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'ExecuteQueryRequest',
package: const $pb.PackageName(
_omitMessageNames ? '' : 'google.firebase.dataconnect.v1alpha'),
_omitMessageNames ? '' : 'google.firebase.dataconnect.v1beta'),
createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'name')
..aOS(2, _omitFieldNames ? '' : 'operationName')
Expand Down Expand Up @@ -161,7 +160,7 @@ class ExecuteMutationRequest extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'ExecuteMutationRequest',
package: const $pb.PackageName(
_omitMessageNames ? '' : 'google.firebase.dataconnect.v1alpha'),
_omitMessageNames ? '' : 'google.firebase.dataconnect.v1beta'),
createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'name')
..aOS(2, _omitFieldNames ? '' : 'operationName')
Expand Down Expand Up @@ -270,7 +269,7 @@ class ExecuteQueryResponse extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'ExecuteQueryResponse',
package: const $pb.PackageName(
_omitMessageNames ? '' : 'google.firebase.dataconnect.v1alpha'),
_omitMessageNames ? '' : 'google.firebase.dataconnect.v1beta'),
createEmptyInstance: create)
..aOM<$1.Struct>(1, _omitFieldNames ? '' : 'data',
subBuilder: $1.Struct.create)
Expand Down Expand Up @@ -349,7 +348,7 @@ class ExecuteMutationResponse extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'ExecuteMutationResponse',
package: const $pb.PackageName(
_omitMessageNames ? '' : 'google.firebase.dataconnect.v1alpha'),
_omitMessageNames ? '' : 'google.firebase.dataconnect.v1beta'),
createEmptyInstance: create)
..aOM<$1.Struct>(1, _omitFieldNames ? '' : 'data',
subBuilder: $1.Struct.create)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2024, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

//
// Generated code. Do not modify.
// source: connector_service.proto
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2024, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

//
// Generated code. Do not modify.
// source: connector_service.proto
Expand All @@ -23,25 +22,26 @@ import 'connector_service.pb.dart' as $0;

export 'connector_service.pb.dart';

@$pb.GrpcServiceName('google.firebase.dataconnect.v1alpha.ConnectorService')
@$pb.GrpcServiceName('google.firebase.dataconnect.v1beta.ConnectorService')
class ConnectorServiceClient extends $grpc.Client {
ConnectorServiceClient($grpc.ClientChannel channel,
{$grpc.CallOptions? options,
$core.Iterable<$grpc.ClientInterceptor>? interceptors})
: super(channel, options: options, interceptors: interceptors);
static final _$executeQuery =
$grpc.ClientMethod<$0.ExecuteQueryRequest, $0.ExecuteQueryResponse>(
'/google.firebase.dataconnect.v1alpha.ConnectorService/ExecuteQuery',
'/google.firebase.dataconnect.v1beta.ConnectorService/ExecuteQuery',
($0.ExecuteQueryRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) =>
$0.ExecuteQueryResponse.fromBuffer(value));
static final _$executeMutation = $grpc.ClientMethod<$0.ExecuteMutationRequest,
$0.ExecuteMutationResponse>(
'/google.firebase.dataconnect.v1alpha.ConnectorService/ExecuteMutation',
'/google.firebase.dataconnect.v1beta.ConnectorService/ExecuteMutation',
($0.ExecuteMutationRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) =>
$0.ExecuteMutationResponse.fromBuffer(value));

ConnectorServiceClient($grpc.ClientChannel channel,
{$grpc.CallOptions? options,
$core.Iterable<$grpc.ClientInterceptor>? interceptors})
: super(channel, options: options, interceptors: interceptors);

$grpc.ResponseFuture<$0.ExecuteQueryResponse> executeQuery(
$0.ExecuteQueryRequest request,
{$grpc.CallOptions? options}) {
Expand All @@ -55,8 +55,11 @@ class ConnectorServiceClient extends $grpc.Client {
}
}

@$pb.GrpcServiceName('google.firebase.dataconnect.v1alpha.ConnectorService')
@$pb.GrpcServiceName('google.firebase.dataconnect.v1beta.ConnectorService')
abstract class ConnectorServiceBase extends $grpc.Service {
$core.String get $name =>
'google.firebase.dataconnect.v1beta.ConnectorService';

ConnectorServiceBase() {
$addMethod(
$grpc.ServiceMethod<$0.ExecuteQueryRequest, $0.ExecuteQueryResponse>(
Expand All @@ -77,8 +80,6 @@ abstract class ConnectorServiceBase extends $grpc.Service {
$0.ExecuteMutationRequest.fromBuffer(value),
($0.ExecuteMutationResponse value) => value.writeToBuffer()));
}
$core.String get $name =>
'google.firebase.dataconnect.v1alpha.ConnectorService';

$async.Future<$0.ExecuteQueryResponse> executeQuery_Pre(
$grpc.ServiceCall call,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2024, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

//
// Generated code. Do not modify.
// source: connector_service.proto
Expand Down Expand Up @@ -96,7 +95,7 @@ const ExecuteQueryResponse$json = {
'3': 2,
'4': 3,
'5': 11,
'6': '.google.firebase.dataconnect.v1alpha.GraphqlError',
'6': '.google.firebase.dataconnect.v1beta.GraphqlError',
'10': 'errors'
},
],
Expand All @@ -105,8 +104,8 @@ const ExecuteQueryResponse$json = {
/// Descriptor for `ExecuteQueryResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List executeQueryResponseDescriptor = $convert.base64Decode(
'ChRFeGVjdXRlUXVlcnlSZXNwb25zZRIrCgRkYXRhGAEgASgLMhcuZ29vZ2xlLnByb3RvYnVmLl'
'N0cnVjdFIEZGF0YRJJCgZlcnJvcnMYAiADKAsyMS5nb29nbGUuZmlyZWJhc2UuZGF0YWNvbm5l'
'Y3QudjFhbHBoYS5HcmFwaHFsRXJyb3JSBmVycm9ycw==');
'N0cnVjdFIEZGF0YRJICgZlcnJvcnMYAiADKAsyMC5nb29nbGUuZmlyZWJhc2UuZGF0YWNvbm5l'
'Y3QudjFiZXRhLkdyYXBocWxFcnJvclIGZXJyb3Jz');

@$core.Deprecated('Use executeMutationResponseDescriptor instead')
const ExecuteMutationResponse$json = {
Expand All @@ -125,7 +124,7 @@ const ExecuteMutationResponse$json = {
'3': 2,
'4': 3,
'5': 11,
'6': '.google.firebase.dataconnect.v1alpha.GraphqlError',
'6': '.google.firebase.dataconnect.v1beta.GraphqlError',
'10': 'errors'
},
],
Expand All @@ -134,5 +133,5 @@ const ExecuteMutationResponse$json = {
/// Descriptor for `ExecuteMutationResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List executeMutationResponseDescriptor = $convert.base64Decode(
'ChdFeGVjdXRlTXV0YXRpb25SZXNwb25zZRIrCgRkYXRhGAEgASgLMhcuZ29vZ2xlLnByb3RvYn'
'VmLlN0cnVjdFIEZGF0YRJJCgZlcnJvcnMYAiADKAsyMS5nb29nbGUuZmlyZWJhc2UuZGF0YWNv'
'bm5lY3QudjFhbHBoYS5HcmFwaHFsRXJyb3JSBmVycm9ycw==');
'VmLlN0cnVjdFIEZGF0YRJICgZlcnJvcnMYAiADKAsyMC5nb29nbGUuZmlyZWJhc2UuZGF0YWNv'
'bm5lY3QudjFiZXRhLkdyYXBocWxFcnJvclIGZXJyb3Jz');
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2024, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

//
// Generated code. Do not modify.
// source: google/protobuf/struct.proto
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2024, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

//
// Generated code. Do not modify.
// source: google/protobuf/struct.proto
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2024, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

//
// Generated code. Do not modify.
// source: google/protobuf/struct.proto
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2024, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

//
// Generated code. Do not modify.
// source: graphql_error.proto
Expand Down Expand Up @@ -63,7 +62,7 @@ class GraphqlError extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'GraphqlError',
package: const $pb.PackageName(
_omitMessageNames ? '' : 'google.firebase.dataconnect.v1alpha'),
_omitMessageNames ? '' : 'google.firebase.dataconnect.v1beta'),
createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'message')
..pc<SourceLocation>(
Expand Down Expand Up @@ -188,7 +187,7 @@ class SourceLocation extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'SourceLocation',
package: const $pb.PackageName(
_omitMessageNames ? '' : 'google.firebase.dataconnect.v1alpha'),
_omitMessageNames ? '' : 'google.firebase.dataconnect.v1beta'),
createEmptyInstance: create)
..a<$core.int>(1, _omitFieldNames ? '' : 'line', $pb.PbFieldType.O3)
..a<$core.int>(2, _omitFieldNames ? '' : 'column', $pb.PbFieldType.O3)
Expand Down Expand Up @@ -268,7 +267,7 @@ class GraphqlErrorExtensions extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
_omitMessageNames ? '' : 'GraphqlErrorExtensions',
package: const $pb.PackageName(
_omitMessageNames ? '' : 'google.firebase.dataconnect.v1alpha'),
_omitMessageNames ? '' : 'google.firebase.dataconnect.v1beta'),
createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'file')
..hasRequiredFields = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2024, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

//
// Generated code. Do not modify.
// source: graphql_error.proto
Expand Down
Loading

0 comments on commit 77ded00

Please sign in to comment.