From 1aafc187db2b4198d66adf525644bdd80a913842 Mon Sep 17 00:00:00 2001 From: Lukas Klingsbo Date: Fri, 24 Nov 2023 12:00:54 +0100 Subject: [PATCH 1/6] chore: Move ratings client to monorepo --- .gitignore | 3 + packages/app_center/pubspec.yaml | 5 +- .../app_center_ratings_client/CHANGELOG.md | 3 + packages/app_center_ratings_client/LICENSE | 674 ++++++++++++++++++ packages/app_center_ratings_client/README.md | 18 + .../analysis_options.yaml | 1 + .../lib/ratings_client.dart | 95 +++ .../lib/src/app.dart | 46 ++ .../lib/src/app.freezed.dart | 169 +++++ .../generated/google/protobuf/empty.pb.dart | 65 ++ .../google/protobuf/empty.pbenum.dart | 10 + .../google/protobuf/empty.pbjson.dart | 23 + .../google/protobuf/timestamp.pb.dart | 206 ++++++ .../google/protobuf/timestamp.pbenum.dart | 10 + .../google/protobuf/timestamp.pbjson.dart | 28 + .../generated/ratings_features_app.pb.dart | 249 +++++++ .../ratings_features_app.pbenum.dart | 46 ++ .../ratings_features_app.pbgrpc.dart | 64 ++ .../ratings_features_app.pbjson.dart | 87 +++ .../generated/ratings_features_chart.pb.dart | 301 ++++++++ .../ratings_features_chart.pbenum.dart | 55 ++ .../ratings_features_chart.pbgrpc.dart | 63 ++ .../ratings_features_chart.pbjson.dart | 125 ++++ .../generated/ratings_features_user.pb.dart | 587 +++++++++++++++ .../ratings_features_user.pbenum.dart | 10 + .../ratings_features_user.pbgrpc.dart | 169 +++++ .../ratings_features_user.pbjson.dart | 144 ++++ .../lib/src/user.dart | 26 + .../lib/src/user.freezed.dart | 187 +++++ .../protos/ratings_features_app.proto | 30 + .../protos/ratings_features_chart.proto | 35 + .../protos/ratings_features_user.proto | 52 ++ .../app_center_ratings_client/pubspec.yaml | 22 + .../test/ratings_client_test.dart | 265 +++++++ .../test/ratings_client_test.mocks.dart | 378 ++++++++++ 35 files changed, 4247 insertions(+), 4 deletions(-) create mode 100644 packages/app_center_ratings_client/CHANGELOG.md create mode 100644 packages/app_center_ratings_client/LICENSE create mode 100644 packages/app_center_ratings_client/README.md create mode 100644 packages/app_center_ratings_client/analysis_options.yaml create mode 100644 packages/app_center_ratings_client/lib/ratings_client.dart create mode 100644 packages/app_center_ratings_client/lib/src/app.dart create mode 100644 packages/app_center_ratings_client/lib/src/app.freezed.dart create mode 100644 packages/app_center_ratings_client/lib/src/generated/google/protobuf/empty.pb.dart create mode 100644 packages/app_center_ratings_client/lib/src/generated/google/protobuf/empty.pbenum.dart create mode 100644 packages/app_center_ratings_client/lib/src/generated/google/protobuf/empty.pbjson.dart create mode 100644 packages/app_center_ratings_client/lib/src/generated/google/protobuf/timestamp.pb.dart create mode 100644 packages/app_center_ratings_client/lib/src/generated/google/protobuf/timestamp.pbenum.dart create mode 100644 packages/app_center_ratings_client/lib/src/generated/google/protobuf/timestamp.pbjson.dart create mode 100644 packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pb.dart create mode 100644 packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbenum.dart create mode 100644 packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbgrpc.dart create mode 100644 packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbjson.dart create mode 100644 packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pb.dart create mode 100644 packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pbenum.dart create mode 100644 packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pbgrpc.dart create mode 100644 packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pbjson.dart create mode 100644 packages/app_center_ratings_client/lib/src/generated/ratings_features_user.pb.dart create mode 100644 packages/app_center_ratings_client/lib/src/generated/ratings_features_user.pbenum.dart create mode 100644 packages/app_center_ratings_client/lib/src/generated/ratings_features_user.pbgrpc.dart create mode 100644 packages/app_center_ratings_client/lib/src/generated/ratings_features_user.pbjson.dart create mode 100644 packages/app_center_ratings_client/lib/src/user.dart create mode 100644 packages/app_center_ratings_client/lib/src/user.freezed.dart create mode 100644 packages/app_center_ratings_client/protos/ratings_features_app.proto create mode 100644 packages/app_center_ratings_client/protos/ratings_features_chart.proto create mode 100644 packages/app_center_ratings_client/protos/ratings_features_user.proto create mode 100644 packages/app_center_ratings_client/pubspec.yaml create mode 100644 packages/app_center_ratings_client/test/ratings_client_test.dart create mode 100644 packages/app_center_ratings_client/test/ratings_client_test.mocks.dart diff --git a/.gitignore b/.gitignore index 851e7d7a2..02d5ec871 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,6 @@ app.*.map.json /android/app/debug /android/app/profile /android/app/release + +# Melos generated files +**/pubspec_overrides.yaml diff --git a/packages/app_center/pubspec.yaml b/packages/app_center/pubspec.yaml index 3bcd9374c..391ed86d9 100644 --- a/packages/app_center/pubspec.yaml +++ b/packages/app_center/pubspec.yaml @@ -13,10 +13,7 @@ dependencies: cached_network_image: ^3.3.0 collection: ^1.17.2 dbus: ^0.7.10 - app_center_ratings_client: - git: - url: https://github.com/matthew-hagemann/app_center_ratings_client.dart.git - ref: main + app_center_ratings_client: ^1.0.0 crypto: ^3.0.3 file: ^6.1.4 flutter: diff --git a/packages/app_center_ratings_client/CHANGELOG.md b/packages/app_center_ratings_client/CHANGELOG.md new file mode 100644 index 000000000..effe43c82 --- /dev/null +++ b/packages/app_center_ratings_client/CHANGELOG.md @@ -0,0 +1,3 @@ +## 1.0.0 + +- Initial version. diff --git a/packages/app_center_ratings_client/LICENSE b/packages/app_center_ratings_client/LICENSE new file mode 100644 index 000000000..f288702d2 --- /dev/null +++ b/packages/app_center_ratings_client/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/packages/app_center_ratings_client/README.md b/packages/app_center_ratings_client/README.md new file mode 100644 index 000000000..1db2bb6e1 --- /dev/null +++ b/packages/app_center_ratings_client/README.md @@ -0,0 +1,18 @@ +# Dart Client for Ubuntu App Ratings Service + +## Generating protos: + +```shell +protoc \ + --dart_out=grpc:./lib/src/generated \ + -I./protos \ + ./protos/ratings_features_user.proto google/protobuf/timestamp.proto google/protobuf/empty.proto +``` + +```shell +protoc --dart_out=grpc:lib/src/generated -Iprotos protos/ratings_features_chart.proto +``` + +```shell +protoc --dart_out=grpc:lib/src/generated -Iprotos protos/ratings_features_app.proto +``` diff --git a/packages/app_center_ratings_client/analysis_options.yaml b/packages/app_center_ratings_client/analysis_options.yaml new file mode 100644 index 000000000..cf89ba946 --- /dev/null +++ b/packages/app_center_ratings_client/analysis_options.yaml @@ -0,0 +1 @@ +include: package:ubuntu_lints/analysis_options.yaml diff --git a/packages/app_center_ratings_client/lib/ratings_client.dart b/packages/app_center_ratings_client/lib/ratings_client.dart new file mode 100644 index 000000000..4db30fdfa --- /dev/null +++ b/packages/app_center_ratings_client/lib/ratings_client.dart @@ -0,0 +1,95 @@ +import 'dart:async'; + +import 'package:grpc/grpc.dart'; +import 'package:meta/meta.dart'; + +import 'src/app.dart' as app; +import 'src/generated/google/protobuf/empty.pb.dart'; +import 'src/generated/ratings_features_app.pbgrpc.dart'; +import 'src/generated/ratings_features_user.pbgrpc.dart'; +import 'src/user.dart' as user; + +class RatingsClient { + late AppClient _appClient; + late UserClient _userClient; + + RatingsClient(String serverUrl, int port) { + final channel = ClientChannel( + serverUrl, + port: port, + options: const ChannelOptions( + credentials: ChannelCredentials.insecure(), + ), + ); + _appClient = AppClient(channel); + _userClient = UserClient(channel); + } + + // Additional constructor for testing + @visibleForTesting + RatingsClient.withClients( + this._appClient, + this._userClient, + ); + + Future getRating( + String snapId, + String token, + ) async { + final request = GetRatingRequest(snapId: snapId); + final callOptions = + CallOptions(metadata: {'authorization': 'Bearer $token'}); + final grpcResponse = await _appClient.getRating( + request, + options: callOptions, + ); + return grpcResponse.rating.fromDTO(); + } + + Future authenticate(String id) async { + final request = AuthenticateRequest(id: id); + final grpcResponse = await _userClient.authenticate(request); + return grpcResponse.token; + } + + Future> listMyVotes(String snapIdFilter, String token) async { + final request = ListMyVotesRequest(snapIdFilter: snapIdFilter); + final callOptions = + CallOptions(metadata: {'authorization': 'Bearer $token'}); + final grpcResponse = await _userClient.listMyVotes( + request, + options: callOptions, + ); + return grpcResponse.votes.map((vote) => vote.fromDTO()).toList(); + } + + Future vote( + String snapId, int snapRevision, bool voteUp, String token) async { + final request = VoteRequest( + snapId: snapId, + snapRevision: snapRevision, + voteUp: voteUp, + ); + final callOptions = + CallOptions(metadata: {'authorization': 'Bearer $token'}); + await _userClient.vote(request, options: callOptions); + } + + Future delete(String token) async { + final request = Empty(); + final callOptions = + CallOptions(metadata: {'authorization': 'Bearer $token'}); + await _userClient.delete(request, options: callOptions); + } + + Future> getSnapVotes(String snap_id, String token) async { + final request = GetSnapVotesRequest(snapId: snap_id); + final callOptions = + CallOptions(metadata: {'authorization': 'Bearer $token'}); + final grpcResponse = await _userClient.getSnapVotes( + request, + options: callOptions, + ); + return grpcResponse.votes.map((vote) => vote.fromDTO()).toList(); + } +} diff --git a/packages/app_center_ratings_client/lib/src/app.dart b/packages/app_center_ratings_client/lib/src/app.dart new file mode 100644 index 000000000..c13be5d0f --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/app.dart @@ -0,0 +1,46 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import 'generated/ratings_features_app.pb.dart' as pb; + +part 'app.freezed.dart'; + +@freezed +class Rating with _$Rating { + const factory Rating({ + required String snapId, + required int totalVotes, + required RatingsBand ratingsBand, + }) = _Rating; +} + +enum RatingsBand { + veryGood, + good, + neutral, + poor, + veryPoor, + insufficientVotes, +} + +extension RatingFromDTO on pb.Rating { + Rating fromDTO() { + return Rating( + snapId: this.snapId, + totalVotes: this.totalVotes.toInt(), + ratingsBand: this.ratingsBand.fromDTO(), + ); + } +} + +extension RatingsBandFromDTO on pb.RatingsBand { + RatingsBand fromDTO() { + return switch (this) { + pb.RatingsBand.VERY_GOOD => RatingsBand.veryGood, + pb.RatingsBand.GOOD => RatingsBand.good, + pb.RatingsBand.NEUTRAL => RatingsBand.neutral, + pb.RatingsBand.POOR => RatingsBand.poor, + pb.RatingsBand.VERY_POOR => RatingsBand.veryPoor, + _ => RatingsBand.insufficientVotes, + }; + } +} diff --git a/packages/app_center_ratings_client/lib/src/app.freezed.dart b/packages/app_center_ratings_client/lib/src/app.freezed.dart new file mode 100644 index 000000000..e42a20ad6 --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/app.freezed.dart @@ -0,0 +1,169 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'app.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +/// @nodoc +mixin _$Rating { + String get snapId => throw _privateConstructorUsedError; + int get totalVotes => throw _privateConstructorUsedError; + RatingsBand get ratingsBand => throw _privateConstructorUsedError; + + @JsonKey(ignore: true) + $RatingCopyWith get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $RatingCopyWith<$Res> { + factory $RatingCopyWith(Rating value, $Res Function(Rating) then) = + _$RatingCopyWithImpl<$Res, Rating>; + @useResult + $Res call({String snapId, int totalVotes, RatingsBand ratingsBand}); +} + +/// @nodoc +class _$RatingCopyWithImpl<$Res, $Val extends Rating> + implements $RatingCopyWith<$Res> { + _$RatingCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? snapId = null, + Object? totalVotes = null, + Object? ratingsBand = null, + }) { + return _then(_value.copyWith( + snapId: null == snapId + ? _value.snapId + : snapId // ignore: cast_nullable_to_non_nullable + as String, + totalVotes: null == totalVotes + ? _value.totalVotes + : totalVotes // ignore: cast_nullable_to_non_nullable + as int, + ratingsBand: null == ratingsBand + ? _value.ratingsBand + : ratingsBand // ignore: cast_nullable_to_non_nullable + as RatingsBand, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$RatingImplCopyWith<$Res> implements $RatingCopyWith<$Res> { + factory _$$RatingImplCopyWith( + _$RatingImpl value, $Res Function(_$RatingImpl) then) = + __$$RatingImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String snapId, int totalVotes, RatingsBand ratingsBand}); +} + +/// @nodoc +class __$$RatingImplCopyWithImpl<$Res> + extends _$RatingCopyWithImpl<$Res, _$RatingImpl> + implements _$$RatingImplCopyWith<$Res> { + __$$RatingImplCopyWithImpl( + _$RatingImpl _value, $Res Function(_$RatingImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? snapId = null, + Object? totalVotes = null, + Object? ratingsBand = null, + }) { + return _then(_$RatingImpl( + snapId: null == snapId + ? _value.snapId + : snapId // ignore: cast_nullable_to_non_nullable + as String, + totalVotes: null == totalVotes + ? _value.totalVotes + : totalVotes // ignore: cast_nullable_to_non_nullable + as int, + ratingsBand: null == ratingsBand + ? _value.ratingsBand + : ratingsBand // ignore: cast_nullable_to_non_nullable + as RatingsBand, + )); + } +} + +/// @nodoc + +class _$RatingImpl implements _Rating { + const _$RatingImpl( + {required this.snapId, + required this.totalVotes, + required this.ratingsBand}); + + @override + final String snapId; + @override + final int totalVotes; + @override + final RatingsBand ratingsBand; + + @override + String toString() { + return 'Rating(snapId: $snapId, totalVotes: $totalVotes, ratingsBand: $ratingsBand)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RatingImpl && + (identical(other.snapId, snapId) || other.snapId == snapId) && + (identical(other.totalVotes, totalVotes) || + other.totalVotes == totalVotes) && + (identical(other.ratingsBand, ratingsBand) || + other.ratingsBand == ratingsBand)); + } + + @override + int get hashCode => Object.hash(runtimeType, snapId, totalVotes, ratingsBand); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$RatingImplCopyWith<_$RatingImpl> get copyWith => + __$$RatingImplCopyWithImpl<_$RatingImpl>(this, _$identity); +} + +abstract class _Rating implements Rating { + const factory _Rating( + {required final String snapId, + required final int totalVotes, + required final RatingsBand ratingsBand}) = _$RatingImpl; + + @override + String get snapId; + @override + int get totalVotes; + @override + RatingsBand get ratingsBand; + @override + @JsonKey(ignore: true) + _$$RatingImplCopyWith<_$RatingImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/packages/app_center_ratings_client/lib/src/generated/google/protobuf/empty.pb.dart b/packages/app_center_ratings_client/lib/src/generated/google/protobuf/empty.pb.dart new file mode 100644 index 000000000..2701c1874 --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/generated/google/protobuf/empty.pb.dart @@ -0,0 +1,65 @@ +// +// Generated code. Do not modify. +// source: google/protobuf/empty.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +/// 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); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +class Empty extends $pb.GeneratedMessage { + factory Empty() => create(); + Empty._() : super(); + factory Empty.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Empty.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Empty', + package: + const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), + createEmptyInstance: create) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Empty clone() => Empty()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Empty copyWith(void Function(Empty) updates) => + super.copyWith((message) => updates(message as Empty)) as Empty; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Empty create() => Empty._(); + Empty createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Empty getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Empty? _defaultInstance; +} + +const _omitMessageNames = + $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/packages/app_center_ratings_client/lib/src/generated/google/protobuf/empty.pbenum.dart b/packages/app_center_ratings_client/lib/src/generated/google/protobuf/empty.pbenum.dart new file mode 100644 index 000000000..2f2a76136 --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/generated/google/protobuf/empty.pbenum.dart @@ -0,0 +1,10 @@ +// +// Generated code. Do not modify. +// source: google/protobuf/empty.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import diff --git a/packages/app_center_ratings_client/lib/src/generated/google/protobuf/empty.pbjson.dart b/packages/app_center_ratings_client/lib/src/generated/google/protobuf/empty.pbjson.dart new file mode 100644 index 000000000..35f6e2eca --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/generated/google/protobuf/empty.pbjson.dart @@ -0,0 +1,23 @@ +// +// Generated code. Do not modify. +// source: google/protobuf/empty.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use emptyDescriptor instead') +const Empty$json = { + '1': 'Empty', +}; + +/// Descriptor for `Empty`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List emptyDescriptor = + $convert.base64Decode('CgVFbXB0eQ=='); diff --git a/packages/app_center_ratings_client/lib/src/generated/google/protobuf/timestamp.pb.dart b/packages/app_center_ratings_client/lib/src/generated/google/protobuf/timestamp.pb.dart new file mode 100644 index 000000000..99ba83a78 --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/generated/google/protobuf/timestamp.pb.dart @@ -0,0 +1,206 @@ +// +// Generated code. Do not modify. +// source: google/protobuf/timestamp.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:fixnum/fixnum.dart' as $fixnum; +import 'package:protobuf/protobuf.dart' as $pb; +import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin; + +/// A Timestamp represents a point in time independent of any time zone or local +/// calendar, encoded as a count of seconds and fractions of seconds at +/// nanosecond resolution. The count is relative to an epoch at UTC midnight on +/// January 1, 1970, in the proleptic Gregorian calendar which extends the +/// Gregorian calendar backwards to year one. +/// +/// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap +/// second table is needed for interpretation, using a [24-hour linear +/// smear](https://developers.google.com/time/smear). +/// +/// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By +/// restricting to that range, we ensure that we can convert to and from [RFC +/// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. +/// +/// # Examples +/// +/// Example 1: Compute Timestamp from POSIX `time()`. +/// +/// Timestamp timestamp; +/// timestamp.set_seconds(time(NULL)); +/// timestamp.set_nanos(0); +/// +/// Example 2: Compute Timestamp from POSIX `gettimeofday()`. +/// +/// struct timeval tv; +/// gettimeofday(&tv, NULL); +/// +/// Timestamp timestamp; +/// timestamp.set_seconds(tv.tv_sec); +/// timestamp.set_nanos(tv.tv_usec * 1000); +/// +/// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. +/// +/// FILETIME ft; +/// GetSystemTimeAsFileTime(&ft); +/// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; +/// +/// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z +/// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. +/// Timestamp timestamp; +/// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); +/// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); +/// +/// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. +/// +/// long millis = System.currentTimeMillis(); +/// +/// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) +/// .setNanos((int) ((millis % 1000) * 1000000)).build(); +/// +/// +/// Example 5: Compute Timestamp from Java `Instant.now()`. +/// +/// Instant now = Instant.now(); +/// +/// Timestamp timestamp = +/// Timestamp.newBuilder().setSeconds(now.getEpochSecond()) +/// .setNanos(now.getNano()).build(); +/// +/// +/// Example 6: Compute Timestamp from current time in Python. +/// +/// timestamp = Timestamp() +/// timestamp.GetCurrentTime() +/// +/// # JSON Mapping +/// +/// In JSON format, the Timestamp type is encoded as a string in the +/// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the +/// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" +/// where {year} is always expressed using four digits while {month}, {day}, +/// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional +/// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), +/// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone +/// is required. A proto3 JSON serializer should always use UTC (as indicated by +/// "Z") when printing the Timestamp type and a proto3 JSON parser should be +/// able to accept both UTC and other timezones (as indicated by an offset). +/// +/// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past +/// 01:30 UTC on January 15, 2017. +/// +/// In JavaScript, one can convert a Date object to this format using the +/// standard +/// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) +/// method. In Python, a standard `datetime.datetime` object can be converted +/// to this format using +/// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with +/// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use +/// the Joda Time's [`ISODateTimeFormat.dateTime()`]( +/// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D +/// ) to obtain a formatter capable of generating timestamps in this format. +class Timestamp extends $pb.GeneratedMessage with $mixin.TimestampMixin { + factory Timestamp({ + $fixnum.Int64? seconds, + $core.int? nanos, + }) { + final $result = create(); + if (seconds != null) { + $result.seconds = seconds; + } + if (nanos != null) { + $result.nanos = nanos; + } + return $result; + } + Timestamp._() : super(); + factory Timestamp.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Timestamp.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Timestamp', + package: + const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), + createEmptyInstance: create, + toProto3Json: $mixin.TimestampMixin.toProto3JsonHelper, + fromProto3Json: $mixin.TimestampMixin.fromProto3JsonHelper) + ..aInt64(1, _omitFieldNames ? '' : 'seconds') + ..a<$core.int>(2, _omitFieldNames ? '' : 'nanos', $pb.PbFieldType.O3) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Timestamp clone() => Timestamp()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Timestamp copyWith(void Function(Timestamp) updates) => + super.copyWith((message) => updates(message as Timestamp)) as Timestamp; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Timestamp create() => Timestamp._(); + Timestamp createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Timestamp getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Timestamp? _defaultInstance; + + /// Represents seconds of UTC time since Unix epoch + /// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + /// 9999-12-31T23:59:59Z inclusive. + @$pb.TagNumber(1) + $fixnum.Int64 get seconds => $_getI64(0); + @$pb.TagNumber(1) + set seconds($fixnum.Int64 v) { + $_setInt64(0, v); + } + + @$pb.TagNumber(1) + $core.bool hasSeconds() => $_has(0); + @$pb.TagNumber(1) + void clearSeconds() => clearField(1); + + /// Non-negative fractions of a second at nanosecond resolution. Negative + /// second values with fractions must still have non-negative nanos values + /// that count forward in time. Must be from 0 to 999,999,999 + /// inclusive. + @$pb.TagNumber(2) + $core.int get nanos => $_getIZ(1); + @$pb.TagNumber(2) + set nanos($core.int v) { + $_setSignedInt32(1, v); + } + + @$pb.TagNumber(2) + $core.bool hasNanos() => $_has(1); + @$pb.TagNumber(2) + void clearNanos() => clearField(2); + + /// Creates a new instance from [dateTime]. + /// + /// Time zone information will not be preserved. + static Timestamp fromDateTime($core.DateTime dateTime) { + final result = create(); + $mixin.TimestampMixin.setFromDateTime(result, dateTime); + return result; + } +} + +const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); +const _omitMessageNames = + $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/packages/app_center_ratings_client/lib/src/generated/google/protobuf/timestamp.pbenum.dart b/packages/app_center_ratings_client/lib/src/generated/google/protobuf/timestamp.pbenum.dart new file mode 100644 index 000000000..a194b8050 --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/generated/google/protobuf/timestamp.pbenum.dart @@ -0,0 +1,10 @@ +// +// Generated code. Do not modify. +// source: google/protobuf/timestamp.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import diff --git a/packages/app_center_ratings_client/lib/src/generated/google/protobuf/timestamp.pbjson.dart b/packages/app_center_ratings_client/lib/src/generated/google/protobuf/timestamp.pbjson.dart new file mode 100644 index 000000000..39ab20fad --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/generated/google/protobuf/timestamp.pbjson.dart @@ -0,0 +1,28 @@ +// +// Generated code. Do not modify. +// source: google/protobuf/timestamp.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use timestampDescriptor instead') +const Timestamp$json = { + '1': 'Timestamp', + '2': [ + {'1': 'seconds', '3': 1, '4': 1, '5': 3, '10': 'seconds'}, + {'1': 'nanos', '3': 2, '4': 1, '5': 5, '10': 'nanos'}, + ], +}; + +/// Descriptor for `Timestamp`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List timestampDescriptor = $convert.base64Decode( + 'CglUaW1lc3RhbXASGAoHc2Vjb25kcxgBIAEoA1IHc2Vjb25kcxIUCgVuYW5vcxgCIAEoBVIFbm' + 'Fub3M='); diff --git a/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pb.dart b/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pb.dart new file mode 100644 index 000000000..56193eb61 --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pb.dart @@ -0,0 +1,249 @@ +// +// Generated code. Do not modify. +// source: ratings_features_app.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:fixnum/fixnum.dart' as $fixnum; +import 'package:protobuf/protobuf.dart' as $pb; + +import 'ratings_features_app.pbenum.dart'; + +export 'ratings_features_app.pbenum.dart'; + +class GetRatingRequest extends $pb.GeneratedMessage { + factory GetRatingRequest({ + $core.String? snapId, + }) { + final $result = create(); + if (snapId != null) { + $result.snapId = snapId; + } + return $result; + } + GetRatingRequest._() : super(); + factory GetRatingRequest.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory GetRatingRequest.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'GetRatingRequest', + package: const $pb.PackageName( + _omitMessageNames ? '' : 'ratings.features.app'), + createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'snapId') + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetRatingRequest clone() => GetRatingRequest()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetRatingRequest copyWith(void Function(GetRatingRequest) updates) => + super.copyWith((message) => updates(message as GetRatingRequest)) + as GetRatingRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetRatingRequest create() => GetRatingRequest._(); + GetRatingRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => + $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetRatingRequest getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static GetRatingRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get snapId => $_getSZ(0); + @$pb.TagNumber(1) + set snapId($core.String v) { + $_setString(0, v); + } + + @$pb.TagNumber(1) + $core.bool hasSnapId() => $_has(0); + @$pb.TagNumber(1) + void clearSnapId() => clearField(1); +} + +class GetRatingResponse extends $pb.GeneratedMessage { + factory GetRatingResponse({ + Rating? rating, + }) { + final $result = create(); + if (rating != null) { + $result.rating = rating; + } + return $result; + } + GetRatingResponse._() : super(); + factory GetRatingResponse.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory GetRatingResponse.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'GetRatingResponse', + package: const $pb.PackageName( + _omitMessageNames ? '' : 'ratings.features.app'), + createEmptyInstance: create) + ..aOM(1, _omitFieldNames ? '' : 'rating', subBuilder: Rating.create) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetRatingResponse clone() => GetRatingResponse()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetRatingResponse copyWith(void Function(GetRatingResponse) updates) => + super.copyWith((message) => updates(message as GetRatingResponse)) + as GetRatingResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetRatingResponse create() => GetRatingResponse._(); + GetRatingResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => + $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetRatingResponse getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static GetRatingResponse? _defaultInstance; + + @$pb.TagNumber(1) + Rating get rating => $_getN(0); + @$pb.TagNumber(1) + set rating(Rating v) { + setField(1, v); + } + + @$pb.TagNumber(1) + $core.bool hasRating() => $_has(0); + @$pb.TagNumber(1) + void clearRating() => clearField(1); + @$pb.TagNumber(1) + Rating ensureRating() => $_ensure(0); +} + +class Rating extends $pb.GeneratedMessage { + factory Rating({ + $core.String? snapId, + $fixnum.Int64? totalVotes, + RatingsBand? ratingsBand, + }) { + final $result = create(); + if (snapId != null) { + $result.snapId = snapId; + } + if (totalVotes != null) { + $result.totalVotes = totalVotes; + } + if (ratingsBand != null) { + $result.ratingsBand = ratingsBand; + } + return $result; + } + Rating._() : super(); + factory Rating.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Rating.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Rating', + package: const $pb.PackageName( + _omitMessageNames ? '' : 'ratings.features.app'), + createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'snapId') + ..a<$fixnum.Int64>( + 2, _omitFieldNames ? '' : 'totalVotes', $pb.PbFieldType.OU6, + defaultOrMaker: $fixnum.Int64.ZERO) + ..e( + 3, _omitFieldNames ? '' : 'ratingsBand', $pb.PbFieldType.OE, + defaultOrMaker: RatingsBand.VERY_GOOD, + valueOf: RatingsBand.valueOf, + enumValues: RatingsBand.values) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Rating clone() => Rating()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Rating copyWith(void Function(Rating) updates) => + super.copyWith((message) => updates(message as Rating)) as Rating; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Rating create() => Rating._(); + Rating createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Rating getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Rating? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get snapId => $_getSZ(0); + @$pb.TagNumber(1) + set snapId($core.String v) { + $_setString(0, v); + } + + @$pb.TagNumber(1) + $core.bool hasSnapId() => $_has(0); + @$pb.TagNumber(1) + void clearSnapId() => clearField(1); + + @$pb.TagNumber(2) + $fixnum.Int64 get totalVotes => $_getI64(1); + @$pb.TagNumber(2) + set totalVotes($fixnum.Int64 v) { + $_setInt64(1, v); + } + + @$pb.TagNumber(2) + $core.bool hasTotalVotes() => $_has(1); + @$pb.TagNumber(2) + void clearTotalVotes() => clearField(2); + + @$pb.TagNumber(3) + RatingsBand get ratingsBand => $_getN(2); + @$pb.TagNumber(3) + set ratingsBand(RatingsBand v) { + setField(3, v); + } + + @$pb.TagNumber(3) + $core.bool hasRatingsBand() => $_has(2); + @$pb.TagNumber(3) + void clearRatingsBand() => clearField(3); +} + +const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); +const _omitMessageNames = + $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbenum.dart b/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbenum.dart new file mode 100644 index 000000000..eeaebe1ff --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbenum.dart @@ -0,0 +1,46 @@ +// +// Generated code. Do not modify. +// source: ratings_features_app.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +class RatingsBand extends $pb.ProtobufEnum { + static const RatingsBand VERY_GOOD = + RatingsBand._(0, _omitEnumNames ? '' : 'VERY_GOOD'); + static const RatingsBand GOOD = + RatingsBand._(1, _omitEnumNames ? '' : 'GOOD'); + static const RatingsBand NEUTRAL = + RatingsBand._(2, _omitEnumNames ? '' : 'NEUTRAL'); + static const RatingsBand POOR = + RatingsBand._(3, _omitEnumNames ? '' : 'POOR'); + static const RatingsBand VERY_POOR = + RatingsBand._(4, _omitEnumNames ? '' : 'VERY_POOR'); + static const RatingsBand INSUFFICIENT_VOTES = + RatingsBand._(5, _omitEnumNames ? '' : 'INSUFFICIENT_VOTES'); + + static const $core.List values = [ + VERY_GOOD, + GOOD, + NEUTRAL, + POOR, + VERY_POOR, + INSUFFICIENT_VOTES, + ]; + + static final $core.Map<$core.int, RatingsBand> _byValue = + $pb.ProtobufEnum.initByValue(values); + static RatingsBand? valueOf($core.int value) => _byValue[value]; + + const RatingsBand._($core.int v, $core.String n) : super(v, n); +} + +const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names'); diff --git a/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbgrpc.dart b/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbgrpc.dart new file mode 100644 index 000000000..28d0ec8d3 --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbgrpc.dart @@ -0,0 +1,64 @@ +// +// Generated code. Do not modify. +// source: ratings_features_app.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:async' as $async; +import 'dart:core' as $core; + +import 'package:grpc/service_api.dart' as $grpc; +import 'package:protobuf/protobuf.dart' as $pb; + +import 'ratings_features_app.pb.dart' as $0; + +export 'ratings_features_app.pb.dart'; + +@$pb.GrpcServiceName('ratings.features.app.App') +class AppClient extends $grpc.Client { + static final _$getRating = + $grpc.ClientMethod<$0.GetRatingRequest, $0.GetRatingResponse>( + '/ratings.features.app.App/GetRating', + ($0.GetRatingRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => + $0.GetRatingResponse.fromBuffer(value)); + + AppClient($grpc.ClientChannel channel, + {$grpc.CallOptions? options, + $core.Iterable<$grpc.ClientInterceptor>? interceptors}) + : super(channel, options: options, interceptors: interceptors); + + $grpc.ResponseFuture<$0.GetRatingResponse> getRating( + $0.GetRatingRequest request, + {$grpc.CallOptions? options}) { + return $createUnaryCall(_$getRating, request, options: options); + } +} + +@$pb.GrpcServiceName('ratings.features.app.App') +abstract class AppServiceBase extends $grpc.Service { + $core.String get $name => 'ratings.features.app.App'; + + AppServiceBase() { + $addMethod($grpc.ServiceMethod<$0.GetRatingRequest, $0.GetRatingResponse>( + 'GetRating', + getRating_Pre, + false, + false, + ($core.List<$core.int> value) => $0.GetRatingRequest.fromBuffer(value), + ($0.GetRatingResponse value) => value.writeToBuffer())); + } + + $async.Future<$0.GetRatingResponse> getRating_Pre($grpc.ServiceCall call, + $async.Future<$0.GetRatingRequest> request) async { + return getRating(call, await request); + } + + $async.Future<$0.GetRatingResponse> getRating( + $grpc.ServiceCall call, $0.GetRatingRequest request); +} diff --git a/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbjson.dart b/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbjson.dart new file mode 100644 index 000000000..6323d1ae4 --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbjson.dart @@ -0,0 +1,87 @@ +// +// Generated code. Do not modify. +// source: ratings_features_app.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use ratingsBandDescriptor instead') +const RatingsBand$json = { + '1': 'RatingsBand', + '2': [ + {'1': 'VERY_GOOD', '2': 0}, + {'1': 'GOOD', '2': 1}, + {'1': 'NEUTRAL', '2': 2}, + {'1': 'POOR', '2': 3}, + {'1': 'VERY_POOR', '2': 4}, + {'1': 'INSUFFICIENT_VOTES', '2': 5}, + ], +}; + +/// Descriptor for `RatingsBand`. Decode as a `google.protobuf.EnumDescriptorProto`. +final $typed_data.Uint8List ratingsBandDescriptor = $convert.base64Decode( + 'CgtSYXRpbmdzQmFuZBINCglWRVJZX0dPT0QQABIICgRHT09EEAESCwoHTkVVVFJBTBACEggKBF' + 'BPT1IQAxINCglWRVJZX1BPT1IQBBIWChJJTlNVRkZJQ0lFTlRfVk9URVMQBQ=='); + +@$core.Deprecated('Use getRatingRequestDescriptor instead') +const GetRatingRequest$json = { + '1': 'GetRatingRequest', + '2': [ + {'1': 'snap_id', '3': 1, '4': 1, '5': 9, '10': 'snapId'}, + ], +}; + +/// Descriptor for `GetRatingRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getRatingRequestDescriptor = $convert.base64Decode( + 'ChBHZXRSYXRpbmdSZXF1ZXN0EhcKB3NuYXBfaWQYASABKAlSBnNuYXBJZA=='); + +@$core.Deprecated('Use getRatingResponseDescriptor instead') +const GetRatingResponse$json = { + '1': 'GetRatingResponse', + '2': [ + { + '1': 'rating', + '3': 1, + '4': 1, + '5': 11, + '6': '.ratings.features.app.Rating', + '10': 'rating' + }, + ], +}; + +/// Descriptor for `GetRatingResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getRatingResponseDescriptor = $convert.base64Decode( + 'ChFHZXRSYXRpbmdSZXNwb25zZRI0CgZyYXRpbmcYASABKAsyHC5yYXRpbmdzLmZlYXR1cmVzLm' + 'FwcC5SYXRpbmdSBnJhdGluZw=='); + +@$core.Deprecated('Use ratingDescriptor instead') +const Rating$json = { + '1': 'Rating', + '2': [ + {'1': 'snap_id', '3': 1, '4': 1, '5': 9, '10': 'snapId'}, + {'1': 'total_votes', '3': 2, '4': 1, '5': 4, '10': 'totalVotes'}, + { + '1': 'ratings_band', + '3': 3, + '4': 1, + '5': 14, + '6': '.ratings.features.app.RatingsBand', + '10': 'ratingsBand' + }, + ], +}; + +/// Descriptor for `Rating`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List ratingDescriptor = $convert.base64Decode( + 'CgZSYXRpbmcSFwoHc25hcF9pZBgBIAEoCVIGc25hcElkEh8KC3RvdGFsX3ZvdGVzGAIgASgEUg' + 'p0b3RhbFZvdGVzEkQKDHJhdGluZ3NfYmFuZBgDIAEoDjIhLnJhdGluZ3MuZmVhdHVyZXMuYXBw' + 'LlJhdGluZ3NCYW5kUgtyYXRpbmdzQmFuZA=='); diff --git a/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pb.dart b/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pb.dart new file mode 100644 index 000000000..333102612 --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pb.dart @@ -0,0 +1,301 @@ +// +// Generated code. Do not modify. +// source: ratings_features_chart.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:fixnum/fixnum.dart' as $fixnum; +import 'package:protobuf/protobuf.dart' as $pb; + +import 'ratings_features_chart.pbenum.dart'; + +export 'ratings_features_chart.pbenum.dart'; + +class GetChartRequest extends $pb.GeneratedMessage { + factory GetChartRequest({ + Timeframe? timeframe, + ChartType? type, + }) { + final $result = create(); + if (timeframe != null) { + $result.timeframe = timeframe; + } + if (type != null) { + $result.type = type; + } + return $result; + } + GetChartRequest._() : super(); + factory GetChartRequest.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory GetChartRequest.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'GetChartRequest', + package: const $pb.PackageName( + _omitMessageNames ? '' : 'ratings.features.chart'), + createEmptyInstance: create) + ..e(1, _omitFieldNames ? '' : 'timeframe', $pb.PbFieldType.OE, + defaultOrMaker: Timeframe.TIMEFRAME_UNSPECIFIED, + valueOf: Timeframe.valueOf, + enumValues: Timeframe.values) + ..e(2, _omitFieldNames ? '' : 'type', $pb.PbFieldType.OE, + defaultOrMaker: ChartType.CHART_TYPE_TOP_UNSPECIFIED, + valueOf: ChartType.valueOf, + enumValues: ChartType.values) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetChartRequest clone() => GetChartRequest()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetChartRequest copyWith(void Function(GetChartRequest) updates) => + super.copyWith((message) => updates(message as GetChartRequest)) + as GetChartRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetChartRequest create() => GetChartRequest._(); + GetChartRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => + $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetChartRequest getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static GetChartRequest? _defaultInstance; + + @$pb.TagNumber(1) + Timeframe get timeframe => $_getN(0); + @$pb.TagNumber(1) + set timeframe(Timeframe v) { + setField(1, v); + } + + @$pb.TagNumber(1) + $core.bool hasTimeframe() => $_has(0); + @$pb.TagNumber(1) + void clearTimeframe() => clearField(1); + + @$pb.TagNumber(2) + ChartType get type => $_getN(1); + @$pb.TagNumber(2) + set type(ChartType v) { + setField(2, v); + } + + @$pb.TagNumber(2) + $core.bool hasType() => $_has(1); + @$pb.TagNumber(2) + void clearType() => clearField(2); +} + +class GetChartResponse extends $pb.GeneratedMessage { + factory GetChartResponse({ + Timeframe? timeframe, + ChartType? type, + $core.Iterable? orderedChartData, + }) { + final $result = create(); + if (timeframe != null) { + $result.timeframe = timeframe; + } + if (type != null) { + $result.type = type; + } + if (orderedChartData != null) { + $result.orderedChartData.addAll(orderedChartData); + } + return $result; + } + GetChartResponse._() : super(); + factory GetChartResponse.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory GetChartResponse.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'GetChartResponse', + package: const $pb.PackageName( + _omitMessageNames ? '' : 'ratings.features.chart'), + createEmptyInstance: create) + ..e(1, _omitFieldNames ? '' : 'timeframe', $pb.PbFieldType.OE, + defaultOrMaker: Timeframe.TIMEFRAME_UNSPECIFIED, + valueOf: Timeframe.valueOf, + enumValues: Timeframe.values) + ..e(2, _omitFieldNames ? '' : 'type', $pb.PbFieldType.OE, + defaultOrMaker: ChartType.CHART_TYPE_TOP_UNSPECIFIED, + valueOf: ChartType.valueOf, + enumValues: ChartType.values) + ..pc( + 3, _omitFieldNames ? '' : 'orderedChartData', $pb.PbFieldType.PM, + subBuilder: ChartData.create) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetChartResponse clone() => GetChartResponse()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetChartResponse copyWith(void Function(GetChartResponse) updates) => + super.copyWith((message) => updates(message as GetChartResponse)) + as GetChartResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetChartResponse create() => GetChartResponse._(); + GetChartResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => + $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetChartResponse getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static GetChartResponse? _defaultInstance; + + @$pb.TagNumber(1) + Timeframe get timeframe => $_getN(0); + @$pb.TagNumber(1) + set timeframe(Timeframe v) { + setField(1, v); + } + + @$pb.TagNumber(1) + $core.bool hasTimeframe() => $_has(0); + @$pb.TagNumber(1) + void clearTimeframe() => clearField(1); + + @$pb.TagNumber(2) + ChartType get type => $_getN(1); + @$pb.TagNumber(2) + set type(ChartType v) { + setField(2, v); + } + + @$pb.TagNumber(2) + $core.bool hasType() => $_has(1); + @$pb.TagNumber(2) + void clearType() => clearField(2); + + @$pb.TagNumber(3) + $core.List get orderedChartData => $_getList(2); +} + +class ChartData extends $pb.GeneratedMessage { + factory ChartData({ + $core.String? app, + $fixnum.Int64? totalUpVotes, + $fixnum.Int64? totalDownVotes, + }) { + final $result = create(); + if (app != null) { + $result.app = app; + } + if (totalUpVotes != null) { + $result.totalUpVotes = totalUpVotes; + } + if (totalDownVotes != null) { + $result.totalDownVotes = totalDownVotes; + } + return $result; + } + ChartData._() : super(); + factory ChartData.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory ChartData.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'ChartData', + package: const $pb.PackageName( + _omitMessageNames ? '' : 'ratings.features.chart'), + createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'app') + ..a<$fixnum.Int64>( + 2, _omitFieldNames ? '' : 'totalUpVotes', $pb.PbFieldType.OU6, + defaultOrMaker: $fixnum.Int64.ZERO) + ..a<$fixnum.Int64>( + 3, _omitFieldNames ? '' : 'totalDownVotes', $pb.PbFieldType.OU6, + defaultOrMaker: $fixnum.Int64.ZERO) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ChartData clone() => ChartData()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ChartData copyWith(void Function(ChartData) updates) => + super.copyWith((message) => updates(message as ChartData)) as ChartData; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static ChartData create() => ChartData._(); + ChartData createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ChartData getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ChartData? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get app => $_getSZ(0); + @$pb.TagNumber(1) + set app($core.String v) { + $_setString(0, v); + } + + @$pb.TagNumber(1) + $core.bool hasApp() => $_has(0); + @$pb.TagNumber(1) + void clearApp() => clearField(1); + + @$pb.TagNumber(2) + $fixnum.Int64 get totalUpVotes => $_getI64(1); + @$pb.TagNumber(2) + set totalUpVotes($fixnum.Int64 v) { + $_setInt64(1, v); + } + + @$pb.TagNumber(2) + $core.bool hasTotalUpVotes() => $_has(1); + @$pb.TagNumber(2) + void clearTotalUpVotes() => clearField(2); + + @$pb.TagNumber(3) + $fixnum.Int64 get totalDownVotes => $_getI64(2); + @$pb.TagNumber(3) + set totalDownVotes($fixnum.Int64 v) { + $_setInt64(2, v); + } + + @$pb.TagNumber(3) + $core.bool hasTotalDownVotes() => $_has(2); + @$pb.TagNumber(3) + void clearTotalDownVotes() => clearField(3); +} + +const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); +const _omitMessageNames = + $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pbenum.dart b/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pbenum.dart new file mode 100644 index 000000000..6b940e99a --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pbenum.dart @@ -0,0 +1,55 @@ +// +// Generated code. Do not modify. +// source: ratings_features_chart.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +class ChartType extends $pb.ProtobufEnum { + static const ChartType CHART_TYPE_TOP_UNSPECIFIED = + ChartType._(0, _omitEnumNames ? '' : 'CHART_TYPE_TOP_UNSPECIFIED'); + static const ChartType CHART_TYPE_TOP = + ChartType._(1, _omitEnumNames ? '' : 'CHART_TYPE_TOP'); + + static const $core.List values = [ + CHART_TYPE_TOP_UNSPECIFIED, + CHART_TYPE_TOP, + ]; + + static final $core.Map<$core.int, ChartType> _byValue = + $pb.ProtobufEnum.initByValue(values); + static ChartType? valueOf($core.int value) => _byValue[value]; + + const ChartType._($core.int v, $core.String n) : super(v, n); +} + +class Timeframe extends $pb.ProtobufEnum { + static const Timeframe TIMEFRAME_UNSPECIFIED = + Timeframe._(0, _omitEnumNames ? '' : 'TIMEFRAME_UNSPECIFIED'); + static const Timeframe TIMEFRAME_WEEK = + Timeframe._(1, _omitEnumNames ? '' : 'TIMEFRAME_WEEK'); + static const Timeframe TIMEFRAME_MONTH = + Timeframe._(2, _omitEnumNames ? '' : 'TIMEFRAME_MONTH'); + + static const $core.List values = [ + TIMEFRAME_UNSPECIFIED, + TIMEFRAME_WEEK, + TIMEFRAME_MONTH, + ]; + + static final $core.Map<$core.int, Timeframe> _byValue = + $pb.ProtobufEnum.initByValue(values); + static Timeframe? valueOf($core.int value) => _byValue[value]; + + const Timeframe._($core.int v, $core.String n) : super(v, n); +} + +const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names'); diff --git a/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pbgrpc.dart b/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pbgrpc.dart new file mode 100644 index 000000000..9a39d0a7b --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pbgrpc.dart @@ -0,0 +1,63 @@ +// +// Generated code. Do not modify. +// source: ratings_features_chart.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:async' as $async; +import 'dart:core' as $core; + +import 'package:grpc/service_api.dart' as $grpc; +import 'package:protobuf/protobuf.dart' as $pb; + +import 'ratings_features_chart.pb.dart' as $0; + +export 'ratings_features_chart.pb.dart'; + +@$pb.GrpcServiceName('ratings.features.chart.Chart') +class ChartClient extends $grpc.Client { + static final _$getChart = + $grpc.ClientMethod<$0.GetChartRequest, $0.GetChartResponse>( + '/ratings.features.chart.Chart/GetChart', + ($0.GetChartRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => + $0.GetChartResponse.fromBuffer(value)); + + ChartClient($grpc.ClientChannel channel, + {$grpc.CallOptions? options, + $core.Iterable<$grpc.ClientInterceptor>? interceptors}) + : super(channel, options: options, interceptors: interceptors); + + $grpc.ResponseFuture<$0.GetChartResponse> getChart($0.GetChartRequest request, + {$grpc.CallOptions? options}) { + return $createUnaryCall(_$getChart, request, options: options); + } +} + +@$pb.GrpcServiceName('ratings.features.chart.Chart') +abstract class ChartServiceBase extends $grpc.Service { + $core.String get $name => 'ratings.features.chart.Chart'; + + ChartServiceBase() { + $addMethod($grpc.ServiceMethod<$0.GetChartRequest, $0.GetChartResponse>( + 'GetChart', + getChart_Pre, + false, + false, + ($core.List<$core.int> value) => $0.GetChartRequest.fromBuffer(value), + ($0.GetChartResponse value) => value.writeToBuffer())); + } + + $async.Future<$0.GetChartResponse> getChart_Pre( + $grpc.ServiceCall call, $async.Future<$0.GetChartRequest> request) async { + return getChart(call, await request); + } + + $async.Future<$0.GetChartResponse> getChart( + $grpc.ServiceCall call, $0.GetChartRequest request); +} diff --git a/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pbjson.dart b/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pbjson.dart new file mode 100644 index 000000000..c8c32252f --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pbjson.dart @@ -0,0 +1,125 @@ +// +// Generated code. Do not modify. +// source: ratings_features_chart.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use chartTypeDescriptor instead') +const ChartType$json = { + '1': 'ChartType', + '2': [ + {'1': 'CHART_TYPE_TOP_UNSPECIFIED', '2': 0}, + {'1': 'CHART_TYPE_TOP', '2': 1}, + ], +}; + +/// Descriptor for `ChartType`. Decode as a `google.protobuf.EnumDescriptorProto`. +final $typed_data.Uint8List chartTypeDescriptor = $convert.base64Decode( + 'CglDaGFydFR5cGUSHgoaQ0hBUlRfVFlQRV9UT1BfVU5TUEVDSUZJRUQQABISCg5DSEFSVF9UWV' + 'BFX1RPUBAB'); + +@$core.Deprecated('Use timeframeDescriptor instead') +const Timeframe$json = { + '1': 'Timeframe', + '2': [ + {'1': 'TIMEFRAME_UNSPECIFIED', '2': 0}, + {'1': 'TIMEFRAME_WEEK', '2': 1}, + {'1': 'TIMEFRAME_MONTH', '2': 2}, + ], +}; + +/// Descriptor for `Timeframe`. Decode as a `google.protobuf.EnumDescriptorProto`. +final $typed_data.Uint8List timeframeDescriptor = $convert.base64Decode( + 'CglUaW1lZnJhbWUSGQoVVElNRUZSQU1FX1VOU1BFQ0lGSUVEEAASEgoOVElNRUZSQU1FX1dFRU' + 'sQARITCg9USU1FRlJBTUVfTU9OVEgQAg=='); + +@$core.Deprecated('Use getChartRequestDescriptor instead') +const GetChartRequest$json = { + '1': 'GetChartRequest', + '2': [ + { + '1': 'timeframe', + '3': 1, + '4': 1, + '5': 14, + '6': '.ratings.features.chart.Timeframe', + '10': 'timeframe' + }, + { + '1': 'type', + '3': 2, + '4': 1, + '5': 14, + '6': '.ratings.features.chart.ChartType', + '10': 'type' + }, + ], +}; + +/// Descriptor for `GetChartRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getChartRequestDescriptor = $convert.base64Decode( + 'Cg9HZXRDaGFydFJlcXVlc3QSPwoJdGltZWZyYW1lGAEgASgOMiEucmF0aW5ncy5mZWF0dXJlcy' + '5jaGFydC5UaW1lZnJhbWVSCXRpbWVmcmFtZRI1CgR0eXBlGAIgASgOMiEucmF0aW5ncy5mZWF0' + 'dXJlcy5jaGFydC5DaGFydFR5cGVSBHR5cGU='); + +@$core.Deprecated('Use getChartResponseDescriptor instead') +const GetChartResponse$json = { + '1': 'GetChartResponse', + '2': [ + { + '1': 'timeframe', + '3': 1, + '4': 1, + '5': 14, + '6': '.ratings.features.chart.Timeframe', + '10': 'timeframe' + }, + { + '1': 'type', + '3': 2, + '4': 1, + '5': 14, + '6': '.ratings.features.chart.ChartType', + '10': 'type' + }, + { + '1': 'ordered_chart_data', + '3': 3, + '4': 3, + '5': 11, + '6': '.ratings.features.chart.ChartData', + '10': 'orderedChartData' + }, + ], +}; + +/// Descriptor for `GetChartResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getChartResponseDescriptor = $convert.base64Decode( + 'ChBHZXRDaGFydFJlc3BvbnNlEj8KCXRpbWVmcmFtZRgBIAEoDjIhLnJhdGluZ3MuZmVhdHVyZX' + 'MuY2hhcnQuVGltZWZyYW1lUgl0aW1lZnJhbWUSNQoEdHlwZRgCIAEoDjIhLnJhdGluZ3MuZmVh' + 'dHVyZXMuY2hhcnQuQ2hhcnRUeXBlUgR0eXBlEk8KEm9yZGVyZWRfY2hhcnRfZGF0YRgDIAMoCz' + 'IhLnJhdGluZ3MuZmVhdHVyZXMuY2hhcnQuQ2hhcnREYXRhUhBvcmRlcmVkQ2hhcnREYXRh'); + +@$core.Deprecated('Use chartDataDescriptor instead') +const ChartData$json = { + '1': 'ChartData', + '2': [ + {'1': 'app', '3': 1, '4': 1, '5': 9, '10': 'app'}, + {'1': 'total_up_votes', '3': 2, '4': 1, '5': 4, '10': 'totalUpVotes'}, + {'1': 'total_down_votes', '3': 3, '4': 1, '5': 4, '10': 'totalDownVotes'}, + ], +}; + +/// Descriptor for `ChartData`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List chartDataDescriptor = $convert.base64Decode( + 'CglDaGFydERhdGESEAoDYXBwGAEgASgJUgNhcHASJAoOdG90YWxfdXBfdm90ZXMYAiABKARSDH' + 'RvdGFsVXBWb3RlcxIoChB0b3RhbF9kb3duX3ZvdGVzGAMgASgEUg50b3RhbERvd25Wb3Rlcw=='); diff --git a/packages/app_center_ratings_client/lib/src/generated/ratings_features_user.pb.dart b/packages/app_center_ratings_client/lib/src/generated/ratings_features_user.pb.dart new file mode 100644 index 000000000..491e677c0 --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/generated/ratings_features_user.pb.dart @@ -0,0 +1,587 @@ +// +// Generated code. Do not modify. +// source: ratings_features_user.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +import 'google/protobuf/timestamp.pb.dart' as $2; + +class AuthenticateRequest extends $pb.GeneratedMessage { + factory AuthenticateRequest({ + $core.String? id, + }) { + final $result = create(); + if (id != null) { + $result.id = id; + } + return $result; + } + AuthenticateRequest._() : super(); + factory AuthenticateRequest.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory AuthenticateRequest.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'AuthenticateRequest', + package: const $pb.PackageName( + _omitMessageNames ? '' : 'ratings.features.user'), + createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'id') + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + AuthenticateRequest clone() => AuthenticateRequest()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + AuthenticateRequest copyWith(void Function(AuthenticateRequest) updates) => + super.copyWith((message) => updates(message as AuthenticateRequest)) + as AuthenticateRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static AuthenticateRequest create() => AuthenticateRequest._(); + AuthenticateRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => + $pb.PbList(); + @$core.pragma('dart2js:noInline') + static AuthenticateRequest getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static AuthenticateRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get id => $_getSZ(0); + @$pb.TagNumber(1) + set id($core.String v) { + $_setString(0, v); + } + + @$pb.TagNumber(1) + $core.bool hasId() => $_has(0); + @$pb.TagNumber(1) + void clearId() => clearField(1); +} + +class AuthenticateResponse extends $pb.GeneratedMessage { + factory AuthenticateResponse({ + $core.String? token, + }) { + final $result = create(); + if (token != null) { + $result.token = token; + } + return $result; + } + AuthenticateResponse._() : super(); + factory AuthenticateResponse.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory AuthenticateResponse.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'AuthenticateResponse', + package: const $pb.PackageName( + _omitMessageNames ? '' : 'ratings.features.user'), + createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'token') + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + AuthenticateResponse clone() => + AuthenticateResponse()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + AuthenticateResponse copyWith(void Function(AuthenticateResponse) updates) => + super.copyWith((message) => updates(message as AuthenticateResponse)) + as AuthenticateResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static AuthenticateResponse create() => AuthenticateResponse._(); + AuthenticateResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => + $pb.PbList(); + @$core.pragma('dart2js:noInline') + static AuthenticateResponse getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static AuthenticateResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get token => $_getSZ(0); + @$pb.TagNumber(1) + set token($core.String v) { + $_setString(0, v); + } + + @$pb.TagNumber(1) + $core.bool hasToken() => $_has(0); + @$pb.TagNumber(1) + void clearToken() => clearField(1); +} + +class ListMyVotesRequest extends $pb.GeneratedMessage { + factory ListMyVotesRequest({ + $core.String? snapIdFilter, + }) { + final $result = create(); + if (snapIdFilter != null) { + $result.snapIdFilter = snapIdFilter; + } + return $result; + } + ListMyVotesRequest._() : super(); + factory ListMyVotesRequest.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory ListMyVotesRequest.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'ListMyVotesRequest', + package: const $pb.PackageName( + _omitMessageNames ? '' : 'ratings.features.user'), + createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'snapIdFilter') + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ListMyVotesRequest clone() => ListMyVotesRequest()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ListMyVotesRequest copyWith(void Function(ListMyVotesRequest) updates) => + super.copyWith((message) => updates(message as ListMyVotesRequest)) + as ListMyVotesRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static ListMyVotesRequest create() => ListMyVotesRequest._(); + ListMyVotesRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => + $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ListMyVotesRequest getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static ListMyVotesRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get snapIdFilter => $_getSZ(0); + @$pb.TagNumber(1) + set snapIdFilter($core.String v) { + $_setString(0, v); + } + + @$pb.TagNumber(1) + $core.bool hasSnapIdFilter() => $_has(0); + @$pb.TagNumber(1) + void clearSnapIdFilter() => clearField(1); +} + +class ListMyVotesResponse extends $pb.GeneratedMessage { + factory ListMyVotesResponse({ + $core.Iterable? votes, + }) { + final $result = create(); + if (votes != null) { + $result.votes.addAll(votes); + } + return $result; + } + ListMyVotesResponse._() : super(); + factory ListMyVotesResponse.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory ListMyVotesResponse.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'ListMyVotesResponse', + package: const $pb.PackageName( + _omitMessageNames ? '' : 'ratings.features.user'), + createEmptyInstance: create) + ..pc(1, _omitFieldNames ? '' : 'votes', $pb.PbFieldType.PM, + subBuilder: Vote.create) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + ListMyVotesResponse clone() => ListMyVotesResponse()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + ListMyVotesResponse copyWith(void Function(ListMyVotesResponse) updates) => + super.copyWith((message) => updates(message as ListMyVotesResponse)) + as ListMyVotesResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static ListMyVotesResponse create() => ListMyVotesResponse._(); + ListMyVotesResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => + $pb.PbList(); + @$core.pragma('dart2js:noInline') + static ListMyVotesResponse getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static ListMyVotesResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.List get votes => $_getList(0); +} + +class GetSnapVotesRequest extends $pb.GeneratedMessage { + factory GetSnapVotesRequest({ + $core.String? snapId, + }) { + final $result = create(); + if (snapId != null) { + $result.snapId = snapId; + } + return $result; + } + GetSnapVotesRequest._() : super(); + factory GetSnapVotesRequest.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory GetSnapVotesRequest.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'GetSnapVotesRequest', + package: const $pb.PackageName( + _omitMessageNames ? '' : 'ratings.features.user'), + createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'snapId') + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetSnapVotesRequest clone() => GetSnapVotesRequest()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetSnapVotesRequest copyWith(void Function(GetSnapVotesRequest) updates) => + super.copyWith((message) => updates(message as GetSnapVotesRequest)) + as GetSnapVotesRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetSnapVotesRequest create() => GetSnapVotesRequest._(); + GetSnapVotesRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => + $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetSnapVotesRequest getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static GetSnapVotesRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get snapId => $_getSZ(0); + @$pb.TagNumber(1) + set snapId($core.String v) { + $_setString(0, v); + } + + @$pb.TagNumber(1) + $core.bool hasSnapId() => $_has(0); + @$pb.TagNumber(1) + void clearSnapId() => clearField(1); +} + +class GetSnapVotesResponse extends $pb.GeneratedMessage { + factory GetSnapVotesResponse({ + $core.Iterable? votes, + }) { + final $result = create(); + if (votes != null) { + $result.votes.addAll(votes); + } + return $result; + } + GetSnapVotesResponse._() : super(); + factory GetSnapVotesResponse.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory GetSnapVotesResponse.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'GetSnapVotesResponse', + package: const $pb.PackageName( + _omitMessageNames ? '' : 'ratings.features.user'), + createEmptyInstance: create) + ..pc(1, _omitFieldNames ? '' : 'votes', $pb.PbFieldType.PM, + subBuilder: Vote.create) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + GetSnapVotesResponse clone() => + GetSnapVotesResponse()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + GetSnapVotesResponse copyWith(void Function(GetSnapVotesResponse) updates) => + super.copyWith((message) => updates(message as GetSnapVotesResponse)) + as GetSnapVotesResponse; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static GetSnapVotesResponse create() => GetSnapVotesResponse._(); + GetSnapVotesResponse createEmptyInstance() => create(); + static $pb.PbList createRepeated() => + $pb.PbList(); + @$core.pragma('dart2js:noInline') + static GetSnapVotesResponse getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static GetSnapVotesResponse? _defaultInstance; + + @$pb.TagNumber(1) + $core.List get votes => $_getList(0); +} + +class Vote extends $pb.GeneratedMessage { + factory Vote({ + $core.String? snapId, + $core.int? snapRevision, + $core.bool? voteUp, + $2.Timestamp? timestamp, + }) { + final $result = create(); + if (snapId != null) { + $result.snapId = snapId; + } + if (snapRevision != null) { + $result.snapRevision = snapRevision; + } + if (voteUp != null) { + $result.voteUp = voteUp; + } + if (timestamp != null) { + $result.timestamp = timestamp; + } + return $result; + } + Vote._() : super(); + factory Vote.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Vote.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Vote', + package: const $pb.PackageName( + _omitMessageNames ? '' : 'ratings.features.user'), + createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'snapId') + ..a<$core.int>(2, _omitFieldNames ? '' : 'snapRevision', $pb.PbFieldType.O3) + ..aOB(3, _omitFieldNames ? '' : 'voteUp') + ..aOM<$2.Timestamp>(4, _omitFieldNames ? '' : 'timestamp', + subBuilder: $2.Timestamp.create) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Vote clone() => Vote()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Vote copyWith(void Function(Vote) updates) => + super.copyWith((message) => updates(message as Vote)) as Vote; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Vote create() => Vote._(); + Vote createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Vote getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Vote? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get snapId => $_getSZ(0); + @$pb.TagNumber(1) + set snapId($core.String v) { + $_setString(0, v); + } + + @$pb.TagNumber(1) + $core.bool hasSnapId() => $_has(0); + @$pb.TagNumber(1) + void clearSnapId() => clearField(1); + + @$pb.TagNumber(2) + $core.int get snapRevision => $_getIZ(1); + @$pb.TagNumber(2) + set snapRevision($core.int v) { + $_setSignedInt32(1, v); + } + + @$pb.TagNumber(2) + $core.bool hasSnapRevision() => $_has(1); + @$pb.TagNumber(2) + void clearSnapRevision() => clearField(2); + + @$pb.TagNumber(3) + $core.bool get voteUp => $_getBF(2); + @$pb.TagNumber(3) + set voteUp($core.bool v) { + $_setBool(2, v); + } + + @$pb.TagNumber(3) + $core.bool hasVoteUp() => $_has(2); + @$pb.TagNumber(3) + void clearVoteUp() => clearField(3); + + @$pb.TagNumber(4) + $2.Timestamp get timestamp => $_getN(3); + @$pb.TagNumber(4) + set timestamp($2.Timestamp v) { + setField(4, v); + } + + @$pb.TagNumber(4) + $core.bool hasTimestamp() => $_has(3); + @$pb.TagNumber(4) + void clearTimestamp() => clearField(4); + @$pb.TagNumber(4) + $2.Timestamp ensureTimestamp() => $_ensure(3); +} + +class VoteRequest extends $pb.GeneratedMessage { + factory VoteRequest({ + $core.String? snapId, + $core.int? snapRevision, + $core.bool? voteUp, + }) { + final $result = create(); + if (snapId != null) { + $result.snapId = snapId; + } + if (snapRevision != null) { + $result.snapRevision = snapRevision; + } + if (voteUp != null) { + $result.voteUp = voteUp; + } + return $result; + } + VoteRequest._() : super(); + factory VoteRequest.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory VoteRequest.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'VoteRequest', + package: const $pb.PackageName( + _omitMessageNames ? '' : 'ratings.features.user'), + createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'snapId') + ..a<$core.int>(2, _omitFieldNames ? '' : 'snapRevision', $pb.PbFieldType.O3) + ..aOB(3, _omitFieldNames ? '' : 'voteUp') + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + VoteRequest clone() => VoteRequest()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + VoteRequest copyWith(void Function(VoteRequest) updates) => + super.copyWith((message) => updates(message as VoteRequest)) + as VoteRequest; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static VoteRequest create() => VoteRequest._(); + VoteRequest createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static VoteRequest getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static VoteRequest? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get snapId => $_getSZ(0); + @$pb.TagNumber(1) + set snapId($core.String v) { + $_setString(0, v); + } + + @$pb.TagNumber(1) + $core.bool hasSnapId() => $_has(0); + @$pb.TagNumber(1) + void clearSnapId() => clearField(1); + + @$pb.TagNumber(2) + $core.int get snapRevision => $_getIZ(1); + @$pb.TagNumber(2) + set snapRevision($core.int v) { + $_setSignedInt32(1, v); + } + + @$pb.TagNumber(2) + $core.bool hasSnapRevision() => $_has(1); + @$pb.TagNumber(2) + void clearSnapRevision() => clearField(2); + + @$pb.TagNumber(3) + $core.bool get voteUp => $_getBF(2); + @$pb.TagNumber(3) + set voteUp($core.bool v) { + $_setBool(2, v); + } + + @$pb.TagNumber(3) + $core.bool hasVoteUp() => $_has(2); + @$pb.TagNumber(3) + void clearVoteUp() => clearField(3); +} + +const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); +const _omitMessageNames = + $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/packages/app_center_ratings_client/lib/src/generated/ratings_features_user.pbenum.dart b/packages/app_center_ratings_client/lib/src/generated/ratings_features_user.pbenum.dart new file mode 100644 index 000000000..a7ac33807 --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/generated/ratings_features_user.pbenum.dart @@ -0,0 +1,10 @@ +// +// Generated code. Do not modify. +// source: ratings_features_user.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import diff --git a/packages/app_center_ratings_client/lib/src/generated/ratings_features_user.pbgrpc.dart b/packages/app_center_ratings_client/lib/src/generated/ratings_features_user.pbgrpc.dart new file mode 100644 index 000000000..9a6ac75a3 --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/generated/ratings_features_user.pbgrpc.dart @@ -0,0 +1,169 @@ +// +// Generated code. Do not modify. +// source: ratings_features_user.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:async' as $async; +import 'dart:core' as $core; + +import 'package:grpc/service_api.dart' as $grpc; +import 'package:protobuf/protobuf.dart' as $pb; + +import 'google/protobuf/empty.pb.dart' as $1; +import 'ratings_features_user.pb.dart' as $0; + +export 'ratings_features_user.pb.dart'; + +@$pb.GrpcServiceName('ratings.features.user.User') +class UserClient extends $grpc.Client { + static final _$authenticate = + $grpc.ClientMethod<$0.AuthenticateRequest, $0.AuthenticateResponse>( + '/ratings.features.user.User/Authenticate', + ($0.AuthenticateRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => + $0.AuthenticateResponse.fromBuffer(value)); + static final _$delete = $grpc.ClientMethod<$1.Empty, $1.Empty>( + '/ratings.features.user.User/Delete', + ($1.Empty value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $1.Empty.fromBuffer(value)); + static final _$vote = $grpc.ClientMethod<$0.VoteRequest, $1.Empty>( + '/ratings.features.user.User/Vote', + ($0.VoteRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => $1.Empty.fromBuffer(value)); + static final _$listMyVotes = + $grpc.ClientMethod<$0.ListMyVotesRequest, $0.ListMyVotesResponse>( + '/ratings.features.user.User/ListMyVotes', + ($0.ListMyVotesRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => + $0.ListMyVotesResponse.fromBuffer(value)); + static final _$getSnapVotes = + $grpc.ClientMethod<$0.GetSnapVotesRequest, $0.GetSnapVotesResponse>( + '/ratings.features.user.User/GetSnapVotes', + ($0.GetSnapVotesRequest value) => value.writeToBuffer(), + ($core.List<$core.int> value) => + $0.GetSnapVotesResponse.fromBuffer(value)); + + UserClient($grpc.ClientChannel channel, + {$grpc.CallOptions? options, + $core.Iterable<$grpc.ClientInterceptor>? interceptors}) + : super(channel, options: options, interceptors: interceptors); + + $grpc.ResponseFuture<$0.AuthenticateResponse> authenticate( + $0.AuthenticateRequest request, + {$grpc.CallOptions? options}) { + return $createUnaryCall(_$authenticate, request, options: options); + } + + $grpc.ResponseFuture<$1.Empty> delete($1.Empty request, + {$grpc.CallOptions? options}) { + return $createUnaryCall(_$delete, request, options: options); + } + + $grpc.ResponseFuture<$1.Empty> vote($0.VoteRequest request, + {$grpc.CallOptions? options}) { + return $createUnaryCall(_$vote, request, options: options); + } + + $grpc.ResponseFuture<$0.ListMyVotesResponse> listMyVotes( + $0.ListMyVotesRequest request, + {$grpc.CallOptions? options}) { + return $createUnaryCall(_$listMyVotes, request, options: options); + } + + $grpc.ResponseFuture<$0.GetSnapVotesResponse> getSnapVotes( + $0.GetSnapVotesRequest request, + {$grpc.CallOptions? options}) { + return $createUnaryCall(_$getSnapVotes, request, options: options); + } +} + +@$pb.GrpcServiceName('ratings.features.user.User') +abstract class UserServiceBase extends $grpc.Service { + $core.String get $name => 'ratings.features.user.User'; + + UserServiceBase() { + $addMethod( + $grpc.ServiceMethod<$0.AuthenticateRequest, $0.AuthenticateResponse>( + 'Authenticate', + authenticate_Pre, + false, + false, + ($core.List<$core.int> value) => + $0.AuthenticateRequest.fromBuffer(value), + ($0.AuthenticateResponse value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$1.Empty, $1.Empty>( + 'Delete', + delete_Pre, + false, + false, + ($core.List<$core.int> value) => $1.Empty.fromBuffer(value), + ($1.Empty value) => value.writeToBuffer())); + $addMethod($grpc.ServiceMethod<$0.VoteRequest, $1.Empty>( + 'Vote', + vote_Pre, + false, + false, + ($core.List<$core.int> value) => $0.VoteRequest.fromBuffer(value), + ($1.Empty value) => value.writeToBuffer())); + $addMethod( + $grpc.ServiceMethod<$0.ListMyVotesRequest, $0.ListMyVotesResponse>( + 'ListMyVotes', + listMyVotes_Pre, + false, + false, + ($core.List<$core.int> value) => + $0.ListMyVotesRequest.fromBuffer(value), + ($0.ListMyVotesResponse value) => value.writeToBuffer())); + $addMethod( + $grpc.ServiceMethod<$0.GetSnapVotesRequest, $0.GetSnapVotesResponse>( + 'GetSnapVotes', + getSnapVotes_Pre, + false, + false, + ($core.List<$core.int> value) => + $0.GetSnapVotesRequest.fromBuffer(value), + ($0.GetSnapVotesResponse value) => value.writeToBuffer())); + } + + $async.Future<$0.AuthenticateResponse> authenticate_Pre( + $grpc.ServiceCall call, + $async.Future<$0.AuthenticateRequest> request) async { + return authenticate(call, await request); + } + + $async.Future<$1.Empty> delete_Pre( + $grpc.ServiceCall call, $async.Future<$1.Empty> request) async { + return delete(call, await request); + } + + $async.Future<$1.Empty> vote_Pre( + $grpc.ServiceCall call, $async.Future<$0.VoteRequest> request) async { + return vote(call, await request); + } + + $async.Future<$0.ListMyVotesResponse> listMyVotes_Pre($grpc.ServiceCall call, + $async.Future<$0.ListMyVotesRequest> request) async { + return listMyVotes(call, await request); + } + + $async.Future<$0.GetSnapVotesResponse> getSnapVotes_Pre( + $grpc.ServiceCall call, + $async.Future<$0.GetSnapVotesRequest> request) async { + return getSnapVotes(call, await request); + } + + $async.Future<$0.AuthenticateResponse> authenticate( + $grpc.ServiceCall call, $0.AuthenticateRequest request); + $async.Future<$1.Empty> delete($grpc.ServiceCall call, $1.Empty request); + $async.Future<$1.Empty> vote($grpc.ServiceCall call, $0.VoteRequest request); + $async.Future<$0.ListMyVotesResponse> listMyVotes( + $grpc.ServiceCall call, $0.ListMyVotesRequest request); + $async.Future<$0.GetSnapVotesResponse> getSnapVotes( + $grpc.ServiceCall call, $0.GetSnapVotesRequest request); +} diff --git a/packages/app_center_ratings_client/lib/src/generated/ratings_features_user.pbjson.dart b/packages/app_center_ratings_client/lib/src/generated/ratings_features_user.pbjson.dart new file mode 100644 index 000000000..2e566da7f --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/generated/ratings_features_user.pbjson.dart @@ -0,0 +1,144 @@ +// +// Generated code. Do not modify. +// source: ratings_features_user.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use authenticateRequestDescriptor instead') +const AuthenticateRequest$json = { + '1': 'AuthenticateRequest', + '2': [ + {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, + ], +}; + +/// Descriptor for `AuthenticateRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List authenticateRequestDescriptor = $convert + .base64Decode('ChNBdXRoZW50aWNhdGVSZXF1ZXN0Eg4KAmlkGAEgASgJUgJpZA=='); + +@$core.Deprecated('Use authenticateResponseDescriptor instead') +const AuthenticateResponse$json = { + '1': 'AuthenticateResponse', + '2': [ + {'1': 'token', '3': 1, '4': 1, '5': 9, '10': 'token'}, + ], +}; + +/// Descriptor for `AuthenticateResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List authenticateResponseDescriptor = + $convert.base64Decode( + 'ChRBdXRoZW50aWNhdGVSZXNwb25zZRIUCgV0b2tlbhgBIAEoCVIFdG9rZW4='); + +@$core.Deprecated('Use listMyVotesRequestDescriptor instead') +const ListMyVotesRequest$json = { + '1': 'ListMyVotesRequest', + '2': [ + {'1': 'snap_id_filter', '3': 1, '4': 1, '5': 9, '10': 'snapIdFilter'}, + ], +}; + +/// Descriptor for `ListMyVotesRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List listMyVotesRequestDescriptor = $convert.base64Decode( + 'ChJMaXN0TXlWb3Rlc1JlcXVlc3QSJAoOc25hcF9pZF9maWx0ZXIYASABKAlSDHNuYXBJZEZpbH' + 'Rlcg=='); + +@$core.Deprecated('Use listMyVotesResponseDescriptor instead') +const ListMyVotesResponse$json = { + '1': 'ListMyVotesResponse', + '2': [ + { + '1': 'votes', + '3': 1, + '4': 3, + '5': 11, + '6': '.ratings.features.user.Vote', + '10': 'votes' + }, + ], +}; + +/// Descriptor for `ListMyVotesResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List listMyVotesResponseDescriptor = $convert.base64Decode( + 'ChNMaXN0TXlWb3Rlc1Jlc3BvbnNlEjEKBXZvdGVzGAEgAygLMhsucmF0aW5ncy5mZWF0dXJlcy' + '51c2VyLlZvdGVSBXZvdGVz'); + +@$core.Deprecated('Use getSnapVotesRequestDescriptor instead') +const GetSnapVotesRequest$json = { + '1': 'GetSnapVotesRequest', + '2': [ + {'1': 'snap_id', '3': 1, '4': 1, '5': 9, '10': 'snapId'}, + ], +}; + +/// Descriptor for `GetSnapVotesRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getSnapVotesRequestDescriptor = + $convert.base64Decode( + 'ChNHZXRTbmFwVm90ZXNSZXF1ZXN0EhcKB3NuYXBfaWQYASABKAlSBnNuYXBJZA=='); + +@$core.Deprecated('Use getSnapVotesResponseDescriptor instead') +const GetSnapVotesResponse$json = { + '1': 'GetSnapVotesResponse', + '2': [ + { + '1': 'votes', + '3': 1, + '4': 3, + '5': 11, + '6': '.ratings.features.user.Vote', + '10': 'votes' + }, + ], +}; + +/// Descriptor for `GetSnapVotesResponse`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List getSnapVotesResponseDescriptor = $convert.base64Decode( + 'ChRHZXRTbmFwVm90ZXNSZXNwb25zZRIxCgV2b3RlcxgBIAMoCzIbLnJhdGluZ3MuZmVhdHVyZX' + 'MudXNlci5Wb3RlUgV2b3Rlcw=='); + +@$core.Deprecated('Use voteDescriptor instead') +const Vote$json = { + '1': 'Vote', + '2': [ + {'1': 'snap_id', '3': 1, '4': 1, '5': 9, '10': 'snapId'}, + {'1': 'snap_revision', '3': 2, '4': 1, '5': 5, '10': 'snapRevision'}, + {'1': 'vote_up', '3': 3, '4': 1, '5': 8, '10': 'voteUp'}, + { + '1': 'timestamp', + '3': 4, + '4': 1, + '5': 11, + '6': '.google.protobuf.Timestamp', + '10': 'timestamp' + }, + ], +}; + +/// Descriptor for `Vote`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List voteDescriptor = $convert.base64Decode( + 'CgRWb3RlEhcKB3NuYXBfaWQYASABKAlSBnNuYXBJZBIjCg1zbmFwX3JldmlzaW9uGAIgASgFUg' + 'xzbmFwUmV2aXNpb24SFwoHdm90ZV91cBgDIAEoCFIGdm90ZVVwEjgKCXRpbWVzdGFtcBgEIAEo' + 'CzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBSCXRpbWVzdGFtcA=='); + +@$core.Deprecated('Use voteRequestDescriptor instead') +const VoteRequest$json = { + '1': 'VoteRequest', + '2': [ + {'1': 'snap_id', '3': 1, '4': 1, '5': 9, '10': 'snapId'}, + {'1': 'snap_revision', '3': 2, '4': 1, '5': 5, '10': 'snapRevision'}, + {'1': 'vote_up', '3': 3, '4': 1, '5': 8, '10': 'voteUp'}, + ], +}; + +/// Descriptor for `VoteRequest`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List voteRequestDescriptor = $convert.base64Decode( + 'CgtWb3RlUmVxdWVzdBIXCgdzbmFwX2lkGAEgASgJUgZzbmFwSWQSIwoNc25hcF9yZXZpc2lvbh' + 'gCIAEoBVIMc25hcFJldmlzaW9uEhcKB3ZvdGVfdXAYAyABKAhSBnZvdGVVcA=='); diff --git a/packages/app_center_ratings_client/lib/src/user.dart b/packages/app_center_ratings_client/lib/src/user.dart new file mode 100644 index 000000000..25edc1439 --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/user.dart @@ -0,0 +1,26 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import 'generated/ratings_features_user.pb.dart' as pb; + +part 'user.freezed.dart'; + +@freezed +class Vote with _$Vote { + const factory Vote({ + required String snapId, + required int snapRevision, + required bool voteUp, + required DateTime dateTime, + }) = _Vote; +} + +extension VoteFromDTO on pb.Vote { + Vote fromDTO() { + return Vote( + snapId: this.snapId, + snapRevision: this.snapRevision, + voteUp: this.voteUp, + dateTime: this.timestamp.toDateTime(), + ); + } +} diff --git a/packages/app_center_ratings_client/lib/src/user.freezed.dart b/packages/app_center_ratings_client/lib/src/user.freezed.dart new file mode 100644 index 000000000..e52bb5738 --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/user.freezed.dart @@ -0,0 +1,187 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'user.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +/// @nodoc +mixin _$Vote { + String get snapId => throw _privateConstructorUsedError; + int get snapRevision => throw _privateConstructorUsedError; + bool get voteUp => throw _privateConstructorUsedError; + DateTime get dateTime => throw _privateConstructorUsedError; + + @JsonKey(ignore: true) + $VoteCopyWith get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $VoteCopyWith<$Res> { + factory $VoteCopyWith(Vote value, $Res Function(Vote) then) = + _$VoteCopyWithImpl<$Res, Vote>; + @useResult + $Res call({String snapId, int snapRevision, bool voteUp, DateTime dateTime}); +} + +/// @nodoc +class _$VoteCopyWithImpl<$Res, $Val extends Vote> + implements $VoteCopyWith<$Res> { + _$VoteCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? snapId = null, + Object? snapRevision = null, + Object? voteUp = null, + Object? dateTime = null, + }) { + return _then(_value.copyWith( + snapId: null == snapId + ? _value.snapId + : snapId // ignore: cast_nullable_to_non_nullable + as String, + snapRevision: null == snapRevision + ? _value.snapRevision + : snapRevision // ignore: cast_nullable_to_non_nullable + as int, + voteUp: null == voteUp + ? _value.voteUp + : voteUp // ignore: cast_nullable_to_non_nullable + as bool, + dateTime: null == dateTime + ? _value.dateTime + : dateTime // ignore: cast_nullable_to_non_nullable + as DateTime, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$VoteImplCopyWith<$Res> implements $VoteCopyWith<$Res> { + factory _$$VoteImplCopyWith( + _$VoteImpl value, $Res Function(_$VoteImpl) then) = + __$$VoteImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String snapId, int snapRevision, bool voteUp, DateTime dateTime}); +} + +/// @nodoc +class __$$VoteImplCopyWithImpl<$Res> + extends _$VoteCopyWithImpl<$Res, _$VoteImpl> + implements _$$VoteImplCopyWith<$Res> { + __$$VoteImplCopyWithImpl(_$VoteImpl _value, $Res Function(_$VoteImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? snapId = null, + Object? snapRevision = null, + Object? voteUp = null, + Object? dateTime = null, + }) { + return _then(_$VoteImpl( + snapId: null == snapId + ? _value.snapId + : snapId // ignore: cast_nullable_to_non_nullable + as String, + snapRevision: null == snapRevision + ? _value.snapRevision + : snapRevision // ignore: cast_nullable_to_non_nullable + as int, + voteUp: null == voteUp + ? _value.voteUp + : voteUp // ignore: cast_nullable_to_non_nullable + as bool, + dateTime: null == dateTime + ? _value.dateTime + : dateTime // ignore: cast_nullable_to_non_nullable + as DateTime, + )); + } +} + +/// @nodoc + +class _$VoteImpl implements _Vote { + const _$VoteImpl( + {required this.snapId, + required this.snapRevision, + required this.voteUp, + required this.dateTime}); + + @override + final String snapId; + @override + final int snapRevision; + @override + final bool voteUp; + @override + final DateTime dateTime; + + @override + String toString() { + return 'Vote(snapId: $snapId, snapRevision: $snapRevision, voteUp: $voteUp, dateTime: $dateTime)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$VoteImpl && + (identical(other.snapId, snapId) || other.snapId == snapId) && + (identical(other.snapRevision, snapRevision) || + other.snapRevision == snapRevision) && + (identical(other.voteUp, voteUp) || other.voteUp == voteUp) && + (identical(other.dateTime, dateTime) || + other.dateTime == dateTime)); + } + + @override + int get hashCode => + Object.hash(runtimeType, snapId, snapRevision, voteUp, dateTime); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$VoteImplCopyWith<_$VoteImpl> get copyWith => + __$$VoteImplCopyWithImpl<_$VoteImpl>(this, _$identity); +} + +abstract class _Vote implements Vote { + const factory _Vote( + {required final String snapId, + required final int snapRevision, + required final bool voteUp, + required final DateTime dateTime}) = _$VoteImpl; + + @override + String get snapId; + @override + int get snapRevision; + @override + bool get voteUp; + @override + DateTime get dateTime; + @override + @JsonKey(ignore: true) + _$$VoteImplCopyWith<_$VoteImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/packages/app_center_ratings_client/protos/ratings_features_app.proto b/packages/app_center_ratings_client/protos/ratings_features_app.proto new file mode 100644 index 000000000..e6494e4ea --- /dev/null +++ b/packages/app_center_ratings_client/protos/ratings_features_app.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; + +package ratings.features.app; + +service App { + rpc GetRating (GetRatingRequest) returns (GetRatingResponse) {} +} + +message GetRatingRequest { + string snap_id = 1; +} + +message GetRatingResponse { + Rating rating = 1; +} + +message Rating { + string snap_id = 1; + uint64 total_votes = 2; + RatingsBand ratings_band = 3; +} + +enum RatingsBand { + VERY_GOOD = 0; + GOOD = 1; + NEUTRAL = 2; + POOR = 3; + VERY_POOR = 4; + INSUFFICIENT_VOTES = 5; +} diff --git a/packages/app_center_ratings_client/protos/ratings_features_chart.proto b/packages/app_center_ratings_client/protos/ratings_features_chart.proto new file mode 100644 index 000000000..d5f1b8c42 --- /dev/null +++ b/packages/app_center_ratings_client/protos/ratings_features_chart.proto @@ -0,0 +1,35 @@ +syntax = "proto3"; + +package ratings.features.chart; + +service Chart { + rpc GetChart (GetChartRequest) returns (GetChartResponse) {} +} + +message GetChartRequest { + Timeframe timeframe = 1; + ChartType type = 2; +} + +enum ChartType { + CHART_TYPE_TOP_UNSPECIFIED = 0; + CHART_TYPE_TOP = 1; +} + +message GetChartResponse { + Timeframe timeframe = 1; + ChartType type = 2; + repeated ChartData ordered_chart_data = 3; +} + +message ChartData { + string app = 1; + uint64 total_up_votes = 2; + uint64 total_down_votes = 3; +} + +enum Timeframe { + TIMEFRAME_UNSPECIFIED = 0; + TIMEFRAME_WEEK = 1; + TIMEFRAME_MONTH = 2; +} diff --git a/packages/app_center_ratings_client/protos/ratings_features_user.proto b/packages/app_center_ratings_client/protos/ratings_features_user.proto new file mode 100644 index 000000000..1ab2a6497 --- /dev/null +++ b/packages/app_center_ratings_client/protos/ratings_features_user.proto @@ -0,0 +1,52 @@ +syntax = "proto3"; + +package ratings.features.user; + +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; + +service User { + rpc Authenticate (AuthenticateRequest) returns (AuthenticateResponse) {} + + rpc Delete (google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc Vote (VoteRequest) returns (google.protobuf.Empty) {} + rpc ListMyVotes (ListMyVotesRequest) returns (ListMyVotesResponse) {} + rpc GetSnapVotes(GetSnapVotesRequest) returns (GetSnapVotesResponse) {} +} + +message AuthenticateRequest { + string id = 1; +} + +message AuthenticateResponse { + string token = 1; +} + +message ListMyVotesRequest { + string snap_id_filter = 1; +} + +message ListMyVotesResponse { + repeated Vote votes = 1; +} + +message GetSnapVotesRequest { + string snap_id = 1; +} + +message GetSnapVotesResponse { + repeated Vote votes = 1; +} + +message Vote { + string snap_id = 1; + int32 snap_revision = 2; + bool vote_up = 3; + google.protobuf.Timestamp timestamp = 4; +} + +message VoteRequest { + string snap_id = 1; + int32 snap_revision = 2; + bool vote_up = 3; +} diff --git a/packages/app_center_ratings_client/pubspec.yaml b/packages/app_center_ratings_client/pubspec.yaml new file mode 100644 index 000000000..9583730c4 --- /dev/null +++ b/packages/app_center_ratings_client/pubspec.yaml @@ -0,0 +1,22 @@ +name: app_center_ratings_client +description: Dart client for the App Center Rating service +repository: https://github.com/ubuntu/app-center/tree/main/packages/app_center_ratings_client +version: 1.0.0 + +environment: + sdk: '>=3.1.0 <4.0.0' + +dependencies: + fixnum: ^1.1.0 + freezed: ^2.4.1 + freezed_annotation: ^2.4.1 + grpc: ^3.1.0 + meta: ^1.7.0 + protobuf: ^3.0.0 + protoc_plugin: ^21.0.1 + +dev_dependencies: + build_runner: ^2.4.6 + mockito: ^5.4.3 + test: ^1.21.0 + ubuntu_lints: ^0.1.0 \ No newline at end of file diff --git a/packages/app_center_ratings_client/test/ratings_client_test.dart b/packages/app_center_ratings_client/test/ratings_client_test.dart new file mode 100644 index 000000000..14e58e71f --- /dev/null +++ b/packages/app_center_ratings_client/test/ratings_client_test.dart @@ -0,0 +1,265 @@ +import 'dart:async'; + +import 'package:app_center_ratings_client/ratings_client.dart'; +import 'package:app_center_ratings_client/src/app.dart' as app; +import 'package:app_center_ratings_client/src/generated/google/protobuf/empty.pb.dart'; +import 'package:app_center_ratings_client/src/generated/google/protobuf/timestamp.pb.dart'; +import 'package:app_center_ratings_client/src/generated/ratings_features_app.pbgrpc.dart'; +import 'package:app_center_ratings_client/src/generated/ratings_features_user.pbgrpc.dart'; +import 'package:app_center_ratings_client/src/user.dart' as user; +import 'package:fixnum/fixnum.dart'; +import 'package:grpc/grpc.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; +import 'package:test/test.dart'; + +import 'ratings_client_test.mocks.dart'; + +@GenerateMocks([AppClient, UserClient]) +void main() { + final mockAppClient = MockAppClient(); + final mockUserClient = MockUserClient(); + final ratingsClient = RatingsClient.withClients( + mockAppClient, + mockUserClient, + ); + + test('get rating', () async { + final snapId = 'foo'; + final token = 'bar'; + final pbRating = Rating( + snapId: snapId, + totalVotes: Int64(105), + ratingsBand: RatingsBand.NEUTRAL, + ); + final expectedResponse = app.Rating( + snapId: snapId, + totalVotes: 105, + ratingsBand: app.RatingsBand.neutral, + ); + final mockResponse = GetRatingResponse(rating: pbRating); + final request = GetRatingRequest(snapId: snapId); + when(mockAppClient.getRating( + request, + options: anyNamed('options'), + )).thenAnswer((_) => MockResponseFuture(mockResponse)); + final response = await ratingsClient.getRating( + snapId, + token, + ); + expect( + response, + equals(expectedResponse), + ); + final capturedArgs = verify(mockAppClient.getRating( + request, + options: captureAnyNamed('options'), + )).captured; + final capturedOptions = capturedArgs.single as CallOptions; + expect( + capturedOptions.metadata, + containsPair( + 'authorization', + 'Bearer $token', + ), + ); + }); + + test('authenticate user', () async { + final id = 'foo'; + final token = 'bar'; + final mockResponse = AuthenticateResponse(token: token); + final request = AuthenticateRequest(id: id); + when(mockUserClient.authenticate(request)).thenAnswer( + (_) => MockResponseFuture(mockResponse)); + final response = await ratingsClient.authenticate(id); + verify(mockUserClient.authenticate(request)).captured; + expect( + response, + equals(token), + ); + }); + + test('list user votes', () async { + final snapIdFilter = 'foo'; + final token = 'bar'; + final time = DateTime.now().toUtc(); + final mockVotes = [ + Vote( + snapId: 'foo1', + snapRevision: 1, + voteUp: true, + timestamp: Timestamp.fromDateTime(time)), + Vote( + snapId: 'foo2', + snapRevision: 2, + voteUp: false, + timestamp: Timestamp.fromDateTime(time)), + ]; + final expectedResponse = [ + user.Vote( + snapId: 'foo1', + snapRevision: 1, + voteUp: true, + dateTime: time, + ), + user.Vote( + snapId: 'foo2', + snapRevision: 2, + voteUp: false, + dateTime: time, + ), + ]; + final mockResponse = ListMyVotesResponse(votes: mockVotes); + final request = ListMyVotesRequest(snapIdFilter: snapIdFilter); + + when(mockUserClient.listMyVotes( + request, + options: anyNamed('options'), + )).thenAnswer((_) => MockResponseFuture(mockResponse)); + final response = await ratingsClient.listMyVotes( + snapIdFilter, + token, + ); + expect(response, equals(expectedResponse)); + + final capturedArgs = verify(mockUserClient.listMyVotes(request, + options: captureAnyNamed('options'))) + .captured; + final capturedOptions = capturedArgs.single as CallOptions; + expect( + capturedOptions.metadata, + containsPair( + 'authorization', + 'Bearer $token', + ), + ); + }); + + test('user votes', () async { + final snapId = 'foo'; + final snapRevision = 1; + final voteUp = true; + final token = 'bar'; + final request = VoteRequest( + snapId: snapId, + snapRevision: snapRevision, + voteUp: voteUp, + ); + + when(mockUserClient.vote( + request, + options: anyNamed('options'), + )).thenAnswer((_) => MockResponseFuture(Empty())); + await ratingsClient.vote( + snapId, + snapRevision, + voteUp, + token, + ); + final capturedArgs = verify(mockUserClient.vote( + request, + options: captureAnyNamed('options'), + )).captured; + final capturedOptions = capturedArgs.single as CallOptions; + expect( + capturedOptions.metadata, + containsPair( + 'authorization', + 'Bearer $token', + )); + }); + + test('user votes by snap id', () async { + final snapId = 'foo'; + final token = 'bar'; + final time = DateTime.now().toUtc(); + final mockVotes = [ + Vote( + snapId: snapId, + snapRevision: 1, + voteUp: true, + timestamp: Timestamp.fromDateTime(time)), + Vote( + snapId: snapId, + snapRevision: 2, + voteUp: false, + timestamp: Timestamp.fromDateTime(time)), + ]; + final expectedResponse = [ + user.Vote( + snapId: snapId, + snapRevision: 1, + voteUp: true, + dateTime: time, + ), + user.Vote( + snapId: snapId, + snapRevision: 2, + voteUp: false, + dateTime: time, + ), + ]; + final mockResponse = GetSnapVotesResponse(votes: mockVotes); + final request = GetSnapVotesRequest(snapId: snapId); + + when(mockUserClient.getSnapVotes( + request, + options: anyNamed('options'), + )).thenAnswer( + (_) => MockResponseFuture(mockResponse)); + final response = await ratingsClient.getSnapVotes( + snapId, + token, + ); + expect(response, equals(expectedResponse)); + + final capturedArgs = verify(mockUserClient.getSnapVotes(request, + options: captureAnyNamed('options'))) + .captured; + final capturedOptions = capturedArgs.single as CallOptions; + expect( + capturedOptions.metadata, + containsPair( + 'authorization', + 'Bearer $token', + ), + ); + }); + + test('delete user', () async { + final token = 'bar'; + final request = Empty(); + + when(mockUserClient.delete( + request, + options: anyNamed('options'), + )).thenAnswer((_) => MockResponseFuture(Empty())); + await ratingsClient.delete(token); + + final capturedArgs = verify( + mockUserClient.delete(request, options: captureAnyNamed('options'))) + .captured; + final capturedOptions = capturedArgs.single as CallOptions; + expect( + capturedOptions.metadata, + containsPair( + 'authorization', + 'Bearer $token', + ), + ); + }); +} + +class MockResponseFuture extends Mock implements ResponseFuture { + final T value; + + MockResponseFuture(this.value); + + @override + Future then(FutureOr Function(T) onValue, {Function? onError}) => + Future.value(value).then( + onValue, + onError: onError, + ); +} diff --git a/packages/app_center_ratings_client/test/ratings_client_test.mocks.dart b/packages/app_center_ratings_client/test/ratings_client_test.mocks.dart new file mode 100644 index 000000000..cde860f6a --- /dev/null +++ b/packages/app_center_ratings_client/test/ratings_client_test.mocks.dart @@ -0,0 +1,378 @@ +// Mocks generated by Mockito 5.4.3 from annotations +// in app_center_ratings_client/test/ratings_client_test.dart. +// Do not manually edit this file. + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'dart:async' as _i6; + +import 'package:app_center_ratings_client/src/generated/google/protobuf/empty.pb.dart' + as _i9; +import 'package:app_center_ratings_client/src/generated/ratings_features_app.pb.dart' + as _i5; +import 'package:app_center_ratings_client/src/generated/ratings_features_app.pbgrpc.dart' + as _i4; +import 'package:app_center_ratings_client/src/generated/ratings_features_user.pb.dart' + as _i8; +import 'package:app_center_ratings_client/src/generated/ratings_features_user.pbgrpc.dart' + as _i7; +import 'package:grpc/service_api.dart' as _i2; +import 'package:grpc/src/client/call.dart' as _i3; +import 'package:mockito/mockito.dart' as _i1; + +// ignore_for_file: type=lint +// ignore_for_file: avoid_redundant_argument_values +// ignore_for_file: avoid_setters_without_getters +// ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package +// ignore_for_file: implementation_imports +// ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: prefer_const_constructors +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class + +class _FakeResponseFuture_0 extends _i1.SmartFake + implements _i2.ResponseFuture { + _FakeResponseFuture_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeClientCall_1 extends _i1.SmartFake + implements _i3.ClientCall { + _FakeClientCall_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeResponseStream_2 extends _i1.SmartFake + implements _i2.ResponseStream { + _FakeResponseStream_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +/// A class which mocks [AppClient]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockAppClient extends _i1.Mock implements _i4.AppClient { + MockAppClient() { + _i1.throwOnMissingStub(this); + } + + @override + _i2.ResponseFuture<_i5.GetRatingResponse> getRating( + _i5.GetRatingRequest? request, { + _i2.CallOptions? options, + }) => + (super.noSuchMethod( + Invocation.method( + #getRating, + [request], + {#options: options}, + ), + returnValue: _FakeResponseFuture_0<_i5.GetRatingResponse>( + this, + Invocation.method( + #getRating, + [request], + {#options: options}, + ), + ), + ) as _i2.ResponseFuture<_i5.GetRatingResponse>); + + @override + _i3.ClientCall $createCall( + _i2.ClientMethod? method, + _i6.Stream? requests, { + _i2.CallOptions? options, + }) => + (super.noSuchMethod( + Invocation.method( + #$createCall, + [ + method, + requests, + ], + {#options: options}, + ), + returnValue: _FakeClientCall_1( + this, + Invocation.method( + #$createCall, + [ + method, + requests, + ], + {#options: options}, + ), + ), + ) as _i3.ClientCall); + + @override + _i2.ResponseFuture $createUnaryCall( + _i2.ClientMethod? method, + Q? request, { + _i2.CallOptions? options, + }) => + (super.noSuchMethod( + Invocation.method( + #$createUnaryCall, + [ + method, + request, + ], + {#options: options}, + ), + returnValue: _FakeResponseFuture_0( + this, + Invocation.method( + #$createUnaryCall, + [ + method, + request, + ], + {#options: options}, + ), + ), + ) as _i2.ResponseFuture); + + @override + _i2.ResponseStream $createStreamingCall( + _i2.ClientMethod? method, + _i6.Stream? requests, { + _i2.CallOptions? options, + }) => + (super.noSuchMethod( + Invocation.method( + #$createStreamingCall, + [ + method, + requests, + ], + {#options: options}, + ), + returnValue: _FakeResponseStream_2( + this, + Invocation.method( + #$createStreamingCall, + [ + method, + requests, + ], + {#options: options}, + ), + ), + ) as _i2.ResponseStream); +} + +/// A class which mocks [UserClient]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockUserClient extends _i1.Mock implements _i7.UserClient { + MockUserClient() { + _i1.throwOnMissingStub(this); + } + + @override + _i2.ResponseFuture<_i8.AuthenticateResponse> authenticate( + _i8.AuthenticateRequest? request, { + _i2.CallOptions? options, + }) => + (super.noSuchMethod( + Invocation.method( + #authenticate, + [request], + {#options: options}, + ), + returnValue: _FakeResponseFuture_0<_i8.AuthenticateResponse>( + this, + Invocation.method( + #authenticate, + [request], + {#options: options}, + ), + ), + ) as _i2.ResponseFuture<_i8.AuthenticateResponse>); + + @override + _i2.ResponseFuture<_i9.Empty> delete( + _i9.Empty? request, { + _i2.CallOptions? options, + }) => + (super.noSuchMethod( + Invocation.method( + #delete, + [request], + {#options: options}, + ), + returnValue: _FakeResponseFuture_0<_i9.Empty>( + this, + Invocation.method( + #delete, + [request], + {#options: options}, + ), + ), + ) as _i2.ResponseFuture<_i9.Empty>); + + @override + _i2.ResponseFuture<_i9.Empty> vote( + _i8.VoteRequest? request, { + _i2.CallOptions? options, + }) => + (super.noSuchMethod( + Invocation.method( + #vote, + [request], + {#options: options}, + ), + returnValue: _FakeResponseFuture_0<_i9.Empty>( + this, + Invocation.method( + #vote, + [request], + {#options: options}, + ), + ), + ) as _i2.ResponseFuture<_i9.Empty>); + + @override + _i2.ResponseFuture<_i8.ListMyVotesResponse> listMyVotes( + _i8.ListMyVotesRequest? request, { + _i2.CallOptions? options, + }) => + (super.noSuchMethod( + Invocation.method( + #listMyVotes, + [request], + {#options: options}, + ), + returnValue: _FakeResponseFuture_0<_i8.ListMyVotesResponse>( + this, + Invocation.method( + #listMyVotes, + [request], + {#options: options}, + ), + ), + ) as _i2.ResponseFuture<_i8.ListMyVotesResponse>); + + @override + _i2.ResponseFuture<_i8.GetSnapVotesResponse> getSnapVotes( + _i8.GetSnapVotesRequest? request, { + _i2.CallOptions? options, + }) => + (super.noSuchMethod( + Invocation.method( + #getSnapVotes, + [request], + {#options: options}, + ), + returnValue: _FakeResponseFuture_0<_i8.GetSnapVotesResponse>( + this, + Invocation.method( + #getSnapVotes, + [request], + {#options: options}, + ), + ), + ) as _i2.ResponseFuture<_i8.GetSnapVotesResponse>); + + @override + _i3.ClientCall $createCall( + _i2.ClientMethod? method, + _i6.Stream? requests, { + _i2.CallOptions? options, + }) => + (super.noSuchMethod( + Invocation.method( + #$createCall, + [ + method, + requests, + ], + {#options: options}, + ), + returnValue: _FakeClientCall_1( + this, + Invocation.method( + #$createCall, + [ + method, + requests, + ], + {#options: options}, + ), + ), + ) as _i3.ClientCall); + + @override + _i2.ResponseFuture $createUnaryCall( + _i2.ClientMethod? method, + Q? request, { + _i2.CallOptions? options, + }) => + (super.noSuchMethod( + Invocation.method( + #$createUnaryCall, + [ + method, + request, + ], + {#options: options}, + ), + returnValue: _FakeResponseFuture_0( + this, + Invocation.method( + #$createUnaryCall, + [ + method, + request, + ], + {#options: options}, + ), + ), + ) as _i2.ResponseFuture); + + @override + _i2.ResponseStream $createStreamingCall( + _i2.ClientMethod? method, + _i6.Stream? requests, { + _i2.CallOptions? options, + }) => + (super.noSuchMethod( + Invocation.method( + #$createStreamingCall, + [ + method, + requests, + ], + {#options: options}, + ), + returnValue: _FakeResponseStream_2( + this, + Invocation.method( + #$createStreamingCall, + [ + method, + requests, + ], + {#options: options}, + ), + ), + ) as _i2.ResponseStream); +} From 5ca5d12225285597e6540bbd493ce2434c744e68 Mon Sep 17 00:00:00 2001 From: Lukas Klingsbo Date: Fri, 24 Nov 2023 12:07:47 +0100 Subject: [PATCH 2/6] ci: Melos bootstrap in integration test --- .github/workflows/integration-test.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/integration-test.yaml b/.github/workflows/integration-test.yaml index 7287628bb..c91f4b636 100644 --- a/.github/workflows/integration-test.yaml +++ b/.github/workflows/integration-test.yaml @@ -13,6 +13,7 @@ jobs: steps: - uses: actions/checkout@v3 - uses: asdf-vm/actions/install@v2 + - uses: bluefireteam/melos-action@v2 - run: sudo apt update - run: sudo apt install -y clang cmake libblkid-dev libglib2.0-dev libgtk-3-dev liblzma-dev network-manager ninja-build packagekit pkg-config polkitd xvfb - run: | From 3a31dc759af86f3526bfa62ae66f850c41cc8ac2 Mon Sep 17 00:00:00 2001 From: Lukas Klingsbo Date: Fri, 24 Nov 2023 12:15:20 +0100 Subject: [PATCH 3/6] ci: Prepare snap workflow before building snap --- .github/workflows/ci.yaml | 2 +- .github/workflows/integration-test.yaml | 2 +- .github/workflows/snap.yaml | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5f95a2bc8..048e2604f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -29,7 +29,7 @@ jobs: steps: - uses: actions/checkout@v3 - uses: asdf-vm/actions/install@v2 - - uses: bluefireteam/melos-action@v2 + - uses: bluefireteam/melos-action@v3 - run: melos generate - name: Check for outdated mocks if: github.event_name != 'push' diff --git a/.github/workflows/integration-test.yaml b/.github/workflows/integration-test.yaml index c91f4b636..c26ef035a 100644 --- a/.github/workflows/integration-test.yaml +++ b/.github/workflows/integration-test.yaml @@ -13,7 +13,7 @@ jobs: steps: - uses: actions/checkout@v3 - uses: asdf-vm/actions/install@v2 - - uses: bluefireteam/melos-action@v2 + - uses: bluefireteam/melos-action@v3 - run: sudo apt update - run: sudo apt install -y clang cmake libblkid-dev libglib2.0-dev libgtk-3-dev liblzma-dev network-manager ninja-build packagekit pkg-config polkitd xvfb - run: | diff --git a/.github/workflows/snap.yaml b/.github/workflows/snap.yaml index 9a0121ee8..d28dbe1df 100644 --- a/.github/workflows/snap.yaml +++ b/.github/workflows/snap.yaml @@ -14,6 +14,8 @@ jobs: - uses: actions/checkout@v3 with: submodules: recursive + - uses: asdf-vm/actions/install@v2 + - uses: bluefireteam/melos-action@v3 - uses: snapcore/action-build@v1 id: snapcraft - uses: actions/upload-artifact@v3 From 4dd2c79893cffc3a676f1416d5bf2386879e6868 Mon Sep 17 00:00:00 2001 From: Lukas Klingsbo Date: Tue, 28 Nov 2023 14:08:39 +0100 Subject: [PATCH 4/6] fix: Update to Matt's changes --- .../app_center/lib/src/ratings/exports.dart | 1 - .../lib/src/ratings/ratings_l10n.dart | 1 + .../lib/src/ratings/ratings_model.dart | 1 + packages/app_center/test/app_card_test.dart | 1 + .../app_center/test/ratings_model_test.dart | 1 + .../app_center/test/ratings_service_test.dart | 1 + .../app_center/test/search_page_test.dart | 1 + packages/app_center/test/snap_page_test.dart | 1 + .../lib/ratings_client.dart | 86 +++++---- .../lib/src/app.freezed.dart | 169 ------------------ .../lib/src/chart.dart | 50 ++++++ .../lib/src/chart.freezed.dart | 150 ++++++++++++++++ .../generated/ratings_features_app.pb.dart | 116 +----------- .../ratings_features_app.pbenum.dart | 36 ---- .../ratings_features_app.pbjson.dart | 47 +---- .../generated/ratings_features_chart.pb.dart | 106 +++-------- .../ratings_features_chart.pbenum.dart | 18 -- .../ratings_features_chart.pbjson.dart | 56 ++---- .../generated/ratings_features_common.pb.dart | 123 +++++++++++++ .../ratings_features_common.pbenum.dart | 46 +++++ .../ratings_features_common.pbjson.dart | 55 ++++++ .../lib/src/{app.dart => ratings.dart} | 34 +++- .../protos/ratings_features_app.proto | 19 +- .../protos/ratings_features_chart.proto | 16 +- .../protos/ratings_features_common.proto | 18 ++ .../test/ratings_client_test.dart | 82 +++++++-- .../test/ratings_client_test.mocks.dart | 122 ++++++++++++- 27 files changed, 770 insertions(+), 587 deletions(-) delete mode 100644 packages/app_center_ratings_client/lib/src/app.freezed.dart create mode 100644 packages/app_center_ratings_client/lib/src/chart.dart create mode 100644 packages/app_center_ratings_client/lib/src/chart.freezed.dart create mode 100644 packages/app_center_ratings_client/lib/src/generated/ratings_features_common.pb.dart create mode 100644 packages/app_center_ratings_client/lib/src/generated/ratings_features_common.pbenum.dart create mode 100644 packages/app_center_ratings_client/lib/src/generated/ratings_features_common.pbjson.dart rename packages/app_center_ratings_client/lib/src/{app.dart => ratings.dart} (55%) create mode 100644 packages/app_center_ratings_client/protos/ratings_features_common.proto diff --git a/packages/app_center/lib/src/ratings/exports.dart b/packages/app_center/lib/src/ratings/exports.dart index 70059c280..728662182 100644 --- a/packages/app_center/lib/src/ratings/exports.dart +++ b/packages/app_center/lib/src/ratings/exports.dart @@ -1,2 +1 @@ -export 'package:app_center_ratings_client/src/app.dart'; export 'package:app_center_ratings_client/src/user.dart'; diff --git a/packages/app_center/lib/src/ratings/ratings_l10n.dart b/packages/app_center/lib/src/ratings/ratings_l10n.dart index 30b1aaf0e..6e1baa067 100644 --- a/packages/app_center/lib/src/ratings/ratings_l10n.dart +++ b/packages/app_center/lib/src/ratings/ratings_l10n.dart @@ -1,3 +1,4 @@ +import 'package:app_center_ratings_client/ratings_client.dart'; import 'package:flutter/material.dart'; import '/l10n.dart'; diff --git a/packages/app_center/lib/src/ratings/ratings_model.dart b/packages/app_center/lib/src/ratings/ratings_model.dart index 880664b4d..c9c898aa0 100644 --- a/packages/app_center/lib/src/ratings/ratings_model.dart +++ b/packages/app_center/lib/src/ratings/ratings_model.dart @@ -1,3 +1,4 @@ +import 'package:app_center_ratings_client/ratings_client.dart'; import 'package:clock/clock.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/packages/app_center/test/app_card_test.dart b/packages/app_center/test/app_card_test.dart index 3a29732ce..e5f04e82a 100644 --- a/packages/app_center/test/app_card_test.dart +++ b/packages/app_center/test/app_card_test.dart @@ -1,5 +1,6 @@ import 'package:app_center/ratings.dart'; import 'package:app_center/widgets.dart'; +import 'package:app_center_ratings_client/ratings_client.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:snapd/snapd.dart'; diff --git a/packages/app_center/test/ratings_model_test.dart b/packages/app_center/test/ratings_model_test.dart index bba353ecd..0a6672ee5 100644 --- a/packages/app_center/test/ratings_model_test.dart +++ b/packages/app_center/test/ratings_model_test.dart @@ -1,4 +1,5 @@ import 'package:app_center/ratings.dart'; +import 'package:app_center_ratings_client/ratings_client.dart'; import 'package:clock/clock.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; diff --git a/packages/app_center/test/ratings_service_test.dart b/packages/app_center/test/ratings_service_test.dart index ef2e24562..81a655945 100644 --- a/packages/app_center/test/ratings_service_test.dart +++ b/packages/app_center/test/ratings_service_test.dart @@ -1,5 +1,6 @@ import 'package:app_center/src/ratings/exports.dart'; import 'package:app_center/src/ratings/ratings_service.dart'; +import 'package:app_center_ratings_client/ratings_client.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; diff --git a/packages/app_center/test/search_page_test.dart b/packages/app_center/test/search_page_test.dart index b2da107dc..655a1acb1 100644 --- a/packages/app_center/test/search_page_test.dart +++ b/packages/app_center/test/search_page_test.dart @@ -2,6 +2,7 @@ import 'package:app_center/ratings.dart'; import 'package:app_center/search.dart'; import 'package:app_center/snapd.dart'; import 'package:app_center/widgets.dart'; +import 'package:app_center_ratings_client/ratings_client.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:snapd/snapd.dart'; diff --git a/packages/app_center/test/snap_page_test.dart b/packages/app_center/test/snap_page_test.dart index a531c5cfa..2e3e0f825 100644 --- a/packages/app_center/test/snap_page_test.dart +++ b/packages/app_center/test/snap_page_test.dart @@ -2,6 +2,7 @@ import 'package:app_center/l10n.dart'; import 'package:app_center/ratings.dart'; import 'package:app_center/snapd.dart'; import 'package:app_center/widgets.dart'; +import 'package:app_center_ratings_client/ratings_client.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/packages/app_center_ratings_client/lib/ratings_client.dart b/packages/app_center_ratings_client/lib/ratings_client.dart index 4db30fdfa..b2ee8f5bc 100644 --- a/packages/app_center_ratings_client/lib/ratings_client.dart +++ b/packages/app_center_ratings_client/lib/ratings_client.dart @@ -3,15 +3,20 @@ import 'dart:async'; import 'package:grpc/grpc.dart'; import 'package:meta/meta.dart'; -import 'src/app.dart' as app; +import 'src/chart.dart'; import 'src/generated/google/protobuf/empty.pb.dart'; -import 'src/generated/ratings_features_app.pbgrpc.dart'; -import 'src/generated/ratings_features_user.pbgrpc.dart'; -import 'src/user.dart' as user; +import 'src/generated/ratings_features_app.pbgrpc.dart' as appPb; +import 'src/generated/ratings_features_chart.pbgrpc.dart' as chartPb; +import 'src/generated/ratings_features_user.pbgrpc.dart' as userPb; +import 'src/ratings.dart'; +import 'src/user.dart'; + +export 'src/ratings.dart' hide RatingsBandL10n; class RatingsClient { - late AppClient _appClient; - late UserClient _userClient; + late appPb.AppClient _appClient; + late userPb.UserClient _userClient; + late chartPb.ChartClient _chartClient; RatingsClient(String serverUrl, int port) { final channel = ClientChannel( @@ -21,8 +26,9 @@ class RatingsClient { credentials: ChannelCredentials.insecure(), ), ); - _appClient = AppClient(channel); - _userClient = UserClient(channel); + _appClient = appPb.AppClient(channel); + _userClient = userPb.UserClient(channel); + _chartClient = chartPb.ChartClient(channel); } // Additional constructor for testing @@ -30,13 +36,36 @@ class RatingsClient { RatingsClient.withClients( this._appClient, this._userClient, + this._chartClient, ); - Future getRating( + Future authenticate(String id) async { + final request = userPb.AuthenticateRequest(id: id); + final grpcResponse = await _userClient.authenticate(request); + return grpcResponse.token; + } + + Future delete(String token) async { + final request = Empty(); + final callOptions = + CallOptions(metadata: {'authorization': 'Bearer $token'}); + await _userClient.delete(request, options: callOptions); + } + + Future> getChart(Timeframe timeframe, String token) async { + final request = chartPb.GetChartRequest(timeframe: timeframe.toDTO()); + final callOptions = + CallOptions(metadata: {'authorization': 'Bearer $token'}); + final grpcResponse = + await _chartClient.getChart(request, options: callOptions); + return grpcResponse.orderedChartData.map((data) => data.fromDTO()).toList(); + } + + Future getRating( String snapId, String token, ) async { - final request = GetRatingRequest(snapId: snapId); + final request = appPb.GetRatingRequest(snapId: snapId); final callOptions = CallOptions(metadata: {'authorization': 'Bearer $token'}); final grpcResponse = await _appClient.getRating( @@ -46,14 +75,19 @@ class RatingsClient { return grpcResponse.rating.fromDTO(); } - Future authenticate(String id) async { - final request = AuthenticateRequest(id: id); - final grpcResponse = await _userClient.authenticate(request); - return grpcResponse.token; + Future> getSnapVotes(String snap_id, String token) async { + final request = userPb.GetSnapVotesRequest(snapId: snap_id); + final callOptions = + CallOptions(metadata: {'authorization': 'Bearer $token'}); + final grpcResponse = await _userClient.getSnapVotes( + request, + options: callOptions, + ); + return grpcResponse.votes.map((vote) => vote.fromDTO()).toList(); } - Future> listMyVotes(String snapIdFilter, String token) async { - final request = ListMyVotesRequest(snapIdFilter: snapIdFilter); + Future> listMyVotes(String snapIdFilter, String token) async { + final request = userPb.ListMyVotesRequest(snapIdFilter: snapIdFilter); final callOptions = CallOptions(metadata: {'authorization': 'Bearer $token'}); final grpcResponse = await _userClient.listMyVotes( @@ -65,7 +99,7 @@ class RatingsClient { Future vote( String snapId, int snapRevision, bool voteUp, String token) async { - final request = VoteRequest( + final request = userPb.VoteRequest( snapId: snapId, snapRevision: snapRevision, voteUp: voteUp, @@ -74,22 +108,4 @@ class RatingsClient { CallOptions(metadata: {'authorization': 'Bearer $token'}); await _userClient.vote(request, options: callOptions); } - - Future delete(String token) async { - final request = Empty(); - final callOptions = - CallOptions(metadata: {'authorization': 'Bearer $token'}); - await _userClient.delete(request, options: callOptions); - } - - Future> getSnapVotes(String snap_id, String token) async { - final request = GetSnapVotesRequest(snapId: snap_id); - final callOptions = - CallOptions(metadata: {'authorization': 'Bearer $token'}); - final grpcResponse = await _userClient.getSnapVotes( - request, - options: callOptions, - ); - return grpcResponse.votes.map((vote) => vote.fromDTO()).toList(); - } } diff --git a/packages/app_center_ratings_client/lib/src/app.freezed.dart b/packages/app_center_ratings_client/lib/src/app.freezed.dart deleted file mode 100644 index e42a20ad6..000000000 --- a/packages/app_center_ratings_client/lib/src/app.freezed.dart +++ /dev/null @@ -1,169 +0,0 @@ -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'app.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); - -/// @nodoc -mixin _$Rating { - String get snapId => throw _privateConstructorUsedError; - int get totalVotes => throw _privateConstructorUsedError; - RatingsBand get ratingsBand => throw _privateConstructorUsedError; - - @JsonKey(ignore: true) - $RatingCopyWith get copyWith => throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $RatingCopyWith<$Res> { - factory $RatingCopyWith(Rating value, $Res Function(Rating) then) = - _$RatingCopyWithImpl<$Res, Rating>; - @useResult - $Res call({String snapId, int totalVotes, RatingsBand ratingsBand}); -} - -/// @nodoc -class _$RatingCopyWithImpl<$Res, $Val extends Rating> - implements $RatingCopyWith<$Res> { - _$RatingCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? snapId = null, - Object? totalVotes = null, - Object? ratingsBand = null, - }) { - return _then(_value.copyWith( - snapId: null == snapId - ? _value.snapId - : snapId // ignore: cast_nullable_to_non_nullable - as String, - totalVotes: null == totalVotes - ? _value.totalVotes - : totalVotes // ignore: cast_nullable_to_non_nullable - as int, - ratingsBand: null == ratingsBand - ? _value.ratingsBand - : ratingsBand // ignore: cast_nullable_to_non_nullable - as RatingsBand, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$RatingImplCopyWith<$Res> implements $RatingCopyWith<$Res> { - factory _$$RatingImplCopyWith( - _$RatingImpl value, $Res Function(_$RatingImpl) then) = - __$$RatingImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({String snapId, int totalVotes, RatingsBand ratingsBand}); -} - -/// @nodoc -class __$$RatingImplCopyWithImpl<$Res> - extends _$RatingCopyWithImpl<$Res, _$RatingImpl> - implements _$$RatingImplCopyWith<$Res> { - __$$RatingImplCopyWithImpl( - _$RatingImpl _value, $Res Function(_$RatingImpl) _then) - : super(_value, _then); - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? snapId = null, - Object? totalVotes = null, - Object? ratingsBand = null, - }) { - return _then(_$RatingImpl( - snapId: null == snapId - ? _value.snapId - : snapId // ignore: cast_nullable_to_non_nullable - as String, - totalVotes: null == totalVotes - ? _value.totalVotes - : totalVotes // ignore: cast_nullable_to_non_nullable - as int, - ratingsBand: null == ratingsBand - ? _value.ratingsBand - : ratingsBand // ignore: cast_nullable_to_non_nullable - as RatingsBand, - )); - } -} - -/// @nodoc - -class _$RatingImpl implements _Rating { - const _$RatingImpl( - {required this.snapId, - required this.totalVotes, - required this.ratingsBand}); - - @override - final String snapId; - @override - final int totalVotes; - @override - final RatingsBand ratingsBand; - - @override - String toString() { - return 'Rating(snapId: $snapId, totalVotes: $totalVotes, ratingsBand: $ratingsBand)'; - } - - @override - bool operator ==(dynamic other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$RatingImpl && - (identical(other.snapId, snapId) || other.snapId == snapId) && - (identical(other.totalVotes, totalVotes) || - other.totalVotes == totalVotes) && - (identical(other.ratingsBand, ratingsBand) || - other.ratingsBand == ratingsBand)); - } - - @override - int get hashCode => Object.hash(runtimeType, snapId, totalVotes, ratingsBand); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$RatingImplCopyWith<_$RatingImpl> get copyWith => - __$$RatingImplCopyWithImpl<_$RatingImpl>(this, _$identity); -} - -abstract class _Rating implements Rating { - const factory _Rating( - {required final String snapId, - required final int totalVotes, - required final RatingsBand ratingsBand}) = _$RatingImpl; - - @override - String get snapId; - @override - int get totalVotes; - @override - RatingsBand get ratingsBand; - @override - @JsonKey(ignore: true) - _$$RatingImplCopyWith<_$RatingImpl> get copyWith => - throw _privateConstructorUsedError; -} diff --git a/packages/app_center_ratings_client/lib/src/chart.dart b/packages/app_center_ratings_client/lib/src/chart.dart new file mode 100644 index 000000000..41c6ffd1f --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/chart.dart @@ -0,0 +1,50 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import 'generated/ratings_features_chart.pb.dart' as pb; +import 'ratings.dart' as common; + +part 'chart.freezed.dart'; + +@freezed +class ChartData with _$ChartData { + const factory ChartData({ + required double rawRating, + required common.Rating rating, + }) = _ChartData; +} + +enum Timeframe { + unspecified, + week, + month, +} + +extension ChartDataFromDTO on pb.ChartData { + ChartData fromDTO() { + return ChartData( + rating: this.rating.fromDTO(), + rawRating: this.rawRating, + ); + } +} + +extension TimeframeFromDTO on pb.Timeframe { + Timeframe fromDTO() { + return switch (this) { + pb.Timeframe.TIMEFRAME_UNSPECIFIED => Timeframe.unspecified, + pb.Timeframe.TIMEFRAME_WEEK => Timeframe.week, + pb.Timeframe.TIMEFRAME_MONTH => Timeframe.month, + _ => Timeframe.unspecified, + }; + } +} + +extension TimeframeToDTO on Timeframe { + pb.Timeframe toDTO() { + return switch (this) { + Timeframe.unspecified => pb.Timeframe.TIMEFRAME_UNSPECIFIED, + Timeframe.week => pb.Timeframe.TIMEFRAME_WEEK, + Timeframe.month => pb.Timeframe.TIMEFRAME_MONTH, + }; + } +} diff --git a/packages/app_center_ratings_client/lib/src/chart.freezed.dart b/packages/app_center_ratings_client/lib/src/chart.freezed.dart new file mode 100644 index 000000000..29a230a05 --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/chart.freezed.dart @@ -0,0 +1,150 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'chart.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +/// @nodoc +mixin _$ChartData { + double get rawRating => throw _privateConstructorUsedError; + common.Rating get rating => throw _privateConstructorUsedError; + + @JsonKey(ignore: true) + $ChartDataCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ChartDataCopyWith<$Res> { + factory $ChartDataCopyWith(ChartData value, $Res Function(ChartData) then) = + _$ChartDataCopyWithImpl<$Res, ChartData>; + @useResult + $Res call({double rawRating, common.Rating rating}); +} + +/// @nodoc +class _$ChartDataCopyWithImpl<$Res, $Val extends ChartData> + implements $ChartDataCopyWith<$Res> { + _$ChartDataCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? rawRating = null, + Object? rating = null, + }) { + return _then(_value.copyWith( + rawRating: null == rawRating + ? _value.rawRating + : rawRating // ignore: cast_nullable_to_non_nullable + as double, + rating: null == rating + ? _value.rating + : rating // ignore: cast_nullable_to_non_nullable + as common.Rating, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$ChartDataImplCopyWith<$Res> + implements $ChartDataCopyWith<$Res> { + factory _$$ChartDataImplCopyWith( + _$ChartDataImpl value, $Res Function(_$ChartDataImpl) then) = + __$$ChartDataImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({double rawRating, common.Rating rating}); +} + +/// @nodoc +class __$$ChartDataImplCopyWithImpl<$Res> + extends _$ChartDataCopyWithImpl<$Res, _$ChartDataImpl> + implements _$$ChartDataImplCopyWith<$Res> { + __$$ChartDataImplCopyWithImpl( + _$ChartDataImpl _value, $Res Function(_$ChartDataImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? rawRating = null, + Object? rating = null, + }) { + return _then(_$ChartDataImpl( + rawRating: null == rawRating + ? _value.rawRating + : rawRating // ignore: cast_nullable_to_non_nullable + as double, + rating: null == rating + ? _value.rating + : rating // ignore: cast_nullable_to_non_nullable + as common.Rating, + )); + } +} + +/// @nodoc + +class _$ChartDataImpl implements _ChartData { + const _$ChartDataImpl({required this.rawRating, required this.rating}); + + @override + final double rawRating; + @override + final common.Rating rating; + + @override + String toString() { + return 'ChartData(rawRating: $rawRating, rating: $rating)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ChartDataImpl && + (identical(other.rawRating, rawRating) || + other.rawRating == rawRating) && + (identical(other.rating, rating) || other.rating == rating)); + } + + @override + int get hashCode => Object.hash(runtimeType, rawRating, rating); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$ChartDataImplCopyWith<_$ChartDataImpl> get copyWith => + __$$ChartDataImplCopyWithImpl<_$ChartDataImpl>(this, _$identity); +} + +abstract class _ChartData implements ChartData { + const factory _ChartData( + {required final double rawRating, + required final common.Rating rating}) = _$ChartDataImpl; + + @override + double get rawRating; + @override + common.Rating get rating; + @override + @JsonKey(ignore: true) + _$$ChartDataImplCopyWith<_$ChartDataImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pb.dart b/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pb.dart index 56193eb61..6ea544c2b 100644 --- a/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pb.dart +++ b/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pb.dart @@ -11,12 +11,9 @@ import 'dart:core' as $core; -import 'package:fixnum/fixnum.dart' as $fixnum; import 'package:protobuf/protobuf.dart' as $pb; -import 'ratings_features_app.pbenum.dart'; - -export 'ratings_features_app.pbenum.dart'; +import 'ratings_features_common.pb.dart' as $1; class GetRatingRequest extends $pb.GeneratedMessage { factory GetRatingRequest({ @@ -82,7 +79,7 @@ class GetRatingRequest extends $pb.GeneratedMessage { class GetRatingResponse extends $pb.GeneratedMessage { factory GetRatingResponse({ - Rating? rating, + $1.Rating? rating, }) { final $result = create(); if (rating != null) { @@ -103,7 +100,8 @@ class GetRatingResponse extends $pb.GeneratedMessage { package: const $pb.PackageName( _omitMessageNames ? '' : 'ratings.features.app'), createEmptyInstance: create) - ..aOM(1, _omitFieldNames ? '' : 'rating', subBuilder: Rating.create) + ..aOM<$1.Rating>(1, _omitFieldNames ? '' : 'rating', + subBuilder: $1.Rating.create) ..hasRequiredFields = false; @$core.Deprecated('Using this can add significant overhead to your binary. ' @@ -130,9 +128,9 @@ class GetRatingResponse extends $pb.GeneratedMessage { static GetRatingResponse? _defaultInstance; @$pb.TagNumber(1) - Rating get rating => $_getN(0); + $1.Rating get rating => $_getN(0); @$pb.TagNumber(1) - set rating(Rating v) { + set rating($1.Rating v) { setField(1, v); } @@ -141,107 +139,7 @@ class GetRatingResponse extends $pb.GeneratedMessage { @$pb.TagNumber(1) void clearRating() => clearField(1); @$pb.TagNumber(1) - Rating ensureRating() => $_ensure(0); -} - -class Rating extends $pb.GeneratedMessage { - factory Rating({ - $core.String? snapId, - $fixnum.Int64? totalVotes, - RatingsBand? ratingsBand, - }) { - final $result = create(); - if (snapId != null) { - $result.snapId = snapId; - } - if (totalVotes != null) { - $result.totalVotes = totalVotes; - } - if (ratingsBand != null) { - $result.ratingsBand = ratingsBand; - } - return $result; - } - Rating._() : super(); - factory Rating.fromBuffer($core.List<$core.int> i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromBuffer(i, r); - factory Rating.fromJson($core.String i, - [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => - create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo( - _omitMessageNames ? '' : 'Rating', - package: const $pb.PackageName( - _omitMessageNames ? '' : 'ratings.features.app'), - createEmptyInstance: create) - ..aOS(1, _omitFieldNames ? '' : 'snapId') - ..a<$fixnum.Int64>( - 2, _omitFieldNames ? '' : 'totalVotes', $pb.PbFieldType.OU6, - defaultOrMaker: $fixnum.Int64.ZERO) - ..e( - 3, _omitFieldNames ? '' : 'ratingsBand', $pb.PbFieldType.OE, - defaultOrMaker: RatingsBand.VERY_GOOD, - valueOf: RatingsBand.valueOf, - enumValues: RatingsBand.values) - ..hasRequiredFields = false; - - @$core.Deprecated('Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - Rating clone() => Rating()..mergeFromMessage(this); - @$core.Deprecated('Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - Rating copyWith(void Function(Rating) updates) => - super.copyWith((message) => updates(message as Rating)) as Rating; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static Rating create() => Rating._(); - Rating createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static Rating getDefault() => - _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Rating? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get snapId => $_getSZ(0); - @$pb.TagNumber(1) - set snapId($core.String v) { - $_setString(0, v); - } - - @$pb.TagNumber(1) - $core.bool hasSnapId() => $_has(0); - @$pb.TagNumber(1) - void clearSnapId() => clearField(1); - - @$pb.TagNumber(2) - $fixnum.Int64 get totalVotes => $_getI64(1); - @$pb.TagNumber(2) - set totalVotes($fixnum.Int64 v) { - $_setInt64(1, v); - } - - @$pb.TagNumber(2) - $core.bool hasTotalVotes() => $_has(1); - @$pb.TagNumber(2) - void clearTotalVotes() => clearField(2); - - @$pb.TagNumber(3) - RatingsBand get ratingsBand => $_getN(2); - @$pb.TagNumber(3) - set ratingsBand(RatingsBand v) { - setField(3, v); - } - - @$pb.TagNumber(3) - $core.bool hasRatingsBand() => $_has(2); - @$pb.TagNumber(3) - void clearRatingsBand() => clearField(3); + $1.Rating ensureRating() => $_ensure(0); } const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); diff --git a/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbenum.dart b/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbenum.dart index eeaebe1ff..bd808605b 100644 --- a/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbenum.dart +++ b/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbenum.dart @@ -8,39 +8,3 @@ // ignore_for_file: constant_identifier_names, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields // ignore_for_file: unnecessary_import, unnecessary_this, unused_import - -import 'dart:core' as $core; - -import 'package:protobuf/protobuf.dart' as $pb; - -class RatingsBand extends $pb.ProtobufEnum { - static const RatingsBand VERY_GOOD = - RatingsBand._(0, _omitEnumNames ? '' : 'VERY_GOOD'); - static const RatingsBand GOOD = - RatingsBand._(1, _omitEnumNames ? '' : 'GOOD'); - static const RatingsBand NEUTRAL = - RatingsBand._(2, _omitEnumNames ? '' : 'NEUTRAL'); - static const RatingsBand POOR = - RatingsBand._(3, _omitEnumNames ? '' : 'POOR'); - static const RatingsBand VERY_POOR = - RatingsBand._(4, _omitEnumNames ? '' : 'VERY_POOR'); - static const RatingsBand INSUFFICIENT_VOTES = - RatingsBand._(5, _omitEnumNames ? '' : 'INSUFFICIENT_VOTES'); - - static const $core.List values = [ - VERY_GOOD, - GOOD, - NEUTRAL, - POOR, - VERY_POOR, - INSUFFICIENT_VOTES, - ]; - - static final $core.Map<$core.int, RatingsBand> _byValue = - $pb.ProtobufEnum.initByValue(values); - static RatingsBand? valueOf($core.int value) => _byValue[value]; - - const RatingsBand._($core.int v, $core.String n) : super(v, n); -} - -const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names'); diff --git a/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbjson.dart b/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbjson.dart index 6323d1ae4..62661ec17 100644 --- a/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbjson.dart +++ b/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbjson.dart @@ -13,24 +13,6 @@ import 'dart:convert' as $convert; import 'dart:core' as $core; import 'dart:typed_data' as $typed_data; -@$core.Deprecated('Use ratingsBandDescriptor instead') -const RatingsBand$json = { - '1': 'RatingsBand', - '2': [ - {'1': 'VERY_GOOD', '2': 0}, - {'1': 'GOOD', '2': 1}, - {'1': 'NEUTRAL', '2': 2}, - {'1': 'POOR', '2': 3}, - {'1': 'VERY_POOR', '2': 4}, - {'1': 'INSUFFICIENT_VOTES', '2': 5}, - ], -}; - -/// Descriptor for `RatingsBand`. Decode as a `google.protobuf.EnumDescriptorProto`. -final $typed_data.Uint8List ratingsBandDescriptor = $convert.base64Decode( - 'CgtSYXRpbmdzQmFuZBINCglWRVJZX0dPT0QQABIICgRHT09EEAESCwoHTkVVVFJBTBACEggKBF' - 'BPT1IQAxINCglWRVJZX1BPT1IQBBIWChJJTlNVRkZJQ0lFTlRfVk9URVMQBQ=='); - @$core.Deprecated('Use getRatingRequestDescriptor instead') const GetRatingRequest$json = { '1': 'GetRatingRequest', @@ -52,7 +34,7 @@ const GetRatingResponse$json = { '3': 1, '4': 1, '5': 11, - '6': '.ratings.features.app.Rating', + '6': '.ratings.features.common.Rating', '10': 'rating' }, ], @@ -60,28 +42,5 @@ const GetRatingResponse$json = { /// Descriptor for `GetRatingResponse`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List getRatingResponseDescriptor = $convert.base64Decode( - 'ChFHZXRSYXRpbmdSZXNwb25zZRI0CgZyYXRpbmcYASABKAsyHC5yYXRpbmdzLmZlYXR1cmVzLm' - 'FwcC5SYXRpbmdSBnJhdGluZw=='); - -@$core.Deprecated('Use ratingDescriptor instead') -const Rating$json = { - '1': 'Rating', - '2': [ - {'1': 'snap_id', '3': 1, '4': 1, '5': 9, '10': 'snapId'}, - {'1': 'total_votes', '3': 2, '4': 1, '5': 4, '10': 'totalVotes'}, - { - '1': 'ratings_band', - '3': 3, - '4': 1, - '5': 14, - '6': '.ratings.features.app.RatingsBand', - '10': 'ratingsBand' - }, - ], -}; - -/// Descriptor for `Rating`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List ratingDescriptor = $convert.base64Decode( - 'CgZSYXRpbmcSFwoHc25hcF9pZBgBIAEoCVIGc25hcElkEh8KC3RvdGFsX3ZvdGVzGAIgASgEUg' - 'p0b3RhbFZvdGVzEkQKDHJhdGluZ3NfYmFuZBgDIAEoDjIhLnJhdGluZ3MuZmVhdHVyZXMuYXBw' - 'LlJhdGluZ3NCYW5kUgtyYXRpbmdzQmFuZA=='); + 'ChFHZXRSYXRpbmdSZXNwb25zZRI3CgZyYXRpbmcYASABKAsyHy5yYXRpbmdzLmZlYXR1cmVzLm' + 'NvbW1vbi5SYXRpbmdSBnJhdGluZw=='); diff --git a/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pb.dart b/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pb.dart index 333102612..c17ae0130 100644 --- a/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pb.dart +++ b/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pb.dart @@ -11,25 +11,21 @@ import 'dart:core' as $core; -import 'package:fixnum/fixnum.dart' as $fixnum; import 'package:protobuf/protobuf.dart' as $pb; import 'ratings_features_chart.pbenum.dart'; +import 'ratings_features_common.pb.dart' as $1; export 'ratings_features_chart.pbenum.dart'; class GetChartRequest extends $pb.GeneratedMessage { factory GetChartRequest({ Timeframe? timeframe, - ChartType? type, }) { final $result = create(); if (timeframe != null) { $result.timeframe = timeframe; } - if (type != null) { - $result.type = type; - } return $result; } GetChartRequest._() : super(); @@ -49,10 +45,6 @@ class GetChartRequest extends $pb.GeneratedMessage { defaultOrMaker: Timeframe.TIMEFRAME_UNSPECIFIED, valueOf: Timeframe.valueOf, enumValues: Timeframe.values) - ..e(2, _omitFieldNames ? '' : 'type', $pb.PbFieldType.OE, - defaultOrMaker: ChartType.CHART_TYPE_TOP_UNSPECIFIED, - valueOf: ChartType.valueOf, - enumValues: ChartType.values) ..hasRequiredFields = false; @$core.Deprecated('Using this can add significant overhead to your binary. ' @@ -89,33 +81,17 @@ class GetChartRequest extends $pb.GeneratedMessage { $core.bool hasTimeframe() => $_has(0); @$pb.TagNumber(1) void clearTimeframe() => clearField(1); - - @$pb.TagNumber(2) - ChartType get type => $_getN(1); - @$pb.TagNumber(2) - set type(ChartType v) { - setField(2, v); - } - - @$pb.TagNumber(2) - $core.bool hasType() => $_has(1); - @$pb.TagNumber(2) - void clearType() => clearField(2); } class GetChartResponse extends $pb.GeneratedMessage { factory GetChartResponse({ Timeframe? timeframe, - ChartType? type, $core.Iterable? orderedChartData, }) { final $result = create(); if (timeframe != null) { $result.timeframe = timeframe; } - if (type != null) { - $result.type = type; - } if (orderedChartData != null) { $result.orderedChartData.addAll(orderedChartData); } @@ -138,12 +114,8 @@ class GetChartResponse extends $pb.GeneratedMessage { defaultOrMaker: Timeframe.TIMEFRAME_UNSPECIFIED, valueOf: Timeframe.valueOf, enumValues: Timeframe.values) - ..e(2, _omitFieldNames ? '' : 'type', $pb.PbFieldType.OE, - defaultOrMaker: ChartType.CHART_TYPE_TOP_UNSPECIFIED, - valueOf: ChartType.valueOf, - enumValues: ChartType.values) ..pc( - 3, _omitFieldNames ? '' : 'orderedChartData', $pb.PbFieldType.PM, + 2, _omitFieldNames ? '' : 'orderedChartData', $pb.PbFieldType.PM, subBuilder: ChartData.create) ..hasRequiredFields = false; @@ -183,36 +155,20 @@ class GetChartResponse extends $pb.GeneratedMessage { void clearTimeframe() => clearField(1); @$pb.TagNumber(2) - ChartType get type => $_getN(1); - @$pb.TagNumber(2) - set type(ChartType v) { - setField(2, v); - } - - @$pb.TagNumber(2) - $core.bool hasType() => $_has(1); - @$pb.TagNumber(2) - void clearType() => clearField(2); - - @$pb.TagNumber(3) - $core.List get orderedChartData => $_getList(2); + $core.List get orderedChartData => $_getList(1); } class ChartData extends $pb.GeneratedMessage { factory ChartData({ - $core.String? app, - $fixnum.Int64? totalUpVotes, - $fixnum.Int64? totalDownVotes, + $core.double? rawRating, + $1.Rating? rating, }) { final $result = create(); - if (app != null) { - $result.app = app; - } - if (totalUpVotes != null) { - $result.totalUpVotes = totalUpVotes; + if (rawRating != null) { + $result.rawRating = rawRating; } - if (totalDownVotes != null) { - $result.totalDownVotes = totalDownVotes; + if (rating != null) { + $result.rating = rating; } return $result; } @@ -229,13 +185,9 @@ class ChartData extends $pb.GeneratedMessage { package: const $pb.PackageName( _omitMessageNames ? '' : 'ratings.features.chart'), createEmptyInstance: create) - ..aOS(1, _omitFieldNames ? '' : 'app') - ..a<$fixnum.Int64>( - 2, _omitFieldNames ? '' : 'totalUpVotes', $pb.PbFieldType.OU6, - defaultOrMaker: $fixnum.Int64.ZERO) - ..a<$fixnum.Int64>( - 3, _omitFieldNames ? '' : 'totalDownVotes', $pb.PbFieldType.OU6, - defaultOrMaker: $fixnum.Int64.ZERO) + ..a<$core.double>(1, _omitFieldNames ? '' : 'rawRating', $pb.PbFieldType.OF) + ..aOM<$1.Rating>(2, _omitFieldNames ? '' : 'rating', + subBuilder: $1.Rating.create) ..hasRequiredFields = false; @$core.Deprecated('Using this can add significant overhead to your binary. ' @@ -260,40 +212,30 @@ class ChartData extends $pb.GeneratedMessage { static ChartData? _defaultInstance; @$pb.TagNumber(1) - $core.String get app => $_getSZ(0); + $core.double get rawRating => $_getN(0); @$pb.TagNumber(1) - set app($core.String v) { - $_setString(0, v); + set rawRating($core.double v) { + $_setFloat(0, v); } @$pb.TagNumber(1) - $core.bool hasApp() => $_has(0); + $core.bool hasRawRating() => $_has(0); @$pb.TagNumber(1) - void clearApp() => clearField(1); + void clearRawRating() => clearField(1); @$pb.TagNumber(2) - $fixnum.Int64 get totalUpVotes => $_getI64(1); + $1.Rating get rating => $_getN(1); @$pb.TagNumber(2) - set totalUpVotes($fixnum.Int64 v) { - $_setInt64(1, v); + set rating($1.Rating v) { + setField(2, v); } @$pb.TagNumber(2) - $core.bool hasTotalUpVotes() => $_has(1); + $core.bool hasRating() => $_has(1); @$pb.TagNumber(2) - void clearTotalUpVotes() => clearField(2); - - @$pb.TagNumber(3) - $fixnum.Int64 get totalDownVotes => $_getI64(2); - @$pb.TagNumber(3) - set totalDownVotes($fixnum.Int64 v) { - $_setInt64(2, v); - } - - @$pb.TagNumber(3) - $core.bool hasTotalDownVotes() => $_has(2); - @$pb.TagNumber(3) - void clearTotalDownVotes() => clearField(3); + void clearRating() => clearField(2); + @$pb.TagNumber(2) + $1.Rating ensureRating() => $_ensure(1); } const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); diff --git a/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pbenum.dart b/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pbenum.dart index 6b940e99a..f8d8dcee8 100644 --- a/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pbenum.dart +++ b/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pbenum.dart @@ -13,24 +13,6 @@ import 'dart:core' as $core; import 'package:protobuf/protobuf.dart' as $pb; -class ChartType extends $pb.ProtobufEnum { - static const ChartType CHART_TYPE_TOP_UNSPECIFIED = - ChartType._(0, _omitEnumNames ? '' : 'CHART_TYPE_TOP_UNSPECIFIED'); - static const ChartType CHART_TYPE_TOP = - ChartType._(1, _omitEnumNames ? '' : 'CHART_TYPE_TOP'); - - static const $core.List values = [ - CHART_TYPE_TOP_UNSPECIFIED, - CHART_TYPE_TOP, - ]; - - static final $core.Map<$core.int, ChartType> _byValue = - $pb.ProtobufEnum.initByValue(values); - static ChartType? valueOf($core.int value) => _byValue[value]; - - const ChartType._($core.int v, $core.String n) : super(v, n); -} - class Timeframe extends $pb.ProtobufEnum { static const Timeframe TIMEFRAME_UNSPECIFIED = Timeframe._(0, _omitEnumNames ? '' : 'TIMEFRAME_UNSPECIFIED'); diff --git a/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pbjson.dart b/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pbjson.dart index c8c32252f..3ba8ff1b0 100644 --- a/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pbjson.dart +++ b/packages/app_center_ratings_client/lib/src/generated/ratings_features_chart.pbjson.dart @@ -13,20 +13,6 @@ import 'dart:convert' as $convert; import 'dart:core' as $core; import 'dart:typed_data' as $typed_data; -@$core.Deprecated('Use chartTypeDescriptor instead') -const ChartType$json = { - '1': 'ChartType', - '2': [ - {'1': 'CHART_TYPE_TOP_UNSPECIFIED', '2': 0}, - {'1': 'CHART_TYPE_TOP', '2': 1}, - ], -}; - -/// Descriptor for `ChartType`. Decode as a `google.protobuf.EnumDescriptorProto`. -final $typed_data.Uint8List chartTypeDescriptor = $convert.base64Decode( - 'CglDaGFydFR5cGUSHgoaQ0hBUlRfVFlQRV9UT1BfVU5TUEVDSUZJRUQQABISCg5DSEFSVF9UWV' - 'BFX1RPUBAB'); - @$core.Deprecated('Use timeframeDescriptor instead') const Timeframe$json = { '1': 'Timeframe', @@ -54,22 +40,13 @@ const GetChartRequest$json = { '6': '.ratings.features.chart.Timeframe', '10': 'timeframe' }, - { - '1': 'type', - '3': 2, - '4': 1, - '5': 14, - '6': '.ratings.features.chart.ChartType', - '10': 'type' - }, ], }; /// Descriptor for `GetChartRequest`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List getChartRequestDescriptor = $convert.base64Decode( 'Cg9HZXRDaGFydFJlcXVlc3QSPwoJdGltZWZyYW1lGAEgASgOMiEucmF0aW5ncy5mZWF0dXJlcy' - '5jaGFydC5UaW1lZnJhbWVSCXRpbWVmcmFtZRI1CgR0eXBlGAIgASgOMiEucmF0aW5ncy5mZWF0' - 'dXJlcy5jaGFydC5DaGFydFR5cGVSBHR5cGU='); + '5jaGFydC5UaW1lZnJhbWVSCXRpbWVmcmFtZQ=='); @$core.Deprecated('Use getChartResponseDescriptor instead') const GetChartResponse$json = { @@ -83,17 +60,9 @@ const GetChartResponse$json = { '6': '.ratings.features.chart.Timeframe', '10': 'timeframe' }, - { - '1': 'type', - '3': 2, - '4': 1, - '5': 14, - '6': '.ratings.features.chart.ChartType', - '10': 'type' - }, { '1': 'ordered_chart_data', - '3': 3, + '3': 2, '4': 3, '5': 11, '6': '.ratings.features.chart.ChartData', @@ -105,21 +74,26 @@ const GetChartResponse$json = { /// Descriptor for `GetChartResponse`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List getChartResponseDescriptor = $convert.base64Decode( 'ChBHZXRDaGFydFJlc3BvbnNlEj8KCXRpbWVmcmFtZRgBIAEoDjIhLnJhdGluZ3MuZmVhdHVyZX' - 'MuY2hhcnQuVGltZWZyYW1lUgl0aW1lZnJhbWUSNQoEdHlwZRgCIAEoDjIhLnJhdGluZ3MuZmVh' - 'dHVyZXMuY2hhcnQuQ2hhcnRUeXBlUgR0eXBlEk8KEm9yZGVyZWRfY2hhcnRfZGF0YRgDIAMoCz' - 'IhLnJhdGluZ3MuZmVhdHVyZXMuY2hhcnQuQ2hhcnREYXRhUhBvcmRlcmVkQ2hhcnREYXRh'); + 'MuY2hhcnQuVGltZWZyYW1lUgl0aW1lZnJhbWUSTwoSb3JkZXJlZF9jaGFydF9kYXRhGAIgAygL' + 'MiEucmF0aW5ncy5mZWF0dXJlcy5jaGFydC5DaGFydERhdGFSEG9yZGVyZWRDaGFydERhdGE='); @$core.Deprecated('Use chartDataDescriptor instead') const ChartData$json = { '1': 'ChartData', '2': [ - {'1': 'app', '3': 1, '4': 1, '5': 9, '10': 'app'}, - {'1': 'total_up_votes', '3': 2, '4': 1, '5': 4, '10': 'totalUpVotes'}, - {'1': 'total_down_votes', '3': 3, '4': 1, '5': 4, '10': 'totalDownVotes'}, + {'1': 'raw_rating', '3': 1, '4': 1, '5': 2, '10': 'rawRating'}, + { + '1': 'rating', + '3': 2, + '4': 1, + '5': 11, + '6': '.ratings.features.common.Rating', + '10': 'rating' + }, ], }; /// Descriptor for `ChartData`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List chartDataDescriptor = $convert.base64Decode( - 'CglDaGFydERhdGESEAoDYXBwGAEgASgJUgNhcHASJAoOdG90YWxfdXBfdm90ZXMYAiABKARSDH' - 'RvdGFsVXBWb3RlcxIoChB0b3RhbF9kb3duX3ZvdGVzGAMgASgEUg50b3RhbERvd25Wb3Rlcw=='); + 'CglDaGFydERhdGESHQoKcmF3X3JhdGluZxgBIAEoAlIJcmF3UmF0aW5nEjcKBnJhdGluZxgCIA' + 'EoCzIfLnJhdGluZ3MuZmVhdHVyZXMuY29tbW9uLlJhdGluZ1IGcmF0aW5n'); diff --git a/packages/app_center_ratings_client/lib/src/generated/ratings_features_common.pb.dart b/packages/app_center_ratings_client/lib/src/generated/ratings_features_common.pb.dart new file mode 100644 index 000000000..a980ba0b8 --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/generated/ratings_features_common.pb.dart @@ -0,0 +1,123 @@ +// +// Generated code. Do not modify. +// source: ratings_features_common.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:fixnum/fixnum.dart' as $fixnum; +import 'package:protobuf/protobuf.dart' as $pb; + +import 'ratings_features_common.pbenum.dart'; + +export 'ratings_features_common.pbenum.dart'; + +class Rating extends $pb.GeneratedMessage { + factory Rating({ + $core.String? snapId, + $fixnum.Int64? totalVotes, + RatingsBand? ratingsBand, + }) { + final $result = create(); + if (snapId != null) { + $result.snapId = snapId; + } + if (totalVotes != null) { + $result.totalVotes = totalVotes; + } + if (ratingsBand != null) { + $result.ratingsBand = ratingsBand; + } + return $result; + } + Rating._() : super(); + factory Rating.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Rating.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Rating', + package: const $pb.PackageName( + _omitMessageNames ? '' : 'ratings.features.common'), + createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'snapId') + ..a<$fixnum.Int64>( + 2, _omitFieldNames ? '' : 'totalVotes', $pb.PbFieldType.OU6, + defaultOrMaker: $fixnum.Int64.ZERO) + ..e( + 3, _omitFieldNames ? '' : 'ratingsBand', $pb.PbFieldType.OE, + defaultOrMaker: RatingsBand.VERY_GOOD, + valueOf: RatingsBand.valueOf, + enumValues: RatingsBand.values) + ..hasRequiredFields = false; + + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Rating clone() => Rating()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Rating copyWith(void Function(Rating) updates) => + super.copyWith((message) => updates(message as Rating)) as Rating; + + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Rating create() => Rating._(); + Rating createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Rating getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Rating? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get snapId => $_getSZ(0); + @$pb.TagNumber(1) + set snapId($core.String v) { + $_setString(0, v); + } + + @$pb.TagNumber(1) + $core.bool hasSnapId() => $_has(0); + @$pb.TagNumber(1) + void clearSnapId() => clearField(1); + + @$pb.TagNumber(2) + $fixnum.Int64 get totalVotes => $_getI64(1); + @$pb.TagNumber(2) + set totalVotes($fixnum.Int64 v) { + $_setInt64(1, v); + } + + @$pb.TagNumber(2) + $core.bool hasTotalVotes() => $_has(1); + @$pb.TagNumber(2) + void clearTotalVotes() => clearField(2); + + @$pb.TagNumber(3) + RatingsBand get ratingsBand => $_getN(2); + @$pb.TagNumber(3) + set ratingsBand(RatingsBand v) { + setField(3, v); + } + + @$pb.TagNumber(3) + $core.bool hasRatingsBand() => $_has(2); + @$pb.TagNumber(3) + void clearRatingsBand() => clearField(3); +} + +const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names'); +const _omitMessageNames = + $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/packages/app_center_ratings_client/lib/src/generated/ratings_features_common.pbenum.dart b/packages/app_center_ratings_client/lib/src/generated/ratings_features_common.pbenum.dart new file mode 100644 index 000000000..3b190bcdb --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/generated/ratings_features_common.pbenum.dart @@ -0,0 +1,46 @@ +// +// Generated code. Do not modify. +// source: ratings_features_common.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +class RatingsBand extends $pb.ProtobufEnum { + static const RatingsBand VERY_GOOD = + RatingsBand._(0, _omitEnumNames ? '' : 'VERY_GOOD'); + static const RatingsBand GOOD = + RatingsBand._(1, _omitEnumNames ? '' : 'GOOD'); + static const RatingsBand NEUTRAL = + RatingsBand._(2, _omitEnumNames ? '' : 'NEUTRAL'); + static const RatingsBand POOR = + RatingsBand._(3, _omitEnumNames ? '' : 'POOR'); + static const RatingsBand VERY_POOR = + RatingsBand._(4, _omitEnumNames ? '' : 'VERY_POOR'); + static const RatingsBand INSUFFICIENT_VOTES = + RatingsBand._(5, _omitEnumNames ? '' : 'INSUFFICIENT_VOTES'); + + static const $core.List values = [ + VERY_GOOD, + GOOD, + NEUTRAL, + POOR, + VERY_POOR, + INSUFFICIENT_VOTES, + ]; + + static final $core.Map<$core.int, RatingsBand> _byValue = + $pb.ProtobufEnum.initByValue(values); + static RatingsBand? valueOf($core.int value) => _byValue[value]; + + const RatingsBand._($core.int v, $core.String n) : super(v, n); +} + +const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names'); diff --git a/packages/app_center_ratings_client/lib/src/generated/ratings_features_common.pbjson.dart b/packages/app_center_ratings_client/lib/src/generated/ratings_features_common.pbjson.dart new file mode 100644 index 000000000..295512611 --- /dev/null +++ b/packages/app_center_ratings_client/lib/src/generated/ratings_features_common.pbjson.dart @@ -0,0 +1,55 @@ +// +// Generated code. Do not modify. +// source: ratings_features_common.proto +// +// @dart = 2.12 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_final_fields +// ignore_for_file: unnecessary_import, unnecessary_this, unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use ratingsBandDescriptor instead') +const RatingsBand$json = { + '1': 'RatingsBand', + '2': [ + {'1': 'VERY_GOOD', '2': 0}, + {'1': 'GOOD', '2': 1}, + {'1': 'NEUTRAL', '2': 2}, + {'1': 'POOR', '2': 3}, + {'1': 'VERY_POOR', '2': 4}, + {'1': 'INSUFFICIENT_VOTES', '2': 5}, + ], +}; + +/// Descriptor for `RatingsBand`. Decode as a `google.protobuf.EnumDescriptorProto`. +final $typed_data.Uint8List ratingsBandDescriptor = $convert.base64Decode( + 'CgtSYXRpbmdzQmFuZBINCglWRVJZX0dPT0QQABIICgRHT09EEAESCwoHTkVVVFJBTBACEggKBF' + 'BPT1IQAxINCglWRVJZX1BPT1IQBBIWChJJTlNVRkZJQ0lFTlRfVk9URVMQBQ=='); + +@$core.Deprecated('Use ratingDescriptor instead') +const Rating$json = { + '1': 'Rating', + '2': [ + {'1': 'snap_id', '3': 1, '4': 1, '5': 9, '10': 'snapId'}, + {'1': 'total_votes', '3': 2, '4': 1, '5': 4, '10': 'totalVotes'}, + { + '1': 'ratings_band', + '3': 3, + '4': 1, + '5': 14, + '6': '.ratings.features.common.RatingsBand', + '10': 'ratingsBand' + }, + ], +}; + +/// Descriptor for `Rating`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List ratingDescriptor = $convert.base64Decode( + 'CgZSYXRpbmcSFwoHc25hcF9pZBgBIAEoCVIGc25hcElkEh8KC3RvdGFsX3ZvdGVzGAIgASgEUg' + 'p0b3RhbFZvdGVzEkcKDHJhdGluZ3NfYmFuZBgDIAEoDjIkLnJhdGluZ3MuZmVhdHVyZXMuY29t' + 'bW9uLlJhdGluZ3NCYW5kUgtyYXRpbmdzQmFuZA=='); diff --git a/packages/app_center_ratings_client/lib/src/app.dart b/packages/app_center_ratings_client/lib/src/ratings.dart similarity index 55% rename from packages/app_center_ratings_client/lib/src/app.dart rename to packages/app_center_ratings_client/lib/src/ratings.dart index c13be5d0f..0efe6969a 100644 --- a/packages/app_center_ratings_client/lib/src/app.dart +++ b/packages/app_center_ratings_client/lib/src/ratings.dart @@ -1,16 +1,32 @@ import 'package:freezed_annotation/freezed_annotation.dart'; -import 'generated/ratings_features_app.pb.dart' as pb; +import 'generated/ratings_features_common.pb.dart' as pb; -part 'app.freezed.dart'; +@immutable +class Rating { + final String snapId; + final int totalVotes; + final RatingsBand ratingsBand; -@freezed -class Rating with _$Rating { - const factory Rating({ - required String snapId, - required int totalVotes, - required RatingsBand ratingsBand, - }) = _Rating; + const Rating({ + required this.snapId, + required this.totalVotes, + required this.ratingsBand, + }); + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + + return other is Rating && + other.snapId == snapId && + other.totalVotes == totalVotes && + other.ratingsBand == ratingsBand; + } + + @override + int get hashCode => + snapId.hashCode ^ totalVotes.hashCode ^ ratingsBand.hashCode; } enum RatingsBand { diff --git a/packages/app_center_ratings_client/protos/ratings_features_app.proto b/packages/app_center_ratings_client/protos/ratings_features_app.proto index e6494e4ea..ac40cffbf 100644 --- a/packages/app_center_ratings_client/protos/ratings_features_app.proto +++ b/packages/app_center_ratings_client/protos/ratings_features_app.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package ratings.features.app; +import "ratings_features_common.proto"; + service App { rpc GetRating (GetRatingRequest) returns (GetRatingResponse) {} } @@ -11,20 +13,5 @@ message GetRatingRequest { } message GetRatingResponse { - Rating rating = 1; -} - -message Rating { - string snap_id = 1; - uint64 total_votes = 2; - RatingsBand ratings_band = 3; -} - -enum RatingsBand { - VERY_GOOD = 0; - GOOD = 1; - NEUTRAL = 2; - POOR = 3; - VERY_POOR = 4; - INSUFFICIENT_VOTES = 5; + ratings.features.common.Rating rating = 1; } diff --git a/packages/app_center_ratings_client/protos/ratings_features_chart.proto b/packages/app_center_ratings_client/protos/ratings_features_chart.proto index d5f1b8c42..19f39d37e 100644 --- a/packages/app_center_ratings_client/protos/ratings_features_chart.proto +++ b/packages/app_center_ratings_client/protos/ratings_features_chart.proto @@ -2,30 +2,24 @@ syntax = "proto3"; package ratings.features.chart; +import "ratings_features_common.proto"; + service Chart { rpc GetChart (GetChartRequest) returns (GetChartResponse) {} } message GetChartRequest { Timeframe timeframe = 1; - ChartType type = 2; -} - -enum ChartType { - CHART_TYPE_TOP_UNSPECIFIED = 0; - CHART_TYPE_TOP = 1; } message GetChartResponse { Timeframe timeframe = 1; - ChartType type = 2; - repeated ChartData ordered_chart_data = 3; + repeated ChartData ordered_chart_data = 2; } message ChartData { - string app = 1; - uint64 total_up_votes = 2; - uint64 total_down_votes = 3; + float raw_rating = 1; + ratings.features.common.Rating rating = 2; } enum Timeframe { diff --git a/packages/app_center_ratings_client/protos/ratings_features_common.proto b/packages/app_center_ratings_client/protos/ratings_features_common.proto new file mode 100644 index 000000000..84a53d5e2 --- /dev/null +++ b/packages/app_center_ratings_client/protos/ratings_features_common.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; + +package ratings.features.common; + +message Rating { + string snap_id = 1; + uint64 total_votes = 2; + RatingsBand ratings_band = 3; +} + +enum RatingsBand { + VERY_GOOD = 0; + GOOD = 1; + NEUTRAL = 2; + POOR = 3; + VERY_POOR = 4; + INSUFFICIENT_VOTES = 5; +} diff --git a/packages/app_center_ratings_client/test/ratings_client_test.dart b/packages/app_center_ratings_client/test/ratings_client_test.dart index 14e58e71f..7fef403cc 100644 --- a/packages/app_center_ratings_client/test/ratings_client_test.dart +++ b/packages/app_center_ratings_client/test/ratings_client_test.dart @@ -1,11 +1,16 @@ import 'dart:async'; -import 'package:app_center_ratings_client/ratings_client.dart'; -import 'package:app_center_ratings_client/src/app.dart' as app; +import 'package:app_center_ratings_client/ratings_client.dart' + hide Rating, RatingsBand; +import 'package:app_center_ratings_client/src/chart.dart' as chart; import 'package:app_center_ratings_client/src/generated/google/protobuf/empty.pb.dart'; import 'package:app_center_ratings_client/src/generated/google/protobuf/timestamp.pb.dart'; -import 'package:app_center_ratings_client/src/generated/ratings_features_app.pbgrpc.dart'; +import 'package:app_center_ratings_client/src/generated/ratings_features_app.pbgrpc.dart' + as pb; +import 'package:app_center_ratings_client/src/generated/ratings_features_chart.pbgrpc.dart'; +import 'package:app_center_ratings_client/src/generated/ratings_features_common.pb.dart'; import 'package:app_center_ratings_client/src/generated/ratings_features_user.pbgrpc.dart'; +import 'package:app_center_ratings_client/src/ratings.dart' as ratings; import 'package:app_center_ratings_client/src/user.dart' as user; import 'package:fixnum/fixnum.dart'; import 'package:grpc/grpc.dart'; @@ -15,14 +20,64 @@ import 'package:test/test.dart'; import 'ratings_client_test.mocks.dart'; -@GenerateMocks([AppClient, UserClient]) +@GenerateMocks([pb.AppClient, UserClient, ChartClient]) void main() { final mockAppClient = MockAppClient(); final mockUserClient = MockUserClient(); - final ratingsClient = RatingsClient.withClients( - mockAppClient, - mockUserClient, - ); + final mockChartClient = MockChartClient(); + final ratingsClient = + RatingsClient.withClients(mockAppClient, mockUserClient, mockChartClient); + + test('get chart', () async { + final snapId = 'foobar'; + final token = 'bar'; + final timeframe = chart.Timeframe.month; + final pbChartList = [ + ChartData( + rawRating: 3, + rating: Rating( + snapId: snapId, + totalVotes: Int64(105), + ratingsBand: RatingsBand.NEUTRAL, + )) + ]; + + final expectedResponse = [ + chart.ChartData( + rawRating: 3, + rating: ratings.Rating( + snapId: snapId, + totalVotes: 105, + ratingsBand: ratings.RatingsBand.neutral, + )) + ]; + final mockResponse = GetChartResponse( + timeframe: Timeframe.TIMEFRAME_MONTH, + orderedChartData: pbChartList, + ); + final request = GetChartRequest(timeframe: Timeframe.TIMEFRAME_MONTH); + when(mockChartClient.getChart( + request, + options: anyNamed('options'), + )).thenAnswer((_) => MockResponseFuture(mockResponse)); + final response = await ratingsClient.getChart(timeframe, token); + expect( + response, + equals(expectedResponse), + ); + final capturedArgs = verify(mockChartClient.getChart( + request, + options: captureAnyNamed('options'), + )).captured; + final capturedOptions = capturedArgs.single as CallOptions; + expect( + capturedOptions.metadata, + containsPair( + 'authorization', + 'Bearer $token', + ), + ); + }); test('get rating', () async { final snapId = 'foo'; @@ -32,17 +87,18 @@ void main() { totalVotes: Int64(105), ratingsBand: RatingsBand.NEUTRAL, ); - final expectedResponse = app.Rating( + final expectedResponse = ratings.Rating( snapId: snapId, totalVotes: 105, - ratingsBand: app.RatingsBand.neutral, + ratingsBand: ratings.RatingsBand.neutral, ); - final mockResponse = GetRatingResponse(rating: pbRating); - final request = GetRatingRequest(snapId: snapId); + final mockResponse = pb.GetRatingResponse(rating: pbRating); + final request = pb.GetRatingRequest(snapId: snapId); when(mockAppClient.getRating( request, options: anyNamed('options'), - )).thenAnswer((_) => MockResponseFuture(mockResponse)); + )).thenAnswer( + (_) => MockResponseFuture(mockResponse)); final response = await ratingsClient.getRating( snapId, token, diff --git a/packages/app_center_ratings_client/test/ratings_client_test.mocks.dart b/packages/app_center_ratings_client/test/ratings_client_test.mocks.dart index cde860f6a..334cd95e5 100644 --- a/packages/app_center_ratings_client/test/ratings_client_test.mocks.dart +++ b/packages/app_center_ratings_client/test/ratings_client_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.3 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in app_center_ratings_client/test/ratings_client_test.dart. // Do not manually edit this file. @@ -11,6 +11,10 @@ import 'package:app_center_ratings_client/src/generated/ratings_features_app.pb. as _i5; import 'package:app_center_ratings_client/src/generated/ratings_features_app.pbgrpc.dart' as _i4; +import 'package:app_center_ratings_client/src/generated/ratings_features_chart.pb.dart' + as _i11; +import 'package:app_center_ratings_client/src/generated/ratings_features_chart.pbgrpc.dart' + as _i10; import 'package:app_center_ratings_client/src/generated/ratings_features_user.pb.dart' as _i8; import 'package:app_center_ratings_client/src/generated/ratings_features_user.pbgrpc.dart' @@ -23,8 +27,6 @@ import 'package:mockito/mockito.dart' as _i1; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references -// ignore_for_file: deprecated_member_use -// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -376,3 +378,117 @@ class MockUserClient extends _i1.Mock implements _i7.UserClient { ), ) as _i2.ResponseStream); } + +/// A class which mocks [ChartClient]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockChartClient extends _i1.Mock implements _i10.ChartClient { + MockChartClient() { + _i1.throwOnMissingStub(this); + } + + @override + _i2.ResponseFuture<_i11.GetChartResponse> getChart( + _i11.GetChartRequest? request, { + _i2.CallOptions? options, + }) => + (super.noSuchMethod( + Invocation.method( + #getChart, + [request], + {#options: options}, + ), + returnValue: _FakeResponseFuture_0<_i11.GetChartResponse>( + this, + Invocation.method( + #getChart, + [request], + {#options: options}, + ), + ), + ) as _i2.ResponseFuture<_i11.GetChartResponse>); + + @override + _i3.ClientCall $createCall( + _i2.ClientMethod? method, + _i6.Stream? requests, { + _i2.CallOptions? options, + }) => + (super.noSuchMethod( + Invocation.method( + #$createCall, + [ + method, + requests, + ], + {#options: options}, + ), + returnValue: _FakeClientCall_1( + this, + Invocation.method( + #$createCall, + [ + method, + requests, + ], + {#options: options}, + ), + ), + ) as _i3.ClientCall); + + @override + _i2.ResponseFuture $createUnaryCall( + _i2.ClientMethod? method, + Q? request, { + _i2.CallOptions? options, + }) => + (super.noSuchMethod( + Invocation.method( + #$createUnaryCall, + [ + method, + request, + ], + {#options: options}, + ), + returnValue: _FakeResponseFuture_0( + this, + Invocation.method( + #$createUnaryCall, + [ + method, + request, + ], + {#options: options}, + ), + ), + ) as _i2.ResponseFuture); + + @override + _i2.ResponseStream $createStreamingCall( + _i2.ClientMethod? method, + _i6.Stream? requests, { + _i2.CallOptions? options, + }) => + (super.noSuchMethod( + Invocation.method( + #$createStreamingCall, + [ + method, + requests, + ], + {#options: options}, + ), + returnValue: _FakeResponseStream_2( + this, + Invocation.method( + #$createStreamingCall, + [ + method, + requests, + ], + {#options: options}, + ), + ), + ) as _i2.ResponseStream); +} From f928bdf690a8c8f34835d121af406e626ff91792 Mon Sep 17 00:00:00 2001 From: Lukas Klingsbo Date: Tue, 28 Nov 2023 14:54:27 +0100 Subject: [PATCH 5/6] fix: Fix analyze issues --- .../lib/src/ratings/ratings_l10n.dart | 3 +- .../app_center/test/test_utils.mocks.dart | 838 +++++++++--------- .../lib/ratings_client.dart | 2 +- .../ratings_features_app.pbenum.dart | 10 - .../ratings_features_user.pbenum.dart | 10 - .../test/ratings_client_test.mocks.dart | 4 +- 6 files changed, 433 insertions(+), 434 deletions(-) delete mode 100644 packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbenum.dart delete mode 100644 packages/app_center_ratings_client/lib/src/generated/ratings_features_user.pbenum.dart diff --git a/packages/app_center/lib/src/ratings/ratings_l10n.dart b/packages/app_center/lib/src/ratings/ratings_l10n.dart index 6e1baa067..2f200a0d1 100644 --- a/packages/app_center/lib/src/ratings/ratings_l10n.dart +++ b/packages/app_center/lib/src/ratings/ratings_l10n.dart @@ -1,8 +1,7 @@ import 'package:app_center_ratings_client/ratings_client.dart'; import 'package:flutter/material.dart'; -import '/l10n.dart'; -import 'exports.dart'; +import '../../l10n.dart'; extension RatingsBandL10n on RatingsBand { String localize(AppLocalizations l10n) { diff --git a/packages/app_center/test/test_utils.mocks.dart b/packages/app_center/test/test_utils.mocks.dart index 860212eab..7d0cdaaa2 100644 --- a/packages/app_center/test/test_utils.mocks.dart +++ b/packages/app_center/test/test_utils.mocks.dart @@ -3,25 +3,26 @@ // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i15; -import 'dart:ui' as _i16; +import 'dart:async' as _i14; +import 'dart:ui' as _i15; import 'package:app_center/appstream.dart' as _i7; import 'package:app_center/packagekit.dart' as _i8; import 'package:app_center/snapd.dart' as _i6; -import 'package:app_center/src/deb/deb_model.dart' as _i17; -import 'package:app_center/src/manage/manage_model.dart' as _i18; -import 'package:app_center/src/ratings/exports.dart' as _i12; -import 'package:app_center/src/ratings/ratings_model.dart' as _i13; +import 'package:app_center/src/deb/deb_model.dart' as _i16; +import 'package:app_center/src/manage/manage_model.dart' as _i17; +import 'package:app_center/src/ratings/exports.dart' as _i21; +import 'package:app_center/src/ratings/ratings_model.dart' as _i12; import 'package:app_center/src/ratings/ratings_service.dart' as _i4; import 'package:app_center_ratings_client/ratings_client.dart' as _i11; +import 'package:app_center_ratings_client/src/chart.dart' as _i22; import 'package:appstream/appstream.dart' as _i9; -import 'package:dbus/dbus.dart' as _i21; -import 'package:file/file.dart' as _i19; +import 'package:dbus/dbus.dart' as _i20; +import 'package:file/file.dart' as _i18; import 'package:flutter_riverpod/flutter_riverpod.dart' as _i5; -import 'package:gtk/src/gtk_application_notifier.dart' as _i20; +import 'package:gtk/src/gtk_application_notifier.dart' as _i19; import 'package:mockito/mockito.dart' as _i1; -import 'package:mockito/src/dummies.dart' as _i14; +import 'package:mockito/src/dummies.dart' as _i13; import 'package:packagekit/packagekit.dart' as _i10; import 'package:snapcraft_launcher/snapcraft_launcher.dart' as _i3; import 'package:snapd/snapd.dart' as _i2; @@ -199,7 +200,7 @@ class _FakeRatingsClient_14 extends _i1.SmartFake ); } -class _FakeRating_15 extends _i1.SmartFake implements _i12.Rating { +class _FakeRating_15 extends _i1.SmartFake implements _i11.Rating { _FakeRating_15( Object parent, Invocation parentInvocation, @@ -254,7 +255,7 @@ class MockSnapLauncher extends _i1.Mock implements _i6.SnapLauncher { /// A class which mocks [RatingsModel]. /// /// See the documentation for Mockito's code generation for more information. -class MockRatingsModel extends _i1.Mock implements _i13.RatingsModel { +class MockRatingsModel extends _i1.Mock implements _i12.RatingsModel { MockRatingsModel() { _i1.throwOnMissingStub(this); } @@ -271,7 +272,7 @@ class MockRatingsModel extends _i1.Mock implements _i13.RatingsModel { @override String get snapId => (super.noSuchMethod( Invocation.getter(#snapId), - returnValue: _i14.dummyValue( + returnValue: _i13.dummyValue( this, Invocation.getter(#snapId), ), @@ -280,14 +281,14 @@ class MockRatingsModel extends _i1.Mock implements _i13.RatingsModel { @override String get snapRevision => (super.noSuchMethod( Invocation.getter(#snapRevision), - returnValue: _i14.dummyValue( + returnValue: _i13.dummyValue( this, Invocation.getter(#snapRevision), ), ) as String); @override - set snapRating(_i12.Rating? _snapRating) => super.noSuchMethod( + set snapRating(_i11.Rating? _snapRating) => super.noSuchMethod( Invocation.setter( #snapRating, _snapRating, @@ -311,27 +312,27 @@ class MockRatingsModel extends _i1.Mock implements _i13.RatingsModel { ) as bool); @override - _i15.Future init() => (super.noSuchMethod( + _i14.Future init() => (super.noSuchMethod( Invocation.method( #init, [], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future castVote(_i13.VoteStatus? castVote) => (super.noSuchMethod( + _i14.Future castVote(_i12.VoteStatus? castVote) => (super.noSuchMethod( Invocation.method( #castVote, [castVote], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( + void addListener(_i15.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -340,7 +341,7 @@ class MockRatingsModel extends _i1.Mock implements _i13.RatingsModel { ); @override - void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( + void removeListener(_i15.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -387,7 +388,7 @@ class MockSnapModel extends _i1.Mock implements _i6.SnapModel { @override String get snapName => (super.noSuchMethod( Invocation.getter(#snapName), - returnValue: _i14.dummyValue( + returnValue: _i13.dummyValue( this, Invocation.getter(#snapName), ), @@ -451,10 +452,10 @@ class MockSnapModel extends _i1.Mock implements _i6.SnapModel { ); @override - _i15.Stream<_i2.SnapdException> get errorStream => (super.noSuchMethod( + _i14.Stream<_i2.SnapdException> get errorStream => (super.noSuchMethod( Invocation.getter(#errorStream), - returnValue: _i15.Stream<_i2.SnapdException>.empty(), - ) as _i15.Stream<_i2.SnapdException>); + returnValue: _i14.Stream<_i2.SnapdException>.empty(), + ) as _i14.Stream<_i2.SnapdException>); @override bool get hasListeners => (super.noSuchMethod( @@ -463,67 +464,67 @@ class MockSnapModel extends _i1.Mock implements _i6.SnapModel { ) as bool); @override - _i15.Future init() => (super.noSuchMethod( + _i14.Future init() => (super.noSuchMethod( Invocation.method( #init, [], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future dispose() => (super.noSuchMethod( + _i14.Future dispose() => (super.noSuchMethod( Invocation.method( #dispose, [], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future cancel() => (super.noSuchMethod( + _i14.Future cancel() => (super.noSuchMethod( Invocation.method( #cancel, [], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future install() => (super.noSuchMethod( + _i14.Future install() => (super.noSuchMethod( Invocation.method( #install, [], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future refresh() => (super.noSuchMethod( + _i14.Future refresh() => (super.noSuchMethod( Invocation.method( #refresh, [], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future remove() => (super.noSuchMethod( + _i14.Future remove() => (super.noSuchMethod( Invocation.method( #remove, [], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( + void addListener(_i15.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -532,7 +533,7 @@ class MockSnapModel extends _i1.Mock implements _i6.SnapModel { ); @override - void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( + void removeListener(_i15.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -553,7 +554,7 @@ class MockSnapModel extends _i1.Mock implements _i6.SnapModel { /// A class which mocks [DebModel]. /// /// See the documentation for Mockito's code generation for more information. -class MockDebModel extends _i1.Mock implements _i17.DebModel { +class MockDebModel extends _i1.Mock implements _i16.DebModel { MockDebModel() { _i1.throwOnMissingStub(this); } @@ -579,7 +580,7 @@ class MockDebModel extends _i1.Mock implements _i17.DebModel { @override String get id => (super.noSuchMethod( Invocation.getter(#id), - returnValue: _i14.dummyValue( + returnValue: _i13.dummyValue( this, Invocation.getter(#id), ), @@ -620,11 +621,11 @@ class MockDebModel extends _i1.Mock implements _i17.DebModel { ) as bool); @override - _i15.Stream<_i10.PackageKitErrorCodeEvent> get errorStream => + _i14.Stream<_i10.PackageKitErrorCodeEvent> get errorStream => (super.noSuchMethod( Invocation.getter(#errorStream), - returnValue: _i15.Stream<_i10.PackageKitErrorCodeEvent>.empty(), - ) as _i15.Stream<_i10.PackageKitErrorCodeEvent>); + returnValue: _i14.Stream<_i10.PackageKitErrorCodeEvent>.empty(), + ) as _i14.Stream<_i10.PackageKitErrorCodeEvent>); @override bool get hasListeners => (super.noSuchMethod( @@ -633,47 +634,47 @@ class MockDebModel extends _i1.Mock implements _i17.DebModel { ) as bool); @override - _i15.Future init() => (super.noSuchMethod( + _i14.Future init() => (super.noSuchMethod( Invocation.method( #init, [], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future install() => (super.noSuchMethod( + _i14.Future install() => (super.noSuchMethod( Invocation.method( #install, [], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future remove() => (super.noSuchMethod( + _i14.Future remove() => (super.noSuchMethod( Invocation.method( #remove, [], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future cancel() => (super.noSuchMethod( + _i14.Future cancel() => (super.noSuchMethod( Invocation.method( #cancel, [], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( + void addListener(_i15.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -682,7 +683,7 @@ class MockDebModel extends _i1.Mock implements _i17.DebModel { ); @override - void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( + void removeListener(_i15.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -712,7 +713,7 @@ class MockDebModel extends _i1.Mock implements _i17.DebModel { /// A class which mocks [ManageModel]. /// /// See the documentation for Mockito's code generation for more information. -class MockManageModel extends _i1.Mock implements _i18.ManageModel { +class MockManageModel extends _i1.Mock implements _i17.ManageModel { MockManageModel() { _i1.throwOnMissingStub(this); } @@ -763,14 +764,14 @@ class MockManageModel extends _i1.Mock implements _i18.ManageModel { ) as bool); @override - _i15.Future init() => (super.noSuchMethod( + _i14.Future init() => (super.noSuchMethod( Invocation.method( #init, [], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override void dispose() => super.noSuchMethod( @@ -782,7 +783,7 @@ class MockManageModel extends _i1.Mock implements _i18.ManageModel { ); @override - void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( + void addListener(_i15.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -791,7 +792,7 @@ class MockManageModel extends _i1.Mock implements _i18.ManageModel { ); @override - void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( + void removeListener(_i15.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -842,25 +843,25 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { ); @override - _i15.Future waitChange(String? changeId) => (super.noSuchMethod( + _i14.Future waitChange(String? changeId) => (super.noSuchMethod( Invocation.method( #waitChange, [changeId], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future loadAuthorization({String? path}) => (super.noSuchMethod( + _i14.Future loadAuthorization({String? path}) => (super.noSuchMethod( Invocation.method( #loadAuthorization, [], {#path: path}, ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override void setAuthorization( @@ -879,12 +880,12 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { ); @override - _i15.Future<_i2.SnapdSystemInfoResponse> systemInfo() => (super.noSuchMethod( + _i14.Future<_i2.SnapdSystemInfoResponse> systemInfo() => (super.noSuchMethod( Invocation.method( #systemInfo, [], ), - returnValue: _i15.Future<_i2.SnapdSystemInfoResponse>.value( + returnValue: _i14.Future<_i2.SnapdSystemInfoResponse>.value( _FakeSnapdSystemInfoResponse_9( this, Invocation.method( @@ -892,34 +893,34 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { [], ), )), - ) as _i15.Future<_i2.SnapdSystemInfoResponse>); + ) as _i14.Future<_i2.SnapdSystemInfoResponse>); @override - _i15.Future> getSnaps() => (super.noSuchMethod( + _i14.Future> getSnaps() => (super.noSuchMethod( Invocation.method( #getSnaps, [], ), - returnValue: _i15.Future>.value(<_i2.Snap>[]), - ) as _i15.Future>); + returnValue: _i14.Future>.value(<_i2.Snap>[]), + ) as _i14.Future>); @override - _i15.Future<_i2.Snap> getSnap(String? name) => (super.noSuchMethod( + _i14.Future<_i2.Snap> getSnap(String? name) => (super.noSuchMethod( Invocation.method( #getSnap, [name], ), - returnValue: _i15.Future<_i2.Snap>.value(_FakeSnap_0( + returnValue: _i14.Future<_i2.Snap>.value(_FakeSnap_0( this, Invocation.method( #getSnap, [name], ), )), - ) as _i15.Future<_i2.Snap>); + ) as _i14.Future<_i2.Snap>); @override - _i15.Future> getApps({ + _i14.Future> getApps({ List? names, _i2.SnapdAppFilter? filter, }) => @@ -932,22 +933,22 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { #filter: filter, }, ), - returnValue: _i15.Future>.value(<_i2.SnapApp>[]), - ) as _i15.Future>); + returnValue: _i14.Future>.value(<_i2.SnapApp>[]), + ) as _i14.Future>); @override - _i15.Future> getCategories() => + _i14.Future> getCategories() => (super.noSuchMethod( Invocation.method( #getCategories, [], ), - returnValue: _i15.Future>.value( + returnValue: _i14.Future>.value( <_i2.SnapdCategoryDetails>[]), - ) as _i15.Future>); + ) as _i14.Future>); @override - _i15.Future<_i2.SnapdConnectionsResponse> getConnections({ + _i14.Future<_i2.SnapdConnectionsResponse> getConnections({ String? snap, String? interface, _i2.SnapdConnectionFilter? filter, @@ -962,7 +963,7 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { #filter: filter, }, ), - returnValue: _i15.Future<_i2.SnapdConnectionsResponse>.value( + returnValue: _i14.Future<_i2.SnapdConnectionsResponse>.value( _FakeSnapdConnectionsResponse_10( this, Invocation.method( @@ -975,25 +976,25 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { }, ), )), - ) as _i15.Future<_i2.SnapdConnectionsResponse>); + ) as _i14.Future<_i2.SnapdConnectionsResponse>); @override - _i15.Future refreshMany(List? names) => (super.noSuchMethod( + _i14.Future refreshMany(List? names) => (super.noSuchMethod( Invocation.method( #refreshMany, [names], ), - returnValue: _i15.Future.value(_i14.dummyValue( + returnValue: _i14.Future.value(_i13.dummyValue( this, Invocation.method( #refreshMany, [names], ), )), - ) as _i15.Future); + ) as _i14.Future); @override - _i15.Future connect( + _i14.Future connect( String? snap, String? plug, String? slotSnap, @@ -1009,7 +1010,7 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { slot, ], ), - returnValue: _i15.Future.value(_i14.dummyValue( + returnValue: _i14.Future.value(_i13.dummyValue( this, Invocation.method( #connect, @@ -1021,10 +1022,10 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { ], ), )), - ) as _i15.Future); + ) as _i14.Future); @override - _i15.Future disconnect( + _i14.Future disconnect( String? plugSnap, String? plug, String? slotSnap, @@ -1040,7 +1041,7 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { slot, ], ), - returnValue: _i15.Future.value(_i14.dummyValue( + returnValue: _i14.Future.value(_i13.dummyValue( this, Invocation.method( #disconnect, @@ -1052,10 +1053,10 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { ], ), )), - ) as _i15.Future); + ) as _i14.Future); @override - _i15.Future> find({ + _i14.Future> find({ String? query, String? name, String? category, @@ -1074,11 +1075,11 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { #filter: filter, }, ), - returnValue: _i15.Future>.value(<_i2.Snap>[]), - ) as _i15.Future>); + returnValue: _i14.Future>.value(<_i2.Snap>[]), + ) as _i14.Future>); @override - _i15.Future<_i2.SnapdLoginResponse> login( + _i14.Future<_i2.SnapdLoginResponse> login( String? email, String? password, { String? otp, @@ -1092,7 +1093,7 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { ], {#otp: otp}, ), - returnValue: _i15.Future<_i2.SnapdLoginResponse>.value( + returnValue: _i14.Future<_i2.SnapdLoginResponse>.value( _FakeSnapdLoginResponse_11( this, Invocation.method( @@ -1104,19 +1105,19 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { {#otp: otp}, ), )), - ) as _i15.Future<_i2.SnapdLoginResponse>); + ) as _i14.Future<_i2.SnapdLoginResponse>); @override - _i15.Future logout(int? id) => (super.noSuchMethod( + _i14.Future logout(int? id) => (super.noSuchMethod( Invocation.method( #logout, [id], ), - returnValue: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future install( + _i14.Future install( String? name, { String? channel, String? revision, @@ -1138,7 +1139,7 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { #jailmode: jailmode, }, ), - returnValue: _i15.Future.value(_i14.dummyValue( + returnValue: _i14.Future.value(_i13.dummyValue( this, Invocation.method( #install, @@ -1153,10 +1154,10 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { }, ), )), - ) as _i15.Future); + ) as _i14.Future); @override - _i15.Future refresh( + _i14.Future refresh( String? name, { String? channel, bool? classic = false, @@ -1170,7 +1171,7 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { #classic: classic, }, ), - returnValue: _i15.Future.value(_i14.dummyValue( + returnValue: _i14.Future.value(_i13.dummyValue( this, Invocation.method( #refresh, @@ -1181,10 +1182,10 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { }, ), )), - ) as _i15.Future); + ) as _i14.Future); @override - _i15.Future remove( + _i14.Future remove( String? name, { bool? purge = false, }) => @@ -1194,7 +1195,7 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { [name], {#purge: purge}, ), - returnValue: _i15.Future.value(_i14.dummyValue( + returnValue: _i14.Future.value(_i13.dummyValue( this, Invocation.method( #remove, @@ -1202,55 +1203,55 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { {#purge: purge}, ), )), - ) as _i15.Future); + ) as _i14.Future); @override - _i15.Future enable(String? name) => (super.noSuchMethod( + _i14.Future enable(String? name) => (super.noSuchMethod( Invocation.method( #enable, [name], ), - returnValue: _i15.Future.value(_i14.dummyValue( + returnValue: _i14.Future.value(_i13.dummyValue( this, Invocation.method( #enable, [name], ), )), - ) as _i15.Future); + ) as _i14.Future); @override - _i15.Future disable(String? name) => (super.noSuchMethod( + _i14.Future disable(String? name) => (super.noSuchMethod( Invocation.method( #disable, [name], ), - returnValue: _i15.Future.value(_i14.dummyValue( + returnValue: _i14.Future.value(_i13.dummyValue( this, Invocation.method( #disable, [name], ), )), - ) as _i15.Future); + ) as _i14.Future); @override - _i15.Future<_i2.SnapdChange> getChange(String? id) => (super.noSuchMethod( + _i14.Future<_i2.SnapdChange> getChange(String? id) => (super.noSuchMethod( Invocation.method( #getChange, [id], ), - returnValue: _i15.Future<_i2.SnapdChange>.value(_FakeSnapdChange_12( + returnValue: _i14.Future<_i2.SnapdChange>.value(_FakeSnapdChange_12( this, Invocation.method( #getChange, [id], ), )), - ) as _i15.Future<_i2.SnapdChange>); + ) as _i14.Future<_i2.SnapdChange>); @override - _i15.Future> getChanges({ + _i14.Future> getChanges({ _i2.SnapdChangeFilter? filter, String? name, }) => @@ -1264,23 +1265,23 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { }, ), returnValue: - _i15.Future>.value(<_i2.SnapdChange>[]), - ) as _i15.Future>); + _i14.Future>.value(<_i2.SnapdChange>[]), + ) as _i14.Future>); @override - _i15.Future<_i2.SnapdChange> abortChange(String? id) => (super.noSuchMethod( + _i14.Future<_i2.SnapdChange> abortChange(String? id) => (super.noSuchMethod( Invocation.method( #abortChange, [id], ), - returnValue: _i15.Future<_i2.SnapdChange>.value(_FakeSnapdChange_12( + returnValue: _i14.Future<_i2.SnapdChange>.value(_FakeSnapdChange_12( this, Invocation.method( #abortChange, [id], ), )), - ) as _i15.Future<_i2.SnapdChange>); + ) as _i14.Future<_i2.SnapdChange>); @override void close() => super.noSuchMethod( @@ -1292,10 +1293,10 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { ); @override - _i15.Stream> getCategory( + _i14.Stream> getCategory( String? name, { Duration? expiry = const Duration(days: 1), - _i19.FileSystem? fs, + _i18.FileSystem? fs, }) => (super.noSuchMethod( Invocation.method( @@ -1306,14 +1307,14 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { #fs: fs, }, ), - returnValue: _i15.Stream>.empty(), - ) as _i15.Stream>); + returnValue: _i14.Stream>.empty(), + ) as _i14.Stream>); @override - _i15.Stream<_i2.Snap?> getStoreSnap( + _i14.Stream<_i2.Snap?> getStoreSnap( String? name, { Duration? expiry = const Duration(minutes: 1), - _i19.FileSystem? fs, + _i18.FileSystem? fs, }) => (super.noSuchMethod( Invocation.method( @@ -1324,14 +1325,14 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { #fs: fs, }, ), - returnValue: _i15.Stream<_i2.Snap?>.empty(), - ) as _i15.Stream<_i2.Snap?>); + returnValue: _i14.Stream<_i2.Snap?>.empty(), + ) as _i14.Stream<_i2.Snap?>); @override - _i15.Stream> getStoreSnaps( + _i14.Stream> getStoreSnaps( List? names, { Duration? expiry = const Duration(minutes: 1), - _i19.FileSystem? fs, + _i18.FileSystem? fs, }) => (super.noSuchMethod( Invocation.method( @@ -1342,11 +1343,11 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { #fs: fs, }, ), - returnValue: _i15.Stream>.empty(), - ) as _i15.Stream>); + returnValue: _i14.Stream>.empty(), + ) as _i14.Stream>); @override - _i15.Stream<_i2.SnapdChange> watchChange( + _i14.Stream<_i2.SnapdChange> watchChange( String? id, { Duration? interval = const Duration(milliseconds: 100), }) => @@ -1356,11 +1357,11 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { [id], {#interval: interval}, ), - returnValue: _i15.Stream<_i2.SnapdChange>.empty(), - ) as _i15.Stream<_i2.SnapdChange>); + returnValue: _i14.Stream<_i2.SnapdChange>.empty(), + ) as _i14.Stream<_i2.SnapdChange>); @override - _i15.Stream> watchChanges({ + _i14.Stream> watchChanges({ String? name, Duration? interval = const Duration(milliseconds: 100), }) => @@ -1373,8 +1374,8 @@ class MockSnapdService extends _i1.Mock implements _i6.SnapdService { #interval: interval, }, ), - returnValue: _i15.Stream>.empty(), - ) as _i15.Stream>); + returnValue: _i14.Stream>.empty(), + ) as _i14.Stream>); } /// A class which mocks [UpdatesModel]. @@ -1410,10 +1411,10 @@ class MockUpdatesModel extends _i1.Mock implements _i6.UpdatesModel { ) as _i5.AsyncValue); @override - _i15.Stream<_i2.SnapdException> get errorStream => (super.noSuchMethod( + _i14.Stream<_i2.SnapdException> get errorStream => (super.noSuchMethod( Invocation.getter(#errorStream), - returnValue: _i15.Stream<_i2.SnapdException>.empty(), - ) as _i15.Stream<_i2.SnapdException>); + returnValue: _i14.Stream<_i2.SnapdException>.empty(), + ) as _i14.Stream<_i2.SnapdException>); @override bool get hasListeners => (super.noSuchMethod( @@ -1422,14 +1423,14 @@ class MockUpdatesModel extends _i1.Mock implements _i6.UpdatesModel { ) as bool); @override - _i15.Future refresh() => (super.noSuchMethod( + _i14.Future refresh() => (super.noSuchMethod( Invocation.method( #refresh, [], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override bool hasUpdate(String? snapName) => (super.noSuchMethod( @@ -1441,17 +1442,17 @@ class MockUpdatesModel extends _i1.Mock implements _i6.UpdatesModel { ) as bool); @override - _i15.Future updateAll() => (super.noSuchMethod( + _i14.Future updateAll() => (super.noSuchMethod( Invocation.method( #updateAll, [], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( + void addListener(_i15.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -1460,7 +1461,7 @@ class MockUpdatesModel extends _i1.Mock implements _i6.UpdatesModel { ); @override - void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( + void removeListener(_i15.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -1491,13 +1492,13 @@ class MockUpdatesModel extends _i1.Mock implements _i6.UpdatesModel { /// /// See the documentation for Mockito's code generation for more information. class MockGtkApplicationNotifier extends _i1.Mock - implements _i20.GtkApplicationNotifier { + implements _i19.GtkApplicationNotifier { MockGtkApplicationNotifier() { _i1.throwOnMissingStub(this); } @override - void addCommandLineListener(_i20.GtkCommandLineListener? listener) => + void addCommandLineListener(_i19.GtkCommandLineListener? listener) => super.noSuchMethod( Invocation.method( #addCommandLineListener, @@ -1507,7 +1508,7 @@ class MockGtkApplicationNotifier extends _i1.Mock ); @override - void removeCommandLineListener(_i20.GtkCommandLineListener? listener) => + void removeCommandLineListener(_i19.GtkCommandLineListener? listener) => super.noSuchMethod( Invocation.method( #removeCommandLineListener, @@ -1517,7 +1518,7 @@ class MockGtkApplicationNotifier extends _i1.Mock ); @override - void addOpenListener(_i20.GtkOpenListener? listener) => super.noSuchMethod( + void addOpenListener(_i19.GtkOpenListener? listener) => super.noSuchMethod( Invocation.method( #addOpenListener, [listener], @@ -1526,7 +1527,7 @@ class MockGtkApplicationNotifier extends _i1.Mock ); @override - void removeOpenListener(_i20.GtkOpenListener? listener) => super.noSuchMethod( + void removeOpenListener(_i19.GtkOpenListener? listener) => super.noSuchMethod( Invocation.method( #removeOpenListener, [listener], @@ -1650,7 +1651,7 @@ class MockPackageKitClient extends _i1.Mock implements _i10.PackageKitClient { @override String get backendAuthor => (super.noSuchMethod( Invocation.getter(#backendAuthor), - returnValue: _i14.dummyValue( + returnValue: _i13.dummyValue( this, Invocation.getter(#backendAuthor), ), @@ -1659,7 +1660,7 @@ class MockPackageKitClient extends _i1.Mock implements _i10.PackageKitClient { @override String get backendDescription => (super.noSuchMethod( Invocation.getter(#backendDescription), - returnValue: _i14.dummyValue( + returnValue: _i13.dummyValue( this, Invocation.getter(#backendDescription), ), @@ -1668,7 +1669,7 @@ class MockPackageKitClient extends _i1.Mock implements _i10.PackageKitClient { @override String get backendName => (super.noSuchMethod( Invocation.getter(#backendName), - returnValue: _i14.dummyValue( + returnValue: _i13.dummyValue( this, Invocation.getter(#backendName), ), @@ -1677,7 +1678,7 @@ class MockPackageKitClient extends _i1.Mock implements _i10.PackageKitClient { @override String get distroId => (super.noSuchMethod( Invocation.getter(#distroId), - returnValue: _i14.dummyValue( + returnValue: _i13.dummyValue( this, Invocation.getter(#distroId), ), @@ -1738,30 +1739,30 @@ class MockPackageKitClient extends _i1.Mock implements _i10.PackageKitClient { ) as int); @override - _i15.Stream> get propertiesChanged => (super.noSuchMethod( + _i14.Stream> get propertiesChanged => (super.noSuchMethod( Invocation.getter(#propertiesChanged), - returnValue: _i15.Stream>.empty(), - ) as _i15.Stream>); + returnValue: _i14.Stream>.empty(), + ) as _i14.Stream>); @override - _i15.Future connect() => (super.noSuchMethod( + _i14.Future connect() => (super.noSuchMethod( Invocation.method( #connect, [], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future<_i10.PackageKitTransaction> getTransaction( - _i21.DBusObjectPath? path) => + _i14.Future<_i10.PackageKitTransaction> getTransaction( + _i20.DBusObjectPath? path) => (super.noSuchMethod( Invocation.method( #getTransaction, [path], ), - returnValue: _i15.Future<_i10.PackageKitTransaction>.value( + returnValue: _i14.Future<_i10.PackageKitTransaction>.value( _FakePackageKitTransaction_13( this, Invocation.method( @@ -1769,16 +1770,16 @@ class MockPackageKitClient extends _i1.Mock implements _i10.PackageKitClient { [path], ), )), - ) as _i15.Future<_i10.PackageKitTransaction>); + ) as _i14.Future<_i10.PackageKitTransaction>); @override - _i15.Future<_i10.PackageKitTransaction> createTransaction() => + _i14.Future<_i10.PackageKitTransaction> createTransaction() => (super.noSuchMethod( Invocation.method( #createTransaction, [], ), - returnValue: _i15.Future<_i10.PackageKitTransaction>.value( + returnValue: _i14.Future<_i10.PackageKitTransaction>.value( _FakePackageKitTransaction_13( this, Invocation.method( @@ -1786,17 +1787,17 @@ class MockPackageKitClient extends _i1.Mock implements _i10.PackageKitClient { [], ), )), - ) as _i15.Future<_i10.PackageKitTransaction>); + ) as _i14.Future<_i10.PackageKitTransaction>); @override - _i15.Future close() => (super.noSuchMethod( + _i14.Future close() => (super.noSuchMethod( Invocation.method( #close, [], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); } /// A class which mocks [PackageKitTransaction]. @@ -1809,13 +1810,13 @@ class MockPackageKitTransaction extends _i1.Mock } @override - _i15.Stream<_i10.PackageKitEvent> get events => (super.noSuchMethod( + _i14.Stream<_i10.PackageKitEvent> get events => (super.noSuchMethod( Invocation.getter(#events), - returnValue: _i15.Stream<_i10.PackageKitEvent>.empty(), - ) as _i15.Stream<_i10.PackageKitEvent>); + returnValue: _i14.Stream<_i10.PackageKitEvent>.empty(), + ) as _i14.Stream<_i10.PackageKitEvent>); @override - set events(_i15.Stream<_i10.PackageKitEvent>? _events) => super.noSuchMethod( + set events(_i14.Stream<_i10.PackageKitEvent>? _events) => super.noSuchMethod( Invocation.setter( #events, _events, @@ -1838,7 +1839,7 @@ class MockPackageKitTransaction extends _i1.Mock @override String get lastPackage => (super.noSuchMethod( Invocation.getter(#lastPackage), - returnValue: _i14.dummyValue( + returnValue: _i13.dummyValue( this, Invocation.getter(#lastPackage), ), @@ -1900,23 +1901,23 @@ class MockPackageKitTransaction extends _i1.Mock ) as Set<_i10.PackageKitTransactionFlag>); @override - _i15.Stream> get propertiesChanged => (super.noSuchMethod( + _i14.Stream> get propertiesChanged => (super.noSuchMethod( Invocation.getter(#propertiesChanged), - returnValue: _i15.Stream>.empty(), - ) as _i15.Stream>); + returnValue: _i14.Stream>.empty(), + ) as _i14.Stream>); @override - _i15.Future cancel() => (super.noSuchMethod( + _i14.Future cancel() => (super.noSuchMethod( Invocation.method( #cancel, [], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future dependsOn( + _i14.Future dependsOn( Iterable<_i10.PackageKitPackageId>? packageIds, { Set<_i10.PackageKitFilter>? filter = const {}, bool? recursive = false, @@ -1930,35 +1931,35 @@ class MockPackageKitTransaction extends _i1.Mock #recursive: recursive, }, ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future getDetails( + _i14.Future getDetails( Iterable<_i10.PackageKitPackageId>? packageIds) => (super.noSuchMethod( Invocation.method( #getDetails, [packageIds], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future getDetailsLocal(Iterable? paths) => + _i14.Future getDetailsLocal(Iterable? paths) => (super.noSuchMethod( Invocation.method( #getDetailsLocal, [paths], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future downloadPackages( + _i14.Future downloadPackages( Iterable<_i10.PackageKitPackageId>? packageIds, { bool? storeInCache = false, }) => @@ -1968,34 +1969,34 @@ class MockPackageKitTransaction extends _i1.Mock [packageIds], {#storeInCache: storeInCache}, ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future getFiles(Iterable<_i10.PackageKitPackageId>? packageIds) => + _i14.Future getFiles(Iterable<_i10.PackageKitPackageId>? packageIds) => (super.noSuchMethod( Invocation.method( #getFiles, [packageIds], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future getFilesLocal(Iterable? paths) => + _i14.Future getFilesLocal(Iterable? paths) => (super.noSuchMethod( Invocation.method( #getFilesLocal, [paths], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future getPackages( + _i14.Future getPackages( {Set<_i10.PackageKitFilter>? filter = const {}}) => (super.noSuchMethod( Invocation.method( @@ -2003,12 +2004,12 @@ class MockPackageKitTransaction extends _i1.Mock [], {#filter: filter}, ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future getRepositoryList( + _i14.Future getRepositoryList( {Set<_i10.PackageKitFilter>? filter = const {}}) => (super.noSuchMethod( Invocation.method( @@ -2016,12 +2017,12 @@ class MockPackageKitTransaction extends _i1.Mock [], {#filter: filter}, ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future setRepositoryEnabled( + _i14.Future setRepositoryEnabled( String? id, bool? enabled, ) => @@ -2033,12 +2034,12 @@ class MockPackageKitTransaction extends _i1.Mock enabled, ], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future setRepositoryData( + _i14.Future setRepositoryData( String? id, String? parameter, String? value, @@ -2052,12 +2053,12 @@ class MockPackageKitTransaction extends _i1.Mock value, ], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future removeRepository( + _i14.Future removeRepository( String? id, { bool? autoremovePackages = false, }) => @@ -2067,24 +2068,24 @@ class MockPackageKitTransaction extends _i1.Mock [id], {#autoremovePackages: autoremovePackages}, ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future getUpdateDetail( + _i14.Future getUpdateDetail( Iterable<_i10.PackageKitPackageId>? packageIds) => (super.noSuchMethod( Invocation.method( #getUpdateDetail, [packageIds], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future getUpdates( + _i14.Future getUpdates( {Set<_i10.PackageKitFilter>? filter = const {}}) => (super.noSuchMethod( Invocation.method( @@ -2092,12 +2093,12 @@ class MockPackageKitTransaction extends _i1.Mock [], {#filter: filter}, ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future installFiles( + _i14.Future installFiles( Iterable? paths, { Set<_i10.PackageKitTransactionFlag>? transactionFlags = const {}, }) => @@ -2107,12 +2108,12 @@ class MockPackageKitTransaction extends _i1.Mock [paths], {#transactionFlags: transactionFlags}, ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future installPackages( + _i14.Future installPackages( Iterable<_i10.PackageKitPackageId>? packageIds, { Set<_i10.PackageKitTransactionFlag>? transactionFlags = const {}, }) => @@ -2122,23 +2123,23 @@ class MockPackageKitTransaction extends _i1.Mock [packageIds], {#transactionFlags: transactionFlags}, ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future refreshCache({bool? force = false}) => (super.noSuchMethod( + _i14.Future refreshCache({bool? force = false}) => (super.noSuchMethod( Invocation.method( #refreshCache, [], {#force: force}, ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future removePackages( + _i14.Future removePackages( Iterable<_i10.PackageKitPackageId>? packageIds, { Set<_i10.PackageKitTransactionFlag>? transactionFlags = const {}, bool? allowDeps = false, @@ -2154,12 +2155,12 @@ class MockPackageKitTransaction extends _i1.Mock #autoremove: autoremove, }, ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future resolve( + _i14.Future resolve( Iterable? packages, { Set<_i10.PackageKitTransactionFlag>? transactionFlags = const {}, }) => @@ -2169,12 +2170,12 @@ class MockPackageKitTransaction extends _i1.Mock [packages], {#transactionFlags: transactionFlags}, ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future searchFiles( + _i14.Future searchFiles( Iterable? values, { Set<_i10.PackageKitFilter>? filter = const {}, }) => @@ -2184,12 +2185,12 @@ class MockPackageKitTransaction extends _i1.Mock [values], {#filter: filter}, ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future searchNames( + _i14.Future searchNames( Iterable? values, { Set<_i10.PackageKitFilter>? filter = const {}, }) => @@ -2199,12 +2200,12 @@ class MockPackageKitTransaction extends _i1.Mock [values], {#filter: filter}, ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future updatePackages( + _i14.Future updatePackages( Iterable<_i10.PackageKitPackageId>? packageIds, { Set<_i10.PackageKitTransactionFlag>? transactionFlags = const {}, }) => @@ -2214,12 +2215,12 @@ class MockPackageKitTransaction extends _i1.Mock [packageIds], {#transactionFlags: transactionFlags}, ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future upgradeSystem( + _i14.Future upgradeSystem( String? distroId, _i10.PackageKitDistroUpgrade? upgradeKind, { Set<_i10.PackageKitTransactionFlag>? transactionFlags = const {}, @@ -2233,9 +2234,9 @@ class MockPackageKitTransaction extends _i1.Mock ], {#transactionFlags: transactionFlags}, ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); } /// A class which mocks [RatingsService]. @@ -2256,53 +2257,53 @@ class MockRatingsService extends _i1.Mock implements _i4.RatingsService { ) as _i11.RatingsClient); @override - _i15.Future<_i12.Rating?> getRating(String? snapId) => (super.noSuchMethod( + _i14.Future<_i11.Rating?> getRating(String? snapId) => (super.noSuchMethod( Invocation.method( #getRating, [snapId], ), - returnValue: _i15.Future<_i12.Rating?>.value(), - ) as _i15.Future<_i12.Rating?>); + returnValue: _i14.Future<_i11.Rating?>.value(), + ) as _i14.Future<_i11.Rating?>); @override - _i15.Future vote(_i12.Vote? vote) => (super.noSuchMethod( + _i14.Future vote(_i21.Vote? vote) => (super.noSuchMethod( Invocation.method( #vote, [vote], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future delete() => (super.noSuchMethod( + _i14.Future delete() => (super.noSuchMethod( Invocation.method( #delete, [], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future> listMyVotes(String? snapFilter) => + _i14.Future> listMyVotes(String? snapFilter) => (super.noSuchMethod( Invocation.method( #listMyVotes, [snapFilter], ), - returnValue: _i15.Future>.value(<_i12.Vote>[]), - ) as _i15.Future>); + returnValue: _i14.Future>.value(<_i21.Vote>[]), + ) as _i14.Future>); @override - _i15.Future> getSnapVotes(String? snapId) => + _i14.Future> getSnapVotes(String? snapId) => (super.noSuchMethod( Invocation.method( #getSnapVotes, [snapId], ), - returnValue: _i15.Future>.value(<_i12.Vote>[]), - ) as _i15.Future>); + returnValue: _i14.Future>.value(<_i21.Vote>[]), + ) as _i14.Future>); } /// A class which mocks [RatingsClient]. @@ -2314,7 +2315,49 @@ class MockRatingsClient extends _i1.Mock implements _i11.RatingsClient { } @override - _i15.Future<_i12.Rating> getRating( + _i14.Future authenticate(String? id) => (super.noSuchMethod( + Invocation.method( + #authenticate, + [id], + ), + returnValue: _i14.Future.value(_i13.dummyValue( + this, + Invocation.method( + #authenticate, + [id], + ), + )), + ) as _i14.Future); + + @override + _i14.Future delete(String? token) => (super.noSuchMethod( + Invocation.method( + #delete, + [token], + ), + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); + + @override + _i14.Future> getChart( + _i22.Timeframe? timeframe, + String? token, + ) => + (super.noSuchMethod( + Invocation.method( + #getChart, + [ + timeframe, + token, + ], + ), + returnValue: + _i14.Future>.value(<_i22.ChartData>[]), + ) as _i14.Future>); + + @override + _i14.Future<_i11.Rating> getRating( String? snapId, String? token, ) => @@ -2326,7 +2369,7 @@ class MockRatingsClient extends _i1.Mock implements _i11.RatingsClient { token, ], ), - returnValue: _i15.Future<_i12.Rating>.value(_FakeRating_15( + returnValue: _i14.Future<_i11.Rating>.value(_FakeRating_15( this, Invocation.method( #getRating, @@ -2336,25 +2379,26 @@ class MockRatingsClient extends _i1.Mock implements _i11.RatingsClient { ], ), )), - ) as _i15.Future<_i12.Rating>); + ) as _i14.Future<_i11.Rating>); @override - _i15.Future authenticate(String? id) => (super.noSuchMethod( + _i14.Future> getSnapVotes( + String? snap_id, + String? token, + ) => + (super.noSuchMethod( Invocation.method( - #authenticate, - [id], + #getSnapVotes, + [ + snap_id, + token, + ], ), - returnValue: _i15.Future.value(_i14.dummyValue( - this, - Invocation.method( - #authenticate, - [id], - ), - )), - ) as _i15.Future); + returnValue: _i14.Future>.value(<_i21.Vote>[]), + ) as _i14.Future>); @override - _i15.Future> listMyVotes( + _i14.Future> listMyVotes( String? snapIdFilter, String? token, ) => @@ -2366,11 +2410,11 @@ class MockRatingsClient extends _i1.Mock implements _i11.RatingsClient { token, ], ), - returnValue: _i15.Future>.value(<_i12.Vote>[]), - ) as _i15.Future>); + returnValue: _i14.Future>.value(<_i21.Vote>[]), + ) as _i14.Future>); @override - _i15.Future vote( + _i14.Future vote( String? snapId, int? snapRevision, bool? voteUp, @@ -2386,35 +2430,9 @@ class MockRatingsClient extends _i1.Mock implements _i11.RatingsClient { token, ], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); - - @override - _i15.Future delete(String? token) => (super.noSuchMethod( - Invocation.method( - #delete, - [token], - ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); - - @override - _i15.Future> getSnapVotes( - String? snap_id, - String? token, - ) => - (super.noSuchMethod( - Invocation.method( - #getSnapVotes, - [ - snap_id, - token, - ], - ), - returnValue: _i15.Future>.value(<_i12.Vote>[]), - ) as _i15.Future>); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); } /// A class which mocks [AppstreamService]. @@ -2438,25 +2456,25 @@ class MockAppstreamService extends _i1.Mock implements _i7.AppstreamService { ) as int); @override - _i15.Future init() => (super.noSuchMethod( + _i14.Future init() => (super.noSuchMethod( Invocation.method( #init, [], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future> search(String? search) => + _i14.Future> search(String? search) => (super.noSuchMethod( Invocation.method( #search, [search], ), - returnValue: _i15.Future>.value( + returnValue: _i14.Future>.value( <_i9.AppstreamComponent>[]), - ) as _i15.Future>); + ) as _i14.Future>); @override _i9.AppstreamComponent getFromId(String? id) => (super.noSuchMethod( @@ -2489,11 +2507,11 @@ class MockPackageKitService extends _i1.Mock implements _i8.PackageKitService { ) as bool); @override - _i15.Stream<_i10.PackageKitErrorCodeEvent> get errorStream => + _i14.Stream<_i10.PackageKitErrorCodeEvent> get errorStream => (super.noSuchMethod( Invocation.getter(#errorStream), - returnValue: _i15.Stream<_i10.PackageKitErrorCodeEvent>.empty(), - ) as _i15.Stream<_i10.PackageKitErrorCodeEvent>); + returnValue: _i14.Stream<_i10.PackageKitErrorCodeEvent>.empty(), + ) as _i14.Stream<_i10.PackageKitErrorCodeEvent>); @override _i10.PackageKitTransaction? getTransaction(int? id) => @@ -2503,57 +2521,57 @@ class MockPackageKitService extends _i1.Mock implements _i8.PackageKitService { )) as _i10.PackageKitTransaction?); @override - _i15.Future activateService() => (super.noSuchMethod( + _i14.Future activateService() => (super.noSuchMethod( Invocation.method( #activateService, [], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future waitTransaction(int? id) => (super.noSuchMethod( + _i14.Future waitTransaction(int? id) => (super.noSuchMethod( Invocation.method( #waitTransaction, [id], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future cancelTransaction(int? id) => (super.noSuchMethod( + _i14.Future cancelTransaction(int? id) => (super.noSuchMethod( Invocation.method( #cancelTransaction, [id], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); @override - _i15.Future install(_i10.PackageKitPackageId? packageId) => + _i14.Future install(_i10.PackageKitPackageId? packageId) => (super.noSuchMethod( Invocation.method( #install, [packageId], ), - returnValue: _i15.Future.value(0), - ) as _i15.Future); + returnValue: _i14.Future.value(0), + ) as _i14.Future); @override - _i15.Future remove(_i10.PackageKitPackageId? packageId) => + _i14.Future remove(_i10.PackageKitPackageId? packageId) => (super.noSuchMethod( Invocation.method( #remove, [packageId], ), - returnValue: _i15.Future.value(0), - ) as _i15.Future); + returnValue: _i14.Future.value(0), + ) as _i14.Future); @override - _i15.Future<_i10.PackageKitPackageEvent?> resolve( + _i14.Future<_i10.PackageKitPackageEvent?> resolve( String? name, [ String? architecture, ]) => @@ -2565,16 +2583,16 @@ class MockPackageKitService extends _i1.Mock implements _i8.PackageKitService { architecture, ], ), - returnValue: _i15.Future<_i10.PackageKitPackageEvent?>.value(), - ) as _i15.Future<_i10.PackageKitPackageEvent?>); + returnValue: _i14.Future<_i10.PackageKitPackageEvent?>.value(), + ) as _i14.Future<_i10.PackageKitPackageEvent?>); @override - _i15.Future dispose() => (super.noSuchMethod( + _i14.Future dispose() => (super.noSuchMethod( Invocation.method( #dispose, [], ), - returnValue: _i15.Future.value(), - returnValueForMissingStub: _i15.Future.value(), - ) as _i15.Future); + returnValue: _i14.Future.value(), + returnValueForMissingStub: _i14.Future.value(), + ) as _i14.Future); } diff --git a/packages/app_center_ratings_client/lib/ratings_client.dart b/packages/app_center_ratings_client/lib/ratings_client.dart index b2ee8f5bc..5431c1e6c 100644 --- a/packages/app_center_ratings_client/lib/ratings_client.dart +++ b/packages/app_center_ratings_client/lib/ratings_client.dart @@ -11,7 +11,7 @@ import 'src/generated/ratings_features_user.pbgrpc.dart' as userPb; import 'src/ratings.dart'; import 'src/user.dart'; -export 'src/ratings.dart' hide RatingsBandL10n; +export 'src/ratings.dart'; class RatingsClient { late appPb.AppClient _appClient; diff --git a/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbenum.dart b/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbenum.dart deleted file mode 100644 index bd808605b..000000000 --- a/packages/app_center_ratings_client/lib/src/generated/ratings_features_app.pbenum.dart +++ /dev/null @@ -1,10 +0,0 @@ -// -// Generated code. Do not modify. -// source: ratings_features_app.proto -// -// @dart = 2.12 - -// ignore_for_file: annotate_overrides, camel_case_types, comment_references -// ignore_for_file: constant_identifier_names, library_prefixes -// ignore_for_file: non_constant_identifier_names, prefer_final_fields -// ignore_for_file: unnecessary_import, unnecessary_this, unused_import diff --git a/packages/app_center_ratings_client/lib/src/generated/ratings_features_user.pbenum.dart b/packages/app_center_ratings_client/lib/src/generated/ratings_features_user.pbenum.dart deleted file mode 100644 index a7ac33807..000000000 --- a/packages/app_center_ratings_client/lib/src/generated/ratings_features_user.pbenum.dart +++ /dev/null @@ -1,10 +0,0 @@ -// -// Generated code. Do not modify. -// source: ratings_features_user.proto -// -// @dart = 2.12 - -// ignore_for_file: annotate_overrides, camel_case_types, comment_references -// ignore_for_file: constant_identifier_names, library_prefixes -// ignore_for_file: non_constant_identifier_names, prefer_final_fields -// ignore_for_file: unnecessary_import, unnecessary_this, unused_import diff --git a/packages/app_center_ratings_client/test/ratings_client_test.mocks.dart b/packages/app_center_ratings_client/test/ratings_client_test.mocks.dart index 334cd95e5..024a105c2 100644 --- a/packages/app_center_ratings_client/test/ratings_client_test.mocks.dart +++ b/packages/app_center_ratings_client/test/ratings_client_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.3 from annotations // in app_center_ratings_client/test/ratings_client_test.dart. // Do not manually edit this file. @@ -27,6 +27,8 @@ import 'package:mockito/mockito.dart' as _i1; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors From 315ce21367dd81645cd47d63f2f3c6c728e44059 Mon Sep 17 00:00:00 2001 From: Lukas Klingsbo Date: Tue, 28 Nov 2023 15:26:42 +0100 Subject: [PATCH 6/6] fix: Use barrel file --- packages/app_center/lib/main.dart | 2 +- .../app_center/lib/src/ratings/ratings_l10n.dart | 2 +- .../lib/src/ratings/ratings_model.dart | 2 +- .../lib/src/ratings/ratings_service.dart | 2 +- packages/app_center/test/app_card_test.dart | 2 +- packages/app_center/test/ratings_model_test.dart | 2 +- .../app_center/test/ratings_service_test.dart | 2 +- packages/app_center/test/search_page_test.dart | 2 +- packages/app_center/test/snap_page_test.dart | 2 +- packages/app_center/test/test_utils.dart | 2 +- packages/app_center/test/test_utils.mocks.dart | 3 ++- .../lib/app_center_ratings_client.dart | 2 ++ .../lib/{ => src}/ratings_client.dart | 16 +++++++--------- .../test/ratings_client_test.dart | 2 +- 14 files changed, 22 insertions(+), 21 deletions(-) create mode 100644 packages/app_center_ratings_client/lib/app_center_ratings_client.dart rename packages/app_center_ratings_client/lib/{ => src}/ratings_client.dart (89%) diff --git a/packages/app_center/lib/main.dart b/packages/app_center/lib/main.dart index 61d46a3b8..46f0eddab 100644 --- a/packages/app_center/lib/main.dart +++ b/packages/app_center/lib/main.dart @@ -1,7 +1,7 @@ import 'dart:async'; import 'dart:io'; -import 'package:app_center_ratings_client/ratings_client.dart'; +import 'package:app_center_ratings_client/app_center_ratings_client.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:github/github.dart'; diff --git a/packages/app_center/lib/src/ratings/ratings_l10n.dart b/packages/app_center/lib/src/ratings/ratings_l10n.dart index 2f200a0d1..62be0fb9c 100644 --- a/packages/app_center/lib/src/ratings/ratings_l10n.dart +++ b/packages/app_center/lib/src/ratings/ratings_l10n.dart @@ -1,4 +1,4 @@ -import 'package:app_center_ratings_client/ratings_client.dart'; +import 'package:app_center_ratings_client/app_center_ratings_client.dart'; import 'package:flutter/material.dart'; import '../../l10n.dart'; diff --git a/packages/app_center/lib/src/ratings/ratings_model.dart b/packages/app_center/lib/src/ratings/ratings_model.dart index c9c898aa0..daf993210 100644 --- a/packages/app_center/lib/src/ratings/ratings_model.dart +++ b/packages/app_center/lib/src/ratings/ratings_model.dart @@ -1,4 +1,4 @@ -import 'package:app_center_ratings_client/ratings_client.dart'; +import 'package:app_center_ratings_client/app_center_ratings_client.dart'; import 'package:clock/clock.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/packages/app_center/lib/src/ratings/ratings_service.dart b/packages/app_center/lib/src/ratings/ratings_service.dart index c8ee71ef9..a770945c0 100644 --- a/packages/app_center/lib/src/ratings/ratings_service.dart +++ b/packages/app_center/lib/src/ratings/ratings_service.dart @@ -1,7 +1,7 @@ import 'dart:convert'; import 'dart:io'; -import 'package:app_center_ratings_client/ratings_client.dart'; +import 'package:app_center_ratings_client/app_center_ratings_client.dart'; import 'package:crypto/crypto.dart'; import 'package:flutter/material.dart'; import 'package:glib/glib.dart'; diff --git a/packages/app_center/test/app_card_test.dart b/packages/app_center/test/app_card_test.dart index e5f04e82a..446bf10ff 100644 --- a/packages/app_center/test/app_card_test.dart +++ b/packages/app_center/test/app_card_test.dart @@ -1,6 +1,6 @@ import 'package:app_center/ratings.dart'; import 'package:app_center/widgets.dart'; -import 'package:app_center_ratings_client/ratings_client.dart'; +import 'package:app_center_ratings_client/app_center_ratings_client.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:snapd/snapd.dart'; diff --git a/packages/app_center/test/ratings_model_test.dart b/packages/app_center/test/ratings_model_test.dart index 0a6672ee5..a80c820e3 100644 --- a/packages/app_center/test/ratings_model_test.dart +++ b/packages/app_center/test/ratings_model_test.dart @@ -1,5 +1,5 @@ import 'package:app_center/ratings.dart'; -import 'package:app_center_ratings_client/ratings_client.dart'; +import 'package:app_center_ratings_client/app_center_ratings_client.dart'; import 'package:clock/clock.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; diff --git a/packages/app_center/test/ratings_service_test.dart b/packages/app_center/test/ratings_service_test.dart index 81a655945..8929754db 100644 --- a/packages/app_center/test/ratings_service_test.dart +++ b/packages/app_center/test/ratings_service_test.dart @@ -1,6 +1,6 @@ import 'package:app_center/src/ratings/exports.dart'; import 'package:app_center/src/ratings/ratings_service.dart'; -import 'package:app_center_ratings_client/ratings_client.dart'; +import 'package:app_center_ratings_client/app_center_ratings_client.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; diff --git a/packages/app_center/test/search_page_test.dart b/packages/app_center/test/search_page_test.dart index 655a1acb1..948155cde 100644 --- a/packages/app_center/test/search_page_test.dart +++ b/packages/app_center/test/search_page_test.dart @@ -2,7 +2,7 @@ import 'package:app_center/ratings.dart'; import 'package:app_center/search.dart'; import 'package:app_center/snapd.dart'; import 'package:app_center/widgets.dart'; -import 'package:app_center_ratings_client/ratings_client.dart'; +import 'package:app_center_ratings_client/app_center_ratings_client.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:snapd/snapd.dart'; diff --git a/packages/app_center/test/snap_page_test.dart b/packages/app_center/test/snap_page_test.dart index 2e3e0f825..276f8e091 100644 --- a/packages/app_center/test/snap_page_test.dart +++ b/packages/app_center/test/snap_page_test.dart @@ -2,7 +2,7 @@ import 'package:app_center/l10n.dart'; import 'package:app_center/ratings.dart'; import 'package:app_center/snapd.dart'; import 'package:app_center/widgets.dart'; -import 'package:app_center_ratings_client/ratings_client.dart'; +import 'package:app_center_ratings_client/app_center_ratings_client.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/packages/app_center/test/test_utils.dart b/packages/app_center/test/test_utils.dart index 78584c80c..18ba948cb 100644 --- a/packages/app_center/test/test_utils.dart +++ b/packages/app_center/test/test_utils.dart @@ -8,7 +8,7 @@ import 'package:app_center/ratings.dart'; import 'package:app_center/snapd.dart'; import 'package:app_center/src/deb/deb_model.dart'; import 'package:app_center/src/manage/manage_model.dart'; -import 'package:app_center_ratings_client/ratings_client.dart'; +import 'package:app_center_ratings_client/app_center_ratings_client.dart'; import 'package:appstream/appstream.dart'; import 'package:collection/collection.dart'; import 'package:flutter/material.dart'; diff --git a/packages/app_center/test/test_utils.mocks.dart b/packages/app_center/test/test_utils.mocks.dart index 7d0cdaaa2..f6e4024ad 100644 --- a/packages/app_center/test/test_utils.mocks.dart +++ b/packages/app_center/test/test_utils.mocks.dart @@ -14,7 +14,8 @@ import 'package:app_center/src/manage/manage_model.dart' as _i17; import 'package:app_center/src/ratings/exports.dart' as _i21; import 'package:app_center/src/ratings/ratings_model.dart' as _i12; import 'package:app_center/src/ratings/ratings_service.dart' as _i4; -import 'package:app_center_ratings_client/ratings_client.dart' as _i11; +import 'package:app_center_ratings_client/app_center_ratings_client.dart' + as _i11; import 'package:app_center_ratings_client/src/chart.dart' as _i22; import 'package:appstream/appstream.dart' as _i9; import 'package:dbus/dbus.dart' as _i20; diff --git a/packages/app_center_ratings_client/lib/app_center_ratings_client.dart b/packages/app_center_ratings_client/lib/app_center_ratings_client.dart new file mode 100644 index 000000000..61db672ed --- /dev/null +++ b/packages/app_center_ratings_client/lib/app_center_ratings_client.dart @@ -0,0 +1,2 @@ +export 'src/ratings.dart'; +export 'src/ratings_client.dart'; diff --git a/packages/app_center_ratings_client/lib/ratings_client.dart b/packages/app_center_ratings_client/lib/src/ratings_client.dart similarity index 89% rename from packages/app_center_ratings_client/lib/ratings_client.dart rename to packages/app_center_ratings_client/lib/src/ratings_client.dart index 5431c1e6c..c4d235d47 100644 --- a/packages/app_center_ratings_client/lib/ratings_client.dart +++ b/packages/app_center_ratings_client/lib/src/ratings_client.dart @@ -3,15 +3,13 @@ import 'dart:async'; import 'package:grpc/grpc.dart'; import 'package:meta/meta.dart'; -import 'src/chart.dart'; -import 'src/generated/google/protobuf/empty.pb.dart'; -import 'src/generated/ratings_features_app.pbgrpc.dart' as appPb; -import 'src/generated/ratings_features_chart.pbgrpc.dart' as chartPb; -import 'src/generated/ratings_features_user.pbgrpc.dart' as userPb; -import 'src/ratings.dart'; -import 'src/user.dart'; - -export 'src/ratings.dart'; +import 'chart.dart'; +import 'generated/google/protobuf/empty.pb.dart'; +import 'generated/ratings_features_app.pbgrpc.dart' as appPb; +import 'generated/ratings_features_chart.pbgrpc.dart' as chartPb; +import 'generated/ratings_features_user.pbgrpc.dart' as userPb; +import 'ratings.dart'; +import 'user.dart'; class RatingsClient { late appPb.AppClient _appClient; diff --git a/packages/app_center_ratings_client/test/ratings_client_test.dart b/packages/app_center_ratings_client/test/ratings_client_test.dart index 7fef403cc..3232c2da6 100644 --- a/packages/app_center_ratings_client/test/ratings_client_test.dart +++ b/packages/app_center_ratings_client/test/ratings_client_test.dart @@ -1,6 +1,6 @@ import 'dart:async'; -import 'package:app_center_ratings_client/ratings_client.dart' +import 'package:app_center_ratings_client/app_center_ratings_client.dart' hide Rating, RatingsBand; import 'package:app_center_ratings_client/src/chart.dart' as chart; import 'package:app_center_ratings_client/src/generated/google/protobuf/empty.pb.dart';