├── .gitignore ├── .vscode └── settings.json ├── AUTHORS ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── config.yaml ├── discovery └── firebaseapis │ ├── cloudfunctions__v1.json │ ├── fcm__v1.json │ ├── fcmdata__v1beta1.json │ ├── firebase__v1beta1.json │ ├── firebaseappcheck__v1beta.json │ ├── firebaseappdistribution__v1.json │ ├── firebasedatabase__v1beta.json │ ├── firebasedynamiclinks__v1.json │ ├── firebasehosting__v1.json │ ├── firebasehosting__v1beta1.json │ ├── firebaseml__v1.json │ ├── firebaseml__v1beta2.json │ ├── firebaserules__v1.json │ ├── firebasestorage__v1beta.json │ ├── firestore__v1.json │ ├── firestore__v1beta1.json │ ├── firestore__v1beta2.json │ ├── identitytoolkit__v1.json │ ├── identitytoolkit__v2.json │ ├── identitytoolkit__v3.json │ ├── storage__v1.json │ └── testing__v1.json ├── generated └── firebaseapis │ ├── .gitignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── example │ └── main.dart │ ├── lib │ ├── cloudfunctions │ │ └── v1.dart │ ├── fcm │ │ └── v1.dart │ ├── fcmdata │ │ └── v1beta1.dart │ ├── firebase │ │ └── v1beta1.dart │ ├── firebaseappcheck │ │ └── v1beta.dart │ ├── firebaseappdistribution │ │ └── v1.dart │ ├── firebasedatabase │ │ └── v1beta.dart │ ├── firebasedynamiclinks │ │ └── v1.dart │ ├── firebasehosting │ │ ├── v1.dart │ │ └── v1beta1.dart │ ├── firebaseml │ │ ├── v1.dart │ │ └── v1beta2.dart │ ├── firebaserules │ │ └── v1.dart │ ├── firebasestorage │ │ └── v1beta.dart │ ├── firestore │ │ ├── v1.dart │ │ ├── v1beta1.dart │ │ └── v1beta2.dart │ ├── identitytoolkit │ │ ├── v1.dart │ │ ├── v2.dart │ │ └── v3.dart │ ├── shared.dart │ ├── src │ │ └── user_agent.dart │ ├── storage │ │ └── v1.dart │ └── testing │ │ └── v1.dart │ ├── pubspec.yaml │ └── test │ ├── cloudfunctions │ └── v1_test.dart │ ├── fcm │ └── v1_test.dart │ ├── fcmdata │ └── v1beta1_test.dart │ ├── firebase │ └── v1beta1_test.dart │ ├── firebaseappcheck │ └── v1beta_test.dart │ ├── firebaseappdistribution │ └── v1_test.dart │ ├── firebasedatabase │ └── v1beta_test.dart │ ├── firebasedynamiclinks │ └── v1_test.dart │ ├── firebasehosting │ ├── v1_test.dart │ └── v1beta1_test.dart │ ├── firebaseml │ ├── v1_test.dart │ └── v1beta2_test.dart │ ├── firebaserules │ └── v1_test.dart │ ├── firebasestorage │ └── v1beta_test.dart │ ├── firestore │ ├── v1_test.dart │ ├── v1beta1_test.dart │ └── v1beta2_test.dart │ ├── identitytoolkit │ ├── v1_test.dart │ ├── v2_test.dart │ └── v3_test.dart │ ├── storage │ └── v1_test.dart │ ├── test_shared.dart │ └── testing │ └── v1_test.dart ├── generator ├── bin │ └── generate.dart ├── lib │ ├── googleapis_generator.dart │ └── src │ │ ├── package_configuration.dart │ │ └── utils.dart ├── pubspec.yaml └── tool │ └── config_delta.dart ├── googleapis.LICENSE ├── melos.yaml ├── overrides ├── i303.diff ├── i488.diff ├── i504.diff ├── i517.diff ├── i77.diff └── idt_v1.diff ├── pubspec.yaml └── resources ├── LICENSE ├── README.md └── firebaseapis ├── CHANGELOG.md ├── examples └── main.dart ├── pubspec.yaml └── pubspec_overrides.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | .dart_tool/ 2 | .packages 3 | pubspec.lock 4 | 5 | # User files 6 | test_integration/*.json 7 | test_integration/client_id*.yaml 8 | test_integration/config.yaml 9 | *.iml 10 | .DS_Store 11 | .idea 12 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "dart.runPubGetOnPubspecChanges": false 3 | } -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | # Below is a list of people and organizations that have contributed 2 | # to the Dart project. Names should be added to the list like so: 3 | # 4 | # Name/Organization 5 | 6 | Google Inc. 7 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | ## 2023-08-28 7 | 8 | ### Changes 9 | 10 | --- 11 | 12 | Packages with breaking changes: 13 | 14 | - [`firebaseapis` - `v0.2.0`](#firebaseapis---v020) 15 | 16 | Packages with other changes: 17 | 18 | - There are no other changes in this release. 19 | 20 | --- 21 | 22 | #### `firebaseapis` - `v0.2.0` 23 | 24 | - **BREAKING** **FEAT**: upgrade to latest generator, patches & APIs. 25 | 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2020 Invertase Limited 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Firebase API Client Libraries for Dart 2 | 3 | 4 | Chat on Discord 5 | 6 | 7 | [![melos](https://img.shields.io/badge/maintained%20with-melos-f700ff.svg?style=flat-square)](https://github.com/invertase/melos) 8 | 9 | This is based on the [`googleapis.dart`](https://github.com/google/googleapis.dart) repository but instead aimed at supporting Firebase related APIs only. Additionally, this adds support for several unlisted (but discoverable) Firebase APIs that are not listed on the official [discovery API](https://discovery.googleapis.com/discovery/v1/apis) that `googleapis.dart` uses (and is currently limited to) as well as several private APIs (APIs that require an API key to view discovery information). 10 | 11 | > See [./generated/firebaseapis/README.md](./generated/firebaseapis/README.md) for information on all the currently supported APIs. 12 | 13 | ## Usage Example 14 | 15 | ```dart 16 | // Import the APIs you want to use 17 | import 'package:firebaseapis/firebaseremoteconfig/v1.dart' as remote_config; 18 | import 'package:firebaseapis/firebaserules/v1.dart' as firebase_rules; 19 | // Import Auth client 20 | import 'package:googleapis_auth/auth_io.dart' as auth; 21 | 22 | // Get an Auth Client 23 | final authClient = await auth.clientViaApplicationDefaultCredentials(scopes: [ 24 | remote_config.FirebaseRemoteConfigApi.cloudPlatformScope, 25 | ]); 26 | 27 | // Call some APIs 28 | final rc = remote_config.FirebaseRemoteConfigApi(authClient); 29 | final config = 30 | await rc.projects.getRemoteConfig('projects/'); 31 | print(config.parameters); 32 | print(config.parameters?.values.first.defaultValue); 33 | print(config.parameters?.values.first.description); 34 | print(config.parameters?.values.first.valueType); 35 | 36 | final fr = firebase_rules.FirebaseRulesApi(authClient); 37 | final rules = 38 | await fr.projects.rulesets.list('projects/'); 39 | print(rules.rulesets?.first.name); 40 | print(rules.rulesets?.first.source?.files?.first.content); 41 | ``` 42 | 43 | ## Custom Request Headers 44 | 45 | Custom request headers can be set by adding to `requestHeaders`: 46 | 47 | ```dart 48 | import 'package:firebaseapis/src/user_agent.dart'; 49 | 50 | Future main() async { 51 | requestHeaders.addAll({ 52 | 'cool-header': 'cool-value', 53 | }); 54 | print(requestHeaders); 55 | } 56 | ``` 57 | 58 | ## Contributing 59 | 60 | This project uses [Melos](https://github.com/invertase/melos) to manage the project and dependencies. 61 | 62 | To install Melos, run the following command from your SSH client: 63 | 64 | ```bash 65 | dart pub global activate melos 66 | ``` 67 | 68 | Next, at the root of your locally cloned repository bootstrap the projects dependencies: 69 | 70 | ```bash 71 | melos bootstrap 72 | ``` 73 | 74 | The bootstrap command locally links all dependencies within the project without having to 75 | provide manual [`dependency_overrides`](https://dart.dev/tools/pub/pubspec). This allows all 76 | plugins, examples and tests to build from the local clone project. 77 | 78 | > You do not need to run `flutter pub get` once bootstrap has been completed. 79 | 80 | ### Adding a new API 81 | 82 | To add a new API and generate library code for it is fairly straightforward; 83 | 84 | 1. Add the API to the `apis` list in [`./config.yaml`](config.yaml) 85 | 2. Run `melos run config:download` to update the downloaded discovery document JSON files that are in [`./discovery`](discovery). 86 | - **Note**: several APIs require an [API key](https://cloud.google.com/docs/authentication/api-keys) to be able to read the discovery information. Set a `API_KEY` environment variable before running the command to be able to download the discovery documents for these private APIs, e.g. `API_KEY= melos run config:download`. 87 | 3. Run `melos run config:generate` to generate new Dart library code for the API, which outputs to [`./generated/firebaseapis`](generated/firebaseapis). 88 | 89 | --- 90 | 91 |

92 | 93 | 94 | 95 |

96 | Maintained by Invertase. 97 |

98 |

99 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | analyzer: 2 | strong-mode: 3 | implicit-casts: false 4 | 5 | linter: 6 | rules: 7 | - always_declare_return_types 8 | - always_require_non_null_named_parameters 9 | - annotate_overrides 10 | - avoid_bool_literals_in_conditional_expressions 11 | - avoid_catching_errors 12 | - avoid_classes_with_only_static_members 13 | - avoid_dynamic_calls 14 | - avoid_empty_else 15 | - avoid_function_literals_in_foreach_calls 16 | - avoid_init_to_null 17 | - avoid_null_checks_in_equality_operators 18 | - avoid_private_typedef_functions 19 | - avoid_redundant_argument_values 20 | - avoid_relative_lib_imports 21 | - avoid_renaming_method_parameters 22 | - avoid_return_types_on_setters 23 | - avoid_returning_null 24 | - avoid_returning_null_for_void 25 | - avoid_returning_this 26 | - avoid_shadowing_type_parameters 27 | - avoid_single_cascade_in_expression_statements 28 | - avoid_types_as_parameter_names 29 | - avoid_unused_constructor_parameters 30 | - avoid_void_async 31 | - await_only_futures 32 | - camel_case_extensions 33 | - camel_case_types 34 | - cancel_subscriptions 35 | #- cascade_invocations 36 | - comment_references 37 | - constant_identifier_names 38 | - control_flow_in_finally 39 | - curly_braces_in_flow_control_structures 40 | - directives_ordering 41 | - empty_catches 42 | - empty_constructor_bodies 43 | - empty_statements 44 | - file_names 45 | - hash_and_equals 46 | - implementation_imports 47 | - invariant_booleans 48 | - iterable_contains_unrelated_type 49 | - join_return_with_assignment 50 | - library_names 51 | - library_prefixes 52 | - lines_longer_than_80_chars 53 | - list_remove_unrelated_type 54 | - literal_only_boolean_expressions 55 | - missing_whitespace_between_adjacent_strings 56 | - no_duplicate_case_values 57 | - no_runtimeType_toString 58 | - non_constant_identifier_names 59 | - null_closures 60 | - omit_local_variable_types 61 | - only_throw_errors 62 | - overridden_fields 63 | - package_api_docs 64 | - package_names 65 | - package_prefixed_library_names 66 | - prefer_adjacent_string_concatenation 67 | - prefer_asserts_in_initializer_lists 68 | - prefer_collection_literals 69 | - prefer_conditional_assignment 70 | - prefer_const_constructors 71 | - prefer_const_declarations 72 | - prefer_contains 73 | - prefer_equal_for_default_values 74 | - prefer_expression_function_bodies 75 | - prefer_final_fields 76 | - prefer_final_locals 77 | - prefer_for_elements_to_map_fromIterable 78 | - prefer_function_declarations_over_variables 79 | - prefer_generic_function_type_aliases 80 | - prefer_if_null_operators 81 | - prefer_initializing_formals 82 | - prefer_inlined_adds 83 | - prefer_interpolation_to_compose_strings 84 | - prefer_is_empty 85 | - prefer_is_not_empty 86 | - prefer_is_not_operator 87 | - prefer_iterable_whereType 88 | - prefer_null_aware_operators 89 | - prefer_relative_imports 90 | - prefer_single_quotes 91 | - prefer_spread_collections 92 | - prefer_typing_uninitialized_variables 93 | - prefer_void_to_null 94 | - provide_deprecation_message 95 | - recursive_getters 96 | - slash_for_doc_comments 97 | - sort_pub_dependencies 98 | - test_types_in_equals 99 | - throw_in_finally 100 | - type_annotate_public_apis 101 | - type_init_formals 102 | - unawaited_futures 103 | - unnecessary_brace_in_string_interps 104 | - unnecessary_const 105 | - unnecessary_getters_setters 106 | - unnecessary_lambdas 107 | - unnecessary_new 108 | - unnecessary_null_aware_assignments 109 | - unnecessary_null_in_if_null_operators 110 | - unnecessary_overrides 111 | - unnecessary_parenthesis 112 | - unnecessary_statements 113 | - unnecessary_string_interpolations 114 | - unnecessary_this 115 | - unrelated_type_equality_checks 116 | - use_function_type_syntax_for_parameters 117 | - use_is_even_rather_than_modulo 118 | - use_rethrow_when_possible 119 | - use_string_buffers 120 | - valid_regexps 121 | - void_checks 122 | -------------------------------------------------------------------------------- /config.yaml: -------------------------------------------------------------------------------- 1 | # Manually curated lists of which APIs should go into which packages, and which 2 | # should be ignored. 3 | packages: 4 | - firebaseapis: 5 | version: 0.1.1 6 | repository: https://github.com/invertase/dart_firebase_apis/tree/master/generated/firebaseapis 7 | readme: resources/README.md 8 | license: resources/LICENSE 9 | changelog: resources/firebaseapis/CHANGELOG.md 10 | example: resources/firebaseapis/examples/main.dart 11 | extraDevDependencies: 12 | googleapis_auth: ^1.0.0 13 | apis: 14 | - cloudfunctions:v1 15 | - fcm:v1 16 | - firebasedynamiclinks:v1 17 | - firebasehosting:v1 18 | - firebaseinappmessaging:v1 19 | - firebaseml:v1 20 | - firebaseremoteconfig:v1 21 | - firebaserules:v1 22 | - firestore:v1 23 | - identitytoolkit:v1 24 | - identitytoolkit:v2 25 | - identitytoolkit:v3 26 | - firebasestorage:v1 27 | - firebaseappdistribution:v1 28 | - storage:v1 29 | - testing:v1 30 | # Alphas & Betas 31 | - firebaseappdistribution:v1alpha 32 | - fcmdata:v1beta1 33 | - firebase:v1beta1 34 | - firebaseappcheck:v1beta 35 | - firebasedatabase:v1beta 36 | - firebasehosting:v1beta1 37 | - firebaseml:v1beta2 38 | - firebasestorage:v1beta 39 | - firestore:v1beta1 40 | - firestore:v1beta2 41 | - securetoken:v2beta1 42 | # APIs that require an API key to Discover 43 | - firebaseapptesters:v1alpha 44 | - firebaseinstallations:v1 45 | - fcmregistrations:v1 46 | - firebasepredictions:v1beta1 47 | - firebaseextensions:v1beta 48 | -------------------------------------------------------------------------------- /discovery/firebaseapis/firebasehosting__v1.json: -------------------------------------------------------------------------------- 1 | { 2 | "basePath": "", 3 | "baseUrl": "https://firebasehosting.googleapis.com/", 4 | "batchPath": "batch", 5 | "canonicalName": "Firebase Hosting", 6 | "description": "The Firebase Hosting REST API enables programmatic and customizable management and deployments to your Firebase-hosted sites. Use this REST API to create and manage channels and sites as well as to deploy new or updated hosting configurations and content files.", 7 | "discoveryVersion": "v1", 8 | "documentationLink": "https://firebase.google.com/docs/hosting/", 9 | "icons": { 10 | "x16": "http://www.google.com/images/icons/product/search-16.gif", 11 | "x32": "http://www.google.com/images/icons/product/search-32.gif" 12 | }, 13 | "id": "firebasehosting:v1", 14 | "kind": "discovery#restDescription", 15 | "name": "firebasehosting", 16 | "ownerDomain": "google.com", 17 | "ownerName": "Google", 18 | "protocol": "rest", 19 | "revision": "20230823", 20 | "rootUrl": "https://firebasehosting.googleapis.com/", 21 | "servicePath": "", 22 | "title": "Firebase Hosting API", 23 | "version": "v1", 24 | "version_module": true, 25 | "parameters": { 26 | "$.xgafv": { 27 | "description": "V1 error format.", 28 | "enum": [ 29 | "1", 30 | "2" 31 | ], 32 | "enumDescriptions": [ 33 | "v1 error format", 34 | "v2 error format" 35 | ], 36 | "location": "query", 37 | "type": "string" 38 | }, 39 | "access_token": { 40 | "description": "OAuth access token.", 41 | "location": "query", 42 | "type": "string" 43 | }, 44 | "alt": { 45 | "default": "json", 46 | "description": "Data format for response.", 47 | "enum": [ 48 | "json", 49 | "media", 50 | "proto" 51 | ], 52 | "enumDescriptions": [ 53 | "Responses with Content-Type of application/json", 54 | "Media download with context-dependent Content-Type", 55 | "Responses with Content-Type of application/x-protobuf" 56 | ], 57 | "location": "query", 58 | "type": "string" 59 | }, 60 | "callback": { 61 | "description": "JSONP", 62 | "location": "query", 63 | "type": "string" 64 | }, 65 | "fields": { 66 | "description": "Selector specifying which fields to include in a partial response.", 67 | "location": "query", 68 | "type": "string" 69 | }, 70 | "key": { 71 | "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", 72 | "location": "query", 73 | "type": "string" 74 | }, 75 | "oauth_token": { 76 | "description": "OAuth 2.0 token for the current user.", 77 | "location": "query", 78 | "type": "string" 79 | }, 80 | "prettyPrint": { 81 | "default": "true", 82 | "description": "Returns response with indentations and line breaks.", 83 | "location": "query", 84 | "type": "boolean" 85 | }, 86 | "quotaUser": { 87 | "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", 88 | "location": "query", 89 | "type": "string" 90 | }, 91 | "uploadType": { 92 | "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", 93 | "location": "query", 94 | "type": "string" 95 | }, 96 | "upload_protocol": { 97 | "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", 98 | "location": "query", 99 | "type": "string" 100 | } 101 | }, 102 | "resources": { 103 | "operations": { 104 | "methods": { 105 | "cancel": { 106 | "description": "Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.", 107 | "flatPath": "v1/operations/{operationsId}:cancel", 108 | "httpMethod": "POST", 109 | "id": "firebasehosting.operations.cancel", 110 | "parameterOrder": [ 111 | "name" 112 | ], 113 | "parameters": { 114 | "name": { 115 | "description": "The name of the operation resource to be cancelled.", 116 | "location": "path", 117 | "pattern": "^operations/.*$", 118 | "required": true, 119 | "type": "string" 120 | } 121 | }, 122 | "path": "v1/{+name}:cancel", 123 | "request": { 124 | "$ref": "CancelOperationRequest" 125 | }, 126 | "response": { 127 | "$ref": "Empty" 128 | } 129 | }, 130 | "delete": { 131 | "description": "Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.", 132 | "flatPath": "v1/operations/{operationsId}", 133 | "httpMethod": "DELETE", 134 | "id": "firebasehosting.operations.delete", 135 | "parameterOrder": [ 136 | "name" 137 | ], 138 | "parameters": { 139 | "name": { 140 | "description": "The name of the operation resource to be deleted.", 141 | "location": "path", 142 | "pattern": "^operations/.*$", 143 | "required": true, 144 | "type": "string" 145 | } 146 | }, 147 | "path": "v1/{+name}", 148 | "response": { 149 | "$ref": "Empty" 150 | } 151 | }, 152 | "list": { 153 | "description": "Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.", 154 | "flatPath": "v1/operations", 155 | "httpMethod": "GET", 156 | "id": "firebasehosting.operations.list", 157 | "parameterOrder": [ 158 | "name" 159 | ], 160 | "parameters": { 161 | "filter": { 162 | "description": "The standard list filter.", 163 | "location": "query", 164 | "type": "string" 165 | }, 166 | "name": { 167 | "description": "The name of the operation's parent resource.", 168 | "location": "path", 169 | "pattern": "^operations$", 170 | "required": true, 171 | "type": "string" 172 | }, 173 | "pageSize": { 174 | "description": "The standard list page size.", 175 | "format": "int32", 176 | "location": "query", 177 | "type": "integer" 178 | }, 179 | "pageToken": { 180 | "description": "The standard list page token.", 181 | "location": "query", 182 | "type": "string" 183 | } 184 | }, 185 | "path": "v1/{+name}", 186 | "response": { 187 | "$ref": "ListOperationsResponse" 188 | } 189 | } 190 | } 191 | } 192 | }, 193 | "schemas": { 194 | "CancelOperationRequest": { 195 | "description": "The request message for Operations.CancelOperation.", 196 | "id": "CancelOperationRequest", 197 | "properties": {}, 198 | "type": "object" 199 | }, 200 | "Empty": { 201 | "description": "A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }", 202 | "id": "Empty", 203 | "properties": {}, 204 | "type": "object" 205 | }, 206 | "ListOperationsResponse": { 207 | "description": "The response message for Operations.ListOperations.", 208 | "id": "ListOperationsResponse", 209 | "properties": { 210 | "nextPageToken": { 211 | "description": "The standard List next-page token.", 212 | "type": "string" 213 | }, 214 | "operations": { 215 | "description": "A list of operations that matches the specified filter in the request.", 216 | "items": { 217 | "$ref": "Operation" 218 | }, 219 | "type": "array" 220 | } 221 | }, 222 | "type": "object" 223 | }, 224 | "Operation": { 225 | "description": "This resource represents a long-running operation that is the result of a network API call.", 226 | "id": "Operation", 227 | "properties": { 228 | "done": { 229 | "description": "If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.", 230 | "type": "boolean" 231 | }, 232 | "error": { 233 | "$ref": "Status", 234 | "description": "The error result of the operation in case of failure or cancellation." 235 | }, 236 | "metadata": { 237 | "additionalProperties": { 238 | "description": "Properties of the object. Contains field @type with type URL.", 239 | "type": "any" 240 | }, 241 | "description": "Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.", 242 | "type": "object" 243 | }, 244 | "name": { 245 | "description": "The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.", 246 | "type": "string" 247 | }, 248 | "response": { 249 | "additionalProperties": { 250 | "description": "Properties of the object. Contains field @type with type URL.", 251 | "type": "any" 252 | }, 253 | "description": "The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.", 254 | "type": "object" 255 | } 256 | }, 257 | "type": "object" 258 | }, 259 | "Status": { 260 | "description": "The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).", 261 | "id": "Status", 262 | "properties": { 263 | "code": { 264 | "description": "The status code, which should be an enum value of google.rpc.Code.", 265 | "format": "int32", 266 | "type": "integer" 267 | }, 268 | "details": { 269 | "description": "A list of messages that carry the error details. There is a common set of message types for APIs to use.", 270 | "items": { 271 | "additionalProperties": { 272 | "description": "Properties of the object. Contains field @type with type URL.", 273 | "type": "any" 274 | }, 275 | "type": "object" 276 | }, 277 | "type": "array" 278 | }, 279 | "message": { 280 | "description": "A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.", 281 | "type": "string" 282 | } 283 | }, 284 | "type": "object" 285 | } 286 | } 287 | } 288 | -------------------------------------------------------------------------------- /discovery/firebaseapis/firebaseml__v1.json: -------------------------------------------------------------------------------- 1 | { 2 | "auth": { 3 | "oauth2": { 4 | "scopes": { 5 | "https://www.googleapis.com/auth/cloud-platform": { 6 | "description": "See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account." 7 | } 8 | } 9 | } 10 | }, 11 | "basePath": "", 12 | "baseUrl": "https://firebaseml.googleapis.com/", 13 | "batchPath": "batch", 14 | "canonicalName": "Firebase ML", 15 | "description": "Access custom machine learning models hosted via Firebase ML.", 16 | "discoveryVersion": "v1", 17 | "documentationLink": "https://firebase.google.com", 18 | "icons": { 19 | "x16": "http://www.google.com/images/icons/product/search-16.gif", 20 | "x32": "http://www.google.com/images/icons/product/search-32.gif" 21 | }, 22 | "id": "firebaseml:v1", 23 | "kind": "discovery#restDescription", 24 | "name": "firebaseml", 25 | "ownerDomain": "google.com", 26 | "ownerName": "Google", 27 | "protocol": "rest", 28 | "revision": "20230823", 29 | "rootUrl": "https://firebaseml.googleapis.com/", 30 | "servicePath": "", 31 | "title": "Firebase ML API", 32 | "version": "v1", 33 | "version_module": true, 34 | "parameters": { 35 | "$.xgafv": { 36 | "description": "V1 error format.", 37 | "enum": [ 38 | "1", 39 | "2" 40 | ], 41 | "enumDescriptions": [ 42 | "v1 error format", 43 | "v2 error format" 44 | ], 45 | "location": "query", 46 | "type": "string" 47 | }, 48 | "access_token": { 49 | "description": "OAuth access token.", 50 | "location": "query", 51 | "type": "string" 52 | }, 53 | "alt": { 54 | "default": "json", 55 | "description": "Data format for response.", 56 | "enum": [ 57 | "json", 58 | "media", 59 | "proto" 60 | ], 61 | "enumDescriptions": [ 62 | "Responses with Content-Type of application/json", 63 | "Media download with context-dependent Content-Type", 64 | "Responses with Content-Type of application/x-protobuf" 65 | ], 66 | "location": "query", 67 | "type": "string" 68 | }, 69 | "callback": { 70 | "description": "JSONP", 71 | "location": "query", 72 | "type": "string" 73 | }, 74 | "fields": { 75 | "description": "Selector specifying which fields to include in a partial response.", 76 | "location": "query", 77 | "type": "string" 78 | }, 79 | "key": { 80 | "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", 81 | "location": "query", 82 | "type": "string" 83 | }, 84 | "oauth_token": { 85 | "description": "OAuth 2.0 token for the current user.", 86 | "location": "query", 87 | "type": "string" 88 | }, 89 | "prettyPrint": { 90 | "default": "true", 91 | "description": "Returns response with indentations and line breaks.", 92 | "location": "query", 93 | "type": "boolean" 94 | }, 95 | "quotaUser": { 96 | "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", 97 | "location": "query", 98 | "type": "string" 99 | }, 100 | "uploadType": { 101 | "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", 102 | "location": "query", 103 | "type": "string" 104 | }, 105 | "upload_protocol": { 106 | "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", 107 | "location": "query", 108 | "type": "string" 109 | } 110 | }, 111 | "resources": { 112 | "operations": { 113 | "methods": { 114 | "cancel": { 115 | "description": "Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.", 116 | "flatPath": "v1/operations/{operationsId}:cancel", 117 | "httpMethod": "POST", 118 | "id": "firebaseml.operations.cancel", 119 | "parameterOrder": [ 120 | "name" 121 | ], 122 | "parameters": { 123 | "name": { 124 | "description": "The name of the operation resource to be cancelled.", 125 | "location": "path", 126 | "pattern": "^operations/.*$", 127 | "required": true, 128 | "type": "string" 129 | } 130 | }, 131 | "path": "v1/{+name}:cancel", 132 | "request": { 133 | "$ref": "CancelOperationRequest" 134 | }, 135 | "response": { 136 | "$ref": "Empty" 137 | }, 138 | "scopes": [ 139 | "https://www.googleapis.com/auth/cloud-platform" 140 | ] 141 | }, 142 | "delete": { 143 | "description": "Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.", 144 | "flatPath": "v1/operations/{operationsId}", 145 | "httpMethod": "DELETE", 146 | "id": "firebaseml.operations.delete", 147 | "parameterOrder": [ 148 | "name" 149 | ], 150 | "parameters": { 151 | "name": { 152 | "description": "The name of the operation resource to be deleted.", 153 | "location": "path", 154 | "pattern": "^operations/.*$", 155 | "required": true, 156 | "type": "string" 157 | } 158 | }, 159 | "path": "v1/{+name}", 160 | "response": { 161 | "$ref": "Empty" 162 | }, 163 | "scopes": [ 164 | "https://www.googleapis.com/auth/cloud-platform" 165 | ] 166 | }, 167 | "list": { 168 | "description": "Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.", 169 | "flatPath": "v1/operations", 170 | "httpMethod": "GET", 171 | "id": "firebaseml.operations.list", 172 | "parameterOrder": [ 173 | "name" 174 | ], 175 | "parameters": { 176 | "filter": { 177 | "description": "The standard list filter.", 178 | "location": "query", 179 | "type": "string" 180 | }, 181 | "name": { 182 | "description": "The name of the operation's parent resource.", 183 | "location": "path", 184 | "pattern": "^operations$", 185 | "required": true, 186 | "type": "string" 187 | }, 188 | "pageSize": { 189 | "description": "The standard list page size.", 190 | "format": "int32", 191 | "location": "query", 192 | "type": "integer" 193 | }, 194 | "pageToken": { 195 | "description": "The standard list page token.", 196 | "location": "query", 197 | "type": "string" 198 | } 199 | }, 200 | "path": "v1/{+name}", 201 | "response": { 202 | "$ref": "ListOperationsResponse" 203 | }, 204 | "scopes": [ 205 | "https://www.googleapis.com/auth/cloud-platform" 206 | ] 207 | } 208 | } 209 | } 210 | }, 211 | "schemas": { 212 | "CancelOperationRequest": { 213 | "description": "The request message for Operations.CancelOperation.", 214 | "id": "CancelOperationRequest", 215 | "properties": {}, 216 | "type": "object" 217 | }, 218 | "Empty": { 219 | "description": "A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }", 220 | "id": "Empty", 221 | "properties": {}, 222 | "type": "object" 223 | }, 224 | "ListOperationsResponse": { 225 | "description": "The response message for Operations.ListOperations.", 226 | "id": "ListOperationsResponse", 227 | "properties": { 228 | "nextPageToken": { 229 | "description": "The standard List next-page token.", 230 | "type": "string" 231 | }, 232 | "operations": { 233 | "description": "A list of operations that matches the specified filter in the request.", 234 | "items": { 235 | "$ref": "Operation" 236 | }, 237 | "type": "array" 238 | } 239 | }, 240 | "type": "object" 241 | }, 242 | "ModelOperationMetadata": { 243 | "description": "This is returned in the longrunning operations for create/update.", 244 | "id": "ModelOperationMetadata", 245 | "properties": { 246 | "basicOperationStatus": { 247 | "enum": [ 248 | "BASIC_OPERATION_STATUS_UNSPECIFIED", 249 | "BASIC_OPERATION_STATUS_UPLOADING", 250 | "BASIC_OPERATION_STATUS_VERIFYING" 251 | ], 252 | "enumDescriptions": [ 253 | "The status is unspecified", 254 | "The model file is being uploaded", 255 | "The model file is being verified" 256 | ], 257 | "type": "string" 258 | }, 259 | "name": { 260 | "description": "The name of the model we are creating/updating The name must have the form `projects/{project_id}/models/{model_id}`", 261 | "type": "string" 262 | } 263 | }, 264 | "type": "object" 265 | }, 266 | "Operation": { 267 | "description": "This resource represents a long-running operation that is the result of a network API call.", 268 | "id": "Operation", 269 | "properties": { 270 | "done": { 271 | "description": "If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.", 272 | "type": "boolean" 273 | }, 274 | "error": { 275 | "$ref": "Status", 276 | "description": "The error result of the operation in case of failure or cancellation." 277 | }, 278 | "metadata": { 279 | "additionalProperties": { 280 | "description": "Properties of the object. Contains field @type with type URL.", 281 | "type": "any" 282 | }, 283 | "description": "Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.", 284 | "type": "object" 285 | }, 286 | "name": { 287 | "description": "The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.", 288 | "type": "string" 289 | }, 290 | "response": { 291 | "additionalProperties": { 292 | "description": "Properties of the object. Contains field @type with type URL.", 293 | "type": "any" 294 | }, 295 | "description": "The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.", 296 | "type": "object" 297 | } 298 | }, 299 | "type": "object" 300 | }, 301 | "Status": { 302 | "description": "The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).", 303 | "id": "Status", 304 | "properties": { 305 | "code": { 306 | "description": "The status code, which should be an enum value of google.rpc.Code.", 307 | "format": "int32", 308 | "type": "integer" 309 | }, 310 | "details": { 311 | "description": "A list of messages that carry the error details. There is a common set of message types for APIs to use.", 312 | "items": { 313 | "additionalProperties": { 314 | "description": "Properties of the object. Contains field @type with type URL.", 315 | "type": "any" 316 | }, 317 | "type": "object" 318 | }, 319 | "type": "array" 320 | }, 321 | "message": { 322 | "description": "A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.", 323 | "type": "string" 324 | } 325 | }, 326 | "type": "object" 327 | } 328 | } 329 | } 330 | -------------------------------------------------------------------------------- /generated/firebaseapis/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://dart.dev/guides/libraries/private-files 2 | .dart_tool/ 3 | .packages 4 | pubspec.lock 5 | -------------------------------------------------------------------------------- /generated/firebaseapis/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.2.0 2 | 3 | > Note: This release has breaking changes. 4 | 5 | - **BREAKING** **FEAT**: upgrade to latest generator, patches & APIs. 6 | 7 | ## 0.1.1 8 | 9 | - Added support for the following private Firebase APIs: 10 | - `firebaseapptesters:v1alpha` 11 | - `firebaseinstallations:v1` 12 | - `fcmregistrations:v1` 13 | - `firebasepredictions:v1beta1` 14 | - `firebaseextensions:v1beta` 15 | 16 | ## 0.1.0+1 17 | 18 | - Add support for additional Identity Toolkit APIs (v1 & v2). 19 | 20 | ## 0.1.0 21 | 22 | - Initial release 23 | -------------------------------------------------------------------------------- /generated/firebaseapis/LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2020 Invertase Limited 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /generated/firebaseapis/README.md: -------------------------------------------------------------------------------- 1 | ## Firebase APIs for Dart 2 | 3 | Generated Dart libraries for accessing 4 | [Firebase APIs](https://firebase.google.com). 5 | 6 | This is based on the [`googleapis.dart`](https://github.com/google/googleapis.dart) repository but instead aimed at supporting Firebase related APIs only. Additionally, this adds support for several unlisted (but discoverable) Firebase APIs that are not listed on the official [discovery API](https://discovery.googleapis.com/discovery/v1/apis) that `googleapis.dart` uses (and is currently limited to) as well as several private APIs (APIs that require an API key to view discovery information). 7 | 8 | ## Available Google APIs 9 | 10 | The following is a list of APIs that are currently available inside this 11 | package. 12 | 13 | #### Cloud Functions API - `cloudfunctions_v1` 14 | 15 | Manages lightweight user-provided functions executed in response to events. 16 | 17 | - [Documentation](https://cloud.google.com/functions) 18 | - [API details](https://pub.dev/documentation/firebaseapis/0.1.1/cloudfunctions_v1/cloudfunctions_v1-library.html) 19 | 20 | #### Firebase Cloud Messaging API - `fcm_v1` 21 | 22 | FCM send API that provides a cross-platform messaging solution to reliably deliver messages at no cost. 23 | 24 | - [Documentation](https://firebase.google.com/docs/cloud-messaging) 25 | - [API details](https://pub.dev/documentation/firebaseapis/0.1.1/fcm_v1/fcm_v1-library.html) 26 | 27 | #### Firebase Cloud Messaging Data API - `fcmdata_v1beta1` 28 | 29 | Provides additional information about Firebase Cloud Messaging (FCM) message sends and deliveries. 30 | 31 | - [Documentation](https://firebase.google.com/docs/cloud-messaging) 32 | - [API details](https://pub.dev/documentation/firebaseapis/0.1.1/fcmdata_v1beta1/fcmdata_v1beta1-library.html) 33 | 34 | #### Firebase Management API - `firebase_v1beta1` 35 | 36 | The Firebase Management API enables programmatic setup and management of Firebase projects, including a project's Firebase resources and Firebase apps. 37 | 38 | - [Documentation](https://firebase.google.com) 39 | - [API details](https://pub.dev/documentation/firebaseapis/0.1.1/firebase_v1beta1/firebase_v1beta1-library.html) 40 | 41 | #### Firebase App Check API - `firebaseappcheck_v1beta` 42 | 43 | Firebase App Check works alongside other Firebase services to help protect your backend resources from abuse, such as billing fraud or phishing. 44 | 45 | - [Documentation](https://firebase.google.com/docs/app-check) 46 | - [API details](https://pub.dev/documentation/firebaseapis/0.1.1/firebaseappcheck_v1beta/firebaseappcheck_v1beta-library.html) 47 | 48 | #### Firebase App Distribution API - `firebaseappdistribution_v1` 49 | 50 | - [Documentation](https://firebase.google.com/products/app-distribution) 51 | - [API details](https://pub.dev/documentation/firebaseapis/0.1.1/firebaseappdistribution_v1/firebaseappdistribution_v1-library.html) 52 | 53 | #### Firebase Realtime Database API - `firebasedatabase_v1beta` 54 | 55 | The Firebase Realtime Database API enables programmatic provisioning and management of Realtime Database instances. 56 | 57 | - [Documentation](https://firebase.google.com/docs/reference/rest/database/database-management/rest/) 58 | - [API details](https://pub.dev/documentation/firebaseapis/0.1.1/firebasedatabase_v1beta/firebasedatabase_v1beta-library.html) 59 | 60 | #### Firebase Dynamic Links API - `firebasedynamiclinks_v1` 61 | 62 | Programmatically creates and manages Firebase Dynamic Links. 63 | 64 | - [Documentation](https://firebase.google.com/docs/dynamic-links/) 65 | - [API details](https://pub.dev/documentation/firebaseapis/0.1.1/firebasedynamiclinks_v1/firebasedynamiclinks_v1-library.html) 66 | 67 | #### Firebase Hosting API - `firebasehosting_v1` 68 | 69 | The Firebase Hosting REST API enables programmatic and customizable management and deployments to your Firebase-hosted sites. Use this REST API to create and manage channels and sites as well as to deploy new or updated hosting configurations and content files. 70 | 71 | - [Documentation](https://firebase.google.com/docs/hosting/) 72 | - [API details](https://pub.dev/documentation/firebaseapis/0.1.1/firebasehosting_v1/firebasehosting_v1-library.html) 73 | 74 | #### Firebase Hosting API - `firebasehosting_v1beta1` 75 | 76 | The Firebase Hosting REST API enables programmatic and customizable management and deployments to your Firebase-hosted sites. Use this REST API to create and manage channels and sites as well as to deploy new or updated hosting configurations and content files. 77 | 78 | - [Documentation](https://firebase.google.com/docs/hosting/) 79 | - [API details](https://pub.dev/documentation/firebaseapis/0.1.1/firebasehosting_v1beta1/firebasehosting_v1beta1-library.html) 80 | 81 | #### Firebase ML API - `firebaseml_v1` 82 | 83 | Access custom machine learning models hosted via Firebase ML. 84 | 85 | - [Documentation](https://firebase.google.com) 86 | - [API details](https://pub.dev/documentation/firebaseapis/0.1.1/firebaseml_v1/firebaseml_v1-library.html) 87 | 88 | #### Firebase ML API - `firebaseml_v1beta2` 89 | 90 | Access custom machine learning models hosted via Firebase ML. 91 | 92 | - [Documentation](https://firebase.google.com) 93 | - [API details](https://pub.dev/documentation/firebaseapis/0.1.1/firebaseml_v1beta2/firebaseml_v1beta2-library.html) 94 | 95 | #### Firebase Rules API - `firebaserules_v1` 96 | 97 | Creates and manages rules that determine when a Firebase Rules-enabled service should permit a request. 98 | 99 | - [Documentation](https://firebase.google.com/docs/storage/security) 100 | - [API details](https://pub.dev/documentation/firebaseapis/0.1.1/firebaserules_v1/firebaserules_v1-library.html) 101 | 102 | #### Cloud Storage for Firebase API - `firebasestorage_v1beta` 103 | 104 | The Cloud Storage for Firebase API enables programmatic management of Cloud Storage buckets for use in Firebase projects 105 | 106 | - [Documentation](https://firebase.google.com/docs/storage) 107 | - [API details](https://pub.dev/documentation/firebaseapis/0.1.1/firebasestorage_v1beta/firebasestorage_v1beta-library.html) 108 | 109 | #### Cloud Firestore API - `firestore_v1` 110 | 111 | Accesses the NoSQL document database built for automatic scaling, high performance, and ease of application development. 112 | 113 | - [Documentation](https://cloud.google.com/firestore) 114 | - [API details](https://pub.dev/documentation/firebaseapis/0.1.1/firestore_v1/firestore_v1-library.html) 115 | 116 | #### Cloud Firestore API - `firestore_v1beta1` 117 | 118 | Accesses the NoSQL document database built for automatic scaling, high performance, and ease of application development. 119 | 120 | - [Documentation](https://cloud.google.com/firestore) 121 | - [API details](https://pub.dev/documentation/firebaseapis/0.1.1/firestore_v1beta1/firestore_v1beta1-library.html) 122 | 123 | #### Cloud Firestore API - `firestore_v1beta2` 124 | 125 | Accesses the NoSQL document database built for automatic scaling, high performance, and ease of application development. 126 | 127 | - [Documentation](https://cloud.google.com/firestore) 128 | - [API details](https://pub.dev/documentation/firebaseapis/0.1.1/firestore_v1beta2/firestore_v1beta2-library.html) 129 | 130 | #### Identity Toolkit API - `identitytoolkit_v1` 131 | 132 | The Google Identity Toolkit API lets you use open standards to verify a user's identity. 133 | 134 | - [Documentation](https://cloud.google.com/identity-platform) 135 | - [API details](https://pub.dev/documentation/firebaseapis/0.1.1/identitytoolkit_v1/identitytoolkit_v1-library.html) 136 | 137 | #### Identity Toolkit API - `identitytoolkit_v2` 138 | 139 | The Google Identity Toolkit API lets you use open standards to verify a user's identity. 140 | 141 | - [Documentation](https://cloud.google.com/identity-platform) 142 | - [API details](https://pub.dev/documentation/firebaseapis/0.1.1/identitytoolkit_v2/identitytoolkit_v2-library.html) 143 | 144 | #### ![Logo](https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png) Google Identity Toolkit API - `identitytoolkit_v3` 145 | 146 | Help the third party sites to implement federated login. 147 | 148 | - [Documentation](https://developers.google.com/identity-toolkit/v3/) 149 | - [API details](https://pub.dev/documentation/firebaseapis/0.1.1/identitytoolkit_v3/identitytoolkit_v3-library.html) 150 | 151 | #### ![Logo](https://www.google.com/images/icons/product/cloud_storage-16.png) Cloud Storage JSON API - `storage_v1` 152 | 153 | Stores and retrieves potentially large, immutable data objects. 154 | 155 | - [Documentation](https://developers.google.com/storage/docs/json_api/) 156 | - [API details](https://pub.dev/documentation/firebaseapis/0.1.1/storage_v1/storage_v1-library.html) 157 | 158 | #### Cloud Testing API - `testing_v1` 159 | 160 | Allows developers to run automated tests for their mobile applications on Google infrastructure. 161 | 162 | - [Documentation](https://developers.google.com/cloud-test-lab/) 163 | - [API details](https://pub.dev/documentation/firebaseapis/0.1.1/testing_v1/testing_v1-library.html) 164 | 165 | -------------------------------------------------------------------------------- /generated/firebaseapis/example/main.dart: -------------------------------------------------------------------------------- 1 | /// This example demonstrates usage for a Dart command line application. 2 | /// 3 | /// For details of how to use this package in Flutter, see 4 | /// https://flutter.dev/docs/development/data-and-backend/google-apis 5 | 6 | import 'package:firebaseapis/firebaseremoteconfig/v1.dart' as remote_config; 7 | import 'package:firebaseapis/firebaserules/v1.dart' as firebase_rules; 8 | import 'package:firebaseapis/identitytoolkit/v1.dart' as firebase_auth; 9 | import 'package:googleapis_auth/auth_io.dart' as auth; 10 | 11 | Future main() async { 12 | final authClient = await auth.clientViaApplicationDefaultCredentials(scopes: [ 13 | firebase_rules.FirebaseRulesApi.firebaseScope, 14 | // or read only 15 | // firebase_rules.FirebaseRulesApi.firebaseReadonlyScope, 16 | 17 | firebase_auth.IdentityToolkitApi.firebaseScope, 18 | 19 | remote_config.FirebaseRemoteConfigApi.cloudPlatformScope, 20 | ]); 21 | 22 | // // or 23 | // final authClient = 24 | // auth.clientViaApiKey('API KEY GOES HERE'); 25 | 26 | // // or 27 | // final authClient = await auth.clientViaServiceAccount( 28 | // auth.ServiceAccountCredentials.fromJson( 29 | // r''' 30 | // YOUR JSON HERE 31 | // ''', 32 | // ), 33 | // [ 34 | // remote_config.FirebaseRemoteConfigApi.cloudPlatformScope, 35 | // ], 36 | // ); 37 | 38 | final fr = firebase_rules.FirebaseRulesApi(authClient); 39 | final rules = await fr.projects.rulesets.list('projects/'); 40 | 41 | print(rules.rulesets?.first.name); 42 | print(rules.rulesets?.first.source?.files?.first.content); 43 | 44 | final rc = remote_config.FirebaseRemoteConfigApi(authClient); 45 | final config = 46 | await rc.projects.getRemoteConfig('projects/'); 47 | print(config.parameters); 48 | print(config.parameters?.values.first.defaultValue); 49 | print(config.parameters?.values.first.description); 50 | print(config.parameters?.values.first.valueType); 51 | 52 | final fa = firebase_auth.IdentityToolkitApi(authClient); 53 | final users = await fa.accounts 54 | .lookup(firebase_auth.GoogleCloudIdentitytoolkitV1GetAccountInfoRequest( 55 | localId: [''], 56 | )); 57 | print(users.users?.first.localId); 58 | print(users.users?.first.email); 59 | authClient.close(); 60 | } 61 | -------------------------------------------------------------------------------- /generated/firebaseapis/lib/firebasehosting/v1.dart: -------------------------------------------------------------------------------- 1 | // This is a generated file (see the discoveryapis_generator project). 2 | 3 | // ignore_for_file: camel_case_types 4 | // ignore_for_file: comment_references 5 | // ignore_for_file: deprecated_member_use_from_same_package 6 | // ignore_for_file: lines_longer_than_80_chars 7 | // ignore_for_file: non_constant_identifier_names 8 | // ignore_for_file: prefer_interpolation_to_compose_strings 9 | // ignore_for_file: unnecessary_brace_in_string_interps 10 | // ignore_for_file: unnecessary_lambdas 11 | // ignore_for_file: unnecessary_library_directive 12 | // ignore_for_file: unnecessary_string_interpolations 13 | 14 | /// Firebase Hosting API - v1 15 | /// 16 | /// The Firebase Hosting REST API enables programmatic and customizable 17 | /// management and deployments to your Firebase-hosted sites. Use this REST API 18 | /// to create and manage channels and sites as well as to deploy new or updated 19 | /// hosting configurations and content files. 20 | /// 21 | /// For more information, see 22 | /// 23 | /// Create an instance of [FirebaseHostingApi] to access these resources: 24 | /// 25 | /// - [OperationsResource] 26 | library firebasehosting_v1; 27 | 28 | import 'dart:async' as async; 29 | import 'dart:convert' as convert; 30 | import 'dart:core' as core; 31 | 32 | import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; 33 | import 'package:http/http.dart' as http; 34 | 35 | import '../shared.dart'; 36 | import '../src/user_agent.dart'; 37 | 38 | export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' 39 | show ApiRequestError, DetailedApiRequestError; 40 | 41 | /// The Firebase Hosting REST API enables programmatic and customizable 42 | /// management and deployments to your Firebase-hosted sites. 43 | /// 44 | /// Use this REST API to create and manage channels and sites as well as to 45 | /// deploy new or updated hosting configurations and content files. 46 | class FirebaseHostingApi { 47 | final commons.ApiRequester _requester; 48 | 49 | OperationsResource get operations => OperationsResource(_requester); 50 | 51 | FirebaseHostingApi(http.Client client, 52 | {core.String rootUrl = 'https://firebasehosting.googleapis.com/', 53 | core.String servicePath = ''}) 54 | : _requester = 55 | commons.ApiRequester(client, rootUrl, servicePath, requestHeaders); 56 | } 57 | 58 | class OperationsResource { 59 | final commons.ApiRequester _requester; 60 | 61 | OperationsResource(commons.ApiRequester client) : _requester = client; 62 | 63 | /// Starts asynchronous cancellation on a long-running operation. 64 | /// 65 | /// The server makes a best effort to cancel the operation, but success is not 66 | /// guaranteed. If the server doesn't support this method, it returns 67 | /// `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation 68 | /// or other methods to check whether the cancellation succeeded or whether 69 | /// the operation completed despite cancellation. On successful cancellation, 70 | /// the operation is not deleted; instead, it becomes an operation with an 71 | /// Operation.error value with a google.rpc.Status.code of 1, corresponding to 72 | /// `Code.CANCELLED`. 73 | /// 74 | /// [request] - The metadata request object. 75 | /// 76 | /// Request parameters: 77 | /// 78 | /// [name] - The name of the operation resource to be cancelled. 79 | /// Value must have pattern `^operations/.*$`. 80 | /// 81 | /// [$fields] - Selector specifying which fields to include in a partial 82 | /// response. 83 | /// 84 | /// Completes with a [Empty]. 85 | /// 86 | /// Completes with a [commons.ApiRequestError] if the API endpoint returned an 87 | /// error. 88 | /// 89 | /// If the used [http.Client] completes with an error when making a REST call, 90 | /// this method will complete with the same error. 91 | async.Future cancel( 92 | CancelOperationRequest request, 93 | core.String name, { 94 | core.String? $fields, 95 | }) async { 96 | final body_ = convert.json.encode(request); 97 | final queryParams_ = >{ 98 | if ($fields != null) 'fields': [$fields], 99 | }; 100 | 101 | final url_ = 'v1/' + core.Uri.encodeFull('$name') + ':cancel'; 102 | 103 | final response_ = await _requester.request( 104 | url_, 105 | 'POST', 106 | body: body_, 107 | queryParams: queryParams_, 108 | ); 109 | return Empty.fromJson(response_ as core.Map); 110 | } 111 | 112 | /// Deletes a long-running operation. 113 | /// 114 | /// This method indicates that the client is no longer interested in the 115 | /// operation result. It does not cancel the operation. If the server doesn't 116 | /// support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. 117 | /// 118 | /// Request parameters: 119 | /// 120 | /// [name] - The name of the operation resource to be deleted. 121 | /// Value must have pattern `^operations/.*$`. 122 | /// 123 | /// [$fields] - Selector specifying which fields to include in a partial 124 | /// response. 125 | /// 126 | /// Completes with a [Empty]. 127 | /// 128 | /// Completes with a [commons.ApiRequestError] if the API endpoint returned an 129 | /// error. 130 | /// 131 | /// If the used [http.Client] completes with an error when making a REST call, 132 | /// this method will complete with the same error. 133 | async.Future delete( 134 | core.String name, { 135 | core.String? $fields, 136 | }) async { 137 | final queryParams_ = >{ 138 | if ($fields != null) 'fields': [$fields], 139 | }; 140 | 141 | final url_ = 'v1/' + core.Uri.encodeFull('$name'); 142 | 143 | final response_ = await _requester.request( 144 | url_, 145 | 'DELETE', 146 | queryParams: queryParams_, 147 | ); 148 | return Empty.fromJson(response_ as core.Map); 149 | } 150 | 151 | /// Lists operations that match the specified filter in the request. 152 | /// 153 | /// If the server doesn't support this method, it returns `UNIMPLEMENTED`. 154 | /// 155 | /// Request parameters: 156 | /// 157 | /// [name] - The name of the operation's parent resource. 158 | /// Value must have pattern `^operations$`. 159 | /// 160 | /// [filter] - The standard list filter. 161 | /// 162 | /// [pageSize] - The standard list page size. 163 | /// 164 | /// [pageToken] - The standard list page token. 165 | /// 166 | /// [$fields] - Selector specifying which fields to include in a partial 167 | /// response. 168 | /// 169 | /// Completes with a [ListOperationsResponse]. 170 | /// 171 | /// Completes with a [commons.ApiRequestError] if the API endpoint returned an 172 | /// error. 173 | /// 174 | /// If the used [http.Client] completes with an error when making a REST call, 175 | /// this method will complete with the same error. 176 | async.Future list( 177 | core.String name, { 178 | core.String? filter, 179 | core.int? pageSize, 180 | core.String? pageToken, 181 | core.String? $fields, 182 | }) async { 183 | final queryParams_ = >{ 184 | if (filter != null) 'filter': [filter], 185 | if (pageSize != null) 'pageSize': ['${pageSize}'], 186 | if (pageToken != null) 'pageToken': [pageToken], 187 | if ($fields != null) 'fields': [$fields], 188 | }; 189 | 190 | final url_ = 'v1/' + core.Uri.encodeFull('$name'); 191 | 192 | final response_ = await _requester.request( 193 | url_, 194 | 'GET', 195 | queryParams: queryParams_, 196 | ); 197 | return ListOperationsResponse.fromJson( 198 | response_ as core.Map); 199 | } 200 | } 201 | 202 | /// The request message for Operations.CancelOperation. 203 | typedef CancelOperationRequest = $Empty; 204 | 205 | /// A generic empty message that you can re-use to avoid defining duplicated 206 | /// empty messages in your APIs. 207 | /// 208 | /// A typical example is to use it as the request or the response type of an API 209 | /// method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns 210 | /// (google.protobuf.Empty); } 211 | typedef Empty = $Empty; 212 | 213 | /// The response message for Operations.ListOperations. 214 | class ListOperationsResponse { 215 | /// The standard List next-page token. 216 | core.String? nextPageToken; 217 | 218 | /// A list of operations that matches the specified filter in the request. 219 | core.List? operations; 220 | 221 | ListOperationsResponse({ 222 | this.nextPageToken, 223 | this.operations, 224 | }); 225 | 226 | ListOperationsResponse.fromJson(core.Map json_) 227 | : this( 228 | nextPageToken: json_.containsKey('nextPageToken') 229 | ? json_['nextPageToken'] as core.String 230 | : null, 231 | operations: json_.containsKey('operations') 232 | ? (json_['operations'] as core.List) 233 | .map((value) => Operation.fromJson( 234 | value as core.Map)) 235 | .toList() 236 | : null, 237 | ); 238 | 239 | core.Map toJson() => { 240 | if (nextPageToken != null) 'nextPageToken': nextPageToken!, 241 | if (operations != null) 'operations': operations!, 242 | }; 243 | } 244 | 245 | /// This resource represents a long-running operation that is the result of a 246 | /// network API call. 247 | class Operation { 248 | /// If the value is `false`, it means the operation is still in progress. 249 | /// 250 | /// If `true`, the operation is completed, and either `error` or `response` is 251 | /// available. 252 | core.bool? done; 253 | 254 | /// The error result of the operation in case of failure or cancellation. 255 | Status? error; 256 | 257 | /// Service-specific metadata associated with the operation. 258 | /// 259 | /// It typically contains progress information and common metadata such as 260 | /// create time. Some services might not provide such metadata. Any method 261 | /// that returns a long-running operation should document the metadata type, 262 | /// if any. 263 | /// 264 | /// The values for Object must be JSON objects. It can consist of `num`, 265 | /// `String`, `bool` and `null` as well as `Map` and `List` values. 266 | core.Map? metadata; 267 | 268 | /// The server-assigned name, which is only unique within the same service 269 | /// that originally returns it. 270 | /// 271 | /// If you use the default HTTP mapping, the `name` should be a resource name 272 | /// ending with `operations/{unique_id}`. 273 | core.String? name; 274 | 275 | /// The normal, successful response of the operation. 276 | /// 277 | /// If the original method returns no data on success, such as `Delete`, the 278 | /// response is `google.protobuf.Empty`. If the original method is standard 279 | /// `Get`/`Create`/`Update`, the response should be the resource. For other 280 | /// methods, the response should have the type `XxxResponse`, where `Xxx` is 281 | /// the original method name. For example, if the original method name is 282 | /// `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`. 283 | /// 284 | /// The values for Object must be JSON objects. It can consist of `num`, 285 | /// `String`, `bool` and `null` as well as `Map` and `List` values. 286 | core.Map? response; 287 | 288 | Operation({ 289 | this.done, 290 | this.error, 291 | this.metadata, 292 | this.name, 293 | this.response, 294 | }); 295 | 296 | Operation.fromJson(core.Map json_) 297 | : this( 298 | done: json_.containsKey('done') ? json_['done'] as core.bool : null, 299 | error: json_.containsKey('error') 300 | ? Status.fromJson( 301 | json_['error'] as core.Map) 302 | : null, 303 | metadata: json_.containsKey('metadata') 304 | ? json_['metadata'] as core.Map 305 | : null, 306 | name: json_.containsKey('name') ? json_['name'] as core.String : null, 307 | response: json_.containsKey('response') 308 | ? json_['response'] as core.Map 309 | : null, 310 | ); 311 | 312 | core.Map toJson() => { 313 | if (done != null) 'done': done!, 314 | if (error != null) 'error': error!, 315 | if (metadata != null) 'metadata': metadata!, 316 | if (name != null) 'name': name!, 317 | if (response != null) 'response': response!, 318 | }; 319 | } 320 | 321 | /// The `Status` type defines a logical error model that is suitable for 322 | /// different programming environments, including REST APIs and RPC APIs. 323 | /// 324 | /// It is used by [gRPC](https://github.com/grpc). Each `Status` message 325 | /// contains three pieces of data: error code, error message, and error details. 326 | /// You can find out more about this error model and how to work with it in the 327 | /// [API Design Guide](https://cloud.google.com/apis/design/errors). 328 | typedef Status = $Status; 329 | -------------------------------------------------------------------------------- /generated/firebaseapis/lib/firebaseml/v1.dart: -------------------------------------------------------------------------------- 1 | // This is a generated file (see the discoveryapis_generator project). 2 | 3 | // ignore_for_file: camel_case_types 4 | // ignore_for_file: comment_references 5 | // ignore_for_file: deprecated_member_use_from_same_package 6 | // ignore_for_file: lines_longer_than_80_chars 7 | // ignore_for_file: non_constant_identifier_names 8 | // ignore_for_file: prefer_interpolation_to_compose_strings 9 | // ignore_for_file: unnecessary_brace_in_string_interps 10 | // ignore_for_file: unnecessary_lambdas 11 | // ignore_for_file: unnecessary_library_directive 12 | // ignore_for_file: unnecessary_string_interpolations 13 | 14 | /// Firebase ML API - v1 15 | /// 16 | /// Access custom machine learning models hosted via Firebase ML. 17 | /// 18 | /// For more information, see 19 | /// 20 | /// Create an instance of [FirebaseMLApi] to access these resources: 21 | /// 22 | /// - [OperationsResource] 23 | library firebaseml_v1; 24 | 25 | import 'dart:async' as async; 26 | import 'dart:convert' as convert; 27 | import 'dart:core' as core; 28 | 29 | import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; 30 | import 'package:http/http.dart' as http; 31 | 32 | import '../shared.dart'; 33 | import '../src/user_agent.dart'; 34 | 35 | export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' 36 | show ApiRequestError, DetailedApiRequestError; 37 | 38 | /// Access custom machine learning models hosted via Firebase ML. 39 | class FirebaseMLApi { 40 | /// See, edit, configure, and delete your Google Cloud data and see the email 41 | /// address for your Google Account. 42 | static const cloudPlatformScope = 43 | 'https://www.googleapis.com/auth/cloud-platform'; 44 | 45 | final commons.ApiRequester _requester; 46 | 47 | OperationsResource get operations => OperationsResource(_requester); 48 | 49 | FirebaseMLApi(http.Client client, 50 | {core.String rootUrl = 'https://firebaseml.googleapis.com/', 51 | core.String servicePath = ''}) 52 | : _requester = 53 | commons.ApiRequester(client, rootUrl, servicePath, requestHeaders); 54 | } 55 | 56 | class OperationsResource { 57 | final commons.ApiRequester _requester; 58 | 59 | OperationsResource(commons.ApiRequester client) : _requester = client; 60 | 61 | /// Starts asynchronous cancellation on a long-running operation. 62 | /// 63 | /// The server 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 can use Operations.GetOperation 66 | /// or other methods to check whether the cancellation succeeded or whether 67 | /// the operation completed despite cancellation. On successful cancellation, 68 | /// the operation is not deleted; instead, it becomes an operation with an 69 | /// Operation.error value with a google.rpc.Status.code of 1, corresponding to 70 | /// `Code.CANCELLED`. 71 | /// 72 | /// [request] - The metadata request object. 73 | /// 74 | /// Request parameters: 75 | /// 76 | /// [name] - The name of the operation resource to be cancelled. 77 | /// Value must have pattern `^operations/.*$`. 78 | /// 79 | /// [$fields] - Selector specifying which fields to include in a partial 80 | /// response. 81 | /// 82 | /// Completes with a [Empty]. 83 | /// 84 | /// Completes with a [commons.ApiRequestError] if the API endpoint returned an 85 | /// error. 86 | /// 87 | /// If the used [http.Client] completes with an error when making a REST call, 88 | /// this method will complete with the same error. 89 | async.Future cancel( 90 | CancelOperationRequest request, 91 | core.String name, { 92 | core.String? $fields, 93 | }) async { 94 | final body_ = convert.json.encode(request); 95 | final queryParams_ = >{ 96 | if ($fields != null) 'fields': [$fields], 97 | }; 98 | 99 | final url_ = 'v1/' + core.Uri.encodeFull('$name') + ':cancel'; 100 | 101 | final response_ = await _requester.request( 102 | url_, 103 | 'POST', 104 | body: body_, 105 | queryParams: queryParams_, 106 | ); 107 | return Empty.fromJson(response_ as core.Map); 108 | } 109 | 110 | /// Deletes a long-running operation. 111 | /// 112 | /// This method indicates that the client is no longer interested in the 113 | /// operation result. It does not cancel the operation. If the server doesn't 114 | /// support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. 115 | /// 116 | /// Request parameters: 117 | /// 118 | /// [name] - The name of the operation resource to be deleted. 119 | /// Value must have pattern `^operations/.*$`. 120 | /// 121 | /// [$fields] - Selector specifying which fields to include in a partial 122 | /// response. 123 | /// 124 | /// Completes with a [Empty]. 125 | /// 126 | /// Completes with a [commons.ApiRequestError] if the API endpoint returned an 127 | /// error. 128 | /// 129 | /// If the used [http.Client] completes with an error when making a REST call, 130 | /// this method will complete with the same error. 131 | async.Future delete( 132 | core.String name, { 133 | core.String? $fields, 134 | }) async { 135 | final queryParams_ = >{ 136 | if ($fields != null) 'fields': [$fields], 137 | }; 138 | 139 | final url_ = 'v1/' + core.Uri.encodeFull('$name'); 140 | 141 | final response_ = await _requester.request( 142 | url_, 143 | 'DELETE', 144 | queryParams: queryParams_, 145 | ); 146 | return Empty.fromJson(response_ as core.Map); 147 | } 148 | 149 | /// Lists operations that match the specified filter in the request. 150 | /// 151 | /// If the server doesn't support this method, it returns `UNIMPLEMENTED`. 152 | /// 153 | /// Request parameters: 154 | /// 155 | /// [name] - The name of the operation's parent resource. 156 | /// Value must have pattern `^operations$`. 157 | /// 158 | /// [filter] - The standard list filter. 159 | /// 160 | /// [pageSize] - The standard list page size. 161 | /// 162 | /// [pageToken] - The standard list page token. 163 | /// 164 | /// [$fields] - Selector specifying which fields to include in a partial 165 | /// response. 166 | /// 167 | /// Completes with a [ListOperationsResponse]. 168 | /// 169 | /// Completes with a [commons.ApiRequestError] if the API endpoint returned an 170 | /// error. 171 | /// 172 | /// If the used [http.Client] completes with an error when making a REST call, 173 | /// this method will complete with the same error. 174 | async.Future list( 175 | core.String name, { 176 | core.String? filter, 177 | core.int? pageSize, 178 | core.String? pageToken, 179 | core.String? $fields, 180 | }) async { 181 | final queryParams_ = >{ 182 | if (filter != null) 'filter': [filter], 183 | if (pageSize != null) 'pageSize': ['${pageSize}'], 184 | if (pageToken != null) 'pageToken': [pageToken], 185 | if ($fields != null) 'fields': [$fields], 186 | }; 187 | 188 | final url_ = 'v1/' + core.Uri.encodeFull('$name'); 189 | 190 | final response_ = await _requester.request( 191 | url_, 192 | 'GET', 193 | queryParams: queryParams_, 194 | ); 195 | return ListOperationsResponse.fromJson( 196 | response_ as core.Map); 197 | } 198 | } 199 | 200 | /// The request message for Operations.CancelOperation. 201 | typedef CancelOperationRequest = $Empty; 202 | 203 | /// A generic empty message that you can re-use to avoid defining duplicated 204 | /// empty messages in your APIs. 205 | /// 206 | /// A typical example is to use it as the request or the response type of an API 207 | /// method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns 208 | /// (google.protobuf.Empty); } 209 | typedef Empty = $Empty; 210 | 211 | /// The response message for Operations.ListOperations. 212 | class ListOperationsResponse { 213 | /// The standard List next-page token. 214 | core.String? nextPageToken; 215 | 216 | /// A list of operations that matches the specified filter in the request. 217 | core.List? operations; 218 | 219 | ListOperationsResponse({ 220 | this.nextPageToken, 221 | this.operations, 222 | }); 223 | 224 | ListOperationsResponse.fromJson(core.Map json_) 225 | : this( 226 | nextPageToken: json_.containsKey('nextPageToken') 227 | ? json_['nextPageToken'] as core.String 228 | : null, 229 | operations: json_.containsKey('operations') 230 | ? (json_['operations'] as core.List) 231 | .map((value) => Operation.fromJson( 232 | value as core.Map)) 233 | .toList() 234 | : null, 235 | ); 236 | 237 | core.Map toJson() => { 238 | if (nextPageToken != null) 'nextPageToken': nextPageToken!, 239 | if (operations != null) 'operations': operations!, 240 | }; 241 | } 242 | 243 | /// This resource represents a long-running operation that is the result of a 244 | /// network API call. 245 | class Operation { 246 | /// If the value is `false`, it means the operation is still in progress. 247 | /// 248 | /// If `true`, the operation is completed, and either `error` or `response` is 249 | /// available. 250 | core.bool? done; 251 | 252 | /// The error result of the operation in case of failure or cancellation. 253 | Status? error; 254 | 255 | /// Service-specific metadata associated with the operation. 256 | /// 257 | /// It typically contains progress information and common metadata such as 258 | /// create time. Some services might not provide such metadata. Any method 259 | /// that returns a long-running operation should document the metadata type, 260 | /// if any. 261 | /// 262 | /// The values for Object must be JSON objects. It can consist of `num`, 263 | /// `String`, `bool` and `null` as well as `Map` and `List` values. 264 | core.Map? metadata; 265 | 266 | /// The server-assigned name, which is only unique within the same service 267 | /// that originally returns it. 268 | /// 269 | /// If you use the default HTTP mapping, the `name` should be a resource name 270 | /// ending with `operations/{unique_id}`. 271 | core.String? name; 272 | 273 | /// The normal, successful response of the operation. 274 | /// 275 | /// If the original method returns no data on success, such as `Delete`, the 276 | /// response is `google.protobuf.Empty`. If the original method is standard 277 | /// `Get`/`Create`/`Update`, the response should be the resource. For other 278 | /// methods, the response should have the type `XxxResponse`, where `Xxx` is 279 | /// the original method name. For example, if the original method name is 280 | /// `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`. 281 | /// 282 | /// The values for Object must be JSON objects. It can consist of `num`, 283 | /// `String`, `bool` and `null` as well as `Map` and `List` values. 284 | core.Map? response; 285 | 286 | Operation({ 287 | this.done, 288 | this.error, 289 | this.metadata, 290 | this.name, 291 | this.response, 292 | }); 293 | 294 | Operation.fromJson(core.Map json_) 295 | : this( 296 | done: json_.containsKey('done') ? json_['done'] as core.bool : null, 297 | error: json_.containsKey('error') 298 | ? Status.fromJson( 299 | json_['error'] as core.Map) 300 | : null, 301 | metadata: json_.containsKey('metadata') 302 | ? json_['metadata'] as core.Map 303 | : null, 304 | name: json_.containsKey('name') ? json_['name'] as core.String : null, 305 | response: json_.containsKey('response') 306 | ? json_['response'] as core.Map 307 | : null, 308 | ); 309 | 310 | core.Map toJson() => { 311 | if (done != null) 'done': done!, 312 | if (error != null) 'error': error!, 313 | if (metadata != null) 'metadata': metadata!, 314 | if (name != null) 'name': name!, 315 | if (response != null) 'response': response!, 316 | }; 317 | } 318 | 319 | /// The `Status` type defines a logical error model that is suitable for 320 | /// different programming environments, including REST APIs and RPC APIs. 321 | /// 322 | /// It is used by [gRPC](https://github.com/grpc). Each `Status` message 323 | /// contains three pieces of data: error code, error message, and error details. 324 | /// You can find out more about this error model and how to work with it in the 325 | /// [API Design Guide](https://cloud.google.com/apis/design/errors). 326 | typedef Status = $Status; 327 | -------------------------------------------------------------------------------- /generated/firebaseapis/lib/firebasestorage/v1beta.dart: -------------------------------------------------------------------------------- 1 | // This is a generated file (see the discoveryapis_generator project). 2 | 3 | // ignore_for_file: camel_case_types 4 | // ignore_for_file: comment_references 5 | // ignore_for_file: deprecated_member_use_from_same_package 6 | // ignore_for_file: lines_longer_than_80_chars 7 | // ignore_for_file: non_constant_identifier_names 8 | // ignore_for_file: prefer_interpolation_to_compose_strings 9 | // ignore_for_file: unnecessary_brace_in_string_interps 10 | // ignore_for_file: unnecessary_lambdas 11 | // ignore_for_file: unnecessary_library_directive 12 | // ignore_for_file: unnecessary_string_interpolations 13 | 14 | /// Cloud Storage for Firebase API - v1beta 15 | /// 16 | /// The Cloud Storage for Firebase API enables programmatic management of Cloud 17 | /// Storage buckets for use in Firebase projects 18 | /// 19 | /// For more information, see 20 | /// 21 | /// Create an instance of [FirebasestorageApi] to access these resources: 22 | /// 23 | /// - [ProjectsResource] 24 | /// - [ProjectsBucketsResource] 25 | library firebasestorage_v1beta; 26 | 27 | import 'dart:async' as async; 28 | import 'dart:convert' as convert; 29 | import 'dart:core' as core; 30 | 31 | import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; 32 | import 'package:http/http.dart' as http; 33 | 34 | import '../shared.dart'; 35 | import '../src/user_agent.dart'; 36 | 37 | export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' 38 | show ApiRequestError, DetailedApiRequestError; 39 | 40 | /// The Cloud Storage for Firebase API enables programmatic management of Cloud 41 | /// Storage buckets for use in Firebase projects 42 | class FirebasestorageApi { 43 | /// See, edit, configure, and delete your Google Cloud data and see the email 44 | /// address for your Google Account. 45 | static const cloudPlatformScope = 46 | 'https://www.googleapis.com/auth/cloud-platform'; 47 | 48 | /// View and administer all your Firebase data and settings 49 | static const firebaseScope = 'https://www.googleapis.com/auth/firebase'; 50 | 51 | final commons.ApiRequester _requester; 52 | 53 | ProjectsResource get projects => ProjectsResource(_requester); 54 | 55 | FirebasestorageApi(http.Client client, 56 | {core.String rootUrl = 'https://firebasestorage.googleapis.com/', 57 | core.String servicePath = ''}) 58 | : _requester = 59 | commons.ApiRequester(client, rootUrl, servicePath, requestHeaders); 60 | } 61 | 62 | class ProjectsResource { 63 | final commons.ApiRequester _requester; 64 | 65 | ProjectsBucketsResource get buckets => ProjectsBucketsResource(_requester); 66 | 67 | ProjectsResource(commons.ApiRequester client) : _requester = client; 68 | } 69 | 70 | class ProjectsBucketsResource { 71 | final commons.ApiRequester _requester; 72 | 73 | ProjectsBucketsResource(commons.ApiRequester client) : _requester = client; 74 | 75 | /// Links a Google Cloud Storage bucket to a Firebase project. 76 | /// 77 | /// [request] - The metadata request object. 78 | /// 79 | /// Request parameters: 80 | /// 81 | /// [bucket] - Required. Resource name of the bucket, mirrors the ID of the 82 | /// underlying Google Cloud Storage bucket, 83 | /// `projects/{project_id_or_number}/buckets/{bucket_id}`. 84 | /// Value must have pattern `^projects/\[^/\]+/buckets/\[^/\]+$`. 85 | /// 86 | /// [$fields] - Selector specifying which fields to include in a partial 87 | /// response. 88 | /// 89 | /// Completes with a [Bucket]. 90 | /// 91 | /// Completes with a [commons.ApiRequestError] if the API endpoint returned an 92 | /// error. 93 | /// 94 | /// If the used [http.Client] completes with an error when making a REST call, 95 | /// this method will complete with the same error. 96 | async.Future addFirebase( 97 | AddFirebaseRequest request, 98 | core.String bucket, { 99 | core.String? $fields, 100 | }) async { 101 | final body_ = convert.json.encode(request); 102 | final queryParams_ = >{ 103 | if ($fields != null) 'fields': [$fields], 104 | }; 105 | 106 | final url_ = 'v1beta/' + core.Uri.encodeFull('$bucket') + ':addFirebase'; 107 | 108 | final response_ = await _requester.request( 109 | url_, 110 | 'POST', 111 | body: body_, 112 | queryParams: queryParams_, 113 | ); 114 | return Bucket.fromJson(response_ as core.Map); 115 | } 116 | 117 | /// Gets a single linked storage bucket. 118 | /// 119 | /// Request parameters: 120 | /// 121 | /// [name] - Required. Resource name of the bucket, mirrors the ID of the 122 | /// underlying Google Cloud Storage bucket, 123 | /// `projects/{project_id_or_number}/buckets/{bucket_id}`. 124 | /// Value must have pattern `^projects/\[^/\]+/buckets/\[^/\]+$`. 125 | /// 126 | /// [$fields] - Selector specifying which fields to include in a partial 127 | /// response. 128 | /// 129 | /// Completes with a [Bucket]. 130 | /// 131 | /// Completes with a [commons.ApiRequestError] if the API endpoint returned an 132 | /// error. 133 | /// 134 | /// If the used [http.Client] completes with an error when making a REST call, 135 | /// this method will complete with the same error. 136 | async.Future get( 137 | core.String name, { 138 | core.String? $fields, 139 | }) async { 140 | final queryParams_ = >{ 141 | if ($fields != null) 'fields': [$fields], 142 | }; 143 | 144 | final url_ = 'v1beta/' + core.Uri.encodeFull('$name'); 145 | 146 | final response_ = await _requester.request( 147 | url_, 148 | 'GET', 149 | queryParams: queryParams_, 150 | ); 151 | return Bucket.fromJson(response_ as core.Map); 152 | } 153 | 154 | /// Lists the linked storage buckets for a project. 155 | /// 156 | /// Request parameters: 157 | /// 158 | /// [parent] - Required. Resource name of the parent Firebase project, 159 | /// `projects/{project_id_or_number}`. 160 | /// Value must have pattern `^projects/\[^/\]+$`. 161 | /// 162 | /// [pageSize] - The maximum number of buckets to return. If not set, the 163 | /// server will use a reasonable default. 164 | /// 165 | /// [pageToken] - A page token, received from a previous `ListBuckets` call. 166 | /// Provide this to retrieve the subsequent page. When paginating, all other 167 | /// parameters provided to `ListBuckets` must match the call that provided the 168 | /// page token. 169 | /// 170 | /// [$fields] - Selector specifying which fields to include in a partial 171 | /// response. 172 | /// 173 | /// Completes with a [ListBucketsResponse]. 174 | /// 175 | /// Completes with a [commons.ApiRequestError] if the API endpoint returned an 176 | /// error. 177 | /// 178 | /// If the used [http.Client] completes with an error when making a REST call, 179 | /// this method will complete with the same error. 180 | async.Future list( 181 | core.String parent, { 182 | core.int? pageSize, 183 | core.String? pageToken, 184 | core.String? $fields, 185 | }) async { 186 | final queryParams_ = >{ 187 | if (pageSize != null) 'pageSize': ['${pageSize}'], 188 | if (pageToken != null) 'pageToken': [pageToken], 189 | if ($fields != null) 'fields': [$fields], 190 | }; 191 | 192 | final url_ = 'v1beta/' + core.Uri.encodeFull('$parent') + '/buckets'; 193 | 194 | final response_ = await _requester.request( 195 | url_, 196 | 'GET', 197 | queryParams: queryParams_, 198 | ); 199 | return ListBucketsResponse.fromJson( 200 | response_ as core.Map); 201 | } 202 | 203 | /// Unlinks a linked Google Cloud Storage bucket from a Firebase project. 204 | /// 205 | /// [request] - The metadata request object. 206 | /// 207 | /// Request parameters: 208 | /// 209 | /// [bucket] - Required. Resource name of the bucket, mirrors the ID of the 210 | /// underlying Google Cloud Storage bucket, 211 | /// `projects/{project_id_or_number}/buckets/{bucket_id}`. 212 | /// Value must have pattern `^projects/\[^/\]+/buckets/\[^/\]+$`. 213 | /// 214 | /// [$fields] - Selector specifying which fields to include in a partial 215 | /// response. 216 | /// 217 | /// Completes with a [Empty]. 218 | /// 219 | /// Completes with a [commons.ApiRequestError] if the API endpoint returned an 220 | /// error. 221 | /// 222 | /// If the used [http.Client] completes with an error when making a REST call, 223 | /// this method will complete with the same error. 224 | async.Future removeFirebase( 225 | RemoveFirebaseRequest request, 226 | core.String bucket, { 227 | core.String? $fields, 228 | }) async { 229 | final body_ = convert.json.encode(request); 230 | final queryParams_ = >{ 231 | if ($fields != null) 'fields': [$fields], 232 | }; 233 | 234 | final url_ = 'v1beta/' + core.Uri.encodeFull('$bucket') + ':removeFirebase'; 235 | 236 | final response_ = await _requester.request( 237 | url_, 238 | 'POST', 239 | body: body_, 240 | queryParams: queryParams_, 241 | ); 242 | return Empty.fromJson(response_ as core.Map); 243 | } 244 | } 245 | 246 | /// The request used to link a Google Cloud Storage bucket to a Firebase 247 | /// project. 248 | typedef AddFirebaseRequest = $Empty; 249 | 250 | /// A storage bucket and its relation to a parent Firebase project. 251 | class Bucket { 252 | /// Resource name of the bucket. 253 | /// 254 | /// Output only. 255 | core.String? name; 256 | 257 | Bucket({ 258 | this.name, 259 | }); 260 | 261 | Bucket.fromJson(core.Map json_) 262 | : this( 263 | name: json_.containsKey('name') ? json_['name'] as core.String : null, 264 | ); 265 | 266 | core.Map toJson() => { 267 | if (name != null) 'name': name!, 268 | }; 269 | } 270 | 271 | /// A generic empty message that you can re-use to avoid defining duplicated 272 | /// empty messages in your APIs. 273 | /// 274 | /// A typical example is to use it as the request or the response type of an API 275 | /// method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns 276 | /// (google.protobuf.Empty); } 277 | typedef Empty = $Empty; 278 | 279 | /// The response returned by `ListBuckets`. 280 | class ListBucketsResponse { 281 | /// The list of linked buckets. 282 | core.List? buckets; 283 | 284 | /// A token that can be sent as `page_token` to retrieve the next page. 285 | /// 286 | /// If this field is omitted, there are no subsequent pages. 287 | core.String? nextPageToken; 288 | 289 | ListBucketsResponse({ 290 | this.buckets, 291 | this.nextPageToken, 292 | }); 293 | 294 | ListBucketsResponse.fromJson(core.Map json_) 295 | : this( 296 | buckets: json_.containsKey('buckets') 297 | ? (json_['buckets'] as core.List) 298 | .map((value) => Bucket.fromJson( 299 | value as core.Map)) 300 | .toList() 301 | : null, 302 | nextPageToken: json_.containsKey('nextPageToken') 303 | ? json_['nextPageToken'] as core.String 304 | : null, 305 | ); 306 | 307 | core.Map toJson() => { 308 | if (buckets != null) 'buckets': buckets!, 309 | if (nextPageToken != null) 'nextPageToken': nextPageToken!, 310 | }; 311 | } 312 | 313 | /// The request used to unlink a Google Cloud Storage bucket from a Firebase 314 | /// project. 315 | typedef RemoveFirebaseRequest = $Empty; 316 | -------------------------------------------------------------------------------- /generated/firebaseapis/lib/src/user_agent.dart: -------------------------------------------------------------------------------- 1 | import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; 2 | 3 | /// Request headers used by all libraries in this package 4 | final requestHeaders = { 5 | 'user-agent': 'google-api-dart-client/0.1.1', 6 | 'x-goog-api-client': 'gl-dart/${commons.dartVersion} gdcl/0.1.1', 7 | }; 8 | -------------------------------------------------------------------------------- /generated/firebaseapis/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: firebaseapis 2 | version: 0.2.0 3 | description: Auto-generated client libraries for accessing Google APIs described through the API discovery service. 4 | repository: https://github.com/invertase/dart_firebase_apis/tree/master/generated/firebaseapis 5 | environment: 6 | sdk: '^3.0.0' 7 | dependencies: 8 | # This is a private package dependency used by the generated client stubs. 9 | _discoveryapis_commons: ^1.0.0 10 | http: ">=0.13.0 <2.0.0" 11 | dev_dependencies: 12 | googleapis_auth: ^1.0.0 13 | test: ^1.16.0 14 | -------------------------------------------------------------------------------- /generated/firebaseapis/test/fcmdata/v1beta1_test.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: camel_case_types 2 | // ignore_for_file: comment_references 3 | // ignore_for_file: deprecated_member_use_from_same_package 4 | // ignore_for_file: lines_longer_than_80_chars 5 | // ignore_for_file: non_constant_identifier_names 6 | // ignore_for_file: prefer_const_declarations 7 | // ignore_for_file: prefer_expression_function_bodies 8 | // ignore_for_file: prefer_final_locals 9 | // ignore_for_file: prefer_interpolation_to_compose_strings 10 | // ignore_for_file: unnecessary_brace_in_string_interps 11 | // ignore_for_file: unnecessary_cast 12 | // ignore_for_file: unnecessary_lambdas 13 | // ignore_for_file: unnecessary_library_directive 14 | // ignore_for_file: unnecessary_string_interpolations 15 | // ignore_for_file: unreachable_from_main 16 | // ignore_for_file: unused_local_variable 17 | 18 | import 'dart:async' as async; 19 | import 'dart:convert' as convert; 20 | import 'dart:core' as core; 21 | 22 | import 'package:firebaseapis/fcmdata/v1beta1.dart' as api; 23 | import 'package:http/http.dart' as http; 24 | import 'package:test/test.dart' as unittest; 25 | 26 | import '../test_shared.dart'; 27 | 28 | core.int buildCounterGoogleFirebaseFcmDataV1beta1AndroidDeliveryData = 0; 29 | api.GoogleFirebaseFcmDataV1beta1AndroidDeliveryData 30 | buildGoogleFirebaseFcmDataV1beta1AndroidDeliveryData() { 31 | final o = api.GoogleFirebaseFcmDataV1beta1AndroidDeliveryData(); 32 | buildCounterGoogleFirebaseFcmDataV1beta1AndroidDeliveryData++; 33 | if (buildCounterGoogleFirebaseFcmDataV1beta1AndroidDeliveryData < 3) { 34 | o.analyticsLabel = 'foo'; 35 | o.appId = 'foo'; 36 | o.data = buildGoogleFirebaseFcmDataV1beta1Data(); 37 | o.date = buildGoogleTypeDate(); 38 | } 39 | buildCounterGoogleFirebaseFcmDataV1beta1AndroidDeliveryData--; 40 | return o; 41 | } 42 | 43 | void checkGoogleFirebaseFcmDataV1beta1AndroidDeliveryData( 44 | api.GoogleFirebaseFcmDataV1beta1AndroidDeliveryData o) { 45 | buildCounterGoogleFirebaseFcmDataV1beta1AndroidDeliveryData++; 46 | if (buildCounterGoogleFirebaseFcmDataV1beta1AndroidDeliveryData < 3) { 47 | unittest.expect( 48 | o.analyticsLabel!, 49 | unittest.equals('foo'), 50 | ); 51 | unittest.expect( 52 | o.appId!, 53 | unittest.equals('foo'), 54 | ); 55 | checkGoogleFirebaseFcmDataV1beta1Data(o.data!); 56 | checkGoogleTypeDate(o.date!); 57 | } 58 | buildCounterGoogleFirebaseFcmDataV1beta1AndroidDeliveryData--; 59 | } 60 | 61 | core.int buildCounterGoogleFirebaseFcmDataV1beta1Data = 0; 62 | api.GoogleFirebaseFcmDataV1beta1Data buildGoogleFirebaseFcmDataV1beta1Data() { 63 | final o = api.GoogleFirebaseFcmDataV1beta1Data(); 64 | buildCounterGoogleFirebaseFcmDataV1beta1Data++; 65 | if (buildCounterGoogleFirebaseFcmDataV1beta1Data < 3) { 66 | o.countMessagesAccepted = 'foo'; 67 | o.deliveryPerformancePercents = 68 | buildGoogleFirebaseFcmDataV1beta1DeliveryPerformancePercents(); 69 | o.messageInsightPercents = 70 | buildGoogleFirebaseFcmDataV1beta1MessageInsightPercents(); 71 | o.messageOutcomePercents = 72 | buildGoogleFirebaseFcmDataV1beta1MessageOutcomePercents(); 73 | } 74 | buildCounterGoogleFirebaseFcmDataV1beta1Data--; 75 | return o; 76 | } 77 | 78 | void checkGoogleFirebaseFcmDataV1beta1Data( 79 | api.GoogleFirebaseFcmDataV1beta1Data o) { 80 | buildCounterGoogleFirebaseFcmDataV1beta1Data++; 81 | if (buildCounterGoogleFirebaseFcmDataV1beta1Data < 3) { 82 | unittest.expect( 83 | o.countMessagesAccepted!, 84 | unittest.equals('foo'), 85 | ); 86 | checkGoogleFirebaseFcmDataV1beta1DeliveryPerformancePercents( 87 | o.deliveryPerformancePercents!); 88 | checkGoogleFirebaseFcmDataV1beta1MessageInsightPercents( 89 | o.messageInsightPercents!); 90 | checkGoogleFirebaseFcmDataV1beta1MessageOutcomePercents( 91 | o.messageOutcomePercents!); 92 | } 93 | buildCounterGoogleFirebaseFcmDataV1beta1Data--; 94 | } 95 | 96 | core.int buildCounterGoogleFirebaseFcmDataV1beta1DeliveryPerformancePercents = 97 | 0; 98 | api.GoogleFirebaseFcmDataV1beta1DeliveryPerformancePercents 99 | buildGoogleFirebaseFcmDataV1beta1DeliveryPerformancePercents() { 100 | final o = api.GoogleFirebaseFcmDataV1beta1DeliveryPerformancePercents(); 101 | buildCounterGoogleFirebaseFcmDataV1beta1DeliveryPerformancePercents++; 102 | if (buildCounterGoogleFirebaseFcmDataV1beta1DeliveryPerformancePercents < 3) { 103 | o.delayedDeviceDoze = 42.0; 104 | o.delayedDeviceOffline = 42.0; 105 | o.delayedMessageThrottled = 42.0; 106 | o.delayedUserStopped = 42.0; 107 | o.deliveredNoDelay = 42.0; 108 | } 109 | buildCounterGoogleFirebaseFcmDataV1beta1DeliveryPerformancePercents--; 110 | return o; 111 | } 112 | 113 | void checkGoogleFirebaseFcmDataV1beta1DeliveryPerformancePercents( 114 | api.GoogleFirebaseFcmDataV1beta1DeliveryPerformancePercents o) { 115 | buildCounterGoogleFirebaseFcmDataV1beta1DeliveryPerformancePercents++; 116 | if (buildCounterGoogleFirebaseFcmDataV1beta1DeliveryPerformancePercents < 3) { 117 | unittest.expect( 118 | o.delayedDeviceDoze!, 119 | unittest.equals(42.0), 120 | ); 121 | unittest.expect( 122 | o.delayedDeviceOffline!, 123 | unittest.equals(42.0), 124 | ); 125 | unittest.expect( 126 | o.delayedMessageThrottled!, 127 | unittest.equals(42.0), 128 | ); 129 | unittest.expect( 130 | o.delayedUserStopped!, 131 | unittest.equals(42.0), 132 | ); 133 | unittest.expect( 134 | o.deliveredNoDelay!, 135 | unittest.equals(42.0), 136 | ); 137 | } 138 | buildCounterGoogleFirebaseFcmDataV1beta1DeliveryPerformancePercents--; 139 | } 140 | 141 | core.List 142 | buildUnnamed0() => [ 143 | buildGoogleFirebaseFcmDataV1beta1AndroidDeliveryData(), 144 | buildGoogleFirebaseFcmDataV1beta1AndroidDeliveryData(), 145 | ]; 146 | 147 | void checkUnnamed0( 148 | core.List o) { 149 | unittest.expect(o, unittest.hasLength(2)); 150 | checkGoogleFirebaseFcmDataV1beta1AndroidDeliveryData(o[0]); 151 | checkGoogleFirebaseFcmDataV1beta1AndroidDeliveryData(o[1]); 152 | } 153 | 154 | core.int 155 | buildCounterGoogleFirebaseFcmDataV1beta1ListAndroidDeliveryDataResponse = 0; 156 | api.GoogleFirebaseFcmDataV1beta1ListAndroidDeliveryDataResponse 157 | buildGoogleFirebaseFcmDataV1beta1ListAndroidDeliveryDataResponse() { 158 | final o = api.GoogleFirebaseFcmDataV1beta1ListAndroidDeliveryDataResponse(); 159 | buildCounterGoogleFirebaseFcmDataV1beta1ListAndroidDeliveryDataResponse++; 160 | if (buildCounterGoogleFirebaseFcmDataV1beta1ListAndroidDeliveryDataResponse < 161 | 3) { 162 | o.androidDeliveryData = buildUnnamed0(); 163 | o.nextPageToken = 'foo'; 164 | } 165 | buildCounterGoogleFirebaseFcmDataV1beta1ListAndroidDeliveryDataResponse--; 166 | return o; 167 | } 168 | 169 | void checkGoogleFirebaseFcmDataV1beta1ListAndroidDeliveryDataResponse( 170 | api.GoogleFirebaseFcmDataV1beta1ListAndroidDeliveryDataResponse o) { 171 | buildCounterGoogleFirebaseFcmDataV1beta1ListAndroidDeliveryDataResponse++; 172 | if (buildCounterGoogleFirebaseFcmDataV1beta1ListAndroidDeliveryDataResponse < 173 | 3) { 174 | checkUnnamed0(o.androidDeliveryData!); 175 | unittest.expect( 176 | o.nextPageToken!, 177 | unittest.equals('foo'), 178 | ); 179 | } 180 | buildCounterGoogleFirebaseFcmDataV1beta1ListAndroidDeliveryDataResponse--; 181 | } 182 | 183 | core.int buildCounterGoogleFirebaseFcmDataV1beta1MessageInsightPercents = 0; 184 | api.GoogleFirebaseFcmDataV1beta1MessageInsightPercents 185 | buildGoogleFirebaseFcmDataV1beta1MessageInsightPercents() { 186 | final o = api.GoogleFirebaseFcmDataV1beta1MessageInsightPercents(); 187 | buildCounterGoogleFirebaseFcmDataV1beta1MessageInsightPercents++; 188 | if (buildCounterGoogleFirebaseFcmDataV1beta1MessageInsightPercents < 3) { 189 | o.priorityLowered = 42.0; 190 | } 191 | buildCounterGoogleFirebaseFcmDataV1beta1MessageInsightPercents--; 192 | return o; 193 | } 194 | 195 | void checkGoogleFirebaseFcmDataV1beta1MessageInsightPercents( 196 | api.GoogleFirebaseFcmDataV1beta1MessageInsightPercents o) { 197 | buildCounterGoogleFirebaseFcmDataV1beta1MessageInsightPercents++; 198 | if (buildCounterGoogleFirebaseFcmDataV1beta1MessageInsightPercents < 3) { 199 | unittest.expect( 200 | o.priorityLowered!, 201 | unittest.equals(42.0), 202 | ); 203 | } 204 | buildCounterGoogleFirebaseFcmDataV1beta1MessageInsightPercents--; 205 | } 206 | 207 | core.int buildCounterGoogleFirebaseFcmDataV1beta1MessageOutcomePercents = 0; 208 | api.GoogleFirebaseFcmDataV1beta1MessageOutcomePercents 209 | buildGoogleFirebaseFcmDataV1beta1MessageOutcomePercents() { 210 | final o = api.GoogleFirebaseFcmDataV1beta1MessageOutcomePercents(); 211 | buildCounterGoogleFirebaseFcmDataV1beta1MessageOutcomePercents++; 212 | if (buildCounterGoogleFirebaseFcmDataV1beta1MessageOutcomePercents < 3) { 213 | o.delivered = 42.0; 214 | o.droppedAppForceStopped = 42.0; 215 | o.droppedDeviceInactive = 42.0; 216 | o.droppedTooManyPendingMessages = 42.0; 217 | o.pending = 42.0; 218 | } 219 | buildCounterGoogleFirebaseFcmDataV1beta1MessageOutcomePercents--; 220 | return o; 221 | } 222 | 223 | void checkGoogleFirebaseFcmDataV1beta1MessageOutcomePercents( 224 | api.GoogleFirebaseFcmDataV1beta1MessageOutcomePercents o) { 225 | buildCounterGoogleFirebaseFcmDataV1beta1MessageOutcomePercents++; 226 | if (buildCounterGoogleFirebaseFcmDataV1beta1MessageOutcomePercents < 3) { 227 | unittest.expect( 228 | o.delivered!, 229 | unittest.equals(42.0), 230 | ); 231 | unittest.expect( 232 | o.droppedAppForceStopped!, 233 | unittest.equals(42.0), 234 | ); 235 | unittest.expect( 236 | o.droppedDeviceInactive!, 237 | unittest.equals(42.0), 238 | ); 239 | unittest.expect( 240 | o.droppedTooManyPendingMessages!, 241 | unittest.equals(42.0), 242 | ); 243 | unittest.expect( 244 | o.pending!, 245 | unittest.equals(42.0), 246 | ); 247 | } 248 | buildCounterGoogleFirebaseFcmDataV1beta1MessageOutcomePercents--; 249 | } 250 | 251 | core.int buildCounterGoogleTypeDate = 0; 252 | api.GoogleTypeDate buildGoogleTypeDate() { 253 | final o = api.GoogleTypeDate(); 254 | buildCounterGoogleTypeDate++; 255 | if (buildCounterGoogleTypeDate < 3) { 256 | o.day = 42; 257 | o.month = 42; 258 | o.year = 42; 259 | } 260 | buildCounterGoogleTypeDate--; 261 | return o; 262 | } 263 | 264 | void checkGoogleTypeDate(api.GoogleTypeDate o) { 265 | buildCounterGoogleTypeDate++; 266 | if (buildCounterGoogleTypeDate < 3) { 267 | unittest.expect( 268 | o.day!, 269 | unittest.equals(42), 270 | ); 271 | unittest.expect( 272 | o.month!, 273 | unittest.equals(42), 274 | ); 275 | unittest.expect( 276 | o.year!, 277 | unittest.equals(42), 278 | ); 279 | } 280 | buildCounterGoogleTypeDate--; 281 | } 282 | 283 | void main() { 284 | unittest.group('obj-schema-GoogleFirebaseFcmDataV1beta1AndroidDeliveryData', 285 | () { 286 | unittest.test('to-json--from-json', () async { 287 | final o = buildGoogleFirebaseFcmDataV1beta1AndroidDeliveryData(); 288 | final oJson = convert.jsonDecode(convert.jsonEncode(o)); 289 | final od = api.GoogleFirebaseFcmDataV1beta1AndroidDeliveryData.fromJson( 290 | oJson as core.Map); 291 | checkGoogleFirebaseFcmDataV1beta1AndroidDeliveryData(od); 292 | }); 293 | }); 294 | 295 | unittest.group('obj-schema-GoogleFirebaseFcmDataV1beta1Data', () { 296 | unittest.test('to-json--from-json', () async { 297 | final o = buildGoogleFirebaseFcmDataV1beta1Data(); 298 | final oJson = convert.jsonDecode(convert.jsonEncode(o)); 299 | final od = api.GoogleFirebaseFcmDataV1beta1Data.fromJson( 300 | oJson as core.Map); 301 | checkGoogleFirebaseFcmDataV1beta1Data(od); 302 | }); 303 | }); 304 | 305 | unittest.group( 306 | 'obj-schema-GoogleFirebaseFcmDataV1beta1DeliveryPerformancePercents', () { 307 | unittest.test('to-json--from-json', () async { 308 | final o = buildGoogleFirebaseFcmDataV1beta1DeliveryPerformancePercents(); 309 | final oJson = convert.jsonDecode(convert.jsonEncode(o)); 310 | final od = 311 | api.GoogleFirebaseFcmDataV1beta1DeliveryPerformancePercents.fromJson( 312 | oJson as core.Map); 313 | checkGoogleFirebaseFcmDataV1beta1DeliveryPerformancePercents(od); 314 | }); 315 | }); 316 | 317 | unittest.group( 318 | 'obj-schema-GoogleFirebaseFcmDataV1beta1ListAndroidDeliveryDataResponse', 319 | () { 320 | unittest.test('to-json--from-json', () async { 321 | final o = 322 | buildGoogleFirebaseFcmDataV1beta1ListAndroidDeliveryDataResponse(); 323 | final oJson = convert.jsonDecode(convert.jsonEncode(o)); 324 | final od = api.GoogleFirebaseFcmDataV1beta1ListAndroidDeliveryDataResponse 325 | .fromJson(oJson as core.Map); 326 | checkGoogleFirebaseFcmDataV1beta1ListAndroidDeliveryDataResponse(od); 327 | }); 328 | }); 329 | 330 | unittest.group( 331 | 'obj-schema-GoogleFirebaseFcmDataV1beta1MessageInsightPercents', () { 332 | unittest.test('to-json--from-json', () async { 333 | final o = buildGoogleFirebaseFcmDataV1beta1MessageInsightPercents(); 334 | final oJson = convert.jsonDecode(convert.jsonEncode(o)); 335 | final od = 336 | api.GoogleFirebaseFcmDataV1beta1MessageInsightPercents.fromJson( 337 | oJson as core.Map); 338 | checkGoogleFirebaseFcmDataV1beta1MessageInsightPercents(od); 339 | }); 340 | }); 341 | 342 | unittest.group( 343 | 'obj-schema-GoogleFirebaseFcmDataV1beta1MessageOutcomePercents', () { 344 | unittest.test('to-json--from-json', () async { 345 | final o = buildGoogleFirebaseFcmDataV1beta1MessageOutcomePercents(); 346 | final oJson = convert.jsonDecode(convert.jsonEncode(o)); 347 | final od = 348 | api.GoogleFirebaseFcmDataV1beta1MessageOutcomePercents.fromJson( 349 | oJson as core.Map); 350 | checkGoogleFirebaseFcmDataV1beta1MessageOutcomePercents(od); 351 | }); 352 | }); 353 | 354 | unittest.group('obj-schema-GoogleTypeDate', () { 355 | unittest.test('to-json--from-json', () async { 356 | final o = buildGoogleTypeDate(); 357 | final oJson = convert.jsonDecode(convert.jsonEncode(o)); 358 | final od = api.GoogleTypeDate.fromJson( 359 | oJson as core.Map); 360 | checkGoogleTypeDate(od); 361 | }); 362 | }); 363 | 364 | unittest.group('resource-ProjectsAndroidAppsDeliveryDataResource', () { 365 | unittest.test('method--list', () async { 366 | final mock = HttpServerMock(); 367 | final res = api.FcmdataApi(mock).projects.androidApps.deliveryData; 368 | final arg_parent = 'foo'; 369 | final arg_pageSize = 42; 370 | final arg_pageToken = 'foo'; 371 | final arg_$fields = 'foo'; 372 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 373 | final path = req.url.path; 374 | var pathOffset = 0; 375 | core.int index; 376 | core.String subPart; 377 | unittest.expect( 378 | path.substring(pathOffset, pathOffset + 1), 379 | unittest.equals('/'), 380 | ); 381 | pathOffset += 1; 382 | unittest.expect( 383 | path.substring(pathOffset, pathOffset + 8), 384 | unittest.equals('v1beta1/'), 385 | ); 386 | pathOffset += 8; 387 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; 388 | 389 | final query = req.url.query; 390 | var queryOffset = 0; 391 | final queryMap = >{}; 392 | void addQueryParam(core.String n, core.String v) => 393 | queryMap.putIfAbsent(n, () => []).add(v); 394 | 395 | if (query.isNotEmpty) { 396 | for (var part in query.split('&')) { 397 | final keyValue = part.split('='); 398 | addQueryParam( 399 | core.Uri.decodeQueryComponent(keyValue[0]), 400 | core.Uri.decodeQueryComponent(keyValue[1]), 401 | ); 402 | } 403 | } 404 | unittest.expect( 405 | core.int.parse(queryMap['pageSize']!.first), 406 | unittest.equals(arg_pageSize), 407 | ); 408 | unittest.expect( 409 | queryMap['pageToken']!.first, 410 | unittest.equals(arg_pageToken), 411 | ); 412 | unittest.expect( 413 | queryMap['fields']!.first, 414 | unittest.equals(arg_$fields), 415 | ); 416 | 417 | final h = { 418 | 'content-type': 'application/json; charset=utf-8', 419 | }; 420 | final resp = convert.json.encode( 421 | buildGoogleFirebaseFcmDataV1beta1ListAndroidDeliveryDataResponse()); 422 | return async.Future.value(stringResponse(200, h, resp)); 423 | }), true); 424 | final response = await res.list(arg_parent, 425 | pageSize: arg_pageSize, 426 | pageToken: arg_pageToken, 427 | $fields: arg_$fields); 428 | checkGoogleFirebaseFcmDataV1beta1ListAndroidDeliveryDataResponse(response 429 | as api.GoogleFirebaseFcmDataV1beta1ListAndroidDeliveryDataResponse); 430 | }); 431 | }); 432 | } 433 | -------------------------------------------------------------------------------- /generated/firebaseapis/test/firebasestorage/v1beta_test.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: camel_case_types 2 | // ignore_for_file: comment_references 3 | // ignore_for_file: deprecated_member_use_from_same_package 4 | // ignore_for_file: lines_longer_than_80_chars 5 | // ignore_for_file: non_constant_identifier_names 6 | // ignore_for_file: prefer_const_declarations 7 | // ignore_for_file: prefer_expression_function_bodies 8 | // ignore_for_file: prefer_final_locals 9 | // ignore_for_file: prefer_interpolation_to_compose_strings 10 | // ignore_for_file: unnecessary_brace_in_string_interps 11 | // ignore_for_file: unnecessary_cast 12 | // ignore_for_file: unnecessary_lambdas 13 | // ignore_for_file: unnecessary_library_directive 14 | // ignore_for_file: unnecessary_string_interpolations 15 | // ignore_for_file: unreachable_from_main 16 | // ignore_for_file: unused_local_variable 17 | 18 | import 'dart:async' as async; 19 | import 'dart:convert' as convert; 20 | import 'dart:core' as core; 21 | 22 | import 'package:firebaseapis/firebasestorage/v1beta.dart' as api; 23 | import 'package:http/http.dart' as http; 24 | import 'package:test/test.dart' as unittest; 25 | 26 | import '../test_shared.dart'; 27 | 28 | core.int buildCounterAddFirebaseRequest = 0; 29 | api.AddFirebaseRequest buildAddFirebaseRequest() { 30 | final o = api.AddFirebaseRequest(); 31 | buildCounterAddFirebaseRequest++; 32 | if (buildCounterAddFirebaseRequest < 3) {} 33 | buildCounterAddFirebaseRequest--; 34 | return o; 35 | } 36 | 37 | void checkAddFirebaseRequest(api.AddFirebaseRequest o) { 38 | buildCounterAddFirebaseRequest++; 39 | if (buildCounterAddFirebaseRequest < 3) {} 40 | buildCounterAddFirebaseRequest--; 41 | } 42 | 43 | core.int buildCounterBucket = 0; 44 | api.Bucket buildBucket() { 45 | final o = api.Bucket(); 46 | buildCounterBucket++; 47 | if (buildCounterBucket < 3) { 48 | o.name = 'foo'; 49 | } 50 | buildCounterBucket--; 51 | return o; 52 | } 53 | 54 | void checkBucket(api.Bucket o) { 55 | buildCounterBucket++; 56 | if (buildCounterBucket < 3) { 57 | unittest.expect( 58 | o.name!, 59 | unittest.equals('foo'), 60 | ); 61 | } 62 | buildCounterBucket--; 63 | } 64 | 65 | core.int buildCounterEmpty = 0; 66 | api.Empty buildEmpty() { 67 | final o = api.Empty(); 68 | buildCounterEmpty++; 69 | if (buildCounterEmpty < 3) {} 70 | buildCounterEmpty--; 71 | return o; 72 | } 73 | 74 | void checkEmpty(api.Empty o) { 75 | buildCounterEmpty++; 76 | if (buildCounterEmpty < 3) {} 77 | buildCounterEmpty--; 78 | } 79 | 80 | core.List buildUnnamed0() => [ 81 | buildBucket(), 82 | buildBucket(), 83 | ]; 84 | 85 | void checkUnnamed0(core.List o) { 86 | unittest.expect(o, unittest.hasLength(2)); 87 | checkBucket(o[0]); 88 | checkBucket(o[1]); 89 | } 90 | 91 | core.int buildCounterListBucketsResponse = 0; 92 | api.ListBucketsResponse buildListBucketsResponse() { 93 | final o = api.ListBucketsResponse(); 94 | buildCounterListBucketsResponse++; 95 | if (buildCounterListBucketsResponse < 3) { 96 | o.buckets = buildUnnamed0(); 97 | o.nextPageToken = 'foo'; 98 | } 99 | buildCounterListBucketsResponse--; 100 | return o; 101 | } 102 | 103 | void checkListBucketsResponse(api.ListBucketsResponse o) { 104 | buildCounterListBucketsResponse++; 105 | if (buildCounterListBucketsResponse < 3) { 106 | checkUnnamed0(o.buckets!); 107 | unittest.expect( 108 | o.nextPageToken!, 109 | unittest.equals('foo'), 110 | ); 111 | } 112 | buildCounterListBucketsResponse--; 113 | } 114 | 115 | core.int buildCounterRemoveFirebaseRequest = 0; 116 | api.RemoveFirebaseRequest buildRemoveFirebaseRequest() { 117 | final o = api.RemoveFirebaseRequest(); 118 | buildCounterRemoveFirebaseRequest++; 119 | if (buildCounterRemoveFirebaseRequest < 3) {} 120 | buildCounterRemoveFirebaseRequest--; 121 | return o; 122 | } 123 | 124 | void checkRemoveFirebaseRequest(api.RemoveFirebaseRequest o) { 125 | buildCounterRemoveFirebaseRequest++; 126 | if (buildCounterRemoveFirebaseRequest < 3) {} 127 | buildCounterRemoveFirebaseRequest--; 128 | } 129 | 130 | void main() { 131 | unittest.group('obj-schema-AddFirebaseRequest', () { 132 | unittest.test('to-json--from-json', () async { 133 | final o = buildAddFirebaseRequest(); 134 | final oJson = convert.jsonDecode(convert.jsonEncode(o)); 135 | final od = api.AddFirebaseRequest.fromJson( 136 | oJson as core.Map); 137 | checkAddFirebaseRequest(od); 138 | }); 139 | }); 140 | 141 | unittest.group('obj-schema-Bucket', () { 142 | unittest.test('to-json--from-json', () async { 143 | final o = buildBucket(); 144 | final oJson = convert.jsonDecode(convert.jsonEncode(o)); 145 | final od = 146 | api.Bucket.fromJson(oJson as core.Map); 147 | checkBucket(od); 148 | }); 149 | }); 150 | 151 | unittest.group('obj-schema-Empty', () { 152 | unittest.test('to-json--from-json', () async { 153 | final o = buildEmpty(); 154 | final oJson = convert.jsonDecode(convert.jsonEncode(o)); 155 | final od = 156 | api.Empty.fromJson(oJson as core.Map); 157 | checkEmpty(od); 158 | }); 159 | }); 160 | 161 | unittest.group('obj-schema-ListBucketsResponse', () { 162 | unittest.test('to-json--from-json', () async { 163 | final o = buildListBucketsResponse(); 164 | final oJson = convert.jsonDecode(convert.jsonEncode(o)); 165 | final od = api.ListBucketsResponse.fromJson( 166 | oJson as core.Map); 167 | checkListBucketsResponse(od); 168 | }); 169 | }); 170 | 171 | unittest.group('obj-schema-RemoveFirebaseRequest', () { 172 | unittest.test('to-json--from-json', () async { 173 | final o = buildRemoveFirebaseRequest(); 174 | final oJson = convert.jsonDecode(convert.jsonEncode(o)); 175 | final od = api.RemoveFirebaseRequest.fromJson( 176 | oJson as core.Map); 177 | checkRemoveFirebaseRequest(od); 178 | }); 179 | }); 180 | 181 | unittest.group('resource-ProjectsBucketsResource', () { 182 | unittest.test('method--addFirebase', () async { 183 | final mock = HttpServerMock(); 184 | final res = api.FirebasestorageApi(mock).projects.buckets; 185 | final arg_request = buildAddFirebaseRequest(); 186 | final arg_bucket = 'foo'; 187 | final arg_$fields = 'foo'; 188 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 189 | final obj = api.AddFirebaseRequest.fromJson( 190 | json as core.Map); 191 | checkAddFirebaseRequest(obj); 192 | 193 | final path = req.url.path; 194 | var pathOffset = 0; 195 | core.int index; 196 | core.String subPart; 197 | unittest.expect( 198 | path.substring(pathOffset, pathOffset + 1), 199 | unittest.equals('/'), 200 | ); 201 | pathOffset += 1; 202 | unittest.expect( 203 | path.substring(pathOffset, pathOffset + 7), 204 | unittest.equals('v1beta/'), 205 | ); 206 | pathOffset += 7; 207 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; 208 | 209 | final query = req.url.query; 210 | var queryOffset = 0; 211 | final queryMap = >{}; 212 | void addQueryParam(core.String n, core.String v) => 213 | queryMap.putIfAbsent(n, () => []).add(v); 214 | 215 | if (query.isNotEmpty) { 216 | for (var part in query.split('&')) { 217 | final keyValue = part.split('='); 218 | addQueryParam( 219 | core.Uri.decodeQueryComponent(keyValue[0]), 220 | core.Uri.decodeQueryComponent(keyValue[1]), 221 | ); 222 | } 223 | } 224 | unittest.expect( 225 | queryMap['fields']!.first, 226 | unittest.equals(arg_$fields), 227 | ); 228 | 229 | final h = { 230 | 'content-type': 'application/json; charset=utf-8', 231 | }; 232 | final resp = convert.json.encode(buildBucket()); 233 | return async.Future.value(stringResponse(200, h, resp)); 234 | }), true); 235 | final response = 236 | await res.addFirebase(arg_request, arg_bucket, $fields: arg_$fields); 237 | checkBucket(response as api.Bucket); 238 | }); 239 | 240 | unittest.test('method--get', () async { 241 | final mock = HttpServerMock(); 242 | final res = api.FirebasestorageApi(mock).projects.buckets; 243 | final arg_name = 'foo'; 244 | final arg_$fields = 'foo'; 245 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 246 | final path = req.url.path; 247 | var pathOffset = 0; 248 | core.int index; 249 | core.String subPart; 250 | unittest.expect( 251 | path.substring(pathOffset, pathOffset + 1), 252 | unittest.equals('/'), 253 | ); 254 | pathOffset += 1; 255 | unittest.expect( 256 | path.substring(pathOffset, pathOffset + 7), 257 | unittest.equals('v1beta/'), 258 | ); 259 | pathOffset += 7; 260 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; 261 | 262 | final query = req.url.query; 263 | var queryOffset = 0; 264 | final queryMap = >{}; 265 | void addQueryParam(core.String n, core.String v) => 266 | queryMap.putIfAbsent(n, () => []).add(v); 267 | 268 | if (query.isNotEmpty) { 269 | for (var part in query.split('&')) { 270 | final keyValue = part.split('='); 271 | addQueryParam( 272 | core.Uri.decodeQueryComponent(keyValue[0]), 273 | core.Uri.decodeQueryComponent(keyValue[1]), 274 | ); 275 | } 276 | } 277 | unittest.expect( 278 | queryMap['fields']!.first, 279 | unittest.equals(arg_$fields), 280 | ); 281 | 282 | final h = { 283 | 'content-type': 'application/json; charset=utf-8', 284 | }; 285 | final resp = convert.json.encode(buildBucket()); 286 | return async.Future.value(stringResponse(200, h, resp)); 287 | }), true); 288 | final response = await res.get(arg_name, $fields: arg_$fields); 289 | checkBucket(response as api.Bucket); 290 | }); 291 | 292 | unittest.test('method--list', () async { 293 | final mock = HttpServerMock(); 294 | final res = api.FirebasestorageApi(mock).projects.buckets; 295 | final arg_parent = 'foo'; 296 | final arg_pageSize = 42; 297 | final arg_pageToken = 'foo'; 298 | final arg_$fields = 'foo'; 299 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 300 | final path = req.url.path; 301 | var pathOffset = 0; 302 | core.int index; 303 | core.String subPart; 304 | unittest.expect( 305 | path.substring(pathOffset, pathOffset + 1), 306 | unittest.equals('/'), 307 | ); 308 | pathOffset += 1; 309 | unittest.expect( 310 | path.substring(pathOffset, pathOffset + 7), 311 | unittest.equals('v1beta/'), 312 | ); 313 | pathOffset += 7; 314 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; 315 | 316 | final query = req.url.query; 317 | var queryOffset = 0; 318 | final queryMap = >{}; 319 | void addQueryParam(core.String n, core.String v) => 320 | queryMap.putIfAbsent(n, () => []).add(v); 321 | 322 | if (query.isNotEmpty) { 323 | for (var part in query.split('&')) { 324 | final keyValue = part.split('='); 325 | addQueryParam( 326 | core.Uri.decodeQueryComponent(keyValue[0]), 327 | core.Uri.decodeQueryComponent(keyValue[1]), 328 | ); 329 | } 330 | } 331 | unittest.expect( 332 | core.int.parse(queryMap['pageSize']!.first), 333 | unittest.equals(arg_pageSize), 334 | ); 335 | unittest.expect( 336 | queryMap['pageToken']!.first, 337 | unittest.equals(arg_pageToken), 338 | ); 339 | unittest.expect( 340 | queryMap['fields']!.first, 341 | unittest.equals(arg_$fields), 342 | ); 343 | 344 | final h = { 345 | 'content-type': 'application/json; charset=utf-8', 346 | }; 347 | final resp = convert.json.encode(buildListBucketsResponse()); 348 | return async.Future.value(stringResponse(200, h, resp)); 349 | }), true); 350 | final response = await res.list(arg_parent, 351 | pageSize: arg_pageSize, 352 | pageToken: arg_pageToken, 353 | $fields: arg_$fields); 354 | checkListBucketsResponse(response as api.ListBucketsResponse); 355 | }); 356 | 357 | unittest.test('method--removeFirebase', () async { 358 | final mock = HttpServerMock(); 359 | final res = api.FirebasestorageApi(mock).projects.buckets; 360 | final arg_request = buildRemoveFirebaseRequest(); 361 | final arg_bucket = 'foo'; 362 | final arg_$fields = 'foo'; 363 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 364 | final obj = api.RemoveFirebaseRequest.fromJson( 365 | json as core.Map); 366 | checkRemoveFirebaseRequest(obj); 367 | 368 | final path = req.url.path; 369 | var pathOffset = 0; 370 | core.int index; 371 | core.String subPart; 372 | unittest.expect( 373 | path.substring(pathOffset, pathOffset + 1), 374 | unittest.equals('/'), 375 | ); 376 | pathOffset += 1; 377 | unittest.expect( 378 | path.substring(pathOffset, pathOffset + 7), 379 | unittest.equals('v1beta/'), 380 | ); 381 | pathOffset += 7; 382 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; 383 | 384 | final query = req.url.query; 385 | var queryOffset = 0; 386 | final queryMap = >{}; 387 | void addQueryParam(core.String n, core.String v) => 388 | queryMap.putIfAbsent(n, () => []).add(v); 389 | 390 | if (query.isNotEmpty) { 391 | for (var part in query.split('&')) { 392 | final keyValue = part.split('='); 393 | addQueryParam( 394 | core.Uri.decodeQueryComponent(keyValue[0]), 395 | core.Uri.decodeQueryComponent(keyValue[1]), 396 | ); 397 | } 398 | } 399 | unittest.expect( 400 | queryMap['fields']!.first, 401 | unittest.equals(arg_$fields), 402 | ); 403 | 404 | final h = { 405 | 'content-type': 'application/json; charset=utf-8', 406 | }; 407 | final resp = convert.json.encode(buildEmpty()); 408 | return async.Future.value(stringResponse(200, h, resp)); 409 | }), true); 410 | final response = await res.removeFirebase(arg_request, arg_bucket, 411 | $fields: arg_$fields); 412 | checkEmpty(response as api.Empty); 413 | }); 414 | }); 415 | } 416 | -------------------------------------------------------------------------------- /generated/firebaseapis/test/test_shared.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async' as async; 2 | import 'dart:convert' as convert; 3 | import 'dart:core' as core; 4 | 5 | import 'package:http/http.dart' as http; 6 | 7 | class HttpServerMock extends http.BaseClient { 8 | late core.Future Function( 9 | http.BaseRequest, core.Object?) _callback; 10 | late core.bool _expectJson; 11 | 12 | void register( 13 | core.Future Function( 14 | http.BaseRequest, 15 | core.Object?, 16 | ) callback, 17 | core.bool expectJson, 18 | ) { 19 | _callback = callback; 20 | _expectJson = expectJson; 21 | } 22 | 23 | @core.override 24 | async.Future send(http.BaseRequest request) async { 25 | if (_expectJson) { 26 | final jsonString = 27 | await request.finalize().transform(convert.utf8.decoder).join(); 28 | if (jsonString.isEmpty) { 29 | return _callback(request, null); 30 | } else { 31 | return _callback(request, convert.json.decode(jsonString)); 32 | } 33 | } else { 34 | final stream = request.finalize(); 35 | final data = await stream.toBytes(); 36 | return _callback(request, data); 37 | } 38 | } 39 | } 40 | 41 | http.StreamedResponse stringResponse( 42 | core.int status, 43 | core.Map headers, 44 | core.String body, 45 | ) { 46 | final stream = async.Stream.value(convert.utf8.encode(body)); 47 | return http.StreamedResponse(stream, status, headers: headers); 48 | } 49 | -------------------------------------------------------------------------------- /generator/bin/generate.dart: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dart 2 | // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 3 | // for details. All rights reserved. Use of this source code is governed by a 4 | // BSD-style license that can be found in the LICENSE file. 5 | 6 | import 'dart:io'; 7 | 8 | import 'package:args/args.dart'; 9 | import 'package:googleapis_generator_dependency/googleapis_generator.dart'; 10 | 11 | ArgParser _downloadCommandArgParser() => ArgParser() 12 | ..addOption('output-dir', 13 | abbr: 'o', 14 | help: 'Output directory of discovery documents.', 15 | defaultsTo: 'googleapis-discovery-documents'); 16 | 17 | ArgParser _runConfigCommandArgParser() => ArgParser() 18 | ..addCommand('download') 19 | ..addCommand('generate') 20 | ..addOption( 21 | 'config-file', 22 | help: 'Configuration file describing package generation.', 23 | defaultsTo: 'config.yaml', 24 | ) 25 | ..addFlag('delete-existing', defaultsTo: true); 26 | 27 | ArgParser _globalArgParser() => ArgParser() 28 | ..addCommand('download', _downloadCommandArgParser()) 29 | ..addCommand('run_config', _runConfigCommandArgParser()) 30 | ..addFlag('help', abbr: 'h', help: 'Displays usage information.'); 31 | 32 | ArgResults _parseArguments(ArgParser parser, List arguments) { 33 | try { 34 | return parser.parse(arguments); 35 | } on FormatException catch (e) { 36 | _dieWithUsage('Error parsing arguments:\n${e.message}\n'); 37 | } 38 | } 39 | 40 | Never _dieWithUsage([String? message]) { 41 | if (message != null) { 42 | print(message); 43 | } 44 | print('Usage:'); 45 | print('The discovery generator has the following sub-commands:'); 46 | print(''); 47 | print(' download'); 48 | print(' run_config'); 49 | print(''); 50 | print("The 'download' subcommand downloads all discovery documents. " 51 | 'It takes the following options:'); 52 | print(''); 53 | print(_downloadCommandArgParser().usage); 54 | print(''); 55 | print("The 'run_config' subcommand downloads discovery documents and " 56 | 'generates one or more API packages based on a configuration file. ' 57 | 'It takes the following options:'); 58 | print(''); 59 | print(_runConfigCommandArgParser().usage); 60 | exit(1); 61 | } 62 | 63 | Future main(List arguments) async { 64 | final parser = _globalArgParser(); 65 | final options = _parseArguments(parser, arguments); 66 | final commandOptions = options.command!; 67 | final subCommands = ['download', 'generate', 'run_config']; 68 | 69 | if (options['help'] as bool) { 70 | _dieWithUsage(); 71 | } else if (!subCommands.contains(commandOptions.name)) { 72 | _dieWithUsage('Invalid command'); 73 | } 74 | 75 | switch (commandOptions.name) { 76 | case 'download': 77 | await downloadDiscoveryDocuments(commandOptions['output-dir'] as String); 78 | case 'run_config': 79 | if (commandOptions.command == null || 80 | !['download', 'generate'].contains(commandOptions.command!.name)) { 81 | _dieWithUsage('The `run_config` command has only the two subcommands: ' 82 | '`download` and `generate`.'); 83 | } 84 | 85 | final configFile = commandOptions['config-file'] as String; 86 | final deleteExisting = commandOptions['delete-existing'] as bool; 87 | switch (commandOptions.command!.name) { 88 | case 'download': 89 | await downloadFromConfiguration(configFile); 90 | await _applyDiffs(configFile); 91 | print('Done!'); 92 | case 'generate': 93 | generateFromConfiguration( 94 | configFile, 95 | deleteExisting, 96 | ); 97 | print('Done'); 98 | } 99 | } 100 | } 101 | 102 | Future _applyDiffs(String configFile) async { 103 | final configFileUri = Uri.file(configFile); 104 | final overridesPath = configFileUri.resolve('overrides').path; 105 | final overridesType = FileSystemEntity.typeSync(overridesPath); 106 | if (overridesType == FileSystemEntityType.notFound) { 107 | print('No overrides to apply!'); 108 | return; 109 | } 110 | 111 | if (overridesType != FileSystemEntityType.directory) { 112 | throw StateError( 113 | '"$overridesPath" should be a directory! But it is a $overridesType', 114 | ); 115 | } 116 | 117 | print(''); 118 | print('Applying diffs!'); 119 | 120 | final overridesDirectory = Directory(overridesPath); 121 | for (var entry in overridesDirectory.listSync(followLinks: false)) { 122 | if (entry is! File || !entry.path.endsWith('.diff')) { 123 | print('Ignoring "$entry'); 124 | continue; 125 | } 126 | print(' Running `git apply -v ${entry.path}`'); 127 | final result = await Process.start( 128 | 'git', 129 | ['apply', '-v', entry.path], 130 | mode: ProcessStartMode.inheritStdio, 131 | ); 132 | 133 | final exitCode = await result.exitCode; 134 | if (exitCode == 0) { 135 | print(' Success!'); 136 | } else { 137 | print([ 138 | 'Failed!', 139 | 'Exit code: $exitCode', 140 | ].map((e) => ' $e').join('\n')); 141 | } 142 | print('\n\n'); 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /generator/lib/googleapis_generator.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 2 | // for details. All rights reserved. Use of this source code is governed by a 3 | // BSD-style license that can be found in the LICENSE file. 4 | 5 | import 'dart:async'; 6 | import 'dart:convert'; 7 | import 'dart:io'; 8 | 9 | import 'package:discoveryapis_generator/discoveryapis_generator.dart'; 10 | import 'package:http/io_client.dart'; 11 | import 'package:io/ansi.dart' as ansi; 12 | import 'package:pool/pool.dart'; 13 | 14 | import 'src/package_configuration.dart'; 15 | import 'src/utils.dart'; 16 | 17 | Future> downloadDiscoveryDocuments( 18 | String outputDir, 19 | ) async { 20 | final apis = await fetchDiscoveryDocuments(); 21 | writeDiscoveryDocuments(outputDir, apis); 22 | return apis; 23 | } 24 | 25 | void writeDiscoveryDocuments( 26 | String outputDir, 27 | Iterable apis, 28 | ) { 29 | final directory = Directory(outputDir); 30 | if (directory.existsSync()) { 31 | print('Deleting directory $outputDir.'); 32 | directory.deleteSync(recursive: true); 33 | } 34 | directory.createSync(recursive: true); 35 | 36 | for (var description in apis) { 37 | final name = '$outputDir/${description.name}__${description.version}.json'; 38 | final file = File(name); 39 | const encoder = JsonEncoder.withIndent(' '); 40 | file.writeAsStringSync('${encoder.convert(description.toJsonSorted())}\n'); 41 | print('Wrote: $name'); 42 | } 43 | } 44 | 45 | Future> fetchDiscoveryDocuments({ 46 | Map? existingRevisions, 47 | Map? additionalEntries, 48 | }) async { 49 | final client = IOClient(); 50 | 51 | Future download(DirectoryListItems item) async { 52 | try { 53 | final result = await client.get( 54 | Uri.parse(item.discoveryRestUrl!), 55 | headers: requestHeaders, 56 | ); 57 | 58 | if (result.statusCode != 200) { 59 | throw StateError( 60 | 'Not a 200 – ${result.statusCode}\n${result.body}', 61 | ); 62 | } 63 | 64 | final description = RestDescription.fromJson( 65 | jsonDecode(result.body) as Map, 66 | ); 67 | 68 | // Sort members here for stability in the output! 69 | description.sort(); 70 | 71 | return description; 72 | } catch (e, stack) { 73 | print( 74 | ansi.red.wrap( 75 | ''' 76 | ${item.discoveryRestUrl} 77 | Failed to retrieve document for "${item.name}:${item.version}" -> Ignoring! 78 | $e 79 | $stack 80 | ''', 81 | ), 82 | ); 83 | return null; 84 | } 85 | } 86 | 87 | try { 88 | final directoryList = await DiscoveryApi(client).apis.list(); 89 | final list = directoryList.items!; 90 | 91 | if (additionalEntries != null) { 92 | for (var entry in additionalEntries.entries) { 93 | list.add(DirectoryListItems( 94 | id: entry.key, 95 | discoveryRestUrl: entry.value, 96 | )); 97 | } 98 | } 99 | 100 | final pool = Pool(10); 101 | try { 102 | var count = 0; 103 | return await pool 104 | .forEach(list, (DirectoryListItems item) async { 105 | print(ansi.darkGray.wrap( 106 | 'Requesting ${++count} of ${list.length} - ${item.id}', 107 | )); 108 | 109 | RestDescription? description; 110 | for (var i = 1; i <= 10; i++) { 111 | description = await download(item); 112 | if (i > 1) { 113 | print(' ${item.id} try #$i'); 114 | } 115 | 116 | final existingRevision = existingRevisions![description?.id!]; 117 | if (existingRevision != null && 118 | existingRevision != description!.revision) { 119 | final compare = 120 | existingRevision.compareTo(description.revision!); 121 | 122 | if (compare.isNegative) { 123 | print( 124 | ' New! ${description.id} ' 125 | 'from $existingRevision to ${description.revision}', 126 | ); 127 | } else { 128 | final tryAgainLag = i > 5 ? 5 : i; 129 | print( 130 | ' Old revision for ${description.id} ' 131 | 'from $existingRevision to ${description.revision}.\n' 132 | ' Trying again in $tryAgainLag second(s) – ' 133 | '${item.discoveryRestUrl}', 134 | ); 135 | await Future.delayed(Duration(seconds: tryAgainLag)); 136 | continue; 137 | } 138 | } 139 | 140 | return description; 141 | } 142 | return description; 143 | }) 144 | .where((rd) => rd != null) 145 | .cast() 146 | .toList(); 147 | } finally { 148 | await pool.close(); 149 | } 150 | } finally { 151 | client.close(); 152 | } 153 | } 154 | 155 | List loadDiscoveryDocuments(String directory) => 156 | Directory(directory) 157 | .listSync() 158 | .where((fse) => fse is File && fse.path.endsWith('.json')) 159 | .map( 160 | (FileSystemEntity file) => RestDescription.fromJson( 161 | json.decode((file as File).readAsStringSync()) as Map), 162 | ) 163 | .toList(); 164 | 165 | Future downloadFromConfiguration(String configFile) async { 166 | final configuration = DiscoveryPackagesConfiguration(configFile); 167 | 168 | // Generate the packages. 169 | final configFileUri = Uri.file(configFile); 170 | await configuration.download( 171 | discoveryPathFromConfigFileUri(configFileUri), 172 | ); 173 | 174 | // Print warnings for APIs not mentioned. 175 | if (configuration.missingApis.isNotEmpty) { 176 | print('WARNING: No configuration for the following APIs:'); 177 | for (var id in configuration.missingApis) { 178 | print('- $id'); 179 | } 180 | } 181 | if (configuration.excessApis.isNotEmpty) { 182 | print('WARNING: The following APIs do not exist:'); 183 | for (var id in configuration.excessApis) { 184 | print('- $id'); 185 | } 186 | } 187 | 188 | void prettyNotNull(String header, Map? value) { 189 | if (value == null || value.isEmpty) return; 190 | 191 | print(header); 192 | for (var entry in value.entries) { 193 | print(' ${entry.key!.padRight(30)} ${entry.value}'); 194 | } 195 | } 196 | 197 | prettyNotNull('new revisions', configuration.newRevisions); 198 | prettyNotNull('old revisions', configuration.oldRevisions); 199 | } 200 | 201 | void generateFromConfiguration( 202 | String configFile, 203 | bool deleteExisting, 204 | ) { 205 | final configuration = DiscoveryPackagesConfiguration(configFile); 206 | 207 | // Generate the packages. 208 | final configFileUri = Uri.file(configFile); 209 | return configuration.generate( 210 | discoveryPathFromConfigFileUri(configFileUri), 211 | configFileUri.resolve('generated').path, 212 | deleteExisting, 213 | ); 214 | } 215 | 216 | String discoveryPathFromConfigFileUri(Uri configFileUri) => 217 | configFileUri.resolve('discovery').path; 218 | -------------------------------------------------------------------------------- /generator/lib/src/package_configuration.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 2 | // for details. All rights reserved. Use of this source code is governed by a 3 | // BSD-style license that can be found in the LICENSE file. 4 | 5 | import 'dart:async'; 6 | import 'dart:convert'; 7 | import 'dart:io'; 8 | 9 | import 'package:discoveryapis_generator/discoveryapis_generator.dart'; 10 | // ignore: implementation_imports 11 | import 'package:discoveryapis_generator/src/namer.dart'; 12 | import 'package:yaml/yaml.dart'; 13 | 14 | import '../googleapis_generator.dart'; 15 | 16 | class Package { 17 | final String name; 18 | final List apis; 19 | final Pubspec pubspec; 20 | final String readme; 21 | final String license; 22 | final String changelog; 23 | final String? example; 24 | final String? monoPkg; 25 | 26 | Package( 27 | this.name, 28 | this.apis, 29 | this.pubspec, 30 | this.readme, 31 | this.license, 32 | this.changelog, 33 | this.example, 34 | this.monoPkg, 35 | ); 36 | } 37 | 38 | /// Configuration of a set of packages generated from a set of APIs exposed by 39 | /// a Discovery Service. 40 | class DiscoveryPackagesConfiguration { 41 | String configFile; 42 | late final Map yaml; 43 | late Map packages; 44 | 45 | late final Set excessApis; 46 | late final List missingApis; 47 | final existingApiRevisions = {}; 48 | Map? newRevisions; 49 | Map? oldRevisions; 50 | 51 | /// Create a new discovery packages configuration. 52 | /// 53 | /// The format of a YAML document describing a number of packages looks 54 | /// like this: 55 | /// 56 | /// packages: 57 | /// - googleapis: 58 | /// version: 0.1.0 59 | /// repository: https://github.com/dart-lang/googleapis 60 | /// readme: resources/README.md 61 | /// license: resources/LICENSE 62 | /// apis: 63 | /// - analytics:v3 64 | /// - bigquery:v2 65 | /// - googleapis_beta: 66 | /// version: 0.1.0 67 | /// repository: https://github.com/dart-lang/googleapis 68 | /// readme: resources/README.md 69 | /// license: resources/LICENSE 70 | /// apis: 71 | /// - datastore:v1beta2 72 | /// - dns:v1beta1 73 | /// skipped_apis: 74 | /// - adexchangebuyer:v1 75 | /// 76 | /// Each package to build is listed under the key `packages:`. 77 | /// 78 | /// The key `skipped_apis` is used to list APIs returned buy the Discovery 79 | /// Service but is not part of any generated packages. 80 | /// 81 | /// The file names for the content of readme and license files are resolved 82 | /// relative to the configuration file. 83 | DiscoveryPackagesConfiguration(this.configFile) { 84 | yaml = loadYaml(File(configFile).readAsStringSync()) as Map; 85 | } 86 | 87 | /// Downloads discovery documents from the configuration. 88 | /// 89 | /// [discoveryDocsDir] is the directory where all the downloaded discovery 90 | /// documents are stored. 91 | Future download(String discoveryDocsDir) async { 92 | // Delete all downloaded discovery documents. 93 | final dir = Directory(discoveryDocsDir); 94 | if (dir.existsSync()) { 95 | print('*** Cataloging and deleting existing discovery JSON files'); 96 | for (var file in dir.listSync(recursive: true).whereType()) { 97 | final json = 98 | jsonDecode(file.readAsStringSync()) as Map; 99 | final id = json['id'] as String; 100 | final revision = json['revision'] as String; 101 | assert(!existingApiRevisions.containsKey(id)); 102 | existingApiRevisions[id] = revision; 103 | } 104 | 105 | print('Existing API count: ${existingApiRevisions.length}'); 106 | 107 | dir.deleteSync(recursive: true); 108 | } 109 | 110 | Map? additionalEntries; 111 | if (yaml.containsKey('additional_apis')) { 112 | final source = yaml['additional_apis'] as Map?; 113 | if (source != null) { 114 | additionalEntries = source 115 | .map((key, value) => MapEntry(key as String, value as String)); 116 | } 117 | } 118 | 119 | // Get all rest discovery documents & initialize this object. 120 | final allApis = await fetchDiscoveryDocuments( 121 | existingRevisions: existingApiRevisions, 122 | additionalEntries: additionalEntries, 123 | ); 124 | _initialize(allApis); 125 | 126 | var count = 0; 127 | for (var entry in packages.entries) { 128 | print(' ${++count} of ${packages.length} - ${entry.key}'); 129 | 130 | writeDiscoveryDocuments( 131 | '$discoveryDocsDir/${entry.key}', 132 | entry.value.apis.map( 133 | (e) { 134 | final allMatches = 135 | allApis.where((element) => element.id == e).toList(); 136 | 137 | if (allMatches.length == 1) { 138 | return allMatches.single; 139 | } 140 | 141 | print( 142 | 'Looking 1 match for "$e" - instead found ${allMatches.length}', 143 | ); 144 | return null; 145 | }, 146 | ).whereType(), 147 | ); 148 | } 149 | } 150 | 151 | /// Generate packages from the configuration. 152 | /// 153 | /// [discoveryDocsDir] is the directory where all the downloaded discovery 154 | /// documents are stored. 155 | /// 156 | /// [generatedApisDir] is the directory where the packages are generated. 157 | /// Each package is generated in a sub-directory. 158 | void generate( 159 | String discoveryDocsDir, 160 | String generatedApisDir, 161 | bool deleteExisting, 162 | ) { 163 | // Delete all downloaded discovery documents. 164 | final dir = Directory(discoveryDocsDir); 165 | if (!dir.existsSync()) { 166 | throw Exception( 167 | 'Error: The given `$discoveryDocsDir` directory does not exist.'); 168 | } 169 | 170 | // Load discovery documents from disc & initialize this object. 171 | final allApis = []; 172 | for (var package in yaml['packages'] as List) { 173 | (package as Map).forEach((name, _) { 174 | allApis.addAll(loadDiscoveryDocuments('$discoveryDocsDir/$name')); 175 | }); 176 | } 177 | _initialize(allApis); 178 | 179 | // Generate packages. 180 | packages.forEach((name, package) { 181 | final results = generateAllLibraries( 182 | '$discoveryDocsDir/$name', 183 | '$generatedApisDir/$name', 184 | package.pubspec, 185 | deleteExisting: deleteExisting, 186 | ); 187 | for (final result in results) { 188 | if (!result.success) { 189 | print(result.toString()); 190 | } 191 | } 192 | 193 | File('$generatedApisDir/$name/README.md') 194 | .writeAsStringSync(package.readme); 195 | File('$generatedApisDir/$name/LICENSE') 196 | .writeAsStringSync(package.license); 197 | File('$generatedApisDir/$name/CHANGELOG.md') 198 | .writeAsStringSync(package.changelog); 199 | if (package.monoPkg != null) { 200 | File('$generatedApisDir/$name/mono_pkg.yaml') 201 | .writeAsStringSync(package.monoPkg!); 202 | } 203 | if (package.example != null) { 204 | Directory('$generatedApisDir/$name/example').createSync(); 205 | File('$generatedApisDir/$name/example/main.dart') 206 | .writeAsStringSync(package.example!); 207 | } 208 | }); 209 | } 210 | 211 | /// Initializes the missingApis/excessApis/packages properties from a list 212 | /// of [RestDescription]s. 213 | void _initialize(List allApis) { 214 | packages = 215 | _packagesFromYaml(yaml['packages'] as YamlList, configFile, allApis); 216 | final knownApis = _calculateKnownApis( 217 | packages, 218 | _listFromYaml(yaml['skipped_apis'] as YamlList?), 219 | ); 220 | missingApis = _calculateMissingApis(knownApis, allApis); 221 | excessApis = _calculateExcessApis(knownApis, allApis); 222 | 223 | if (existingApiRevisions.isNotEmpty) { 224 | for (var api in allApis) { 225 | final existingRevision = existingApiRevisions[api.id!]; 226 | if (existingRevision != null) { 227 | final compare = api.revision!.compareTo(existingRevision); 228 | if (compare == 0) { 229 | continue; 230 | } 231 | final value = 'previous: $existingRevision; current: ${api.revision}'; 232 | if (compare.isNegative) { 233 | (oldRevisions ??= {})[api.id] = value; 234 | } 235 | if (compare > 0) { 236 | (newRevisions ??= {})[api.id] = value; 237 | } 238 | } 239 | } 240 | } 241 | } 242 | 243 | // Return empty list for YAML null value. 244 | static List _listFromYaml(List? value) => value ?? []; 245 | 246 | static String _generateReadme( 247 | String? readmeFile, 248 | String packageName, 249 | List items, { 250 | String? packageVersion, 251 | }) { 252 | final sb = StringBuffer(); 253 | if (readmeFile != null) { 254 | sb.write(File(readmeFile).readAsStringSync()); 255 | } 256 | sb.writeln(''' 257 | 258 | ## Available Google APIs 259 | 260 | The following is a list of APIs that are currently available inside this 261 | package. 262 | '''); 263 | 264 | for (var item in items) { 265 | sb.write('#### '); 266 | if (item!.icons != null && 267 | item.icons!.x16 != null && 268 | item.icons!.x16!.startsWith('https://')) { 269 | sb.write('![Logo](${item.icons!.x16}) '); 270 | } 271 | final libraryName = ApiLibraryNamer.libraryName(item.name, item.version); 272 | sb 273 | ..writeln('${item.title} - `$libraryName`') 274 | ..writeln(); 275 | 276 | if (item.description != null && item.description!.isNotEmpty) { 277 | sb 278 | ..writeln(item.description) 279 | ..writeln(); 280 | } 281 | 282 | if (item.documentationLink != null) { 283 | sb.writeln('- [Documentation](${item.documentationLink})'); 284 | } 285 | 286 | if (packageVersion != null) { 287 | final basePubUri = 288 | 'https://pub.dev/documentation/$packageName/$packageVersion/'; 289 | final pubUri = '$basePubUri$libraryName/$libraryName-library.html'; 290 | sb.writeln('- [API details]($pubUri)'); 291 | } 292 | sb.writeln(); 293 | } 294 | return sb.toString(); 295 | } 296 | 297 | static Map _packagesFromYaml( 298 | YamlList configPackages, 299 | String configFile, 300 | List allApis, 301 | ) { 302 | final packages = {}; 303 | for (var package in configPackages) { 304 | (package as Map).forEach((name, values) { 305 | packages[name as String] = _packageFromYaml( 306 | name, 307 | values as YamlMap, 308 | configFile, 309 | allApis, 310 | ); 311 | }); 312 | } 313 | 314 | return packages; 315 | } 316 | 317 | static Package _packageFromYaml( 318 | String name, 319 | YamlMap values, 320 | String configFile, 321 | List allApis, 322 | ) { 323 | final apis = _listFromYaml(values['apis'] as List?).cast(); 324 | final version = values['version'] as String?; 325 | final author = values['author'] as String?; 326 | final repository = values['repository'] as String?; 327 | 328 | Map? extraDevDependencies; 329 | if (values.containsKey('extraDevDependencies')) { 330 | extraDevDependencies = 331 | (values['extraDevDependencies'] as YamlMap).cast(); 332 | } 333 | 334 | final configUri = Uri.file(configFile); 335 | 336 | allApis.sort((RestDescription? a, RestDescription? b) { 337 | final result = a!.name!.compareTo(b!.name!); 338 | if (result != 0) return result; 339 | return a.version!.compareTo(b.version!); 340 | }); 341 | 342 | String? readmeFile; 343 | if (values['readme'] != null) { 344 | readmeFile = configUri.resolve(values['readme'] as String).path; 345 | } 346 | late String licenseFile; 347 | if (values['license'] != null) { 348 | licenseFile = configUri.resolve(values['license'] as String).path; 349 | } 350 | late String changelogFile; 351 | if (values['changelog'] != null) { 352 | changelogFile = configUri.resolve(values['changelog'] as String).path; 353 | } 354 | String? example; 355 | if (values['example'] != null) { 356 | final exampleFile = configUri.resolve(values['example'] as String).path; 357 | example = File(exampleFile).readAsStringSync(); 358 | } 359 | 360 | String? monoPkg; 361 | if (values['mono_pkg'] != null) { 362 | final monoPkgFile = configUri.resolve(values['mono_pkg'] as String).path; 363 | monoPkg = File(monoPkgFile).readAsStringSync(); 364 | } 365 | 366 | // Generate package description. 367 | final apiDescriptions = []; 368 | const description = 'Auto-generated client libraries for accessing Google ' 369 | 'APIs described through the API discovery service.'; 370 | for (var apiDescription in allApis) { 371 | if (apis.contains(apiDescription!.id)) { 372 | apiDescriptions.add(apiDescription); 373 | } 374 | } 375 | 376 | // Generate the README.md file content. 377 | final readme = _generateReadme( 378 | readmeFile, 379 | name, 380 | apiDescriptions, 381 | packageVersion: version, 382 | ); 383 | 384 | // Read the LICENSE 385 | final license = File(licenseFile).readAsStringSync(); 386 | 387 | // Read CHANGELOG.md 388 | final changelog = File(changelogFile).readAsStringSync(); 389 | 390 | // Create package description with pubspec.yaml information. 391 | final pubspec = Pubspec( 392 | name, 393 | version, 394 | description, 395 | author: author, 396 | repository: repository, 397 | extraDevDependencies: extraDevDependencies, 398 | ); 399 | return Package( 400 | name, 401 | List.from(apis), 402 | pubspec, 403 | readme, 404 | license, 405 | changelog, 406 | example, 407 | monoPkg, 408 | ); 409 | } 410 | 411 | /// The known APIs are the APis mentioned in each package together with 412 | /// the APIs explicitly skipped. 413 | static Set _calculateKnownApis( 414 | Map packages, 415 | List skippedApis, 416 | ) { 417 | final knownApis = {...skippedApis.cast()}; 418 | packages.forEach((_, package) => knownApis.addAll(package.apis)); 419 | return knownApis; 420 | } 421 | 422 | /// The missing APIs are the APIs returned from the Discovery Service 423 | /// but not mentioned in the configuration. 424 | static List _calculateMissingApis( 425 | Iterable knownApis, 426 | List allApis, 427 | ) => 428 | allApis 429 | .where((item) => !knownApis.contains(item.id)) 430 | .map((item) => item.id!) 431 | .toList(); 432 | 433 | /// The excess APIs are the APIs mentioned in the configuration but not 434 | /// returned from the Discovery Service. 435 | static Set _calculateExcessApis( 436 | Iterable knownApis, 437 | List allApis, 438 | ) => 439 | Set.from(knownApis)..removeAll(allApis.map((e) => e.id)); 440 | } 441 | -------------------------------------------------------------------------------- /generator/lib/src/utils.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file 2 | // for details. All rights reserved. Use of this source code is governed by a 3 | // BSD-style license that can be found in the LICENSE file. 4 | 5 | import 'package:discoveryapis_generator/discoveryapis_generator.dart'; 6 | 7 | extension RestDescriptionExtension on RestDescription { 8 | Map toJsonSorted() { 9 | final output = toJson(); 10 | 11 | String betterKey(String key) => 12 | const {'parameters', 'resources', 'schemas'}.contains(key) 13 | ? '2-$key' 14 | : '1-$key'; 15 | 16 | final pairs = output.entries.toList() 17 | ..sort((a, b) => betterKey(a.key).compareTo(betterKey(b.key))); 18 | 19 | return { 20 | for (var p in pairs) p.key: p.value, 21 | }; 22 | } 23 | 24 | void sort() { 25 | if (auth != null) { 26 | if (auth!.oauth2 != null) { 27 | auth!.oauth2!.scopes = _sortMap(auth!.oauth2!.scopes); 28 | } 29 | } 30 | 31 | for (var schema in schemas!.values) { 32 | schema.properties = _sortProperties(schema.properties); 33 | } 34 | 35 | schemas = _sortMap(schemas!); 36 | 37 | resources = _sortResources(resources); 38 | methods = _sortMethods(methods); 39 | parameters = _sortMap(parameters); 40 | } 41 | 42 | static Map? _sortMap(Map? map) { 43 | if (map == null) return null; 44 | return Map.fromEntries( 45 | map.entries.toList()..sort((a, b) => a.key.compareTo(b.key)), 46 | ); 47 | } 48 | 49 | static Map? _sortMethods( 50 | Map? theMethods, 51 | ) { 52 | if (theMethods == null) return null; 53 | 54 | for (var value in theMethods.values) { 55 | value.parameters = _sortMap(value.parameters); 56 | } 57 | 58 | return _sortMap(theMethods); 59 | } 60 | 61 | static Map? _sortResources( 62 | Map? theResources, 63 | ) { 64 | if (theResources == null) return null; 65 | 66 | for (var value in theResources.values) { 67 | value.resources = _sortResources(value.resources); 68 | value.methods = _sortMethods(value.methods); 69 | } 70 | 71 | return _sortMap(theResources); 72 | } 73 | 74 | static Map? _sortProperties( 75 | Map? theMethods, 76 | ) { 77 | if (theMethods == null) return null; 78 | 79 | for (var value in theMethods.values) { 80 | _sortSchema(value); 81 | } 82 | 83 | return _sortMap(theMethods); 84 | } 85 | 86 | static void _sortSchema(JsonSchema schema) { 87 | if (schema.items != null) { 88 | _sortSchema(schema.items!); 89 | } 90 | 91 | schema.properties = _sortProperties(schema.properties); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /generator/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: googleapis_generator_dependency 2 | publish_to: none 3 | 4 | environment: 5 | sdk: ^3.0.0 6 | 7 | dependencies: 8 | args: ^2.3.1 9 | discoveryapis_generator: any 10 | http: '>=0.13.5 <2.0.0' 11 | io: ^1.0.0 12 | pool: ^1.4.0 13 | yaml: '>=2.1.0 <4.0.0' 14 | 15 | dependency_overrides: 16 | discoveryapis_generator: 17 | git: 18 | path: discoveryapis_generator 19 | url: https://github.com/google/googleapis.dart.git 20 | ref: 5e36e5b195ceaa9188533f4b768ce3ce1d9316a0 21 | -------------------------------------------------------------------------------- /generator/tool/config_delta.dart: -------------------------------------------------------------------------------- 1 | import 'dart:collection'; 2 | import 'dart:io'; 3 | 4 | import 'package:yaml/yaml.dart'; 5 | 6 | /// Use this to print a CSV-friendly delta between an old config and a new 7 | /// config. 8 | Future main(List args) async { 9 | if (args.length != 2) { 10 | stderr.writeln( 11 | r''' 12 | run with two args: ', 13 | 14 | You migt also want to do 15 | git show LAST_PUBLISHED_VERSION:config.yaml > old_config.yaml''', 16 | ); 17 | exitCode = 1; 18 | return; 19 | } 20 | 21 | final configs = [ 22 | ..._configs('old', args[0]), 23 | ..._configs('new', args[1]), 24 | ]; 25 | 26 | stderr.writeln('config count: ${configs.length}'); 27 | 28 | final allApis = SplayTreeSet.of( 29 | configs.expand((element) => element.apis.keys), 30 | ); 31 | 32 | for (var name in _names) { 33 | stderr.writeln('\n### $name'); 34 | final oldVer = configs.singleWhere( 35 | (element) => element.version == 'old' && element.name == name); 36 | final newVer = configs.singleWhere( 37 | (element) => element.version == 'new' && element.name == name); 38 | for (var api in allApis) { 39 | final oldApi = oldVer.apis[api].toString(); 40 | final newApi = newVer.apis[api].toString(); 41 | if (oldApi == newApi) { 42 | continue; 43 | } 44 | stderr.writeln([ 45 | api.padRight(30), 46 | 'old:', 47 | oldApi.padRight(10), 48 | 'new:', 49 | newApi.padRight(10), 50 | ].join('\t')); 51 | } 52 | } 53 | 54 | final rows = [ 55 | [ 56 | 'api', 57 | ...configs.map((e) => '${e.name}@${e.version}'), 58 | ], 59 | for (var api in allApis) 60 | [ 61 | api, 62 | ...configs.map((e) => e.apis[api]?.join(',') ?? ''), 63 | ] 64 | ]; 65 | 66 | print(rows.map((row) => row.map((e) => '"$e"').join(',')).join('\n')); 67 | } 68 | 69 | Iterable _configs(String version, String path) sync* { 70 | stderr.writeln('file: $version'); 71 | final fileContents = File(path).readAsStringSync(); 72 | final yaml = loadYaml(fileContents, sourceUrl: Uri.parse(path)) as YamlMap; 73 | final packages = yaml['packages'] as YamlList?; 74 | 75 | for (var name in _names) { 76 | stderr.writeln(' api: $name'); 77 | final entry = packages!.singleWhere( 78 | (element) => element is Map && element.containsKey(name)) as YamlMap; 79 | 80 | final data = entry[name] as YamlMap; 81 | 82 | final apiList = (data['apis'] as YamlList).cast(); 83 | 84 | final apis = SplayTreeMap>(); 85 | 86 | for (var api in apiList) { 87 | final split = api.split(':'); 88 | assert(split.length == 2); 89 | final apiName = split[0]; 90 | final apiVersion = split[1]; 91 | 92 | apis.putIfAbsent(apiName, SplayTreeSet.new).add(apiVersion); 93 | } 94 | yield Configuration(name, version, apis); 95 | } 96 | } 97 | 98 | const _names = {'googleapis', 'googleapis_beta'}; 99 | 100 | class Configuration { 101 | final String name; 102 | final String version; 103 | 104 | final Map> apis; 105 | 106 | Configuration(this.name, this.version, this.apis); 107 | } 108 | -------------------------------------------------------------------------------- /googleapis.LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2014, the Dart project authors. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following 11 | disclaimer in the documentation and/or other materials provided 12 | with the distribution. 13 | * Neither the name of Google LLC nor the names of its 14 | contributors may be used to endorse or promote products derived 15 | from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /melos.yaml: -------------------------------------------------------------------------------- 1 | name: firebaseapis 2 | 3 | packages: 4 | - generator/* 5 | - _test/* 6 | - _test_package/* 7 | - generated/** 8 | - resources/** 9 | 10 | 11 | scripts: 12 | config:download: dart generator/bin/generate.dart run_config download 13 | config:generate: dart generator/bin/generate.dart run_config generate -------------------------------------------------------------------------------- /overrides/i303.diff: -------------------------------------------------------------------------------- 1 | diff --git a/discovery/firebaseapis/firestore__v1.json b/discovery/firebaseapis/firestore__v1.json 2 | index f59030af3..c865a5ad8 100644 3 | --- a/discovery/firebaseapis/firestore__v1.json 4 | +++ b/discovery/firebaseapis/firestore__v1.json 5 | @@ -2812,32 +2812,35 @@ 6 | "RunQueryResponse": { 7 | "description": "The response for Firestore.RunQuery.", 8 | "id": "RunQueryResponse", 9 | - "properties": { 10 | - "document": { 11 | - "$ref": "Document", 12 | - "description": "A query result, not set when reporting partial progress." 13 | + "items": { 14 | + "properties": { 15 | + "document": { 16 | + "$ref": "Document", 17 | + "description": "A query result, not set when reporting partial progress." 18 | + }, 19 | + "done": { 20 | + "description": "If present, Firestore has completely finished the request and no more documents will be returned.", 21 | + "type": "boolean" 22 | + }, 23 | + "readTime": { 24 | + "description": "The time at which the document was read. This may be monotonically increasing; in this case, the previous documents in the result stream are guaranteed not to have changed between their `read_time` and this one. If the query returns no results, a response with `read_time` and no `document` will be sent, and this represents the time at which the query was run.", 25 | + "format": "google-datetime", 26 | + "type": "string" 27 | + }, 28 | + "skippedResults": { 29 | + "description": "The number of results that have been skipped due to an offset between the last response and the current response.", 30 | + "format": "int32", 31 | + "type": "integer" 32 | + }, 33 | + "transaction": { 34 | + "description": "The transaction that was started as part of this request. Can only be set in the first response, and only if RunQueryRequest.new_transaction was set in the request. If set, no other fields will be set in this response.", 35 | + "format": "byte", 36 | + "type": "string" 37 | + } 38 | }, 39 | - "done": { 40 | - "description": "If present, Firestore has completely finished the request and no more documents will be returned.", 41 | - "type": "boolean" 42 | - }, 43 | - "readTime": { 44 | - "description": "The time at which the document was read. This may be monotonically increasing; in this case, the previous documents in the result stream are guaranteed not to have changed between their `read_time` and this one. If the query returns no results, a response with `read_time` and no `document` will be sent, and this represents the time at which the query was run.", 45 | - "format": "google-datetime", 46 | - "type": "string" 47 | - }, 48 | - "skippedResults": { 49 | - "description": "The number of results that have been skipped due to an offset between the last response and the current response.", 50 | - "format": "int32", 51 | - "type": "integer" 52 | - }, 53 | - "transaction": { 54 | - "description": "The transaction that was started as part of this request. Can only be set in the first response, and only if RunQueryRequest.new_transaction was set in the request. If set, no other fields will be set in this response.", 55 | - "format": "byte", 56 | - "type": "string" 57 | - } 58 | + "type": "object" 59 | }, 60 | - "type": "object" 61 | + "type":"array" 62 | }, 63 | "Status": { 64 | "description": "The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).", 65 | -------------------------------------------------------------------------------- /overrides/i488.diff: -------------------------------------------------------------------------------- 1 | diff --git a/discovery/firebaseapis/firebaseremoteconfig__v1.json b/discovery/firebaseapis/firebaseremoteconfig__v1.json 2 | index 31170fc36..241f62222 100644 3 | --- a/discovery/firebaseapis/firebaseremoteconfig__v1.json 4 | +++ b/discovery/firebaseapis/firebaseremoteconfig__v1.json 5 | @@ -244,7 +244,7 @@ 6 | }, 7 | "path": "v1/{+project}/remoteConfig:downloadDefaults", 8 | "response": { 9 | - "$ref": "HttpBody" 10 | + "$ref": "Response" 11 | }, 12 | "scopes": [ 13 | "https://www.googleapis.com/auth/cloud-platform" 14 | @@ -492,30 +492,12 @@ 15 | }, 16 | "type": "object" 17 | }, 18 | - "HttpBody": { 19 | - "description": "Message that represents an arbitrary HTTP body. It should only be used for payload formats that can't be represented as JSON, such as raw binary or an HTML page. This message can be used both in streaming and non-streaming API methods in the request as well as the response. It can be used as a top-level request field, which is convenient if one wants to extract parameters from either the URL or HTTP template into the request fields and also want access to the raw HTTP body. Example: message GetResourceRequest { // A unique request id. string request_id = 1; // The raw HTTP body is bound to this field. google.api.HttpBody http_body = 2; } service ResourceService { rpc GetResource(GetResourceRequest) returns (google.api.HttpBody); rpc UpdateResource(google.api.HttpBody) returns (google.protobuf.Empty); } Example with streaming methods: service CaldavService { rpc GetCalendar(stream google.api.HttpBody) returns (stream google.api.HttpBody); rpc UpdateCalendar(stream google.api.HttpBody) returns (stream google.api.HttpBody); } Use of this type only changes how the request and response bodies are handled, all other features will continue to work unchanged.", 20 | - "id": "HttpBody", 21 | - "properties": { 22 | - "contentType": { 23 | - "description": "The HTTP Content-Type header value specifying the content type of the body.", 24 | - "type": "string" 25 | - }, 26 | - "data": { 27 | - "description": "The HTTP request/response body as raw binary.", 28 | - "format": "byte", 29 | - "type": "string" 30 | - }, 31 | - "extensions": { 32 | - "description": "Application specific response metadata. Must be set in the first response for streaming APIs.", 33 | - "items": { 34 | - "additionalProperties": { 35 | - "description": "Properties of the object. Contains field @type with type URL.", 36 | - "type": "any" 37 | - }, 38 | - "type": "object" 39 | - }, 40 | - "type": "array" 41 | - } 42 | + "Response": { 43 | + "description": "The values in the configuration.", 44 | + "id": "Response", 45 | + "additionalProperties": { 46 | + "description": "Properties of the object. Contains field @type with type URL.", 47 | + "type": "any" 48 | }, 49 | "type": "object" 50 | }, 51 | -------------------------------------------------------------------------------- /overrides/i504.diff: -------------------------------------------------------------------------------- 1 | diff --git a/discovery/firebaseapis/firestore__v1.json b/discovery/firebaseapis/firestore__v1.json 2 | index 80d5085b7..d97c5a411 100644 3 | --- a/discovery/firebaseapis/firestore__v1.json 4 | +++ b/discovery/firebaseapis/firestore__v1.json 5 | @@ -1478,27 +1478,30 @@ 6 | "BatchGetDocumentsResponse": { 7 | "description": "The streamed response for Firestore.BatchGetDocuments.", 8 | "id": "BatchGetDocumentsResponse", 9 | - "properties": { 10 | - "found": { 11 | - "$ref": "Document", 12 | - "description": "A document that was requested." 13 | + "items": { 14 | + "properties": { 15 | + "found": { 16 | + "$ref": "Document", 17 | + "description": "A document that was requested." 18 | + }, 19 | + "missing": { 20 | + "description": "A document name that was requested but does not exist. In the format: `projects/{project_id}/databases/{database_id}/documents/{document_path}`.", 21 | + "type": "string" 22 | + }, 23 | + "readTime": { 24 | + "description": "The time at which the document was read. This may be monotically increasing, in this case the previous documents in the result stream are guaranteed not to have changed between their read_time and this one.", 25 | + "format": "google-datetime", 26 | + "type": "string" 27 | + }, 28 | + "transaction": { 29 | + "description": "The transaction that was started as part of this request. Will only be set in the first response, and only if BatchGetDocumentsRequest.new_transaction was set in the request.", 30 | + "format": "byte", 31 | + "type": "string" 32 | + } 33 | }, 34 | - "missing": { 35 | - "description": "A document name that was requested but does not exist. In the format: `projects/{project_id}/databases/{database_id}/documents/{document_path}`.", 36 | - "type": "string" 37 | - }, 38 | - "readTime": { 39 | - "description": "The time at which the document was read. This may be monotically increasing, in this case the previous documents in the result stream are guaranteed not to have changed between their read_time and this one.", 40 | - "format": "google-datetime", 41 | - "type": "string" 42 | - }, 43 | - "transaction": { 44 | - "description": "The transaction that was started as part of this request. Will only be set in the first response, and only if BatchGetDocumentsRequest.new_transaction was set in the request.", 45 | - "format": "byte", 46 | - "type": "string" 47 | - } 48 | + "type": "object" 49 | }, 50 | - "type": "object" 51 | + "type": "array" 52 | }, 53 | "BatchWriteRequest": { 54 | "description": "The request for Firestore.BatchWrite.", 55 | -------------------------------------------------------------------------------- /overrides/i517.diff: -------------------------------------------------------------------------------- 1 | diff --git a/discovery/firebaseapis/firestore__v1.json b/discovery/firebaseapis/firestore__v1.json 2 | index da7241732..aa15b8894 100644 3 | --- a/discovery/firebaseapis/firestore__v1.json 4 | +++ b/discovery/firebaseapis/firestore__v1.json 5 | @@ -3085,23 +3085,26 @@ 6 | "RunAggregationQueryResponse": { 7 | "description": "The response for Firestore.RunAggregationQuery.", 8 | "id": "RunAggregationQueryResponse", 9 | - "properties": { 10 | - "readTime": { 11 | - "description": "The time at which the aggregate result was computed. This is always monotonically increasing; in this case, the previous AggregationResult in the result stream are guaranteed not to have changed between their `read_time` and this one. If the query returns no results, a response with `read_time` and no `result` will be sent, and this represents the time at which the query was run.", 12 | - "format": "google-datetime", 13 | - "type": "string" 14 | + "items": { 15 | + "properties": { 16 | + "readTime": { 17 | + "description": "The time at which the aggregate result was computed. This is always monotonically increasing; in this case, the previous AggregationResult in the result stream are guaranteed not to have changed between their `read_time` and this one. If the query returns no results, a response with `read_time` and no `result` will be sent, and this represents the time at which the query was run.", 18 | + "format": "google-datetime", 19 | + "type": "string" 20 | + }, 21 | + "result": { 22 | + "$ref": "AggregationResult", 23 | + "description": "A single aggregation result. Not present when reporting partial progress." 24 | + }, 25 | + "transaction": { 26 | + "description": "The transaction that was started as part of this request. Only present on the first response when the request requested to start a new transaction.", 27 | + "format": "byte", 28 | + "type": "string" 29 | + } 30 | }, 31 | - "result": { 32 | - "$ref": "AggregationResult", 33 | - "description": "A single aggregation result. Not present when reporting partial progress." 34 | - }, 35 | - "transaction": { 36 | - "description": "The transaction that was started as part of this request. Only present on the first response when the request requested to start a new transaction.", 37 | - "format": "byte", 38 | - "type": "string" 39 | - } 40 | + "type": "object" 41 | }, 42 | - "type": "object" 43 | + "type": "array" 44 | }, 45 | "RunQueryRequest": { 46 | "description": "The request for Firestore.RunQuery.", 47 | -------------------------------------------------------------------------------- /overrides/i77.diff: -------------------------------------------------------------------------------- 1 | diff --git a/discovery/firebaseapis/firestore__v1.json b/discovery/firebaseapis/firestore__v1.json 2 | index d6fd38a6b..d72932013 100644 3 | --- a/discovery/firebaseapis/firestore__v1.json 4 | +++ b/discovery/firebaseapis/firestore__v1.json 5 | @@ -994,35 +994,6 @@ 6 | "https://www.googleapis.com/auth/datastore" 7 | ] 8 | }, 9 | - "listen": { 10 | - "description": "Listens to changes. This method is only available via gRPC or WebChannel (not REST).", 11 | - "flatPath": "v1/projects/{projectsId}/databases/{databasesId}/documents:listen", 12 | - "httpMethod": "POST", 13 | - "id": "firestore.projects.databases.documents.listen", 14 | - "parameterOrder": [ 15 | - "database" 16 | - ], 17 | - "parameters": { 18 | - "database": { 19 | - "description": "Required. The database name. In the format: `projects/{project_id}/databases/{database_id}`.", 20 | - "location": "path", 21 | - "pattern": "^projects/[^/]+/databases/[^/]+$", 22 | - "required": true, 23 | - "type": "string" 24 | - } 25 | - }, 26 | - "path": "v1/{+database}/documents:listen", 27 | - "request": { 28 | - "$ref": "ListenRequest" 29 | - }, 30 | - "response": { 31 | - "$ref": "ListenResponse" 32 | - }, 33 | - "scopes": [ 34 | - "https://www.googleapis.com/auth/cloud-platform", 35 | - "https://www.googleapis.com/auth/datastore" 36 | - ] 37 | - }, 38 | "partitionQuery": { 39 | "description": "Partitions a query by returning partition cursors that can be used to run the query in parallel. The returned partition cursors are split points that can be used by RunQuery as starting/end points for the query results.", 40 | "flatPath": "v1/projects/{projectsId}/databases/{databasesId}/documents/{documentsId}/{documentsId1}:partitionQuery", 41 | -------------------------------------------------------------------------------- /overrides/idt_v1.diff: -------------------------------------------------------------------------------- 1 | diff --git a/discovery/firebaseapis/identitytoolkit__v1.json b/discovery/firebaseapis/identitytoolkit__v1.json 2 | index dd6c464..94c4ce6 100644 3 | --- a/discovery/firebaseapis/identitytoolkit__v1.json 4 | +++ b/discovery/firebaseapis/identitytoolkit__v1.json 5 | @@ -1194,7 +1194,9 @@ 6 | "parameterOrder": [], 7 | "parameters": {}, 8 | "path": "v1/publicKeys", 9 | - "response": {}, 10 | + "response": { 11 | + "$ref": "GoogleCloudIdentitytoolkitV1GetSessionCookiePublicKeysResponse" 12 | + }, 13 | "scopes": [ 14 | "https://www.googleapis.com/auth/cloud-platform" 15 | ] 16 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: melos_workspace 2 | 3 | environment: 4 | sdk: ^3.0.0 5 | 6 | dev_dependencies: 7 | melos: 8 | -------------------------------------------------------------------------------- /resources/LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2020 Invertase Limited 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /resources/README.md: -------------------------------------------------------------------------------- 1 | ## Firebase APIs for Dart 2 | 3 | Generated Dart libraries for accessing 4 | [Firebase APIs](https://firebase.google.com). 5 | 6 | This is based on the [`googleapis.dart`](https://github.com/google/googleapis.dart) repository but instead aimed at supporting Firebase related APIs only. Additionally, this adds support for several unlisted (but discoverable) Firebase APIs that are not listed on the official [discovery API](https://discovery.googleapis.com/discovery/v1/apis) that `googleapis.dart` uses (and is currently limited to) as well as several private APIs (APIs that require an API key to view discovery information). 7 | -------------------------------------------------------------------------------- /resources/firebaseapis/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.1.1 2 | 3 | - Added support for the following private Firebase APIs: 4 | - `firebaseapptesters:v1alpha` 5 | - `firebaseinstallations:v1` 6 | - `fcmregistrations:v1` 7 | - `firebasepredictions:v1beta1` 8 | - `firebaseextensions:v1beta` 9 | 10 | ## 0.1.0+1 11 | 12 | - Add support for additional Identity Toolkit APIs (v1 & v2). 13 | 14 | ## 0.1.0 15 | 16 | - Initial release 17 | -------------------------------------------------------------------------------- /resources/firebaseapis/examples/main.dart: -------------------------------------------------------------------------------- 1 | /// This example demonstrates usage for a Dart command line application. 2 | /// 3 | /// For details of how to use this package in Flutter, see 4 | /// https://flutter.dev/docs/development/data-and-backend/google-apis 5 | 6 | import 'package:firebaseapis/firebaseremoteconfig/v1.dart' as remote_config; 7 | import 'package:firebaseapis/firebaserules/v1.dart' as firebase_rules; 8 | import 'package:firebaseapis/identitytoolkit/v1.dart' as firebase_auth; 9 | import 'package:googleapis_auth/auth_io.dart' as auth; 10 | 11 | Future main() async { 12 | final authClient = await auth.clientViaApplicationDefaultCredentials(scopes: [ 13 | firebase_rules.FirebaseRulesApi.firebaseScope, 14 | // or read only 15 | // firebase_rules.FirebaseRulesApi.firebaseReadonlyScope, 16 | 17 | firebase_auth.IdentityToolkitApi.firebaseScope, 18 | 19 | remote_config.FirebaseRemoteConfigApi.cloudPlatformScope, 20 | ]); 21 | 22 | // // or 23 | // final authClient = 24 | // auth.clientViaApiKey('API KEY GOES HERE'); 25 | 26 | // // or 27 | // final authClient = await auth.clientViaServiceAccount( 28 | // auth.ServiceAccountCredentials.fromJson( 29 | // r''' 30 | // YOUR JSON HERE 31 | // ''', 32 | // ), 33 | // [ 34 | // remote_config.FirebaseRemoteConfigApi.cloudPlatformScope, 35 | // ], 36 | // ); 37 | 38 | final fr = firebase_rules.FirebaseRulesApi(authClient); 39 | final rules = await fr.projects.rulesets.list('projects/'); 40 | 41 | print(rules.rulesets?.first.name); 42 | print(rules.rulesets?.first.source?.files?.first.content); 43 | 44 | final rc = remote_config.FirebaseRemoteConfigApi(authClient); 45 | final config = 46 | await rc.projects.getRemoteConfig('projects/'); 47 | print(config.parameters); 48 | print(config.parameters?.values.first.defaultValue); 49 | print(config.parameters?.values.first.description); 50 | print(config.parameters?.values.first.valueType); 51 | 52 | final fa = firebase_auth.IdentityToolkitApi(authClient); 53 | final users = await fa.accounts 54 | .lookup(firebase_auth.GoogleCloudIdentitytoolkitV1GetAccountInfoRequest( 55 | localId: [''], 56 | )); 57 | print(users.users?.first.localId); 58 | print(users.users?.first.email); 59 | authClient.close(); 60 | } 61 | -------------------------------------------------------------------------------- /resources/firebaseapis/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: sample 2 | publish_to: none 3 | 4 | environment: 5 | sdk: '>=2.12.0 <3.0.0' 6 | 7 | dependencies: 8 | firebaseapis: 9 | path: ../../generated/firebaseapis 10 | googleapis_auth: any 11 | 12 | -------------------------------------------------------------------------------- /resources/firebaseapis/pubspec_overrides.yaml: -------------------------------------------------------------------------------- 1 | # melos_managed_dependency_overrides: firebaseapis 2 | dependency_overrides: 3 | firebaseapis: 4 | path: ../../generated/firebaseapis 5 | --------------------------------------------------------------------------------