From e4cd8b1b5e5f051287c0f44baa30804525b767b5 Mon Sep 17 00:00:00 2001 From: Pierre Tessier Date: Mon, 15 Aug 2022 11:29:12 -0400 Subject: [PATCH] use full demo protos (#271) --- src/featureflagservice/README.md | 6 +- src/featureflagservice/config/runtime.exs | 4 +- src/featureflagservice/proto/demo.proto | 319 + .../proto/featureflag.proto | 70 - src/featureflagservice/rebar.config | 2 +- src/featureflagservice/src/ffs_demo_pb.erl | 7068 +++++++++++++++++ .../src/ffs_featureflag_pb.erl | 2013 ----- src/featureflagservice/src/ffs_service.erl | 20 +- .../src/ffs_service_bhvr.erl | 22 +- .../src/ffs_service_client.erl | 76 +- .../src/hipstershop_ad_service_bhvr.erl | 13 + .../src/hipstershop_ad_service_client.erl | 43 + .../src/hipstershop_cart_service_bhvr.erl | 21 + .../src/hipstershop_cart_service_client.erl | 79 + .../src/hipstershop_checkout_service_bhvr.erl | 13 + .../hipstershop_checkout_service_client.erl | 43 + .../src/hipstershop_currency_service_bhvr.erl | 17 + .../hipstershop_currency_service_client.erl | 61 + .../src/hipstershop_email_service_bhvr.erl | 13 + .../src/hipstershop_email_service_client.erl | 43 + .../src/hipstershop_payment_service_bhvr.erl | 13 + .../hipstershop_payment_service_client.erl | 43 + ...pstershop_product_catalog_service_bhvr.erl | 21 + ...tershop_product_catalog_service_client.erl | 79 + ...ipstershop_recommendation_service_bhvr.erl | 13 + ...stershop_recommendation_service_client.erl | 43 + .../src/hipstershop_shipping_service_bhvr.erl | 17 + .../hipstershop_shipping_service_client.erl | 61 + 28 files changed, 8088 insertions(+), 2148 deletions(-) create mode 100644 src/featureflagservice/proto/demo.proto delete mode 100644 src/featureflagservice/proto/featureflag.proto create mode 100644 src/featureflagservice/src/ffs_demo_pb.erl delete mode 100644 src/featureflagservice/src/ffs_featureflag_pb.erl create mode 100644 src/featureflagservice/src/hipstershop_ad_service_bhvr.erl create mode 100644 src/featureflagservice/src/hipstershop_ad_service_client.erl create mode 100644 src/featureflagservice/src/hipstershop_cart_service_bhvr.erl create mode 100644 src/featureflagservice/src/hipstershop_cart_service_client.erl create mode 100644 src/featureflagservice/src/hipstershop_checkout_service_bhvr.erl create mode 100644 src/featureflagservice/src/hipstershop_checkout_service_client.erl create mode 100644 src/featureflagservice/src/hipstershop_currency_service_bhvr.erl create mode 100644 src/featureflagservice/src/hipstershop_currency_service_client.erl create mode 100644 src/featureflagservice/src/hipstershop_email_service_bhvr.erl create mode 100644 src/featureflagservice/src/hipstershop_email_service_client.erl create mode 100644 src/featureflagservice/src/hipstershop_payment_service_bhvr.erl create mode 100644 src/featureflagservice/src/hipstershop_payment_service_client.erl create mode 100644 src/featureflagservice/src/hipstershop_product_catalog_service_bhvr.erl create mode 100644 src/featureflagservice/src/hipstershop_product_catalog_service_client.erl create mode 100644 src/featureflagservice/src/hipstershop_recommendation_service_bhvr.erl create mode 100644 src/featureflagservice/src/hipstershop_recommendation_service_client.erl create mode 100644 src/featureflagservice/src/hipstershop_shipping_service_bhvr.erl create mode 100644 src/featureflagservice/src/hipstershop_shipping_service_client.erl diff --git a/src/featureflagservice/README.md b/src/featureflagservice/README.md index ad373ed5e5..d8461a792c 100644 --- a/src/featureflagservice/README.md +++ b/src/featureflagservice/README.md @@ -40,6 +40,6 @@ for instrumentation. ## Building Protos -A copy of the `FeatureFlagService` protos from `demo.proto` are kept in -`proto/featureflag.proto` and `rebar3 grpc gen` will update the corresponding -Erlang module `src/ffs_featureflag_pb.erl`. +A copy of the protos from `pb/demo.proto` are kept in +`proto/demo.proto` and `rebar3 grpc gen` will update the corresponding +Erlang module `src/ffs_demo_pb.erl`. diff --git a/src/featureflagservice/config/runtime.exs b/src/featureflagservice/config/runtime.exs index 57c6456c6c..fcbea3ec59 100644 --- a/src/featureflagservice/config/runtime.exs +++ b/src/featureflagservice/config/runtime.exs @@ -10,9 +10,9 @@ config :grpcbox, servers: [ %{ :grpc_opts => %{ - :service_protos => [:ffs_featureflag_pb], + :service_protos => [:ffs_demo_pb], :unary_interceptor => {:otel_grpcbox_interceptor, :unary}, - :services => %{:FeatureFlagService => :ffs_service} + :services => %{:"hipstershop.FeatureFlagService" => :ffs_service} }, :listen_opts => %{:port => grpc_port} } diff --git a/src/featureflagservice/proto/demo.proto b/src/featureflagservice/proto/demo.proto new file mode 100644 index 0000000000..882752e9e2 --- /dev/null +++ b/src/featureflagservice/proto/demo.proto @@ -0,0 +1,319 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +import "google/protobuf/timestamp.proto"; + +package hipstershop; + +option go_package = "genproto/hipstershop"; + +// -----------------Cart service----------------- + +service CartService { + rpc AddItem(AddItemRequest) returns (Empty) {} + rpc GetCart(GetCartRequest) returns (Cart) {} + rpc EmptyCart(EmptyCartRequest) returns (Empty) {} +} + +message CartItem { + string product_id = 1; + int32 quantity = 2; +} + +message AddItemRequest { + string user_id = 1; + CartItem item = 2; +} + +message EmptyCartRequest { + string user_id = 1; +} + +message GetCartRequest { + string user_id = 1; +} + +message Cart { + string user_id = 1; + repeated CartItem items = 2; +} + +message Empty {} + +// ---------------Recommendation service---------- + +service RecommendationService { + rpc ListRecommendations(ListRecommendationsRequest) returns (ListRecommendationsResponse){} +} + +message ListRecommendationsRequest { + string user_id = 1; + repeated string product_ids = 2; +} + +message ListRecommendationsResponse { + repeated string product_ids = 1; +} + +// ---------------Product Catalog---------------- + +service ProductCatalogService { + rpc ListProducts(Empty) returns (ListProductsResponse) {} + rpc GetProduct(GetProductRequest) returns (Product) {} + rpc SearchProducts(SearchProductsRequest) returns (SearchProductsResponse) {} +} + +message Product { + string id = 1; + string name = 2; + string description = 3; + string picture = 4; + Money price_usd = 5; + + // Categories such as "clothing" or "kitchen" that can be used to look up + // other related products. + repeated string categories = 6; +} + +message ListProductsResponse { + repeated Product products = 1; +} + +message GetProductRequest { + string id = 1; +} + +message SearchProductsRequest { + string query = 1; +} + +message SearchProductsResponse { + repeated Product results = 1; +} + +// ---------------Shipping Service---------- + +service ShippingService { + rpc GetQuote(GetQuoteRequest) returns (GetQuoteResponse) {} + rpc ShipOrder(ShipOrderRequest) returns (ShipOrderResponse) {} +} + +message GetQuoteRequest { + Address address = 1; + repeated CartItem items = 2; +} + +message GetQuoteResponse { + Money cost_usd = 1; +} + +message ShipOrderRequest { + Address address = 1; + repeated CartItem items = 2; +} + +message ShipOrderResponse { + string tracking_id = 1; +} + +message Address { + string street_address = 1; + string city = 2; + string state = 3; + string country = 4; + int32 zip_code = 5; +} + +// -----------------Currency service----------------- + +service CurrencyService { + rpc GetSupportedCurrencies(Empty) returns (GetSupportedCurrenciesResponse) {} + rpc Convert(CurrencyConversionRequest) returns (Money) {} +} + +// Represents an amount of money with its currency type. +message Money { + // The 3-letter currency code defined in ISO 4217. + string currency_code = 1; + + // The whole units of the amount. + // For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + int64 units = 2; + + // Number of nano (10^-9) units of the amount. + // The value must be between -999,999,999 and +999,999,999 inclusive. + // If `units` is positive, `nanos` must be positive or zero. + // If `units` is zero, `nanos` can be positive, zero, or negative. + // If `units` is negative, `nanos` must be negative or zero. + // For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. + int32 nanos = 3; +} + +message GetSupportedCurrenciesResponse { + // The 3-letter currency code defined in ISO 4217. + repeated string currency_codes = 1; +} + +message CurrencyConversionRequest { + Money from = 1; + + // The 3-letter currency code defined in ISO 4217. + string to_code = 2; +} + +// -------------Payment service----------------- + +service PaymentService { + rpc Charge(ChargeRequest) returns (ChargeResponse) {} +} + +message CreditCardInfo { + string credit_card_number = 1; + int32 credit_card_cvv = 2; + int32 credit_card_expiration_year = 3; + int32 credit_card_expiration_month = 4; +} + +message ChargeRequest { + Money amount = 1; + CreditCardInfo credit_card = 2; +} + +message ChargeResponse { + string transaction_id = 1; +} + +// -------------Email service----------------- + +service EmailService { + rpc SendOrderConfirmation(SendOrderConfirmationRequest) returns (Empty) {} +} + +message OrderItem { + CartItem item = 1; + Money cost = 2; +} + +message OrderResult { + string order_id = 1; + string shipping_tracking_id = 2; + Money shipping_cost = 3; + Address shipping_address = 4; + repeated OrderItem items = 5; +} + +message SendOrderConfirmationRequest { + string email = 1; + OrderResult order = 2; +} + + +// -------------Checkout service----------------- + +service CheckoutService { + rpc PlaceOrder(PlaceOrderRequest) returns (PlaceOrderResponse) {} +} + +message PlaceOrderRequest { + string user_id = 1; + string user_currency = 2; + + Address address = 3; + string email = 5; + CreditCardInfo credit_card = 6; +} + +message PlaceOrderResponse { + OrderResult order = 1; +} + +// ------------Ad service------------------ + +service AdService { + rpc GetAds(AdRequest) returns (AdResponse) {} +} + +message AdRequest { + // List of important key words from the current page describing the context. + repeated string context_keys = 1; +} + +message AdResponse { + repeated Ad ads = 1; +} + +message Ad { + // url to redirect to when an ad is clicked. + string redirect_url = 1; + + // short advertisement text to display. + string text = 2; +} + +// ------------Feature flag service------------------ + +service FeatureFlagService { + rpc GetFlag(GetFlagRequest) returns (GetFlagResponse) {} + rpc CreateFlag(CreateFlagRequest) returns (CreateFlagResponse) {} + rpc UpdateFlag(UpdateFlagRequest) returns (UpdateFlagResponse) {} + rpc ListFlags(ListFlagsRequest) returns (ListFlagsResponse) {} + rpc DeleteFlag(DeleteFlagRequest) returns (DeleteFlagResponse) {} +} + +message Flag { + string name = 1; + string description = 2; + bool enabled = 3; + google.protobuf.Timestamp created_at = 4; + google.protobuf.Timestamp updated_at = 5; +} + +message GetFlagRequest { + string name = 1; +} + +message GetFlagResponse { + Flag flag = 1; +} + +message CreateFlagRequest { + string name = 1; + string description = 2; + bool enabled = 3; +} + +message CreateFlagResponse { + Flag flag = 1; +} + +message UpdateFlagRequest { + string name = 1; + bool enabled = 2; +} + +message UpdateFlagResponse {} + +message ListFlagsRequest {} + +message ListFlagsResponse { + repeated Flag flag = 1; +} + +message DeleteFlagRequest { + string name = 1; +} + +message DeleteFlagResponse {} diff --git a/src/featureflagservice/proto/featureflag.proto b/src/featureflagservice/proto/featureflag.proto deleted file mode 100644 index ff28c6b4d0..0000000000 --- a/src/featureflagservice/proto/featureflag.proto +++ /dev/null @@ -1,70 +0,0 @@ -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -import "google/protobuf/timestamp.proto"; - -// ------------Feature flag service------------------ - -service FeatureFlagService { - rpc GetFlag(GetFlagRequest) returns (GetFlagResponse) {} - rpc CreateFlag(CreateFlagRequest) returns (CreateFlagResponse) {} - rpc UpdateFlag(UpdateFlagRequest) returns (UpdateFlagResponse) {} - rpc ListFlags(ListFlagsRequest) returns (ListFlagsResponse) {} - rpc DeleteFlag(DeleteFlagRequest) returns (DeleteFlagResponse) {} -} - -message Flag { - string name = 1; - string description = 2; - bool enabled = 3; - google.protobuf.Timestamp created_at = 4; - google.protobuf.Timestamp updated_at = 5; -} - -message GetFlagRequest { - string name = 1; -} - -message GetFlagResponse { - Flag flag = 1; -} - -message CreateFlagRequest { - string name = 1; - string description = 2; - bool enabled = 3; -} - -message CreateFlagResponse { - Flag flag = 1; -} - -message UpdateFlagRequest { - string name = 1; - bool enabled = 2; -} - -message UpdateFlagResponse {} - -message ListFlagsRequest {} - -message ListFlagsResponse { - repeated Flag flag = 1; -} - -message DeleteFlagRequest { - string name = 1; -} - -message DeleteFlagResponse {} diff --git a/src/featureflagservice/rebar.config b/src/featureflagservice/rebar.config index 24685783d0..067d4725ad 100644 --- a/src/featureflagservice/rebar.config +++ b/src/featureflagservice/rebar.config @@ -2,7 +2,7 @@ {deps, []}. {grpc, [{protos, ["proto"]}, - {service_modules, [{'FeatureFlagService', "ffs_service"}, + {service_modules, [{'hipstershop.FeatureFlagService', "ffs_service"}, {'grpc.health.v1.Health', "grpcbox_health"}, {'grpc.reflection.v1alpha.ServerReflection', "grpcbox_reflection"}]}, {gpb_opts, [{descriptor, true}, diff --git a/src/featureflagservice/src/ffs_demo_pb.erl b/src/featureflagservice/src/ffs_demo_pb.erl new file mode 100644 index 0000000000..ad77331fb7 --- /dev/null +++ b/src/featureflagservice/src/ffs_demo_pb.erl @@ -0,0 +1,7068 @@ +%% -*- coding: utf-8 -*- +%% @private +%% Automatically generated, do not edit +%% Generated by gpb_compile version 4.19.5 +%% Version source: file +-module(ffs_demo_pb). + +-export([encode_msg/2, encode_msg/3]). +-export([decode_msg/2, decode_msg/3]). +-export([merge_msgs/3, merge_msgs/4]). +-export([verify_msg/2, verify_msg/3]). +-export([get_msg_defs/0]). +-export([get_msg_names/0]). +-export([get_group_names/0]). +-export([get_msg_or_group_names/0]). +-export([get_enum_names/0]). +-export([find_msg_def/1, fetch_msg_def/1]). +-export([find_enum_def/1, fetch_enum_def/1]). +-export([enum_symbol_by_value/2, enum_value_by_symbol/2]). +-export([get_service_names/0]). +-export([get_service_def/1]). +-export([get_rpc_names/1]). +-export([find_rpc_def/2, fetch_rpc_def/2]). +-export([fqbin_to_service_name/1]). +-export([service_name_to_fqbin/1]). +-export([fqbins_to_service_and_rpc_name/2]). +-export([service_and_rpc_name_to_fqbins/2]). +-export([fqbin_to_msg_name/1]). +-export([msg_name_to_fqbin/1]). +-export([fqbin_to_enum_name/1]). +-export([enum_name_to_fqbin/1]). +-export([get_package_name/0]). +-export([uses_packages/0]). +-export([source_basename/0]). +-export([get_all_source_basenames/0]). +-export([get_all_proto_names/0]). +-export([get_msg_containment/1]). +-export([get_pkg_containment/1]). +-export([get_service_containment/1]). +-export([get_rpc_containment/1]). +-export([get_enum_containment/1]). +-export([get_proto_by_msg_name_as_fqbin/1]). +-export([get_proto_by_service_name_as_fqbin/1]). +-export([get_proto_by_enum_name_as_fqbin/1]). +-export([get_protos_by_pkg_name_as_fqbin/1]). +-export([descriptor/0, descriptor/1]). +-export([gpb_version_as_string/0, gpb_version_as_list/0]). +-export([gpb_version_source/0]). + + +%% enumerated types + +-export_type([]). + +%% message types +-type cart_item() :: + #{product_id => unicode:chardata(), % = 1, optional + quantity => integer() % = 2, optional, 32 bits + }. + +-type add_item_request() :: + #{user_id => unicode:chardata(), % = 1, optional + item => cart_item() % = 2, optional + }. + +-type empty_cart_request() :: + #{user_id => unicode:chardata() % = 1, optional + }. + +-type get_cart_request() :: + #{user_id => unicode:chardata() % = 1, optional + }. + +-type cart() :: + #{user_id => unicode:chardata(), % = 1, optional + items => [cart_item()] % = 2, repeated + }. + +-type empty() :: + #{ + }. + +-type list_recommendations_request() :: + #{user_id => unicode:chardata(), % = 1, optional + product_ids => [unicode:chardata()] % = 2, repeated + }. + +-type list_recommendations_response() :: + #{product_ids => [unicode:chardata()] % = 1, repeated + }. + +-type product() :: + #{id => unicode:chardata(), % = 1, optional + name => unicode:chardata(), % = 2, optional + description => unicode:chardata(), % = 3, optional + picture => unicode:chardata(), % = 4, optional + price_usd => money(), % = 5, optional + categories => [unicode:chardata()] % = 6, repeated + }. + +-type list_products_response() :: + #{products => [product()] % = 1, repeated + }. + +-type get_product_request() :: + #{id => unicode:chardata() % = 1, optional + }. + +-type search_products_request() :: + #{query => unicode:chardata() % = 1, optional + }. + +-type search_products_response() :: + #{results => [product()] % = 1, repeated + }. + +-type get_quote_request() :: + #{address => address(), % = 1, optional + items => [cart_item()] % = 2, repeated + }. + +-type get_quote_response() :: + #{cost_usd => money() % = 1, optional + }. + +-type ship_order_request() :: + #{address => address(), % = 1, optional + items => [cart_item()] % = 2, repeated + }. + +-type ship_order_response() :: + #{tracking_id => unicode:chardata() % = 1, optional + }. + +-type address() :: + #{street_address => unicode:chardata(), % = 1, optional + city => unicode:chardata(), % = 2, optional + state => unicode:chardata(), % = 3, optional + country => unicode:chardata(), % = 4, optional + zip_code => integer() % = 5, optional, 32 bits + }. + +-type money() :: + #{currency_code => unicode:chardata(), % = 1, optional + units => integer(), % = 2, optional, 64 bits + nanos => integer() % = 3, optional, 32 bits + }. + +-type get_supported_currencies_response() :: + #{currency_codes => [unicode:chardata()] % = 1, repeated + }. + +-type currency_conversion_request() :: + #{from => money(), % = 1, optional + to_code => unicode:chardata() % = 2, optional + }. + +-type credit_card_info() :: + #{credit_card_number => unicode:chardata(), % = 1, optional + credit_card_cvv => integer(), % = 2, optional, 32 bits + credit_card_expiration_year => integer(), % = 3, optional, 32 bits + credit_card_expiration_month => integer() % = 4, optional, 32 bits + }. + +-type charge_request() :: + #{amount => money(), % = 1, optional + credit_card => credit_card_info() % = 2, optional + }. + +-type charge_response() :: + #{transaction_id => unicode:chardata() % = 1, optional + }. + +-type order_item() :: + #{item => cart_item(), % = 1, optional + cost => money() % = 2, optional + }. + +-type order_result() :: + #{order_id => unicode:chardata(), % = 1, optional + shipping_tracking_id => unicode:chardata(), % = 2, optional + shipping_cost => money(), % = 3, optional + shipping_address => address(), % = 4, optional + items => [order_item()] % = 5, repeated + }. + +-type send_order_confirmation_request() :: + #{email => unicode:chardata(), % = 1, optional + order => order_result() % = 2, optional + }. + +-type place_order_request() :: + #{user_id => unicode:chardata(), % = 1, optional + user_currency => unicode:chardata(), % = 2, optional + address => address(), % = 3, optional + email => unicode:chardata(), % = 5, optional + credit_card => credit_card_info() % = 6, optional + }. + +-type place_order_response() :: + #{order => order_result() % = 1, optional + }. + +-type ad_request() :: + #{context_keys => [unicode:chardata()] % = 1, repeated + }. + +-type ad_response() :: + #{ads => [ad()] % = 1, repeated + }. + +-type ad() :: + #{redirect_url => unicode:chardata(), % = 1, optional + text => unicode:chardata() % = 2, optional + }. + +-type flag() :: + #{name => unicode:chardata(), % = 1, optional + description => unicode:chardata(), % = 2, optional + enabled => boolean() | 0 | 1, % = 3, optional + created_at => timestamp(), % = 4, optional + updated_at => timestamp() % = 5, optional + }. + +-type get_flag_request() :: + #{name => unicode:chardata() % = 1, optional + }. + +-type get_flag_response() :: + #{flag => flag() % = 1, optional + }. + +-type create_flag_request() :: + #{name => unicode:chardata(), % = 1, optional + description => unicode:chardata(), % = 2, optional + enabled => boolean() | 0 | 1 % = 3, optional + }. + +-type create_flag_response() :: + #{flag => flag() % = 1, optional + }. + +-type update_flag_request() :: + #{name => unicode:chardata(), % = 1, optional + enabled => boolean() | 0 | 1 % = 2, optional + }. + +-type update_flag_response() :: + #{ + }. + +-type list_flags_request() :: + #{ + }. + +-type list_flags_response() :: + #{flag => [flag()] % = 1, repeated + }. + +-type delete_flag_request() :: + #{name => unicode:chardata() % = 1, optional + }. + +-type delete_flag_response() :: + #{ + }. + +-type timestamp() :: + #{seconds => integer(), % = 1, optional, 64 bits + nanos => integer() % = 2, optional, 32 bits + }. + +-export_type(['cart_item'/0, 'add_item_request'/0, 'empty_cart_request'/0, 'get_cart_request'/0, 'cart'/0, 'empty'/0, 'list_recommendations_request'/0, 'list_recommendations_response'/0, 'product'/0, 'list_products_response'/0, 'get_product_request'/0, 'search_products_request'/0, 'search_products_response'/0, 'get_quote_request'/0, 'get_quote_response'/0, 'ship_order_request'/0, 'ship_order_response'/0, 'address'/0, 'money'/0, 'get_supported_currencies_response'/0, 'currency_conversion_request'/0, 'credit_card_info'/0, 'charge_request'/0, 'charge_response'/0, 'order_item'/0, 'order_result'/0, 'send_order_confirmation_request'/0, 'place_order_request'/0, 'place_order_response'/0, 'ad_request'/0, 'ad_response'/0, 'ad'/0, 'flag'/0, 'get_flag_request'/0, 'get_flag_response'/0, 'create_flag_request'/0, 'create_flag_response'/0, 'update_flag_request'/0, 'update_flag_response'/0, 'list_flags_request'/0, 'list_flags_response'/0, 'delete_flag_request'/0, 'delete_flag_response'/0, 'timestamp'/0]). +-type '$msg_name'() :: cart_item | add_item_request | empty_cart_request | get_cart_request | cart | empty | list_recommendations_request | list_recommendations_response | product | list_products_response | get_product_request | search_products_request | search_products_response | get_quote_request | get_quote_response | ship_order_request | ship_order_response | address | money | get_supported_currencies_response | currency_conversion_request | credit_card_info | charge_request | charge_response | order_item | order_result | send_order_confirmation_request | place_order_request | place_order_response | ad_request | ad_response | ad | flag | get_flag_request | get_flag_response | create_flag_request | create_flag_response | update_flag_request | update_flag_response | list_flags_request | list_flags_response | delete_flag_request | delete_flag_response | timestamp. +-type '$msg'() :: cart_item() | add_item_request() | empty_cart_request() | get_cart_request() | cart() | empty() | list_recommendations_request() | list_recommendations_response() | product() | list_products_response() | get_product_request() | search_products_request() | search_products_response() | get_quote_request() | get_quote_response() | ship_order_request() | ship_order_response() | address() | money() | get_supported_currencies_response() | currency_conversion_request() | credit_card_info() | charge_request() | charge_response() | order_item() | order_result() | send_order_confirmation_request() | place_order_request() | place_order_response() | ad_request() | ad_response() | ad() | flag() | get_flag_request() | get_flag_response() | create_flag_request() | create_flag_response() | update_flag_request() | update_flag_response() | list_flags_request() | list_flags_response() | delete_flag_request() | delete_flag_response() | timestamp(). +-export_type(['$msg_name'/0, '$msg'/0]). + +-if(?OTP_RELEASE >= 24). +-dialyzer({no_underspecs, encode_msg/2}). +-endif. +-spec encode_msg('$msg'(), '$msg_name'()) -> binary(). +encode_msg(Msg, MsgName) when is_atom(MsgName) -> encode_msg(Msg, MsgName, []). + +-if(?OTP_RELEASE >= 24). +-dialyzer({no_underspecs, encode_msg/3}). +-endif. +-spec encode_msg('$msg'(), '$msg_name'(), list()) -> binary(). +encode_msg(Msg, MsgName, Opts) -> + case proplists:get_bool(verify, Opts) of + true -> verify_msg(Msg, MsgName, Opts); + false -> ok + end, + TrUserData = proplists:get_value(user_data, Opts), + case MsgName of + cart_item -> encode_msg_cart_item(id(Msg, TrUserData), TrUserData); + add_item_request -> encode_msg_add_item_request(id(Msg, TrUserData), TrUserData); + empty_cart_request -> encode_msg_empty_cart_request(id(Msg, TrUserData), TrUserData); + get_cart_request -> encode_msg_get_cart_request(id(Msg, TrUserData), TrUserData); + cart -> encode_msg_cart(id(Msg, TrUserData), TrUserData); + empty -> encode_msg_empty(id(Msg, TrUserData), TrUserData); + list_recommendations_request -> encode_msg_list_recommendations_request(id(Msg, TrUserData), TrUserData); + list_recommendations_response -> encode_msg_list_recommendations_response(id(Msg, TrUserData), TrUserData); + product -> encode_msg_product(id(Msg, TrUserData), TrUserData); + list_products_response -> encode_msg_list_products_response(id(Msg, TrUserData), TrUserData); + get_product_request -> encode_msg_get_product_request(id(Msg, TrUserData), TrUserData); + search_products_request -> encode_msg_search_products_request(id(Msg, TrUserData), TrUserData); + search_products_response -> encode_msg_search_products_response(id(Msg, TrUserData), TrUserData); + get_quote_request -> encode_msg_get_quote_request(id(Msg, TrUserData), TrUserData); + get_quote_response -> encode_msg_get_quote_response(id(Msg, TrUserData), TrUserData); + ship_order_request -> encode_msg_ship_order_request(id(Msg, TrUserData), TrUserData); + ship_order_response -> encode_msg_ship_order_response(id(Msg, TrUserData), TrUserData); + address -> encode_msg_address(id(Msg, TrUserData), TrUserData); + money -> encode_msg_money(id(Msg, TrUserData), TrUserData); + get_supported_currencies_response -> encode_msg_get_supported_currencies_response(id(Msg, TrUserData), TrUserData); + currency_conversion_request -> encode_msg_currency_conversion_request(id(Msg, TrUserData), TrUserData); + credit_card_info -> encode_msg_credit_card_info(id(Msg, TrUserData), TrUserData); + charge_request -> encode_msg_charge_request(id(Msg, TrUserData), TrUserData); + charge_response -> encode_msg_charge_response(id(Msg, TrUserData), TrUserData); + order_item -> encode_msg_order_item(id(Msg, TrUserData), TrUserData); + order_result -> encode_msg_order_result(id(Msg, TrUserData), TrUserData); + send_order_confirmation_request -> encode_msg_send_order_confirmation_request(id(Msg, TrUserData), TrUserData); + place_order_request -> encode_msg_place_order_request(id(Msg, TrUserData), TrUserData); + place_order_response -> encode_msg_place_order_response(id(Msg, TrUserData), TrUserData); + ad_request -> encode_msg_ad_request(id(Msg, TrUserData), TrUserData); + ad_response -> encode_msg_ad_response(id(Msg, TrUserData), TrUserData); + ad -> encode_msg_ad(id(Msg, TrUserData), TrUserData); + flag -> encode_msg_flag(id(Msg, TrUserData), TrUserData); + get_flag_request -> encode_msg_get_flag_request(id(Msg, TrUserData), TrUserData); + get_flag_response -> encode_msg_get_flag_response(id(Msg, TrUserData), TrUserData); + create_flag_request -> encode_msg_create_flag_request(id(Msg, TrUserData), TrUserData); + create_flag_response -> encode_msg_create_flag_response(id(Msg, TrUserData), TrUserData); + update_flag_request -> encode_msg_update_flag_request(id(Msg, TrUserData), TrUserData); + update_flag_response -> encode_msg_update_flag_response(id(Msg, TrUserData), TrUserData); + list_flags_request -> encode_msg_list_flags_request(id(Msg, TrUserData), TrUserData); + list_flags_response -> encode_msg_list_flags_response(id(Msg, TrUserData), TrUserData); + delete_flag_request -> encode_msg_delete_flag_request(id(Msg, TrUserData), TrUserData); + delete_flag_response -> encode_msg_delete_flag_response(id(Msg, TrUserData), TrUserData); + timestamp -> encode_msg_timestamp(id(Msg, TrUserData), TrUserData) + end. + + +encode_msg_cart_item(Msg, TrUserData) -> encode_msg_cart_item(Msg, <<>>, TrUserData). + + +encode_msg_cart_item(#{} = M, Bin, TrUserData) -> + B1 = case M of + #{product_id := F1} -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> e_type_string(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end, + case M of + #{quantity := F2} -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= 0 -> B1; + true -> e_type_int32(TrF2, <>, TrUserData) + end + end; + _ -> B1 + end. + +encode_msg_add_item_request(Msg, TrUserData) -> encode_msg_add_item_request(Msg, <<>>, TrUserData). + + +encode_msg_add_item_request(#{} = M, Bin, TrUserData) -> + B1 = case M of + #{user_id := F1} -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> e_type_string(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end, + case M of + #{item := F2} -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= undefined -> B1; + true -> e_mfield_add_item_request_item(TrF2, <>, TrUserData) + end + end; + _ -> B1 + end. + +encode_msg_empty_cart_request(Msg, TrUserData) -> encode_msg_empty_cart_request(Msg, <<>>, TrUserData). + + +encode_msg_empty_cart_request(#{} = M, Bin, TrUserData) -> + case M of + #{user_id := F1} -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> e_type_string(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end. + +encode_msg_get_cart_request(Msg, TrUserData) -> encode_msg_get_cart_request(Msg, <<>>, TrUserData). + + +encode_msg_get_cart_request(#{} = M, Bin, TrUserData) -> + case M of + #{user_id := F1} -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> e_type_string(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end. + +encode_msg_cart(Msg, TrUserData) -> encode_msg_cart(Msg, <<>>, TrUserData). + + +encode_msg_cart(#{} = M, Bin, TrUserData) -> + B1 = case M of + #{user_id := F1} -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> e_type_string(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end, + case M of + #{items := F2} -> + TrF2 = id(F2, TrUserData), + if TrF2 == [] -> B1; + true -> e_field_cart_items(TrF2, B1, TrUserData) + end; + _ -> B1 + end. + +encode_msg_empty(_Msg, _TrUserData) -> <<>>. + +encode_msg_list_recommendations_request(Msg, TrUserData) -> encode_msg_list_recommendations_request(Msg, <<>>, TrUserData). + + +encode_msg_list_recommendations_request(#{} = M, Bin, TrUserData) -> + B1 = case M of + #{user_id := F1} -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> e_type_string(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end, + case M of + #{product_ids := F2} -> + TrF2 = id(F2, TrUserData), + if TrF2 == [] -> B1; + true -> e_field_list_recommendations_request_product_ids(TrF2, B1, TrUserData) + end; + _ -> B1 + end. + +encode_msg_list_recommendations_response(Msg, TrUserData) -> encode_msg_list_recommendations_response(Msg, <<>>, TrUserData). + + +encode_msg_list_recommendations_response(#{} = M, Bin, TrUserData) -> + case M of + #{product_ids := F1} -> + TrF1 = id(F1, TrUserData), + if TrF1 == [] -> Bin; + true -> e_field_list_recommendations_response_product_ids(TrF1, Bin, TrUserData) + end; + _ -> Bin + end. + +encode_msg_product(Msg, TrUserData) -> encode_msg_product(Msg, <<>>, TrUserData). + + +encode_msg_product(#{} = M, Bin, TrUserData) -> + B1 = case M of + #{id := F1} -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> e_type_string(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end, + B2 = case M of + #{name := F2} -> + begin + TrF2 = id(F2, TrUserData), + case is_empty_string(TrF2) of + true -> B1; + false -> e_type_string(TrF2, <>, TrUserData) + end + end; + _ -> B1 + end, + B3 = case M of + #{description := F3} -> + begin + TrF3 = id(F3, TrUserData), + case is_empty_string(TrF3) of + true -> B2; + false -> e_type_string(TrF3, <>, TrUserData) + end + end; + _ -> B2 + end, + B4 = case M of + #{picture := F4} -> + begin + TrF4 = id(F4, TrUserData), + case is_empty_string(TrF4) of + true -> B3; + false -> e_type_string(TrF4, <>, TrUserData) + end + end; + _ -> B3 + end, + B5 = case M of + #{price_usd := F5} -> + begin + TrF5 = id(F5, TrUserData), + if TrF5 =:= undefined -> B4; + true -> e_mfield_product_price_usd(TrF5, <>, TrUserData) + end + end; + _ -> B4 + end, + case M of + #{categories := F6} -> + TrF6 = id(F6, TrUserData), + if TrF6 == [] -> B5; + true -> e_field_product_categories(TrF6, B5, TrUserData) + end; + _ -> B5 + end. + +encode_msg_list_products_response(Msg, TrUserData) -> encode_msg_list_products_response(Msg, <<>>, TrUserData). + + +encode_msg_list_products_response(#{} = M, Bin, TrUserData) -> + case M of + #{products := F1} -> + TrF1 = id(F1, TrUserData), + if TrF1 == [] -> Bin; + true -> e_field_list_products_response_products(TrF1, Bin, TrUserData) + end; + _ -> Bin + end. + +encode_msg_get_product_request(Msg, TrUserData) -> encode_msg_get_product_request(Msg, <<>>, TrUserData). + + +encode_msg_get_product_request(#{} = M, Bin, TrUserData) -> + case M of + #{id := F1} -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> e_type_string(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end. + +encode_msg_search_products_request(Msg, TrUserData) -> encode_msg_search_products_request(Msg, <<>>, TrUserData). + + +encode_msg_search_products_request(#{} = M, Bin, TrUserData) -> + case M of + #{query := F1} -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> e_type_string(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end. + +encode_msg_search_products_response(Msg, TrUserData) -> encode_msg_search_products_response(Msg, <<>>, TrUserData). + + +encode_msg_search_products_response(#{} = M, Bin, TrUserData) -> + case M of + #{results := F1} -> + TrF1 = id(F1, TrUserData), + if TrF1 == [] -> Bin; + true -> e_field_search_products_response_results(TrF1, Bin, TrUserData) + end; + _ -> Bin + end. + +encode_msg_get_quote_request(Msg, TrUserData) -> encode_msg_get_quote_request(Msg, <<>>, TrUserData). + + +encode_msg_get_quote_request(#{} = M, Bin, TrUserData) -> + B1 = case M of + #{address := F1} -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= undefined -> Bin; + true -> e_mfield_get_quote_request_address(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end, + case M of + #{items := F2} -> + TrF2 = id(F2, TrUserData), + if TrF2 == [] -> B1; + true -> e_field_get_quote_request_items(TrF2, B1, TrUserData) + end; + _ -> B1 + end. + +encode_msg_get_quote_response(Msg, TrUserData) -> encode_msg_get_quote_response(Msg, <<>>, TrUserData). + + +encode_msg_get_quote_response(#{} = M, Bin, TrUserData) -> + case M of + #{cost_usd := F1} -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= undefined -> Bin; + true -> e_mfield_get_quote_response_cost_usd(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end. + +encode_msg_ship_order_request(Msg, TrUserData) -> encode_msg_ship_order_request(Msg, <<>>, TrUserData). + + +encode_msg_ship_order_request(#{} = M, Bin, TrUserData) -> + B1 = case M of + #{address := F1} -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= undefined -> Bin; + true -> e_mfield_ship_order_request_address(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end, + case M of + #{items := F2} -> + TrF2 = id(F2, TrUserData), + if TrF2 == [] -> B1; + true -> e_field_ship_order_request_items(TrF2, B1, TrUserData) + end; + _ -> B1 + end. + +encode_msg_ship_order_response(Msg, TrUserData) -> encode_msg_ship_order_response(Msg, <<>>, TrUserData). + + +encode_msg_ship_order_response(#{} = M, Bin, TrUserData) -> + case M of + #{tracking_id := F1} -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> e_type_string(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end. + +encode_msg_address(Msg, TrUserData) -> encode_msg_address(Msg, <<>>, TrUserData). + + +encode_msg_address(#{} = M, Bin, TrUserData) -> + B1 = case M of + #{street_address := F1} -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> e_type_string(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end, + B2 = case M of + #{city := F2} -> + begin + TrF2 = id(F2, TrUserData), + case is_empty_string(TrF2) of + true -> B1; + false -> e_type_string(TrF2, <>, TrUserData) + end + end; + _ -> B1 + end, + B3 = case M of + #{state := F3} -> + begin + TrF3 = id(F3, TrUserData), + case is_empty_string(TrF3) of + true -> B2; + false -> e_type_string(TrF3, <>, TrUserData) + end + end; + _ -> B2 + end, + B4 = case M of + #{country := F4} -> + begin + TrF4 = id(F4, TrUserData), + case is_empty_string(TrF4) of + true -> B3; + false -> e_type_string(TrF4, <>, TrUserData) + end + end; + _ -> B3 + end, + case M of + #{zip_code := F5} -> + begin + TrF5 = id(F5, TrUserData), + if TrF5 =:= 0 -> B4; + true -> e_type_int32(TrF5, <>, TrUserData) + end + end; + _ -> B4 + end. + +encode_msg_money(Msg, TrUserData) -> encode_msg_money(Msg, <<>>, TrUserData). + + +encode_msg_money(#{} = M, Bin, TrUserData) -> + B1 = case M of + #{currency_code := F1} -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> e_type_string(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end, + B2 = case M of + #{units := F2} -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= 0 -> B1; + true -> e_type_int64(TrF2, <>, TrUserData) + end + end; + _ -> B1 + end, + case M of + #{nanos := F3} -> + begin + TrF3 = id(F3, TrUserData), + if TrF3 =:= 0 -> B2; + true -> e_type_int32(TrF3, <>, TrUserData) + end + end; + _ -> B2 + end. + +encode_msg_get_supported_currencies_response(Msg, TrUserData) -> encode_msg_get_supported_currencies_response(Msg, <<>>, TrUserData). + + +encode_msg_get_supported_currencies_response(#{} = M, Bin, TrUserData) -> + case M of + #{currency_codes := F1} -> + TrF1 = id(F1, TrUserData), + if TrF1 == [] -> Bin; + true -> e_field_get_supported_currencies_response_currency_codes(TrF1, Bin, TrUserData) + end; + _ -> Bin + end. + +encode_msg_currency_conversion_request(Msg, TrUserData) -> encode_msg_currency_conversion_request(Msg, <<>>, TrUserData). + + +encode_msg_currency_conversion_request(#{} = M, Bin, TrUserData) -> + B1 = case M of + #{from := F1} -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= undefined -> Bin; + true -> e_mfield_currency_conversion_request_from(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end, + case M of + #{to_code := F2} -> + begin + TrF2 = id(F2, TrUserData), + case is_empty_string(TrF2) of + true -> B1; + false -> e_type_string(TrF2, <>, TrUserData) + end + end; + _ -> B1 + end. + +encode_msg_credit_card_info(Msg, TrUserData) -> encode_msg_credit_card_info(Msg, <<>>, TrUserData). + + +encode_msg_credit_card_info(#{} = M, Bin, TrUserData) -> + B1 = case M of + #{credit_card_number := F1} -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> e_type_string(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end, + B2 = case M of + #{credit_card_cvv := F2} -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= 0 -> B1; + true -> e_type_int32(TrF2, <>, TrUserData) + end + end; + _ -> B1 + end, + B3 = case M of + #{credit_card_expiration_year := F3} -> + begin + TrF3 = id(F3, TrUserData), + if TrF3 =:= 0 -> B2; + true -> e_type_int32(TrF3, <>, TrUserData) + end + end; + _ -> B2 + end, + case M of + #{credit_card_expiration_month := F4} -> + begin + TrF4 = id(F4, TrUserData), + if TrF4 =:= 0 -> B3; + true -> e_type_int32(TrF4, <>, TrUserData) + end + end; + _ -> B3 + end. + +encode_msg_charge_request(Msg, TrUserData) -> encode_msg_charge_request(Msg, <<>>, TrUserData). + + +encode_msg_charge_request(#{} = M, Bin, TrUserData) -> + B1 = case M of + #{amount := F1} -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= undefined -> Bin; + true -> e_mfield_charge_request_amount(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end, + case M of + #{credit_card := F2} -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= undefined -> B1; + true -> e_mfield_charge_request_credit_card(TrF2, <>, TrUserData) + end + end; + _ -> B1 + end. + +encode_msg_charge_response(Msg, TrUserData) -> encode_msg_charge_response(Msg, <<>>, TrUserData). + + +encode_msg_charge_response(#{} = M, Bin, TrUserData) -> + case M of + #{transaction_id := F1} -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> e_type_string(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end. + +encode_msg_order_item(Msg, TrUserData) -> encode_msg_order_item(Msg, <<>>, TrUserData). + + +encode_msg_order_item(#{} = M, Bin, TrUserData) -> + B1 = case M of + #{item := F1} -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= undefined -> Bin; + true -> e_mfield_order_item_item(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end, + case M of + #{cost := F2} -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= undefined -> B1; + true -> e_mfield_order_item_cost(TrF2, <>, TrUserData) + end + end; + _ -> B1 + end. + +encode_msg_order_result(Msg, TrUserData) -> encode_msg_order_result(Msg, <<>>, TrUserData). + + +encode_msg_order_result(#{} = M, Bin, TrUserData) -> + B1 = case M of + #{order_id := F1} -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> e_type_string(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end, + B2 = case M of + #{shipping_tracking_id := F2} -> + begin + TrF2 = id(F2, TrUserData), + case is_empty_string(TrF2) of + true -> B1; + false -> e_type_string(TrF2, <>, TrUserData) + end + end; + _ -> B1 + end, + B3 = case M of + #{shipping_cost := F3} -> + begin + TrF3 = id(F3, TrUserData), + if TrF3 =:= undefined -> B2; + true -> e_mfield_order_result_shipping_cost(TrF3, <>, TrUserData) + end + end; + _ -> B2 + end, + B4 = case M of + #{shipping_address := F4} -> + begin + TrF4 = id(F4, TrUserData), + if TrF4 =:= undefined -> B3; + true -> e_mfield_order_result_shipping_address(TrF4, <>, TrUserData) + end + end; + _ -> B3 + end, + case M of + #{items := F5} -> + TrF5 = id(F5, TrUserData), + if TrF5 == [] -> B4; + true -> e_field_order_result_items(TrF5, B4, TrUserData) + end; + _ -> B4 + end. + +encode_msg_send_order_confirmation_request(Msg, TrUserData) -> encode_msg_send_order_confirmation_request(Msg, <<>>, TrUserData). + + +encode_msg_send_order_confirmation_request(#{} = M, Bin, TrUserData) -> + B1 = case M of + #{email := F1} -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> e_type_string(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end, + case M of + #{order := F2} -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= undefined -> B1; + true -> e_mfield_send_order_confirmation_request_order(TrF2, <>, TrUserData) + end + end; + _ -> B1 + end. + +encode_msg_place_order_request(Msg, TrUserData) -> encode_msg_place_order_request(Msg, <<>>, TrUserData). + + +encode_msg_place_order_request(#{} = M, Bin, TrUserData) -> + B1 = case M of + #{user_id := F1} -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> e_type_string(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end, + B2 = case M of + #{user_currency := F2} -> + begin + TrF2 = id(F2, TrUserData), + case is_empty_string(TrF2) of + true -> B1; + false -> e_type_string(TrF2, <>, TrUserData) + end + end; + _ -> B1 + end, + B3 = case M of + #{address := F3} -> + begin + TrF3 = id(F3, TrUserData), + if TrF3 =:= undefined -> B2; + true -> e_mfield_place_order_request_address(TrF3, <>, TrUserData) + end + end; + _ -> B2 + end, + B4 = case M of + #{email := F4} -> + begin + TrF4 = id(F4, TrUserData), + case is_empty_string(TrF4) of + true -> B3; + false -> e_type_string(TrF4, <>, TrUserData) + end + end; + _ -> B3 + end, + case M of + #{credit_card := F5} -> + begin + TrF5 = id(F5, TrUserData), + if TrF5 =:= undefined -> B4; + true -> e_mfield_place_order_request_credit_card(TrF5, <>, TrUserData) + end + end; + _ -> B4 + end. + +encode_msg_place_order_response(Msg, TrUserData) -> encode_msg_place_order_response(Msg, <<>>, TrUserData). + + +encode_msg_place_order_response(#{} = M, Bin, TrUserData) -> + case M of + #{order := F1} -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= undefined -> Bin; + true -> e_mfield_place_order_response_order(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end. + +encode_msg_ad_request(Msg, TrUserData) -> encode_msg_ad_request(Msg, <<>>, TrUserData). + + +encode_msg_ad_request(#{} = M, Bin, TrUserData) -> + case M of + #{context_keys := F1} -> + TrF1 = id(F1, TrUserData), + if TrF1 == [] -> Bin; + true -> e_field_ad_request_context_keys(TrF1, Bin, TrUserData) + end; + _ -> Bin + end. + +encode_msg_ad_response(Msg, TrUserData) -> encode_msg_ad_response(Msg, <<>>, TrUserData). + + +encode_msg_ad_response(#{} = M, Bin, TrUserData) -> + case M of + #{ads := F1} -> + TrF1 = id(F1, TrUserData), + if TrF1 == [] -> Bin; + true -> e_field_ad_response_ads(TrF1, Bin, TrUserData) + end; + _ -> Bin + end. + +encode_msg_ad(Msg, TrUserData) -> encode_msg_ad(Msg, <<>>, TrUserData). + + +encode_msg_ad(#{} = M, Bin, TrUserData) -> + B1 = case M of + #{redirect_url := F1} -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> e_type_string(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end, + case M of + #{text := F2} -> + begin + TrF2 = id(F2, TrUserData), + case is_empty_string(TrF2) of + true -> B1; + false -> e_type_string(TrF2, <>, TrUserData) + end + end; + _ -> B1 + end. + +encode_msg_flag(Msg, TrUserData) -> encode_msg_flag(Msg, <<>>, TrUserData). + + +encode_msg_flag(#{} = M, Bin, TrUserData) -> + B1 = case M of + #{name := F1} -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> e_type_string(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end, + B2 = case M of + #{description := F2} -> + begin + TrF2 = id(F2, TrUserData), + case is_empty_string(TrF2) of + true -> B1; + false -> e_type_string(TrF2, <>, TrUserData) + end + end; + _ -> B1 + end, + B3 = case M of + #{enabled := F3} -> + begin + TrF3 = id(F3, TrUserData), + if TrF3 =:= false -> B2; + true -> e_type_bool(TrF3, <>, TrUserData) + end + end; + _ -> B2 + end, + B4 = case M of + #{created_at := F4} -> + begin + TrF4 = id(F4, TrUserData), + if TrF4 =:= undefined -> B3; + true -> e_mfield_flag_created_at(TrF4, <>, TrUserData) + end + end; + _ -> B3 + end, + case M of + #{updated_at := F5} -> + begin + TrF5 = id(F5, TrUserData), + if TrF5 =:= undefined -> B4; + true -> e_mfield_flag_updated_at(TrF5, <>, TrUserData) + end + end; + _ -> B4 + end. + +encode_msg_get_flag_request(Msg, TrUserData) -> encode_msg_get_flag_request(Msg, <<>>, TrUserData). + + +encode_msg_get_flag_request(#{} = M, Bin, TrUserData) -> + case M of + #{name := F1} -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> e_type_string(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end. + +encode_msg_get_flag_response(Msg, TrUserData) -> encode_msg_get_flag_response(Msg, <<>>, TrUserData). + + +encode_msg_get_flag_response(#{} = M, Bin, TrUserData) -> + case M of + #{flag := F1} -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= undefined -> Bin; + true -> e_mfield_get_flag_response_flag(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end. + +encode_msg_create_flag_request(Msg, TrUserData) -> encode_msg_create_flag_request(Msg, <<>>, TrUserData). + + +encode_msg_create_flag_request(#{} = M, Bin, TrUserData) -> + B1 = case M of + #{name := F1} -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> e_type_string(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end, + B2 = case M of + #{description := F2} -> + begin + TrF2 = id(F2, TrUserData), + case is_empty_string(TrF2) of + true -> B1; + false -> e_type_string(TrF2, <>, TrUserData) + end + end; + _ -> B1 + end, + case M of + #{enabled := F3} -> + begin + TrF3 = id(F3, TrUserData), + if TrF3 =:= false -> B2; + true -> e_type_bool(TrF3, <>, TrUserData) + end + end; + _ -> B2 + end. + +encode_msg_create_flag_response(Msg, TrUserData) -> encode_msg_create_flag_response(Msg, <<>>, TrUserData). + + +encode_msg_create_flag_response(#{} = M, Bin, TrUserData) -> + case M of + #{flag := F1} -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= undefined -> Bin; + true -> e_mfield_create_flag_response_flag(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end. + +encode_msg_update_flag_request(Msg, TrUserData) -> encode_msg_update_flag_request(Msg, <<>>, TrUserData). + + +encode_msg_update_flag_request(#{} = M, Bin, TrUserData) -> + B1 = case M of + #{name := F1} -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> e_type_string(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end, + case M of + #{enabled := F2} -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= false -> B1; + true -> e_type_bool(TrF2, <>, TrUserData) + end + end; + _ -> B1 + end. + +encode_msg_update_flag_response(_Msg, _TrUserData) -> <<>>. + +encode_msg_list_flags_request(_Msg, _TrUserData) -> <<>>. + +encode_msg_list_flags_response(Msg, TrUserData) -> encode_msg_list_flags_response(Msg, <<>>, TrUserData). + + +encode_msg_list_flags_response(#{} = M, Bin, TrUserData) -> + case M of + #{flag := F1} -> + TrF1 = id(F1, TrUserData), + if TrF1 == [] -> Bin; + true -> e_field_list_flags_response_flag(TrF1, Bin, TrUserData) + end; + _ -> Bin + end. + +encode_msg_delete_flag_request(Msg, TrUserData) -> encode_msg_delete_flag_request(Msg, <<>>, TrUserData). + + +encode_msg_delete_flag_request(#{} = M, Bin, TrUserData) -> + case M of + #{name := F1} -> + begin + TrF1 = id(F1, TrUserData), + case is_empty_string(TrF1) of + true -> Bin; + false -> e_type_string(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end. + +encode_msg_delete_flag_response(_Msg, _TrUserData) -> <<>>. + +encode_msg_timestamp(Msg, TrUserData) -> encode_msg_timestamp(Msg, <<>>, TrUserData). + + +encode_msg_timestamp(#{} = M, Bin, TrUserData) -> + B1 = case M of + #{seconds := F1} -> + begin + TrF1 = id(F1, TrUserData), + if TrF1 =:= 0 -> Bin; + true -> e_type_int64(TrF1, <>, TrUserData) + end + end; + _ -> Bin + end, + case M of + #{nanos := F2} -> + begin + TrF2 = id(F2, TrUserData), + if TrF2 =:= 0 -> B1; + true -> e_type_int32(TrF2, <>, TrUserData) + end + end; + _ -> B1 + end. + +e_mfield_add_item_request_item(Msg, Bin, TrUserData) -> + SubBin = encode_msg_cart_item(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_cart_items(Msg, Bin, TrUserData) -> + SubBin = encode_msg_cart_item(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_field_cart_items([Elem | Rest], Bin, TrUserData) -> + Bin2 = <>, + Bin3 = e_mfield_cart_items(id(Elem, TrUserData), Bin2, TrUserData), + e_field_cart_items(Rest, Bin3, TrUserData); +e_field_cart_items([], Bin, _TrUserData) -> Bin. + +e_field_list_recommendations_request_product_ids([Elem | Rest], Bin, TrUserData) -> + Bin2 = <>, + Bin3 = e_type_string(id(Elem, TrUserData), Bin2, TrUserData), + e_field_list_recommendations_request_product_ids(Rest, Bin3, TrUserData); +e_field_list_recommendations_request_product_ids([], Bin, _TrUserData) -> Bin. + +e_field_list_recommendations_response_product_ids([Elem | Rest], Bin, TrUserData) -> + Bin2 = <>, + Bin3 = e_type_string(id(Elem, TrUserData), Bin2, TrUserData), + e_field_list_recommendations_response_product_ids(Rest, Bin3, TrUserData); +e_field_list_recommendations_response_product_ids([], Bin, _TrUserData) -> Bin. + +e_mfield_product_price_usd(Msg, Bin, TrUserData) -> + SubBin = encode_msg_money(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_field_product_categories([Elem | Rest], Bin, TrUserData) -> + Bin2 = <>, + Bin3 = e_type_string(id(Elem, TrUserData), Bin2, TrUserData), + e_field_product_categories(Rest, Bin3, TrUserData); +e_field_product_categories([], Bin, _TrUserData) -> Bin. + +e_mfield_list_products_response_products(Msg, Bin, TrUserData) -> + SubBin = encode_msg_product(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_field_list_products_response_products([Elem | Rest], Bin, TrUserData) -> + Bin2 = <>, + Bin3 = e_mfield_list_products_response_products(id(Elem, TrUserData), Bin2, TrUserData), + e_field_list_products_response_products(Rest, Bin3, TrUserData); +e_field_list_products_response_products([], Bin, _TrUserData) -> Bin. + +e_mfield_search_products_response_results(Msg, Bin, TrUserData) -> + SubBin = encode_msg_product(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_field_search_products_response_results([Elem | Rest], Bin, TrUserData) -> + Bin2 = <>, + Bin3 = e_mfield_search_products_response_results(id(Elem, TrUserData), Bin2, TrUserData), + e_field_search_products_response_results(Rest, Bin3, TrUserData); +e_field_search_products_response_results([], Bin, _TrUserData) -> Bin. + +e_mfield_get_quote_request_address(Msg, Bin, TrUserData) -> + SubBin = encode_msg_address(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_get_quote_request_items(Msg, Bin, TrUserData) -> + SubBin = encode_msg_cart_item(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_field_get_quote_request_items([Elem | Rest], Bin, TrUserData) -> + Bin2 = <>, + Bin3 = e_mfield_get_quote_request_items(id(Elem, TrUserData), Bin2, TrUserData), + e_field_get_quote_request_items(Rest, Bin3, TrUserData); +e_field_get_quote_request_items([], Bin, _TrUserData) -> Bin. + +e_mfield_get_quote_response_cost_usd(Msg, Bin, TrUserData) -> + SubBin = encode_msg_money(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_ship_order_request_address(Msg, Bin, TrUserData) -> + SubBin = encode_msg_address(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_ship_order_request_items(Msg, Bin, TrUserData) -> + SubBin = encode_msg_cart_item(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_field_ship_order_request_items([Elem | Rest], Bin, TrUserData) -> + Bin2 = <>, + Bin3 = e_mfield_ship_order_request_items(id(Elem, TrUserData), Bin2, TrUserData), + e_field_ship_order_request_items(Rest, Bin3, TrUserData); +e_field_ship_order_request_items([], Bin, _TrUserData) -> Bin. + +e_field_get_supported_currencies_response_currency_codes([Elem | Rest], Bin, TrUserData) -> + Bin2 = <>, + Bin3 = e_type_string(id(Elem, TrUserData), Bin2, TrUserData), + e_field_get_supported_currencies_response_currency_codes(Rest, Bin3, TrUserData); +e_field_get_supported_currencies_response_currency_codes([], Bin, _TrUserData) -> Bin. + +e_mfield_currency_conversion_request_from(Msg, Bin, TrUserData) -> + SubBin = encode_msg_money(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_charge_request_amount(Msg, Bin, TrUserData) -> + SubBin = encode_msg_money(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_charge_request_credit_card(Msg, Bin, TrUserData) -> + SubBin = encode_msg_credit_card_info(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_order_item_item(Msg, Bin, TrUserData) -> + SubBin = encode_msg_cart_item(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_order_item_cost(Msg, Bin, TrUserData) -> + SubBin = encode_msg_money(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_order_result_shipping_cost(Msg, Bin, TrUserData) -> + SubBin = encode_msg_money(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_order_result_shipping_address(Msg, Bin, TrUserData) -> + SubBin = encode_msg_address(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_order_result_items(Msg, Bin, TrUserData) -> + SubBin = encode_msg_order_item(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_field_order_result_items([Elem | Rest], Bin, TrUserData) -> + Bin2 = <>, + Bin3 = e_mfield_order_result_items(id(Elem, TrUserData), Bin2, TrUserData), + e_field_order_result_items(Rest, Bin3, TrUserData); +e_field_order_result_items([], Bin, _TrUserData) -> Bin. + +e_mfield_send_order_confirmation_request_order(Msg, Bin, TrUserData) -> + SubBin = encode_msg_order_result(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_place_order_request_address(Msg, Bin, TrUserData) -> + SubBin = encode_msg_address(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_place_order_request_credit_card(Msg, Bin, TrUserData) -> + SubBin = encode_msg_credit_card_info(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_place_order_response_order(Msg, Bin, TrUserData) -> + SubBin = encode_msg_order_result(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_field_ad_request_context_keys([Elem | Rest], Bin, TrUserData) -> + Bin2 = <>, + Bin3 = e_type_string(id(Elem, TrUserData), Bin2, TrUserData), + e_field_ad_request_context_keys(Rest, Bin3, TrUserData); +e_field_ad_request_context_keys([], Bin, _TrUserData) -> Bin. + +e_mfield_ad_response_ads(Msg, Bin, TrUserData) -> + SubBin = encode_msg_ad(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_field_ad_response_ads([Elem | Rest], Bin, TrUserData) -> + Bin2 = <>, + Bin3 = e_mfield_ad_response_ads(id(Elem, TrUserData), Bin2, TrUserData), + e_field_ad_response_ads(Rest, Bin3, TrUserData); +e_field_ad_response_ads([], Bin, _TrUserData) -> Bin. + +e_mfield_flag_created_at(Msg, Bin, TrUserData) -> + SubBin = encode_msg_timestamp(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_flag_updated_at(Msg, Bin, TrUserData) -> + SubBin = encode_msg_timestamp(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_get_flag_response_flag(Msg, Bin, TrUserData) -> + SubBin = encode_msg_flag(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_create_flag_response_flag(Msg, Bin, TrUserData) -> + SubBin = encode_msg_flag(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_mfield_list_flags_response_flag(Msg, Bin, TrUserData) -> + SubBin = encode_msg_flag(Msg, <<>>, TrUserData), + Bin2 = e_varint(byte_size(SubBin), Bin), + <>. + +e_field_list_flags_response_flag([Elem | Rest], Bin, TrUserData) -> + Bin2 = <>, + Bin3 = e_mfield_list_flags_response_flag(id(Elem, TrUserData), Bin2, TrUserData), + e_field_list_flags_response_flag(Rest, Bin3, TrUserData); +e_field_list_flags_response_flag([], Bin, _TrUserData) -> Bin. + +-compile({nowarn_unused_function,e_type_sint/3}). +e_type_sint(Value, Bin, _TrUserData) when Value >= 0 -> e_varint(Value * 2, Bin); +e_type_sint(Value, Bin, _TrUserData) -> e_varint(Value * -2 - 1, Bin). + +-compile({nowarn_unused_function,e_type_int32/3}). +e_type_int32(Value, Bin, _TrUserData) when 0 =< Value, Value =< 127 -> <>; +e_type_int32(Value, Bin, _TrUserData) -> + <> = <>, + e_varint(N, Bin). + +-compile({nowarn_unused_function,e_type_int64/3}). +e_type_int64(Value, Bin, _TrUserData) when 0 =< Value, Value =< 127 -> <>; +e_type_int64(Value, Bin, _TrUserData) -> + <> = <>, + e_varint(N, Bin). + +-compile({nowarn_unused_function,e_type_bool/3}). +e_type_bool(true, Bin, _TrUserData) -> <>; +e_type_bool(false, Bin, _TrUserData) -> <>; +e_type_bool(1, Bin, _TrUserData) -> <>; +e_type_bool(0, Bin, _TrUserData) -> <>. + +-compile({nowarn_unused_function,e_type_string/3}). +e_type_string(S, Bin, _TrUserData) -> + Utf8 = unicode:characters_to_binary(S), + Bin2 = e_varint(byte_size(Utf8), Bin), + <>. + +-compile({nowarn_unused_function,e_type_bytes/3}). +e_type_bytes(Bytes, Bin, _TrUserData) when is_binary(Bytes) -> + Bin2 = e_varint(byte_size(Bytes), Bin), + <>; +e_type_bytes(Bytes, Bin, _TrUserData) when is_list(Bytes) -> + BytesBin = iolist_to_binary(Bytes), + Bin2 = e_varint(byte_size(BytesBin), Bin), + <>. + +-compile({nowarn_unused_function,e_type_fixed32/3}). +e_type_fixed32(Value, Bin, _TrUserData) -> <>. + +-compile({nowarn_unused_function,e_type_sfixed32/3}). +e_type_sfixed32(Value, Bin, _TrUserData) -> <>. + +-compile({nowarn_unused_function,e_type_fixed64/3}). +e_type_fixed64(Value, Bin, _TrUserData) -> <>. + +-compile({nowarn_unused_function,e_type_sfixed64/3}). +e_type_sfixed64(Value, Bin, _TrUserData) -> <>. + +-compile({nowarn_unused_function,e_type_float/3}). +e_type_float(V, Bin, _) when is_number(V) -> <>; +e_type_float(infinity, Bin, _) -> <>; +e_type_float('-infinity', Bin, _) -> <>; +e_type_float(nan, Bin, _) -> <>. + +-compile({nowarn_unused_function,e_type_double/3}). +e_type_double(V, Bin, _) when is_number(V) -> <>; +e_type_double(infinity, Bin, _) -> <>; +e_type_double('-infinity', Bin, _) -> <>; +e_type_double(nan, Bin, _) -> <>. + +-compile({nowarn_unused_function,e_unknown_elems/2}). +e_unknown_elems([Elem | Rest], Bin) -> + BinR = case Elem of + {varint, FNum, N} -> + BinF = e_varint(FNum bsl 3, Bin), + e_varint(N, BinF); + {length_delimited, FNum, Data} -> + BinF = e_varint(FNum bsl 3 bor 2, Bin), + BinL = e_varint(byte_size(Data), BinF), + <>; + {group, FNum, GroupFields} -> + Bin1 = e_varint(FNum bsl 3 bor 3, Bin), + Bin2 = e_unknown_elems(GroupFields, Bin1), + e_varint(FNum bsl 3 bor 4, Bin2); + {fixed32, FNum, V} -> + BinF = e_varint(FNum bsl 3 bor 5, Bin), + <>; + {fixed64, FNum, V} -> + BinF = e_varint(FNum bsl 3 bor 1, Bin), + <> + end, + e_unknown_elems(Rest, BinR); +e_unknown_elems([], Bin) -> Bin. + +-compile({nowarn_unused_function,e_varint/3}). +e_varint(N, Bin, _TrUserData) -> e_varint(N, Bin). + +-compile({nowarn_unused_function,e_varint/2}). +e_varint(N, Bin) when N =< 127 -> <>; +e_varint(N, Bin) -> + Bin2 = <>, + e_varint(N bsr 7, Bin2). + +is_empty_string("") -> true; +is_empty_string(<<>>) -> true; +is_empty_string(L) when is_list(L) -> not string_has_chars(L); +is_empty_string(B) when is_binary(B) -> false. + +string_has_chars([C | _]) when is_integer(C) -> true; +string_has_chars([H | T]) -> + case string_has_chars(H) of + true -> true; + false -> string_has_chars(T) + end; +string_has_chars(B) when is_binary(B), byte_size(B) =/= 0 -> true; +string_has_chars(C) when is_integer(C) -> true; +string_has_chars(<<>>) -> false; +string_has_chars([]) -> false. + + +decode_msg(Bin, MsgName) when is_binary(Bin) -> decode_msg(Bin, MsgName, []). + +decode_msg(Bin, MsgName, Opts) when is_binary(Bin) -> + TrUserData = proplists:get_value(user_data, Opts), + decode_msg_1_catch(Bin, MsgName, TrUserData). + +-ifdef('OTP_RELEASE'). +decode_msg_1_catch(Bin, MsgName, TrUserData) -> + try decode_msg_2_doit(MsgName, Bin, TrUserData) + catch + error:{gpb_error,_}=Reason:StackTrace -> + erlang:raise(error, Reason, StackTrace); + Class:Reason:StackTrace -> error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}}) + end. +-else. +decode_msg_1_catch(Bin, MsgName, TrUserData) -> + try decode_msg_2_doit(MsgName, Bin, TrUserData) + catch + error:{gpb_error,_}=Reason -> + erlang:raise(error, Reason, + erlang:get_stacktrace()); + Class:Reason -> + StackTrace = erlang:get_stacktrace(), + error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}}) + end. +-endif. + +decode_msg_2_doit(cart_item, Bin, TrUserData) -> id(decode_msg_cart_item(Bin, TrUserData), TrUserData); +decode_msg_2_doit(add_item_request, Bin, TrUserData) -> id(decode_msg_add_item_request(Bin, TrUserData), TrUserData); +decode_msg_2_doit(empty_cart_request, Bin, TrUserData) -> id(decode_msg_empty_cart_request(Bin, TrUserData), TrUserData); +decode_msg_2_doit(get_cart_request, Bin, TrUserData) -> id(decode_msg_get_cart_request(Bin, TrUserData), TrUserData); +decode_msg_2_doit(cart, Bin, TrUserData) -> id(decode_msg_cart(Bin, TrUserData), TrUserData); +decode_msg_2_doit(empty, Bin, TrUserData) -> id(decode_msg_empty(Bin, TrUserData), TrUserData); +decode_msg_2_doit(list_recommendations_request, Bin, TrUserData) -> id(decode_msg_list_recommendations_request(Bin, TrUserData), TrUserData); +decode_msg_2_doit(list_recommendations_response, Bin, TrUserData) -> id(decode_msg_list_recommendations_response(Bin, TrUserData), TrUserData); +decode_msg_2_doit(product, Bin, TrUserData) -> id(decode_msg_product(Bin, TrUserData), TrUserData); +decode_msg_2_doit(list_products_response, Bin, TrUserData) -> id(decode_msg_list_products_response(Bin, TrUserData), TrUserData); +decode_msg_2_doit(get_product_request, Bin, TrUserData) -> id(decode_msg_get_product_request(Bin, TrUserData), TrUserData); +decode_msg_2_doit(search_products_request, Bin, TrUserData) -> id(decode_msg_search_products_request(Bin, TrUserData), TrUserData); +decode_msg_2_doit(search_products_response, Bin, TrUserData) -> id(decode_msg_search_products_response(Bin, TrUserData), TrUserData); +decode_msg_2_doit(get_quote_request, Bin, TrUserData) -> id(decode_msg_get_quote_request(Bin, TrUserData), TrUserData); +decode_msg_2_doit(get_quote_response, Bin, TrUserData) -> id(decode_msg_get_quote_response(Bin, TrUserData), TrUserData); +decode_msg_2_doit(ship_order_request, Bin, TrUserData) -> id(decode_msg_ship_order_request(Bin, TrUserData), TrUserData); +decode_msg_2_doit(ship_order_response, Bin, TrUserData) -> id(decode_msg_ship_order_response(Bin, TrUserData), TrUserData); +decode_msg_2_doit(address, Bin, TrUserData) -> id(decode_msg_address(Bin, TrUserData), TrUserData); +decode_msg_2_doit(money, Bin, TrUserData) -> id(decode_msg_money(Bin, TrUserData), TrUserData); +decode_msg_2_doit(get_supported_currencies_response, Bin, TrUserData) -> id(decode_msg_get_supported_currencies_response(Bin, TrUserData), TrUserData); +decode_msg_2_doit(currency_conversion_request, Bin, TrUserData) -> id(decode_msg_currency_conversion_request(Bin, TrUserData), TrUserData); +decode_msg_2_doit(credit_card_info, Bin, TrUserData) -> id(decode_msg_credit_card_info(Bin, TrUserData), TrUserData); +decode_msg_2_doit(charge_request, Bin, TrUserData) -> id(decode_msg_charge_request(Bin, TrUserData), TrUserData); +decode_msg_2_doit(charge_response, Bin, TrUserData) -> id(decode_msg_charge_response(Bin, TrUserData), TrUserData); +decode_msg_2_doit(order_item, Bin, TrUserData) -> id(decode_msg_order_item(Bin, TrUserData), TrUserData); +decode_msg_2_doit(order_result, Bin, TrUserData) -> id(decode_msg_order_result(Bin, TrUserData), TrUserData); +decode_msg_2_doit(send_order_confirmation_request, Bin, TrUserData) -> id(decode_msg_send_order_confirmation_request(Bin, TrUserData), TrUserData); +decode_msg_2_doit(place_order_request, Bin, TrUserData) -> id(decode_msg_place_order_request(Bin, TrUserData), TrUserData); +decode_msg_2_doit(place_order_response, Bin, TrUserData) -> id(decode_msg_place_order_response(Bin, TrUserData), TrUserData); +decode_msg_2_doit(ad_request, Bin, TrUserData) -> id(decode_msg_ad_request(Bin, TrUserData), TrUserData); +decode_msg_2_doit(ad_response, Bin, TrUserData) -> id(decode_msg_ad_response(Bin, TrUserData), TrUserData); +decode_msg_2_doit(ad, Bin, TrUserData) -> id(decode_msg_ad(Bin, TrUserData), TrUserData); +decode_msg_2_doit(flag, Bin, TrUserData) -> id(decode_msg_flag(Bin, TrUserData), TrUserData); +decode_msg_2_doit(get_flag_request, Bin, TrUserData) -> id(decode_msg_get_flag_request(Bin, TrUserData), TrUserData); +decode_msg_2_doit(get_flag_response, Bin, TrUserData) -> id(decode_msg_get_flag_response(Bin, TrUserData), TrUserData); +decode_msg_2_doit(create_flag_request, Bin, TrUserData) -> id(decode_msg_create_flag_request(Bin, TrUserData), TrUserData); +decode_msg_2_doit(create_flag_response, Bin, TrUserData) -> id(decode_msg_create_flag_response(Bin, TrUserData), TrUserData); +decode_msg_2_doit(update_flag_request, Bin, TrUserData) -> id(decode_msg_update_flag_request(Bin, TrUserData), TrUserData); +decode_msg_2_doit(update_flag_response, Bin, TrUserData) -> id(decode_msg_update_flag_response(Bin, TrUserData), TrUserData); +decode_msg_2_doit(list_flags_request, Bin, TrUserData) -> id(decode_msg_list_flags_request(Bin, TrUserData), TrUserData); +decode_msg_2_doit(list_flags_response, Bin, TrUserData) -> id(decode_msg_list_flags_response(Bin, TrUserData), TrUserData); +decode_msg_2_doit(delete_flag_request, Bin, TrUserData) -> id(decode_msg_delete_flag_request(Bin, TrUserData), TrUserData); +decode_msg_2_doit(delete_flag_response, Bin, TrUserData) -> id(decode_msg_delete_flag_response(Bin, TrUserData), TrUserData); +decode_msg_2_doit(timestamp, Bin, TrUserData) -> id(decode_msg_timestamp(Bin, TrUserData), TrUserData). + + + +decode_msg_cart_item(Bin, TrUserData) -> dfp_read_field_def_cart_item(Bin, 0, 0, 0, id(<<>>, TrUserData), id(0, TrUserData), TrUserData). + +dfp_read_field_def_cart_item(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_cart_item_product_id(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_cart_item(<<16, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_cart_item_quantity(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_cart_item(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{product_id => F@_1, quantity => F@_2}; +dfp_read_field_def_cart_item(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_cart_item(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). + +dg_read_field_def_cart_item(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_cart_item(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +dg_read_field_def_cart_item(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_cart_item_product_id(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + 16 -> d_field_cart_item_quantity(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_cart_item(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 1 -> skip_64_cart_item(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 2 -> skip_length_delimited_cart_item(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 3 -> skip_group_cart_item(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 5 -> skip_32_cart_item(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) + end + end; +dg_read_field_def_cart_item(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{product_id => F@_1, quantity => F@_2}. + +d_field_cart_item_product_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_cart_item_product_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_cart_item_product_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_cart_item(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). + +d_field_cart_item_quantity(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_cart_item_quantity(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_cart_item_quantity(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> + {NewFValue, RestF} = {begin <> = <<(X bsl N + Acc):32/unsigned-native>>, id(Res, TrUserData) end, Rest}, + dfp_read_field_def_cart_item(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). + +skip_varint_cart_item(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_cart_item(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +skip_varint_cart_item(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_cart_item(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_length_delimited_cart_item(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_cart_item(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +skip_length_delimited_cart_item(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_cart_item(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). + +skip_group_cart_item(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_cart_item(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). + +skip_32_cart_item(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_cart_item(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_64_cart_item(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_cart_item(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +decode_msg_add_item_request(Bin, TrUserData) -> dfp_read_field_def_add_item_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id('$undef', TrUserData), TrUserData). + +dfp_read_field_def_add_item_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_add_item_request_user_id(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_add_item_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_add_item_request_item(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_add_item_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> + S1 = #{user_id => F@_1}, + if F@_2 == '$undef' -> S1; + true -> S1#{item => F@_2} + end; +dfp_read_field_def_add_item_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_add_item_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). + +dg_read_field_def_add_item_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_add_item_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +dg_read_field_def_add_item_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_add_item_request_user_id(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + 18 -> d_field_add_item_request_item(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_add_item_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 1 -> skip_64_add_item_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 2 -> skip_length_delimited_add_item_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 3 -> skip_group_add_item_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 5 -> skip_32_add_item_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) + end + end; +dg_read_field_def_add_item_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> + S1 = #{user_id => F@_1}, + if F@_2 == '$undef' -> S1; + true -> S1#{item => F@_2} + end. + +d_field_add_item_request_user_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_add_item_request_user_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_add_item_request_user_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_add_item_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). + +d_field_add_item_request_item(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_add_item_request_item(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_add_item_request_item(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, Prev, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_cart_item(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_add_item_request(RestF, + 0, + 0, + F, + F@_1, + if Prev == '$undef' -> NewFValue; + true -> merge_msg_cart_item(Prev, NewFValue, TrUserData) + end, + TrUserData). + +skip_varint_add_item_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_add_item_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +skip_varint_add_item_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_add_item_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_length_delimited_add_item_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_add_item_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +skip_length_delimited_add_item_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_add_item_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). + +skip_group_add_item_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_add_item_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). + +skip_32_add_item_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_add_item_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_64_add_item_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_add_item_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +decode_msg_empty_cart_request(Bin, TrUserData) -> dfp_read_field_def_empty_cart_request(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). + +dfp_read_field_def_empty_cart_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_empty_cart_request_user_id(Rest, Z1, Z2, F, F@_1, TrUserData); +dfp_read_field_def_empty_cart_request(<<>>, 0, 0, _, F@_1, _) -> #{user_id => F@_1}; +dfp_read_field_def_empty_cart_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_empty_cart_request(Other, Z1, Z2, F, F@_1, TrUserData). + +dg_read_field_def_empty_cart_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_empty_cart_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +dg_read_field_def_empty_cart_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_empty_cart_request_user_id(Rest, 0, 0, 0, F@_1, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_empty_cart_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 1 -> skip_64_empty_cart_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 2 -> skip_length_delimited_empty_cart_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 3 -> skip_group_empty_cart_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 5 -> skip_32_empty_cart_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) + end + end; +dg_read_field_def_empty_cart_request(<<>>, 0, 0, _, F@_1, _) -> #{user_id => F@_1}. + +d_field_empty_cart_request_user_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_empty_cart_request_user_id(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +d_field_empty_cart_request_user_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_empty_cart_request(RestF, 0, 0, F, NewFValue, TrUserData). + +skip_varint_empty_cart_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_empty_cart_request(Rest, Z1, Z2, F, F@_1, TrUserData); +skip_varint_empty_cart_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_empty_cart_request(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_length_delimited_empty_cart_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_empty_cart_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +skip_length_delimited_empty_cart_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_empty_cart_request(Rest2, 0, 0, F, F@_1, TrUserData). + +skip_group_empty_cart_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_empty_cart_request(Rest, 0, Z2, FNum, F@_1, TrUserData). + +skip_32_empty_cart_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_empty_cart_request(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_64_empty_cart_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_empty_cart_request(Rest, Z1, Z2, F, F@_1, TrUserData). + +decode_msg_get_cart_request(Bin, TrUserData) -> dfp_read_field_def_get_cart_request(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). + +dfp_read_field_def_get_cart_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_get_cart_request_user_id(Rest, Z1, Z2, F, F@_1, TrUserData); +dfp_read_field_def_get_cart_request(<<>>, 0, 0, _, F@_1, _) -> #{user_id => F@_1}; +dfp_read_field_def_get_cart_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_get_cart_request(Other, Z1, Z2, F, F@_1, TrUserData). + +dg_read_field_def_get_cart_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_get_cart_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +dg_read_field_def_get_cart_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_get_cart_request_user_id(Rest, 0, 0, 0, F@_1, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_get_cart_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 1 -> skip_64_get_cart_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 2 -> skip_length_delimited_get_cart_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 3 -> skip_group_get_cart_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 5 -> skip_32_get_cart_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) + end + end; +dg_read_field_def_get_cart_request(<<>>, 0, 0, _, F@_1, _) -> #{user_id => F@_1}. + +d_field_get_cart_request_user_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_get_cart_request_user_id(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +d_field_get_cart_request_user_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_get_cart_request(RestF, 0, 0, F, NewFValue, TrUserData). + +skip_varint_get_cart_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_get_cart_request(Rest, Z1, Z2, F, F@_1, TrUserData); +skip_varint_get_cart_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_cart_request(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_length_delimited_get_cart_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_get_cart_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +skip_length_delimited_get_cart_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_get_cart_request(Rest2, 0, 0, F, F@_1, TrUserData). + +skip_group_get_cart_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_get_cart_request(Rest, 0, Z2, FNum, F@_1, TrUserData). + +skip_32_get_cart_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_cart_request(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_64_get_cart_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_cart_request(Rest, Z1, Z2, F, F@_1, TrUserData). + +decode_msg_cart(Bin, TrUserData) -> dfp_read_field_def_cart(Bin, 0, 0, 0, id(<<>>, TrUserData), id([], TrUserData), TrUserData). + +dfp_read_field_def_cart(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_cart_user_id(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_cart(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_cart_items(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_cart(<<>>, 0, 0, _, F@_1, R1, TrUserData) -> + S1 = #{user_id => F@_1}, + if R1 == '$undef' -> S1; + true -> S1#{items => lists_reverse(R1, TrUserData)} + end; +dfp_read_field_def_cart(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_cart(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). + +dg_read_field_def_cart(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_cart(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +dg_read_field_def_cart(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_cart_user_id(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + 18 -> d_field_cart_items(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_cart(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 1 -> skip_64_cart(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 2 -> skip_length_delimited_cart(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 3 -> skip_group_cart(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 5 -> skip_32_cart(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) + end + end; +dg_read_field_def_cart(<<>>, 0, 0, _, F@_1, R1, TrUserData) -> + S1 = #{user_id => F@_1}, + if R1 == '$undef' -> S1; + true -> S1#{items => lists_reverse(R1, TrUserData)} + end. + +d_field_cart_user_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_cart_user_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_cart_user_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_cart(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). + +d_field_cart_items(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_cart_items(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_cart_items(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, Prev, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_cart_item(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_cart(RestF, 0, 0, F, F@_1, cons(NewFValue, Prev, TrUserData), TrUserData). + +skip_varint_cart(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_cart(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +skip_varint_cart(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_cart(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_length_delimited_cart(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_cart(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +skip_length_delimited_cart(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_cart(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). + +skip_group_cart(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_cart(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). + +skip_32_cart(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_cart(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_64_cart(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_cart(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +decode_msg_empty(Bin, TrUserData) -> dfp_read_field_def_empty(Bin, 0, 0, 0, TrUserData). + +dfp_read_field_def_empty(<<>>, 0, 0, _, _) -> #{}; +dfp_read_field_def_empty(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_empty(Other, Z1, Z2, F, TrUserData). + +dg_read_field_def_empty(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_empty(Rest, N + 7, X bsl N + Acc, F, TrUserData); +dg_read_field_def_empty(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) -> + Key = X bsl N + Acc, + case Key band 7 of + 0 -> skip_varint_empty(Rest, 0, 0, Key bsr 3, TrUserData); + 1 -> skip_64_empty(Rest, 0, 0, Key bsr 3, TrUserData); + 2 -> skip_length_delimited_empty(Rest, 0, 0, Key bsr 3, TrUserData); + 3 -> skip_group_empty(Rest, 0, 0, Key bsr 3, TrUserData); + 5 -> skip_32_empty(Rest, 0, 0, Key bsr 3, TrUserData) + end; +dg_read_field_def_empty(<<>>, 0, 0, _, _) -> #{}. + +skip_varint_empty(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_empty(Rest, Z1, Z2, F, TrUserData); +skip_varint_empty(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). + +skip_length_delimited_empty(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_empty(Rest, N + 7, X bsl N + Acc, F, TrUserData); +skip_length_delimited_empty(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_empty(Rest2, 0, 0, F, TrUserData). + +skip_group_empty(Bin, _, Z2, FNum, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_empty(Rest, 0, Z2, FNum, TrUserData). + +skip_32_empty(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). + +skip_64_empty(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_empty(Rest, Z1, Z2, F, TrUserData). + +decode_msg_list_recommendations_request(Bin, TrUserData) -> dfp_read_field_def_list_recommendations_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id([], TrUserData), TrUserData). + +dfp_read_field_def_list_recommendations_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_list_recommendations_request_user_id(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_list_recommendations_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_list_recommendations_request_product_ids(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_list_recommendations_request(<<>>, 0, 0, _, F@_1, R1, TrUserData) -> #{user_id => F@_1, product_ids => lists_reverse(R1, TrUserData)}; +dfp_read_field_def_list_recommendations_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_list_recommendations_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). + +dg_read_field_def_list_recommendations_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_recommendations_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +dg_read_field_def_list_recommendations_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_list_recommendations_request_user_id(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + 18 -> d_field_list_recommendations_request_product_ids(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_list_recommendations_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 1 -> skip_64_list_recommendations_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 2 -> skip_length_delimited_list_recommendations_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 3 -> skip_group_list_recommendations_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 5 -> skip_32_list_recommendations_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) + end + end; +dg_read_field_def_list_recommendations_request(<<>>, 0, 0, _, F@_1, R1, TrUserData) -> #{user_id => F@_1, product_ids => lists_reverse(R1, TrUserData)}. + +d_field_list_recommendations_request_user_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_list_recommendations_request_user_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_list_recommendations_request_user_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_list_recommendations_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). + +d_field_list_recommendations_request_product_ids(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_list_recommendations_request_product_ids(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_list_recommendations_request_product_ids(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, Prev, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_list_recommendations_request(RestF, 0, 0, F, F@_1, cons(NewFValue, Prev, TrUserData), TrUserData). + +skip_varint_list_recommendations_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_list_recommendations_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +skip_varint_list_recommendations_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_list_recommendations_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_length_delimited_list_recommendations_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_list_recommendations_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +skip_length_delimited_list_recommendations_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_list_recommendations_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). + +skip_group_list_recommendations_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_list_recommendations_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). + +skip_32_list_recommendations_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_list_recommendations_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_64_list_recommendations_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_list_recommendations_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +decode_msg_list_recommendations_response(Bin, TrUserData) -> dfp_read_field_def_list_recommendations_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). + +dfp_read_field_def_list_recommendations_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_recommendations_response_product_ids(Rest, Z1, Z2, F, F@_1, TrUserData); +dfp_read_field_def_list_recommendations_response(<<>>, 0, 0, _, R1, TrUserData) -> #{product_ids => lists_reverse(R1, TrUserData)}; +dfp_read_field_def_list_recommendations_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_recommendations_response(Other, Z1, Z2, F, F@_1, TrUserData). + +dg_read_field_def_list_recommendations_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_recommendations_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +dg_read_field_def_list_recommendations_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_list_recommendations_response_product_ids(Rest, 0, 0, 0, F@_1, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_list_recommendations_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 1 -> skip_64_list_recommendations_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 2 -> skip_length_delimited_list_recommendations_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 3 -> skip_group_list_recommendations_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 5 -> skip_32_list_recommendations_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) + end + end; +dg_read_field_def_list_recommendations_response(<<>>, 0, 0, _, R1, TrUserData) -> #{product_ids => lists_reverse(R1, TrUserData)}. + +d_field_list_recommendations_response_product_ids(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_recommendations_response_product_ids(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +d_field_list_recommendations_response_product_ids(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_list_recommendations_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). + +skip_varint_list_recommendations_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_recommendations_response(Rest, Z1, Z2, F, F@_1, TrUserData); +skip_varint_list_recommendations_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_recommendations_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_length_delimited_list_recommendations_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_recommendations_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +skip_length_delimited_list_recommendations_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_list_recommendations_response(Rest2, 0, 0, F, F@_1, TrUserData). + +skip_group_list_recommendations_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_list_recommendations_response(Rest, 0, Z2, FNum, F@_1, TrUserData). + +skip_32_list_recommendations_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_recommendations_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_64_list_recommendations_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_recommendations_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +decode_msg_product(Bin, TrUserData) -> dfp_read_field_def_product(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), id('$undef', TrUserData), id([], TrUserData), TrUserData). + +dfp_read_field_def_product(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) -> d_field_product_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); +dfp_read_field_def_product(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) -> d_field_product_name(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); +dfp_read_field_def_product(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) -> d_field_product_description(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); +dfp_read_field_def_product(<<34, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) -> d_field_product_picture(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); +dfp_read_field_def_product(<<42, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) -> d_field_product_price_usd(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); +dfp_read_field_def_product(<<50, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) -> d_field_product_categories(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); +dfp_read_field_def_product(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, F@_5, R1, TrUserData) -> + S1 = #{id => F@_1, name => F@_2, description => F@_3, picture => F@_4, categories => lists_reverse(R1, TrUserData)}, + if F@_5 == '$undef' -> S1; + true -> S1#{price_usd => F@_5} + end; +dfp_read_field_def_product(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) -> dg_read_field_def_product(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData). + +dg_read_field_def_product(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) when N < 32 - 7 -> dg_read_field_def_product(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); +dg_read_field_def_product(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_product_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); + 18 -> d_field_product_name(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); + 26 -> d_field_product_description(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); + 34 -> d_field_product_picture(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); + 42 -> d_field_product_price_usd(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); + 50 -> d_field_product_categories(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_product(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); + 1 -> skip_64_product(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); + 2 -> skip_length_delimited_product(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); + 3 -> skip_group_product(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); + 5 -> skip_32_product(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) + end + end; +dg_read_field_def_product(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, F@_5, R1, TrUserData) -> + S1 = #{id => F@_1, name => F@_2, description => F@_3, picture => F@_4, categories => lists_reverse(R1, TrUserData)}, + if F@_5 == '$undef' -> S1; + true -> S1#{price_usd => F@_5} + end. + +d_field_product_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) when N < 57 -> d_field_product_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); +d_field_product_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_product(RestF, 0, 0, F, NewFValue, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData). + +d_field_product_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) when N < 57 -> d_field_product_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); +d_field_product_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, F@_4, F@_5, F@_6, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_product(RestF, 0, 0, F, F@_1, NewFValue, F@_3, F@_4, F@_5, F@_6, TrUserData). + +d_field_product_description(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) when N < 57 -> d_field_product_description(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); +d_field_product_description(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, F@_4, F@_5, F@_6, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_product(RestF, 0, 0, F, F@_1, F@_2, NewFValue, F@_4, F@_5, F@_6, TrUserData). + +d_field_product_picture(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) when N < 57 -> d_field_product_picture(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); +d_field_product_picture(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, _, F@_5, F@_6, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_product(RestF, 0, 0, F, F@_1, F@_2, F@_3, NewFValue, F@_5, F@_6, TrUserData). + +d_field_product_price_usd(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) when N < 57 -> d_field_product_price_usd(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); +d_field_product_price_usd(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, Prev, F@_6, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_money(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_product(RestF, + 0, + 0, + F, + F@_1, + F@_2, + F@_3, + F@_4, + if Prev == '$undef' -> NewFValue; + true -> merge_msg_money(Prev, NewFValue, TrUserData) + end, + F@_6, + TrUserData). + +d_field_product_categories(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) when N < 57 -> d_field_product_categories(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); +d_field_product_categories(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, Prev, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_product(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, cons(NewFValue, Prev, TrUserData), TrUserData). + +skip_varint_product(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) -> skip_varint_product(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); +skip_varint_product(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) -> dfp_read_field_def_product(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData). + +skip_length_delimited_product(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) when N < 57 -> skip_length_delimited_product(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData); +skip_length_delimited_product(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_product(Rest2, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData). + +skip_group_product(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_product(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData). + +skip_32_product(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) -> dfp_read_field_def_product(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData). + +skip_64_product(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData) -> dfp_read_field_def_product(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, F@_6, TrUserData). + +decode_msg_list_products_response(Bin, TrUserData) -> dfp_read_field_def_list_products_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). + +dfp_read_field_def_list_products_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_products_response_products(Rest, Z1, Z2, F, F@_1, TrUserData); +dfp_read_field_def_list_products_response(<<>>, 0, 0, _, R1, TrUserData) -> + S1 = #{}, + if R1 == '$undef' -> S1; + true -> S1#{products => lists_reverse(R1, TrUserData)} + end; +dfp_read_field_def_list_products_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_products_response(Other, Z1, Z2, F, F@_1, TrUserData). + +dg_read_field_def_list_products_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_products_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +dg_read_field_def_list_products_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_list_products_response_products(Rest, 0, 0, 0, F@_1, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_list_products_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 1 -> skip_64_list_products_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 2 -> skip_length_delimited_list_products_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 3 -> skip_group_list_products_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 5 -> skip_32_list_products_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) + end + end; +dg_read_field_def_list_products_response(<<>>, 0, 0, _, R1, TrUserData) -> + S1 = #{}, + if R1 == '$undef' -> S1; + true -> S1#{products => lists_reverse(R1, TrUserData)} + end. + +d_field_list_products_response_products(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_products_response_products(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +d_field_list_products_response_products(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_product(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_list_products_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). + +skip_varint_list_products_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_products_response(Rest, Z1, Z2, F, F@_1, TrUserData); +skip_varint_list_products_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_products_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_length_delimited_list_products_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_products_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +skip_length_delimited_list_products_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_list_products_response(Rest2, 0, 0, F, F@_1, TrUserData). + +skip_group_list_products_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_list_products_response(Rest, 0, Z2, FNum, F@_1, TrUserData). + +skip_32_list_products_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_products_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_64_list_products_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_products_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +decode_msg_get_product_request(Bin, TrUserData) -> dfp_read_field_def_get_product_request(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). + +dfp_read_field_def_get_product_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_get_product_request_id(Rest, Z1, Z2, F, F@_1, TrUserData); +dfp_read_field_def_get_product_request(<<>>, 0, 0, _, F@_1, _) -> #{id => F@_1}; +dfp_read_field_def_get_product_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_get_product_request(Other, Z1, Z2, F, F@_1, TrUserData). + +dg_read_field_def_get_product_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_get_product_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +dg_read_field_def_get_product_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_get_product_request_id(Rest, 0, 0, 0, F@_1, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_get_product_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 1 -> skip_64_get_product_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 2 -> skip_length_delimited_get_product_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 3 -> skip_group_get_product_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 5 -> skip_32_get_product_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) + end + end; +dg_read_field_def_get_product_request(<<>>, 0, 0, _, F@_1, _) -> #{id => F@_1}. + +d_field_get_product_request_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_get_product_request_id(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +d_field_get_product_request_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_get_product_request(RestF, 0, 0, F, NewFValue, TrUserData). + +skip_varint_get_product_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_get_product_request(Rest, Z1, Z2, F, F@_1, TrUserData); +skip_varint_get_product_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_product_request(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_length_delimited_get_product_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_get_product_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +skip_length_delimited_get_product_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_get_product_request(Rest2, 0, 0, F, F@_1, TrUserData). + +skip_group_get_product_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_get_product_request(Rest, 0, Z2, FNum, F@_1, TrUserData). + +skip_32_get_product_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_product_request(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_64_get_product_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_product_request(Rest, Z1, Z2, F, F@_1, TrUserData). + +decode_msg_search_products_request(Bin, TrUserData) -> dfp_read_field_def_search_products_request(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). + +dfp_read_field_def_search_products_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_search_products_request_query(Rest, Z1, Z2, F, F@_1, TrUserData); +dfp_read_field_def_search_products_request(<<>>, 0, 0, _, F@_1, _) -> #{query => F@_1}; +dfp_read_field_def_search_products_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_search_products_request(Other, Z1, Z2, F, F@_1, TrUserData). + +dg_read_field_def_search_products_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_search_products_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +dg_read_field_def_search_products_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_search_products_request_query(Rest, 0, 0, 0, F@_1, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_search_products_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 1 -> skip_64_search_products_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 2 -> skip_length_delimited_search_products_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 3 -> skip_group_search_products_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 5 -> skip_32_search_products_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) + end + end; +dg_read_field_def_search_products_request(<<>>, 0, 0, _, F@_1, _) -> #{query => F@_1}. + +d_field_search_products_request_query(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_search_products_request_query(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +d_field_search_products_request_query(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_search_products_request(RestF, 0, 0, F, NewFValue, TrUserData). + +skip_varint_search_products_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_search_products_request(Rest, Z1, Z2, F, F@_1, TrUserData); +skip_varint_search_products_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_search_products_request(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_length_delimited_search_products_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_search_products_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +skip_length_delimited_search_products_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_search_products_request(Rest2, 0, 0, F, F@_1, TrUserData). + +skip_group_search_products_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_search_products_request(Rest, 0, Z2, FNum, F@_1, TrUserData). + +skip_32_search_products_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_search_products_request(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_64_search_products_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_search_products_request(Rest, Z1, Z2, F, F@_1, TrUserData). + +decode_msg_search_products_response(Bin, TrUserData) -> dfp_read_field_def_search_products_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). + +dfp_read_field_def_search_products_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_search_products_response_results(Rest, Z1, Z2, F, F@_1, TrUserData); +dfp_read_field_def_search_products_response(<<>>, 0, 0, _, R1, TrUserData) -> + S1 = #{}, + if R1 == '$undef' -> S1; + true -> S1#{results => lists_reverse(R1, TrUserData)} + end; +dfp_read_field_def_search_products_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_search_products_response(Other, Z1, Z2, F, F@_1, TrUserData). + +dg_read_field_def_search_products_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_search_products_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +dg_read_field_def_search_products_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_search_products_response_results(Rest, 0, 0, 0, F@_1, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_search_products_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 1 -> skip_64_search_products_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 2 -> skip_length_delimited_search_products_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 3 -> skip_group_search_products_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 5 -> skip_32_search_products_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) + end + end; +dg_read_field_def_search_products_response(<<>>, 0, 0, _, R1, TrUserData) -> + S1 = #{}, + if R1 == '$undef' -> S1; + true -> S1#{results => lists_reverse(R1, TrUserData)} + end. + +d_field_search_products_response_results(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_search_products_response_results(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +d_field_search_products_response_results(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_product(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_search_products_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). + +skip_varint_search_products_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_search_products_response(Rest, Z1, Z2, F, F@_1, TrUserData); +skip_varint_search_products_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_search_products_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_length_delimited_search_products_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_search_products_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +skip_length_delimited_search_products_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_search_products_response(Rest2, 0, 0, F, F@_1, TrUserData). + +skip_group_search_products_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_search_products_response(Rest, 0, Z2, FNum, F@_1, TrUserData). + +skip_32_search_products_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_search_products_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_64_search_products_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_search_products_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +decode_msg_get_quote_request(Bin, TrUserData) -> dfp_read_field_def_get_quote_request(Bin, 0, 0, 0, id('$undef', TrUserData), id([], TrUserData), TrUserData). + +dfp_read_field_def_get_quote_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_get_quote_request_address(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_get_quote_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_get_quote_request_items(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_get_quote_request(<<>>, 0, 0, _, F@_1, R1, TrUserData) -> + S1 = #{}, + S2 = if F@_1 == '$undef' -> S1; + true -> S1#{address => F@_1} + end, + if R1 == '$undef' -> S2; + true -> S2#{items => lists_reverse(R1, TrUserData)} + end; +dfp_read_field_def_get_quote_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_get_quote_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). + +dg_read_field_def_get_quote_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_get_quote_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +dg_read_field_def_get_quote_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_get_quote_request_address(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + 18 -> d_field_get_quote_request_items(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_get_quote_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 1 -> skip_64_get_quote_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 2 -> skip_length_delimited_get_quote_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 3 -> skip_group_get_quote_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 5 -> skip_32_get_quote_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) + end + end; +dg_read_field_def_get_quote_request(<<>>, 0, 0, _, F@_1, R1, TrUserData) -> + S1 = #{}, + S2 = if F@_1 == '$undef' -> S1; + true -> S1#{address => F@_1} + end, + if R1 == '$undef' -> S2; + true -> S2#{items => lists_reverse(R1, TrUserData)} + end. + +d_field_get_quote_request_address(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_get_quote_request_address(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_get_quote_request_address(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, F@_2, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_address(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_get_quote_request(RestF, + 0, + 0, + F, + if Prev == '$undef' -> NewFValue; + true -> merge_msg_address(Prev, NewFValue, TrUserData) + end, + F@_2, + TrUserData). + +d_field_get_quote_request_items(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_get_quote_request_items(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_get_quote_request_items(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, Prev, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_cart_item(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_get_quote_request(RestF, 0, 0, F, F@_1, cons(NewFValue, Prev, TrUserData), TrUserData). + +skip_varint_get_quote_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_get_quote_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +skip_varint_get_quote_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_quote_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_length_delimited_get_quote_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_get_quote_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +skip_length_delimited_get_quote_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_get_quote_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). + +skip_group_get_quote_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_get_quote_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). + +skip_32_get_quote_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_quote_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_64_get_quote_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_get_quote_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +decode_msg_get_quote_response(Bin, TrUserData) -> dfp_read_field_def_get_quote_response(Bin, 0, 0, 0, id('$undef', TrUserData), TrUserData). + +dfp_read_field_def_get_quote_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_get_quote_response_cost_usd(Rest, Z1, Z2, F, F@_1, TrUserData); +dfp_read_field_def_get_quote_response(<<>>, 0, 0, _, F@_1, _) -> + S1 = #{}, + if F@_1 == '$undef' -> S1; + true -> S1#{cost_usd => F@_1} + end; +dfp_read_field_def_get_quote_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_get_quote_response(Other, Z1, Z2, F, F@_1, TrUserData). + +dg_read_field_def_get_quote_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_get_quote_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +dg_read_field_def_get_quote_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_get_quote_response_cost_usd(Rest, 0, 0, 0, F@_1, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_get_quote_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 1 -> skip_64_get_quote_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 2 -> skip_length_delimited_get_quote_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 3 -> skip_group_get_quote_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 5 -> skip_32_get_quote_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) + end + end; +dg_read_field_def_get_quote_response(<<>>, 0, 0, _, F@_1, _) -> + S1 = #{}, + if F@_1 == '$undef' -> S1; + true -> S1#{cost_usd => F@_1} + end. + +d_field_get_quote_response_cost_usd(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_get_quote_response_cost_usd(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +d_field_get_quote_response_cost_usd(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_money(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_get_quote_response(RestF, + 0, + 0, + F, + if Prev == '$undef' -> NewFValue; + true -> merge_msg_money(Prev, NewFValue, TrUserData) + end, + TrUserData). + +skip_varint_get_quote_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_get_quote_response(Rest, Z1, Z2, F, F@_1, TrUserData); +skip_varint_get_quote_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_quote_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_length_delimited_get_quote_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_get_quote_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +skip_length_delimited_get_quote_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_get_quote_response(Rest2, 0, 0, F, F@_1, TrUserData). + +skip_group_get_quote_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_get_quote_response(Rest, 0, Z2, FNum, F@_1, TrUserData). + +skip_32_get_quote_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_quote_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_64_get_quote_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_quote_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +decode_msg_ship_order_request(Bin, TrUserData) -> dfp_read_field_def_ship_order_request(Bin, 0, 0, 0, id('$undef', TrUserData), id([], TrUserData), TrUserData). + +dfp_read_field_def_ship_order_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_ship_order_request_address(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_ship_order_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_ship_order_request_items(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_ship_order_request(<<>>, 0, 0, _, F@_1, R1, TrUserData) -> + S1 = #{}, + S2 = if F@_1 == '$undef' -> S1; + true -> S1#{address => F@_1} + end, + if R1 == '$undef' -> S2; + true -> S2#{items => lists_reverse(R1, TrUserData)} + end; +dfp_read_field_def_ship_order_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_ship_order_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). + +dg_read_field_def_ship_order_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_ship_order_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +dg_read_field_def_ship_order_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_ship_order_request_address(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + 18 -> d_field_ship_order_request_items(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_ship_order_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 1 -> skip_64_ship_order_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 2 -> skip_length_delimited_ship_order_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 3 -> skip_group_ship_order_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 5 -> skip_32_ship_order_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) + end + end; +dg_read_field_def_ship_order_request(<<>>, 0, 0, _, F@_1, R1, TrUserData) -> + S1 = #{}, + S2 = if F@_1 == '$undef' -> S1; + true -> S1#{address => F@_1} + end, + if R1 == '$undef' -> S2; + true -> S2#{items => lists_reverse(R1, TrUserData)} + end. + +d_field_ship_order_request_address(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_ship_order_request_address(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_ship_order_request_address(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, F@_2, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_address(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_ship_order_request(RestF, + 0, + 0, + F, + if Prev == '$undef' -> NewFValue; + true -> merge_msg_address(Prev, NewFValue, TrUserData) + end, + F@_2, + TrUserData). + +d_field_ship_order_request_items(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_ship_order_request_items(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_ship_order_request_items(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, Prev, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_cart_item(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_ship_order_request(RestF, 0, 0, F, F@_1, cons(NewFValue, Prev, TrUserData), TrUserData). + +skip_varint_ship_order_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_ship_order_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +skip_varint_ship_order_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_ship_order_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_length_delimited_ship_order_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_ship_order_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +skip_length_delimited_ship_order_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_ship_order_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). + +skip_group_ship_order_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_ship_order_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). + +skip_32_ship_order_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_ship_order_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_64_ship_order_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_ship_order_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +decode_msg_ship_order_response(Bin, TrUserData) -> dfp_read_field_def_ship_order_response(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). + +dfp_read_field_def_ship_order_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_ship_order_response_tracking_id(Rest, Z1, Z2, F, F@_1, TrUserData); +dfp_read_field_def_ship_order_response(<<>>, 0, 0, _, F@_1, _) -> #{tracking_id => F@_1}; +dfp_read_field_def_ship_order_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_ship_order_response(Other, Z1, Z2, F, F@_1, TrUserData). + +dg_read_field_def_ship_order_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_ship_order_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +dg_read_field_def_ship_order_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_ship_order_response_tracking_id(Rest, 0, 0, 0, F@_1, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_ship_order_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 1 -> skip_64_ship_order_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 2 -> skip_length_delimited_ship_order_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 3 -> skip_group_ship_order_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 5 -> skip_32_ship_order_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) + end + end; +dg_read_field_def_ship_order_response(<<>>, 0, 0, _, F@_1, _) -> #{tracking_id => F@_1}. + +d_field_ship_order_response_tracking_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_ship_order_response_tracking_id(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +d_field_ship_order_response_tracking_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_ship_order_response(RestF, 0, 0, F, NewFValue, TrUserData). + +skip_varint_ship_order_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_ship_order_response(Rest, Z1, Z2, F, F@_1, TrUserData); +skip_varint_ship_order_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_ship_order_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_length_delimited_ship_order_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_ship_order_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +skip_length_delimited_ship_order_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_ship_order_response(Rest2, 0, 0, F, F@_1, TrUserData). + +skip_group_ship_order_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_ship_order_response(Rest, 0, Z2, FNum, F@_1, TrUserData). + +skip_32_ship_order_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_ship_order_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_64_ship_order_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_ship_order_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +decode_msg_address(Bin, TrUserData) -> dfp_read_field_def_address(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), id(0, TrUserData), TrUserData). + +dfp_read_field_def_address(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_address_street_address(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dfp_read_field_def_address(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_address_city(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dfp_read_field_def_address(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_address_state(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dfp_read_field_def_address(<<34, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_address_country(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dfp_read_field_def_address(<<40, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_address_zip_code(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dfp_read_field_def_address(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, F@_5, _) -> #{street_address => F@_1, city => F@_2, state => F@_3, country => F@_4, zip_code => F@_5}; +dfp_read_field_def_address(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dg_read_field_def_address(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +dg_read_field_def_address(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 32 - 7 -> dg_read_field_def_address(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dg_read_field_def_address(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_address_street_address(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 18 -> d_field_address_city(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 26 -> d_field_address_state(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 34 -> d_field_address_country(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 40 -> d_field_address_zip_code(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_address(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 1 -> skip_64_address(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 2 -> skip_length_delimited_address(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 3 -> skip_group_address(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 5 -> skip_32_address(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) + end + end; +dg_read_field_def_address(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, F@_5, _) -> #{street_address => F@_1, city => F@_2, state => F@_3, country => F@_4, zip_code => F@_5}. + +d_field_address_street_address(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_address_street_address(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +d_field_address_street_address(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_address(RestF, 0, 0, F, NewFValue, F@_2, F@_3, F@_4, F@_5, TrUserData). + +d_field_address_city(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_address_city(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +d_field_address_city(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, F@_4, F@_5, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_address(RestF, 0, 0, F, F@_1, NewFValue, F@_3, F@_4, F@_5, TrUserData). + +d_field_address_state(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_address_state(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +d_field_address_state(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, F@_4, F@_5, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_address(RestF, 0, 0, F, F@_1, F@_2, NewFValue, F@_4, F@_5, TrUserData). + +d_field_address_country(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_address_country(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +d_field_address_country(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, _, F@_5, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_address(RestF, 0, 0, F, F@_1, F@_2, F@_3, NewFValue, F@_5, TrUserData). + +d_field_address_zip_code(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_address_zip_code(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +d_field_address_zip_code(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, _, TrUserData) -> + {NewFValue, RestF} = {begin <> = <<(X bsl N + Acc):32/unsigned-native>>, id(Res, TrUserData) end, Rest}, + dfp_read_field_def_address(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, NewFValue, TrUserData). + +skip_varint_address(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> skip_varint_address(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +skip_varint_address(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dfp_read_field_def_address(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +skip_length_delimited_address(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> skip_length_delimited_address(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +skip_length_delimited_address(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_address(Rest2, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +skip_group_address(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_address(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +skip_32_address(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dfp_read_field_def_address(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +skip_64_address(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dfp_read_field_def_address(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +decode_msg_money(Bin, TrUserData) -> dfp_read_field_def_money(Bin, 0, 0, 0, id(<<>>, TrUserData), id(0, TrUserData), id(0, TrUserData), TrUserData). + +dfp_read_field_def_money(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_money_currency_code(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); +dfp_read_field_def_money(<<16, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_money_units(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); +dfp_read_field_def_money(<<24, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_money_nanos(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); +dfp_read_field_def_money(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{currency_code => F@_1, units => F@_2, nanos => F@_3}; +dfp_read_field_def_money(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_money(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). + +dg_read_field_def_money(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_money(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); +dg_read_field_def_money(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_money_currency_code(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); + 16 -> d_field_money_units(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); + 24 -> d_field_money_nanos(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_money(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); + 1 -> skip_64_money(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); + 2 -> skip_length_delimited_money(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); + 3 -> skip_group_money(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); + 5 -> skip_32_money(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) + end + end; +dg_read_field_def_money(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{currency_code => F@_1, units => F@_2, nanos => F@_3}. + +d_field_money_currency_code(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_money_currency_code(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); +d_field_money_currency_code(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_money(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). + +d_field_money_units(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_money_units(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); +d_field_money_units(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) -> + {NewFValue, RestF} = {begin <> = <<(X bsl N + Acc):64/unsigned-native>>, id(Res, TrUserData) end, Rest}, + dfp_read_field_def_money(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). + +d_field_money_nanos(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_money_nanos(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); +d_field_money_nanos(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, TrUserData) -> + {NewFValue, RestF} = {begin <> = <<(X bsl N + Acc):32/unsigned-native>>, id(Res, TrUserData) end, Rest}, + dfp_read_field_def_money(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData). + +skip_varint_money(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_money(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); +skip_varint_money(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_money(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). + +skip_length_delimited_money(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_money(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); +skip_length_delimited_money(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_money(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). + +skip_group_money(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_money(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). + +skip_32_money(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_money(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). + +skip_64_money(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_money(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). + +decode_msg_get_supported_currencies_response(Bin, TrUserData) -> dfp_read_field_def_get_supported_currencies_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). + +dfp_read_field_def_get_supported_currencies_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_get_supported_currencies_response_currency_codes(Rest, Z1, Z2, F, F@_1, TrUserData); +dfp_read_field_def_get_supported_currencies_response(<<>>, 0, 0, _, R1, TrUserData) -> #{currency_codes => lists_reverse(R1, TrUserData)}; +dfp_read_field_def_get_supported_currencies_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_get_supported_currencies_response(Other, Z1, Z2, F, F@_1, TrUserData). + +dg_read_field_def_get_supported_currencies_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_get_supported_currencies_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +dg_read_field_def_get_supported_currencies_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_get_supported_currencies_response_currency_codes(Rest, 0, 0, 0, F@_1, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_get_supported_currencies_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 1 -> skip_64_get_supported_currencies_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 2 -> skip_length_delimited_get_supported_currencies_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 3 -> skip_group_get_supported_currencies_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 5 -> skip_32_get_supported_currencies_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) + end + end; +dg_read_field_def_get_supported_currencies_response(<<>>, 0, 0, _, R1, TrUserData) -> #{currency_codes => lists_reverse(R1, TrUserData)}. + +d_field_get_supported_currencies_response_currency_codes(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_get_supported_currencies_response_currency_codes(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +d_field_get_supported_currencies_response_currency_codes(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_get_supported_currencies_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). + +skip_varint_get_supported_currencies_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_get_supported_currencies_response(Rest, Z1, Z2, F, F@_1, TrUserData); +skip_varint_get_supported_currencies_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_supported_currencies_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_length_delimited_get_supported_currencies_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_get_supported_currencies_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +skip_length_delimited_get_supported_currencies_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_get_supported_currencies_response(Rest2, 0, 0, F, F@_1, TrUserData). + +skip_group_get_supported_currencies_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_get_supported_currencies_response(Rest, 0, Z2, FNum, F@_1, TrUserData). + +skip_32_get_supported_currencies_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_supported_currencies_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_64_get_supported_currencies_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_supported_currencies_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +decode_msg_currency_conversion_request(Bin, TrUserData) -> dfp_read_field_def_currency_conversion_request(Bin, 0, 0, 0, id('$undef', TrUserData), id(<<>>, TrUserData), TrUserData). + +dfp_read_field_def_currency_conversion_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_currency_conversion_request_from(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_currency_conversion_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_currency_conversion_request_to_code(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_currency_conversion_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> + S1 = #{to_code => F@_2}, + if F@_1 == '$undef' -> S1; + true -> S1#{from => F@_1} + end; +dfp_read_field_def_currency_conversion_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_currency_conversion_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). + +dg_read_field_def_currency_conversion_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_currency_conversion_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +dg_read_field_def_currency_conversion_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_currency_conversion_request_from(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + 18 -> d_field_currency_conversion_request_to_code(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_currency_conversion_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 1 -> skip_64_currency_conversion_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 2 -> skip_length_delimited_currency_conversion_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 3 -> skip_group_currency_conversion_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 5 -> skip_32_currency_conversion_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) + end + end; +dg_read_field_def_currency_conversion_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> + S1 = #{to_code => F@_2}, + if F@_1 == '$undef' -> S1; + true -> S1#{from => F@_1} + end. + +d_field_currency_conversion_request_from(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_currency_conversion_request_from(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_currency_conversion_request_from(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, F@_2, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_money(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_currency_conversion_request(RestF, + 0, + 0, + F, + if Prev == '$undef' -> NewFValue; + true -> merge_msg_money(Prev, NewFValue, TrUserData) + end, + F@_2, + TrUserData). + +d_field_currency_conversion_request_to_code(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_currency_conversion_request_to_code(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_currency_conversion_request_to_code(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_currency_conversion_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). + +skip_varint_currency_conversion_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_currency_conversion_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +skip_varint_currency_conversion_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_currency_conversion_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_length_delimited_currency_conversion_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_currency_conversion_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +skip_length_delimited_currency_conversion_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_currency_conversion_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). + +skip_group_currency_conversion_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_currency_conversion_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). + +skip_32_currency_conversion_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_currency_conversion_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_64_currency_conversion_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_currency_conversion_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +decode_msg_credit_card_info(Bin, TrUserData) -> dfp_read_field_def_credit_card_info(Bin, 0, 0, 0, id(<<>>, TrUserData), id(0, TrUserData), id(0, TrUserData), id(0, TrUserData), TrUserData). + +dfp_read_field_def_credit_card_info(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_credit_card_info_credit_card_number(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); +dfp_read_field_def_credit_card_info(<<16, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_credit_card_info_credit_card_cvv(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); +dfp_read_field_def_credit_card_info(<<24, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_credit_card_info_credit_card_expiration_year(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); +dfp_read_field_def_credit_card_info(<<32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_credit_card_info_credit_card_expiration_month(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); +dfp_read_field_def_credit_card_info(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, _) -> #{credit_card_number => F@_1, credit_card_cvv => F@_2, credit_card_expiration_year => F@_3, credit_card_expiration_month => F@_4}; +dfp_read_field_def_credit_card_info(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dg_read_field_def_credit_card_info(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). + +dg_read_field_def_credit_card_info(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 32 - 7 -> dg_read_field_def_credit_card_info(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); +dg_read_field_def_credit_card_info(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, F@_4, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_credit_card_info_credit_card_number(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); + 16 -> d_field_credit_card_info_credit_card_cvv(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); + 24 -> d_field_credit_card_info_credit_card_expiration_year(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); + 32 -> d_field_credit_card_info_credit_card_expiration_month(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_credit_card_info(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); + 1 -> skip_64_credit_card_info(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); + 2 -> skip_length_delimited_credit_card_info(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); + 3 -> skip_group_credit_card_info(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData); + 5 -> skip_32_credit_card_info(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData) + end + end; +dg_read_field_def_credit_card_info(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, _) -> #{credit_card_number => F@_1, credit_card_cvv => F@_2, credit_card_expiration_year => F@_3, credit_card_expiration_month => F@_4}. + +d_field_credit_card_info_credit_card_number(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_credit_card_info_credit_card_number(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); +d_field_credit_card_info_credit_card_number(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, F@_4, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_credit_card_info(RestF, 0, 0, F, NewFValue, F@_2, F@_3, F@_4, TrUserData). + +d_field_credit_card_info_credit_card_cvv(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_credit_card_info_credit_card_cvv(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); +d_field_credit_card_info_credit_card_cvv(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, F@_4, TrUserData) -> + {NewFValue, RestF} = {begin <> = <<(X bsl N + Acc):32/unsigned-native>>, id(Res, TrUserData) end, Rest}, + dfp_read_field_def_credit_card_info(RestF, 0, 0, F, F@_1, NewFValue, F@_3, F@_4, TrUserData). + +d_field_credit_card_info_credit_card_expiration_year(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> + d_field_credit_card_info_credit_card_expiration_year(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); +d_field_credit_card_info_credit_card_expiration_year(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, F@_4, TrUserData) -> + {NewFValue, RestF} = {begin <> = <<(X bsl N + Acc):32/unsigned-native>>, id(Res, TrUserData) end, Rest}, + dfp_read_field_def_credit_card_info(RestF, 0, 0, F, F@_1, F@_2, NewFValue, F@_4, TrUserData). + +d_field_credit_card_info_credit_card_expiration_month(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> + d_field_credit_card_info_credit_card_expiration_month(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); +d_field_credit_card_info_credit_card_expiration_month(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, _, TrUserData) -> + {NewFValue, RestF} = {begin <> = <<(X bsl N + Acc):32/unsigned-native>>, id(Res, TrUserData) end, Rest}, + dfp_read_field_def_credit_card_info(RestF, 0, 0, F, F@_1, F@_2, F@_3, NewFValue, TrUserData). + +skip_varint_credit_card_info(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> skip_varint_credit_card_info(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData); +skip_varint_credit_card_info(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_credit_card_info(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). + +skip_length_delimited_credit_card_info(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> skip_length_delimited_credit_card_info(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData); +skip_length_delimited_credit_card_info(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_credit_card_info(Rest2, 0, 0, F, F@_1, F@_2, F@_3, F@_4, TrUserData). + +skip_group_credit_card_info(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, F@_4, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_credit_card_info(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, F@_4, TrUserData). + +skip_32_credit_card_info(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_credit_card_info(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). + +skip_64_credit_card_info(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_credit_card_info(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData). + +decode_msg_charge_request(Bin, TrUserData) -> dfp_read_field_def_charge_request(Bin, 0, 0, 0, id('$undef', TrUserData), id('$undef', TrUserData), TrUserData). + +dfp_read_field_def_charge_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_charge_request_amount(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_charge_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_charge_request_credit_card(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_charge_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> + S1 = #{}, + S2 = if F@_1 == '$undef' -> S1; + true -> S1#{amount => F@_1} + end, + if F@_2 == '$undef' -> S2; + true -> S2#{credit_card => F@_2} + end; +dfp_read_field_def_charge_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_charge_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). + +dg_read_field_def_charge_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_charge_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +dg_read_field_def_charge_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_charge_request_amount(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + 18 -> d_field_charge_request_credit_card(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_charge_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 1 -> skip_64_charge_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 2 -> skip_length_delimited_charge_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 3 -> skip_group_charge_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 5 -> skip_32_charge_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) + end + end; +dg_read_field_def_charge_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> + S1 = #{}, + S2 = if F@_1 == '$undef' -> S1; + true -> S1#{amount => F@_1} + end, + if F@_2 == '$undef' -> S2; + true -> S2#{credit_card => F@_2} + end. + +d_field_charge_request_amount(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_charge_request_amount(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_charge_request_amount(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, F@_2, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_money(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_charge_request(RestF, + 0, + 0, + F, + if Prev == '$undef' -> NewFValue; + true -> merge_msg_money(Prev, NewFValue, TrUserData) + end, + F@_2, + TrUserData). + +d_field_charge_request_credit_card(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_charge_request_credit_card(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_charge_request_credit_card(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, Prev, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_credit_card_info(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_charge_request(RestF, + 0, + 0, + F, + F@_1, + if Prev == '$undef' -> NewFValue; + true -> merge_msg_credit_card_info(Prev, NewFValue, TrUserData) + end, + TrUserData). + +skip_varint_charge_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_charge_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +skip_varint_charge_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_charge_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_length_delimited_charge_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_charge_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +skip_length_delimited_charge_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_charge_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). + +skip_group_charge_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_charge_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). + +skip_32_charge_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_charge_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_64_charge_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_charge_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +decode_msg_charge_response(Bin, TrUserData) -> dfp_read_field_def_charge_response(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). + +dfp_read_field_def_charge_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_charge_response_transaction_id(Rest, Z1, Z2, F, F@_1, TrUserData); +dfp_read_field_def_charge_response(<<>>, 0, 0, _, F@_1, _) -> #{transaction_id => F@_1}; +dfp_read_field_def_charge_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_charge_response(Other, Z1, Z2, F, F@_1, TrUserData). + +dg_read_field_def_charge_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_charge_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +dg_read_field_def_charge_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_charge_response_transaction_id(Rest, 0, 0, 0, F@_1, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_charge_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 1 -> skip_64_charge_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 2 -> skip_length_delimited_charge_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 3 -> skip_group_charge_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 5 -> skip_32_charge_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) + end + end; +dg_read_field_def_charge_response(<<>>, 0, 0, _, F@_1, _) -> #{transaction_id => F@_1}. + +d_field_charge_response_transaction_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_charge_response_transaction_id(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +d_field_charge_response_transaction_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_charge_response(RestF, 0, 0, F, NewFValue, TrUserData). + +skip_varint_charge_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_charge_response(Rest, Z1, Z2, F, F@_1, TrUserData); +skip_varint_charge_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_charge_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_length_delimited_charge_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_charge_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +skip_length_delimited_charge_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_charge_response(Rest2, 0, 0, F, F@_1, TrUserData). + +skip_group_charge_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_charge_response(Rest, 0, Z2, FNum, F@_1, TrUserData). + +skip_32_charge_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_charge_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_64_charge_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_charge_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +decode_msg_order_item(Bin, TrUserData) -> dfp_read_field_def_order_item(Bin, 0, 0, 0, id('$undef', TrUserData), id('$undef', TrUserData), TrUserData). + +dfp_read_field_def_order_item(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_order_item_item(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_order_item(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_order_item_cost(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_order_item(<<>>, 0, 0, _, F@_1, F@_2, _) -> + S1 = #{}, + S2 = if F@_1 == '$undef' -> S1; + true -> S1#{item => F@_1} + end, + if F@_2 == '$undef' -> S2; + true -> S2#{cost => F@_2} + end; +dfp_read_field_def_order_item(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_order_item(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). + +dg_read_field_def_order_item(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_order_item(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +dg_read_field_def_order_item(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_order_item_item(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + 18 -> d_field_order_item_cost(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_order_item(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 1 -> skip_64_order_item(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 2 -> skip_length_delimited_order_item(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 3 -> skip_group_order_item(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 5 -> skip_32_order_item(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) + end + end; +dg_read_field_def_order_item(<<>>, 0, 0, _, F@_1, F@_2, _) -> + S1 = #{}, + S2 = if F@_1 == '$undef' -> S1; + true -> S1#{item => F@_1} + end, + if F@_2 == '$undef' -> S2; + true -> S2#{cost => F@_2} + end. + +d_field_order_item_item(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_order_item_item(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_order_item_item(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, F@_2, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_cart_item(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_order_item(RestF, + 0, + 0, + F, + if Prev == '$undef' -> NewFValue; + true -> merge_msg_cart_item(Prev, NewFValue, TrUserData) + end, + F@_2, + TrUserData). + +d_field_order_item_cost(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_order_item_cost(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_order_item_cost(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, Prev, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_money(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_order_item(RestF, + 0, + 0, + F, + F@_1, + if Prev == '$undef' -> NewFValue; + true -> merge_msg_money(Prev, NewFValue, TrUserData) + end, + TrUserData). + +skip_varint_order_item(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_order_item(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +skip_varint_order_item(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_order_item(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_length_delimited_order_item(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_order_item(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +skip_length_delimited_order_item(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_order_item(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). + +skip_group_order_item(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_order_item(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). + +skip_32_order_item(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_order_item(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_64_order_item(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_order_item(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +decode_msg_order_result(Bin, TrUserData) -> dfp_read_field_def_order_result(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id('$undef', TrUserData), id('$undef', TrUserData), id([], TrUserData), TrUserData). + +dfp_read_field_def_order_result(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_order_result_order_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dfp_read_field_def_order_result(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_order_result_shipping_tracking_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dfp_read_field_def_order_result(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_order_result_shipping_cost(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dfp_read_field_def_order_result(<<34, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_order_result_shipping_address(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dfp_read_field_def_order_result(<<42, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_order_result_items(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dfp_read_field_def_order_result(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, R1, TrUserData) -> + S1 = #{order_id => F@_1, shipping_tracking_id => F@_2}, + S2 = if F@_3 == '$undef' -> S1; + true -> S1#{shipping_cost => F@_3} + end, + S3 = if F@_4 == '$undef' -> S2; + true -> S2#{shipping_address => F@_4} + end, + if R1 == '$undef' -> S3; + true -> S3#{items => lists_reverse(R1, TrUserData)} + end; +dfp_read_field_def_order_result(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dg_read_field_def_order_result(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +dg_read_field_def_order_result(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 32 - 7 -> dg_read_field_def_order_result(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dg_read_field_def_order_result(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_order_result_order_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 18 -> d_field_order_result_shipping_tracking_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 26 -> d_field_order_result_shipping_cost(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 34 -> d_field_order_result_shipping_address(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 42 -> d_field_order_result_items(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_order_result(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 1 -> skip_64_order_result(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 2 -> skip_length_delimited_order_result(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 3 -> skip_group_order_result(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 5 -> skip_32_order_result(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) + end + end; +dg_read_field_def_order_result(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, R1, TrUserData) -> + S1 = #{order_id => F@_1, shipping_tracking_id => F@_2}, + S2 = if F@_3 == '$undef' -> S1; + true -> S1#{shipping_cost => F@_3} + end, + S3 = if F@_4 == '$undef' -> S2; + true -> S2#{shipping_address => F@_4} + end, + if R1 == '$undef' -> S3; + true -> S3#{items => lists_reverse(R1, TrUserData)} + end. + +d_field_order_result_order_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_order_result_order_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +d_field_order_result_order_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_order_result(RestF, 0, 0, F, NewFValue, F@_2, F@_3, F@_4, F@_5, TrUserData). + +d_field_order_result_shipping_tracking_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> + d_field_order_result_shipping_tracking_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +d_field_order_result_shipping_tracking_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, F@_4, F@_5, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_order_result(RestF, 0, 0, F, F@_1, NewFValue, F@_3, F@_4, F@_5, TrUserData). + +d_field_order_result_shipping_cost(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_order_result_shipping_cost(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +d_field_order_result_shipping_cost(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, Prev, F@_4, F@_5, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_money(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_order_result(RestF, + 0, + 0, + F, + F@_1, + F@_2, + if Prev == '$undef' -> NewFValue; + true -> merge_msg_money(Prev, NewFValue, TrUserData) + end, + F@_4, + F@_5, + TrUserData). + +d_field_order_result_shipping_address(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_order_result_shipping_address(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +d_field_order_result_shipping_address(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, Prev, F@_5, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_address(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_order_result(RestF, + 0, + 0, + F, + F@_1, + F@_2, + F@_3, + if Prev == '$undef' -> NewFValue; + true -> merge_msg_address(Prev, NewFValue, TrUserData) + end, + F@_5, + TrUserData). + +d_field_order_result_items(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_order_result_items(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +d_field_order_result_items(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, Prev, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_order_item(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_order_result(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, cons(NewFValue, Prev, TrUserData), TrUserData). + +skip_varint_order_result(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> skip_varint_order_result(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +skip_varint_order_result(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dfp_read_field_def_order_result(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +skip_length_delimited_order_result(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> skip_length_delimited_order_result(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +skip_length_delimited_order_result(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_order_result(Rest2, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +skip_group_order_result(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_order_result(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +skip_32_order_result(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dfp_read_field_def_order_result(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +skip_64_order_result(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dfp_read_field_def_order_result(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +decode_msg_send_order_confirmation_request(Bin, TrUserData) -> dfp_read_field_def_send_order_confirmation_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id('$undef', TrUserData), TrUserData). + +dfp_read_field_def_send_order_confirmation_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_send_order_confirmation_request_email(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_send_order_confirmation_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_send_order_confirmation_request_order(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_send_order_confirmation_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> + S1 = #{email => F@_1}, + if F@_2 == '$undef' -> S1; + true -> S1#{order => F@_2} + end; +dfp_read_field_def_send_order_confirmation_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_send_order_confirmation_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). + +dg_read_field_def_send_order_confirmation_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_send_order_confirmation_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +dg_read_field_def_send_order_confirmation_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_send_order_confirmation_request_email(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + 18 -> d_field_send_order_confirmation_request_order(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_send_order_confirmation_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 1 -> skip_64_send_order_confirmation_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 2 -> skip_length_delimited_send_order_confirmation_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 3 -> skip_group_send_order_confirmation_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 5 -> skip_32_send_order_confirmation_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) + end + end; +dg_read_field_def_send_order_confirmation_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> + S1 = #{email => F@_1}, + if F@_2 == '$undef' -> S1; + true -> S1#{order => F@_2} + end. + +d_field_send_order_confirmation_request_email(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_send_order_confirmation_request_email(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_send_order_confirmation_request_email(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_send_order_confirmation_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). + +d_field_send_order_confirmation_request_order(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_send_order_confirmation_request_order(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_send_order_confirmation_request_order(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, Prev, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_order_result(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_send_order_confirmation_request(RestF, + 0, + 0, + F, + F@_1, + if Prev == '$undef' -> NewFValue; + true -> merge_msg_order_result(Prev, NewFValue, TrUserData) + end, + TrUserData). + +skip_varint_send_order_confirmation_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_send_order_confirmation_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +skip_varint_send_order_confirmation_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_send_order_confirmation_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_length_delimited_send_order_confirmation_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_send_order_confirmation_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +skip_length_delimited_send_order_confirmation_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_send_order_confirmation_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). + +skip_group_send_order_confirmation_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_send_order_confirmation_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). + +skip_32_send_order_confirmation_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_send_order_confirmation_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_64_send_order_confirmation_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_send_order_confirmation_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +decode_msg_place_order_request(Bin, TrUserData) -> dfp_read_field_def_place_order_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id('$undef', TrUserData), id(<<>>, TrUserData), id('$undef', TrUserData), TrUserData). + +dfp_read_field_def_place_order_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_place_order_request_user_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dfp_read_field_def_place_order_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_place_order_request_user_currency(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dfp_read_field_def_place_order_request(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_place_order_request_address(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dfp_read_field_def_place_order_request(<<42, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_place_order_request_email(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dfp_read_field_def_place_order_request(<<50, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_place_order_request_credit_card(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dfp_read_field_def_place_order_request(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, F@_5, _) -> + S1 = #{user_id => F@_1, user_currency => F@_2, email => F@_4}, + S2 = if F@_3 == '$undef' -> S1; + true -> S1#{address => F@_3} + end, + if F@_5 == '$undef' -> S2; + true -> S2#{credit_card => F@_5} + end; +dfp_read_field_def_place_order_request(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dg_read_field_def_place_order_request(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +dg_read_field_def_place_order_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 32 - 7 -> dg_read_field_def_place_order_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dg_read_field_def_place_order_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_place_order_request_user_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 18 -> d_field_place_order_request_user_currency(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 26 -> d_field_place_order_request_address(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 42 -> d_field_place_order_request_email(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 50 -> d_field_place_order_request_credit_card(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_place_order_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 1 -> skip_64_place_order_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 2 -> skip_length_delimited_place_order_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 3 -> skip_group_place_order_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 5 -> skip_32_place_order_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) + end + end; +dg_read_field_def_place_order_request(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, F@_5, _) -> + S1 = #{user_id => F@_1, user_currency => F@_2, email => F@_4}, + S2 = if F@_3 == '$undef' -> S1; + true -> S1#{address => F@_3} + end, + if F@_5 == '$undef' -> S2; + true -> S2#{credit_card => F@_5} + end. + +d_field_place_order_request_user_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_place_order_request_user_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +d_field_place_order_request_user_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_place_order_request(RestF, 0, 0, F, NewFValue, F@_2, F@_3, F@_4, F@_5, TrUserData). + +d_field_place_order_request_user_currency(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> + d_field_place_order_request_user_currency(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +d_field_place_order_request_user_currency(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, F@_4, F@_5, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_place_order_request(RestF, 0, 0, F, F@_1, NewFValue, F@_3, F@_4, F@_5, TrUserData). + +d_field_place_order_request_address(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_place_order_request_address(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +d_field_place_order_request_address(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, Prev, F@_4, F@_5, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_address(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_place_order_request(RestF, + 0, + 0, + F, + F@_1, + F@_2, + if Prev == '$undef' -> NewFValue; + true -> merge_msg_address(Prev, NewFValue, TrUserData) + end, + F@_4, + F@_5, + TrUserData). + +d_field_place_order_request_email(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_place_order_request_email(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +d_field_place_order_request_email(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, _, F@_5, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_place_order_request(RestF, 0, 0, F, F@_1, F@_2, F@_3, NewFValue, F@_5, TrUserData). + +d_field_place_order_request_credit_card(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_place_order_request_credit_card(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +d_field_place_order_request_credit_card(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, Prev, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_credit_card_info(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_place_order_request(RestF, + 0, + 0, + F, + F@_1, + F@_2, + F@_3, + F@_4, + if Prev == '$undef' -> NewFValue; + true -> merge_msg_credit_card_info(Prev, NewFValue, TrUserData) + end, + TrUserData). + +skip_varint_place_order_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> skip_varint_place_order_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +skip_varint_place_order_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dfp_read_field_def_place_order_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +skip_length_delimited_place_order_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> + skip_length_delimited_place_order_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +skip_length_delimited_place_order_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_place_order_request(Rest2, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +skip_group_place_order_request(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_place_order_request(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +skip_32_place_order_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dfp_read_field_def_place_order_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +skip_64_place_order_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dfp_read_field_def_place_order_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +decode_msg_place_order_response(Bin, TrUserData) -> dfp_read_field_def_place_order_response(Bin, 0, 0, 0, id('$undef', TrUserData), TrUserData). + +dfp_read_field_def_place_order_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_place_order_response_order(Rest, Z1, Z2, F, F@_1, TrUserData); +dfp_read_field_def_place_order_response(<<>>, 0, 0, _, F@_1, _) -> + S1 = #{}, + if F@_1 == '$undef' -> S1; + true -> S1#{order => F@_1} + end; +dfp_read_field_def_place_order_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_place_order_response(Other, Z1, Z2, F, F@_1, TrUserData). + +dg_read_field_def_place_order_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_place_order_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +dg_read_field_def_place_order_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_place_order_response_order(Rest, 0, 0, 0, F@_1, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_place_order_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 1 -> skip_64_place_order_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 2 -> skip_length_delimited_place_order_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 3 -> skip_group_place_order_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 5 -> skip_32_place_order_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) + end + end; +dg_read_field_def_place_order_response(<<>>, 0, 0, _, F@_1, _) -> + S1 = #{}, + if F@_1 == '$undef' -> S1; + true -> S1#{order => F@_1} + end. + +d_field_place_order_response_order(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_place_order_response_order(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +d_field_place_order_response_order(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_order_result(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_place_order_response(RestF, + 0, + 0, + F, + if Prev == '$undef' -> NewFValue; + true -> merge_msg_order_result(Prev, NewFValue, TrUserData) + end, + TrUserData). + +skip_varint_place_order_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_place_order_response(Rest, Z1, Z2, F, F@_1, TrUserData); +skip_varint_place_order_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_place_order_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_length_delimited_place_order_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_place_order_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +skip_length_delimited_place_order_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_place_order_response(Rest2, 0, 0, F, F@_1, TrUserData). + +skip_group_place_order_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_place_order_response(Rest, 0, Z2, FNum, F@_1, TrUserData). + +skip_32_place_order_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_place_order_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_64_place_order_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_place_order_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +decode_msg_ad_request(Bin, TrUserData) -> dfp_read_field_def_ad_request(Bin, 0, 0, 0, id([], TrUserData), TrUserData). + +dfp_read_field_def_ad_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_ad_request_context_keys(Rest, Z1, Z2, F, F@_1, TrUserData); +dfp_read_field_def_ad_request(<<>>, 0, 0, _, R1, TrUserData) -> #{context_keys => lists_reverse(R1, TrUserData)}; +dfp_read_field_def_ad_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_ad_request(Other, Z1, Z2, F, F@_1, TrUserData). + +dg_read_field_def_ad_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_ad_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +dg_read_field_def_ad_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_ad_request_context_keys(Rest, 0, 0, 0, F@_1, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_ad_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 1 -> skip_64_ad_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 2 -> skip_length_delimited_ad_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 3 -> skip_group_ad_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 5 -> skip_32_ad_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) + end + end; +dg_read_field_def_ad_request(<<>>, 0, 0, _, R1, TrUserData) -> #{context_keys => lists_reverse(R1, TrUserData)}. + +d_field_ad_request_context_keys(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_ad_request_context_keys(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +d_field_ad_request_context_keys(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_ad_request(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). + +skip_varint_ad_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_ad_request(Rest, Z1, Z2, F, F@_1, TrUserData); +skip_varint_ad_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_ad_request(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_length_delimited_ad_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_ad_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +skip_length_delimited_ad_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_ad_request(Rest2, 0, 0, F, F@_1, TrUserData). + +skip_group_ad_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_ad_request(Rest, 0, Z2, FNum, F@_1, TrUserData). + +skip_32_ad_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_ad_request(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_64_ad_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_ad_request(Rest, Z1, Z2, F, F@_1, TrUserData). + +decode_msg_ad_response(Bin, TrUserData) -> dfp_read_field_def_ad_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). + +dfp_read_field_def_ad_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_ad_response_ads(Rest, Z1, Z2, F, F@_1, TrUserData); +dfp_read_field_def_ad_response(<<>>, 0, 0, _, R1, TrUserData) -> + S1 = #{}, + if R1 == '$undef' -> S1; + true -> S1#{ads => lists_reverse(R1, TrUserData)} + end; +dfp_read_field_def_ad_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_ad_response(Other, Z1, Z2, F, F@_1, TrUserData). + +dg_read_field_def_ad_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_ad_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +dg_read_field_def_ad_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_ad_response_ads(Rest, 0, 0, 0, F@_1, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_ad_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 1 -> skip_64_ad_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 2 -> skip_length_delimited_ad_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 3 -> skip_group_ad_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 5 -> skip_32_ad_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) + end + end; +dg_read_field_def_ad_response(<<>>, 0, 0, _, R1, TrUserData) -> + S1 = #{}, + if R1 == '$undef' -> S1; + true -> S1#{ads => lists_reverse(R1, TrUserData)} + end. + +d_field_ad_response_ads(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_ad_response_ads(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +d_field_ad_response_ads(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_ad(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_ad_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). + +skip_varint_ad_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_ad_response(Rest, Z1, Z2, F, F@_1, TrUserData); +skip_varint_ad_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_ad_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_length_delimited_ad_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_ad_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +skip_length_delimited_ad_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_ad_response(Rest2, 0, 0, F, F@_1, TrUserData). + +skip_group_ad_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_ad_response(Rest, 0, Z2, FNum, F@_1, TrUserData). + +skip_32_ad_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_ad_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_64_ad_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_ad_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +decode_msg_ad(Bin, TrUserData) -> dfp_read_field_def_ad(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). + +dfp_read_field_def_ad(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_ad_redirect_url(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_ad(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_ad_text(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_ad(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{redirect_url => F@_1, text => F@_2}; +dfp_read_field_def_ad(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_ad(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). + +dg_read_field_def_ad(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_ad(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +dg_read_field_def_ad(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_ad_redirect_url(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + 18 -> d_field_ad_text(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_ad(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 1 -> skip_64_ad(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 2 -> skip_length_delimited_ad(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 3 -> skip_group_ad(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 5 -> skip_32_ad(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) + end + end; +dg_read_field_def_ad(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{redirect_url => F@_1, text => F@_2}. + +d_field_ad_redirect_url(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_ad_redirect_url(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_ad_redirect_url(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_ad(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). + +d_field_ad_text(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_ad_text(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_ad_text(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_ad(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). + +skip_varint_ad(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_ad(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +skip_varint_ad(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_ad(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_length_delimited_ad(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_ad(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +skip_length_delimited_ad(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_ad(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). + +skip_group_ad(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_ad(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). + +skip_32_ad(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_ad(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_64_ad(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_ad(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +decode_msg_flag(Bin, TrUserData) -> dfp_read_field_def_flag(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(false, TrUserData), id('$undef', TrUserData), id('$undef', TrUserData), TrUserData). + +dfp_read_field_def_flag(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_flag_name(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dfp_read_field_def_flag(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_flag_description(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dfp_read_field_def_flag(<<24, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_flag_enabled(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dfp_read_field_def_flag(<<34, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_flag_created_at(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dfp_read_field_def_flag(<<42, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_flag_updated_at(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dfp_read_field_def_flag(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, F@_5, _) -> + S1 = #{name => F@_1, description => F@_2, enabled => F@_3}, + S2 = if F@_4 == '$undef' -> S1; + true -> S1#{created_at => F@_4} + end, + if F@_5 == '$undef' -> S2; + true -> S2#{updated_at => F@_5} + end; +dfp_read_field_def_flag(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dg_read_field_def_flag(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +dg_read_field_def_flag(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 32 - 7 -> dg_read_field_def_flag(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +dg_read_field_def_flag(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_flag_name(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 18 -> d_field_flag_description(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 24 -> d_field_flag_enabled(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 34 -> d_field_flag_created_at(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 42 -> d_field_flag_updated_at(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_flag(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 1 -> skip_64_flag(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 2 -> skip_length_delimited_flag(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 3 -> skip_group_flag(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); + 5 -> skip_32_flag(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) + end + end; +dg_read_field_def_flag(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, F@_5, _) -> + S1 = #{name => F@_1, description => F@_2, enabled => F@_3}, + S2 = if F@_4 == '$undef' -> S1; + true -> S1#{created_at => F@_4} + end, + if F@_5 == '$undef' -> S2; + true -> S2#{updated_at => F@_5} + end. + +d_field_flag_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_flag_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +d_field_flag_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_flag(RestF, 0, 0, F, NewFValue, F@_2, F@_3, F@_4, F@_5, TrUserData). + +d_field_flag_description(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_flag_description(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +d_field_flag_description(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, F@_4, F@_5, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_flag(RestF, 0, 0, F, F@_1, NewFValue, F@_3, F@_4, F@_5, TrUserData). + +d_field_flag_enabled(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_flag_enabled(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +d_field_flag_enabled(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, F@_4, F@_5, TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc =/= 0, TrUserData), Rest}, + dfp_read_field_def_flag(RestF, 0, 0, F, F@_1, F@_2, NewFValue, F@_4, F@_5, TrUserData). + +d_field_flag_created_at(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_flag_created_at(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +d_field_flag_created_at(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, Prev, F@_5, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_timestamp(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_flag(RestF, + 0, + 0, + F, + F@_1, + F@_2, + F@_3, + if Prev == '$undef' -> NewFValue; + true -> merge_msg_timestamp(Prev, NewFValue, TrUserData) + end, + F@_5, + TrUserData). + +d_field_flag_updated_at(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_flag_updated_at(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +d_field_flag_updated_at(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, Prev, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_timestamp(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_flag(RestF, + 0, + 0, + F, + F@_1, + F@_2, + F@_3, + F@_4, + if Prev == '$undef' -> NewFValue; + true -> merge_msg_timestamp(Prev, NewFValue, TrUserData) + end, + TrUserData). + +skip_varint_flag(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> skip_varint_flag(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +skip_varint_flag(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dfp_read_field_def_flag(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +skip_length_delimited_flag(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> skip_length_delimited_flag(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); +skip_length_delimited_flag(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_flag(Rest2, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +skip_group_flag(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_flag(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +skip_32_flag(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dfp_read_field_def_flag(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +skip_64_flag(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dfp_read_field_def_flag(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). + +decode_msg_get_flag_request(Bin, TrUserData) -> dfp_read_field_def_get_flag_request(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). + +dfp_read_field_def_get_flag_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_get_flag_request_name(Rest, Z1, Z2, F, F@_1, TrUserData); +dfp_read_field_def_get_flag_request(<<>>, 0, 0, _, F@_1, _) -> #{name => F@_1}; +dfp_read_field_def_get_flag_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_get_flag_request(Other, Z1, Z2, F, F@_1, TrUserData). + +dg_read_field_def_get_flag_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_get_flag_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +dg_read_field_def_get_flag_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_get_flag_request_name(Rest, 0, 0, 0, F@_1, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_get_flag_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 1 -> skip_64_get_flag_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 2 -> skip_length_delimited_get_flag_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 3 -> skip_group_get_flag_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 5 -> skip_32_get_flag_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) + end + end; +dg_read_field_def_get_flag_request(<<>>, 0, 0, _, F@_1, _) -> #{name => F@_1}. + +d_field_get_flag_request_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_get_flag_request_name(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +d_field_get_flag_request_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_get_flag_request(RestF, 0, 0, F, NewFValue, TrUserData). + +skip_varint_get_flag_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_get_flag_request(Rest, Z1, Z2, F, F@_1, TrUserData); +skip_varint_get_flag_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_flag_request(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_length_delimited_get_flag_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_get_flag_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +skip_length_delimited_get_flag_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_get_flag_request(Rest2, 0, 0, F, F@_1, TrUserData). + +skip_group_get_flag_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_get_flag_request(Rest, 0, Z2, FNum, F@_1, TrUserData). + +skip_32_get_flag_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_flag_request(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_64_get_flag_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_flag_request(Rest, Z1, Z2, F, F@_1, TrUserData). + +decode_msg_get_flag_response(Bin, TrUserData) -> dfp_read_field_def_get_flag_response(Bin, 0, 0, 0, id('$undef', TrUserData), TrUserData). + +dfp_read_field_def_get_flag_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_get_flag_response_flag(Rest, Z1, Z2, F, F@_1, TrUserData); +dfp_read_field_def_get_flag_response(<<>>, 0, 0, _, F@_1, _) -> + S1 = #{}, + if F@_1 == '$undef' -> S1; + true -> S1#{flag => F@_1} + end; +dfp_read_field_def_get_flag_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_get_flag_response(Other, Z1, Z2, F, F@_1, TrUserData). + +dg_read_field_def_get_flag_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_get_flag_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +dg_read_field_def_get_flag_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_get_flag_response_flag(Rest, 0, 0, 0, F@_1, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_get_flag_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 1 -> skip_64_get_flag_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 2 -> skip_length_delimited_get_flag_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 3 -> skip_group_get_flag_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 5 -> skip_32_get_flag_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) + end + end; +dg_read_field_def_get_flag_response(<<>>, 0, 0, _, F@_1, _) -> + S1 = #{}, + if F@_1 == '$undef' -> S1; + true -> S1#{flag => F@_1} + end. + +d_field_get_flag_response_flag(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_get_flag_response_flag(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +d_field_get_flag_response_flag(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_flag(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_get_flag_response(RestF, + 0, + 0, + F, + if Prev == '$undef' -> NewFValue; + true -> merge_msg_flag(Prev, NewFValue, TrUserData) + end, + TrUserData). + +skip_varint_get_flag_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_get_flag_response(Rest, Z1, Z2, F, F@_1, TrUserData); +skip_varint_get_flag_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_flag_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_length_delimited_get_flag_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_get_flag_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +skip_length_delimited_get_flag_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_get_flag_response(Rest2, 0, 0, F, F@_1, TrUserData). + +skip_group_get_flag_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_get_flag_response(Rest, 0, Z2, FNum, F@_1, TrUserData). + +skip_32_get_flag_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_flag_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_64_get_flag_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_flag_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +decode_msg_create_flag_request(Bin, TrUserData) -> dfp_read_field_def_create_flag_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(false, TrUserData), TrUserData). + +dfp_read_field_def_create_flag_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_create_flag_request_name(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); +dfp_read_field_def_create_flag_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_create_flag_request_description(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); +dfp_read_field_def_create_flag_request(<<24, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_create_flag_request_enabled(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); +dfp_read_field_def_create_flag_request(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{name => F@_1, description => F@_2, enabled => F@_3}; +dfp_read_field_def_create_flag_request(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_create_flag_request(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). + +dg_read_field_def_create_flag_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_create_flag_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); +dg_read_field_def_create_flag_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_create_flag_request_name(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); + 18 -> d_field_create_flag_request_description(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); + 24 -> d_field_create_flag_request_enabled(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_create_flag_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); + 1 -> skip_64_create_flag_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); + 2 -> skip_length_delimited_create_flag_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); + 3 -> skip_group_create_flag_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); + 5 -> skip_32_create_flag_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) + end + end; +dg_read_field_def_create_flag_request(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{name => F@_1, description => F@_2, enabled => F@_3}. + +d_field_create_flag_request_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_create_flag_request_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); +d_field_create_flag_request_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_create_flag_request(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). + +d_field_create_flag_request_description(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_create_flag_request_description(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); +d_field_create_flag_request_description(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_create_flag_request(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). + +d_field_create_flag_request_enabled(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_create_flag_request_enabled(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); +d_field_create_flag_request_enabled(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc =/= 0, TrUserData), Rest}, + dfp_read_field_def_create_flag_request(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData). + +skip_varint_create_flag_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_create_flag_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); +skip_varint_create_flag_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_create_flag_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). + +skip_length_delimited_create_flag_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_create_flag_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); +skip_length_delimited_create_flag_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_create_flag_request(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). + +skip_group_create_flag_request(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_create_flag_request(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). + +skip_32_create_flag_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_create_flag_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). + +skip_64_create_flag_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_create_flag_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). + +decode_msg_create_flag_response(Bin, TrUserData) -> dfp_read_field_def_create_flag_response(Bin, 0, 0, 0, id('$undef', TrUserData), TrUserData). + +dfp_read_field_def_create_flag_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_create_flag_response_flag(Rest, Z1, Z2, F, F@_1, TrUserData); +dfp_read_field_def_create_flag_response(<<>>, 0, 0, _, F@_1, _) -> + S1 = #{}, + if F@_1 == '$undef' -> S1; + true -> S1#{flag => F@_1} + end; +dfp_read_field_def_create_flag_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_create_flag_response(Other, Z1, Z2, F, F@_1, TrUserData). + +dg_read_field_def_create_flag_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_create_flag_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +dg_read_field_def_create_flag_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_create_flag_response_flag(Rest, 0, 0, 0, F@_1, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_create_flag_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 1 -> skip_64_create_flag_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 2 -> skip_length_delimited_create_flag_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 3 -> skip_group_create_flag_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 5 -> skip_32_create_flag_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) + end + end; +dg_read_field_def_create_flag_response(<<>>, 0, 0, _, F@_1, _) -> + S1 = #{}, + if F@_1 == '$undef' -> S1; + true -> S1#{flag => F@_1} + end. + +d_field_create_flag_response_flag(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_create_flag_response_flag(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +d_field_create_flag_response_flag(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_flag(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_create_flag_response(RestF, + 0, + 0, + F, + if Prev == '$undef' -> NewFValue; + true -> merge_msg_flag(Prev, NewFValue, TrUserData) + end, + TrUserData). + +skip_varint_create_flag_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_create_flag_response(Rest, Z1, Z2, F, F@_1, TrUserData); +skip_varint_create_flag_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_create_flag_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_length_delimited_create_flag_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_create_flag_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +skip_length_delimited_create_flag_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_create_flag_response(Rest2, 0, 0, F, F@_1, TrUserData). + +skip_group_create_flag_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_create_flag_response(Rest, 0, Z2, FNum, F@_1, TrUserData). + +skip_32_create_flag_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_create_flag_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_64_create_flag_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_create_flag_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +decode_msg_update_flag_request(Bin, TrUserData) -> dfp_read_field_def_update_flag_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(false, TrUserData), TrUserData). + +dfp_read_field_def_update_flag_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_update_flag_request_name(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_update_flag_request(<<16, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_update_flag_request_enabled(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_update_flag_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{name => F@_1, enabled => F@_2}; +dfp_read_field_def_update_flag_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_update_flag_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). + +dg_read_field_def_update_flag_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_update_flag_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +dg_read_field_def_update_flag_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_update_flag_request_name(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + 16 -> d_field_update_flag_request_enabled(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_update_flag_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 1 -> skip_64_update_flag_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 2 -> skip_length_delimited_update_flag_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 3 -> skip_group_update_flag_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 5 -> skip_32_update_flag_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) + end + end; +dg_read_field_def_update_flag_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{name => F@_1, enabled => F@_2}. + +d_field_update_flag_request_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_update_flag_request_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_update_flag_request_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_update_flag_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). + +d_field_update_flag_request_enabled(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_update_flag_request_enabled(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_update_flag_request_enabled(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> + {NewFValue, RestF} = {id(X bsl N + Acc =/= 0, TrUserData), Rest}, + dfp_read_field_def_update_flag_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). + +skip_varint_update_flag_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_update_flag_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +skip_varint_update_flag_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_update_flag_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_length_delimited_update_flag_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_update_flag_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +skip_length_delimited_update_flag_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_update_flag_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). + +skip_group_update_flag_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_update_flag_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). + +skip_32_update_flag_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_update_flag_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_64_update_flag_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_update_flag_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +decode_msg_update_flag_response(Bin, TrUserData) -> dfp_read_field_def_update_flag_response(Bin, 0, 0, 0, TrUserData). + +dfp_read_field_def_update_flag_response(<<>>, 0, 0, _, _) -> #{}; +dfp_read_field_def_update_flag_response(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_update_flag_response(Other, Z1, Z2, F, TrUserData). + +dg_read_field_def_update_flag_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_update_flag_response(Rest, N + 7, X bsl N + Acc, F, TrUserData); +dg_read_field_def_update_flag_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) -> + Key = X bsl N + Acc, + case Key band 7 of + 0 -> skip_varint_update_flag_response(Rest, 0, 0, Key bsr 3, TrUserData); + 1 -> skip_64_update_flag_response(Rest, 0, 0, Key bsr 3, TrUserData); + 2 -> skip_length_delimited_update_flag_response(Rest, 0, 0, Key bsr 3, TrUserData); + 3 -> skip_group_update_flag_response(Rest, 0, 0, Key bsr 3, TrUserData); + 5 -> skip_32_update_flag_response(Rest, 0, 0, Key bsr 3, TrUserData) + end; +dg_read_field_def_update_flag_response(<<>>, 0, 0, _, _) -> #{}. + +skip_varint_update_flag_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_update_flag_response(Rest, Z1, Z2, F, TrUserData); +skip_varint_update_flag_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_update_flag_response(Rest, Z1, Z2, F, TrUserData). + +skip_length_delimited_update_flag_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_update_flag_response(Rest, N + 7, X bsl N + Acc, F, TrUserData); +skip_length_delimited_update_flag_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_update_flag_response(Rest2, 0, 0, F, TrUserData). + +skip_group_update_flag_response(Bin, _, Z2, FNum, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_update_flag_response(Rest, 0, Z2, FNum, TrUserData). + +skip_32_update_flag_response(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_update_flag_response(Rest, Z1, Z2, F, TrUserData). + +skip_64_update_flag_response(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_update_flag_response(Rest, Z1, Z2, F, TrUserData). + +decode_msg_list_flags_request(Bin, TrUserData) -> dfp_read_field_def_list_flags_request(Bin, 0, 0, 0, TrUserData). + +dfp_read_field_def_list_flags_request(<<>>, 0, 0, _, _) -> #{}; +dfp_read_field_def_list_flags_request(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_list_flags_request(Other, Z1, Z2, F, TrUserData). + +dg_read_field_def_list_flags_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_flags_request(Rest, N + 7, X bsl N + Acc, F, TrUserData); +dg_read_field_def_list_flags_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) -> + Key = X bsl N + Acc, + case Key band 7 of + 0 -> skip_varint_list_flags_request(Rest, 0, 0, Key bsr 3, TrUserData); + 1 -> skip_64_list_flags_request(Rest, 0, 0, Key bsr 3, TrUserData); + 2 -> skip_length_delimited_list_flags_request(Rest, 0, 0, Key bsr 3, TrUserData); + 3 -> skip_group_list_flags_request(Rest, 0, 0, Key bsr 3, TrUserData); + 5 -> skip_32_list_flags_request(Rest, 0, 0, Key bsr 3, TrUserData) + end; +dg_read_field_def_list_flags_request(<<>>, 0, 0, _, _) -> #{}. + +skip_varint_list_flags_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_list_flags_request(Rest, Z1, Z2, F, TrUserData); +skip_varint_list_flags_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_list_flags_request(Rest, Z1, Z2, F, TrUserData). + +skip_length_delimited_list_flags_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_list_flags_request(Rest, N + 7, X bsl N + Acc, F, TrUserData); +skip_length_delimited_list_flags_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_list_flags_request(Rest2, 0, 0, F, TrUserData). + +skip_group_list_flags_request(Bin, _, Z2, FNum, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_list_flags_request(Rest, 0, Z2, FNum, TrUserData). + +skip_32_list_flags_request(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_list_flags_request(Rest, Z1, Z2, F, TrUserData). + +skip_64_list_flags_request(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_list_flags_request(Rest, Z1, Z2, F, TrUserData). + +decode_msg_list_flags_response(Bin, TrUserData) -> dfp_read_field_def_list_flags_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). + +dfp_read_field_def_list_flags_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_flags_response_flag(Rest, Z1, Z2, F, F@_1, TrUserData); +dfp_read_field_def_list_flags_response(<<>>, 0, 0, _, R1, TrUserData) -> + S1 = #{}, + if R1 == '$undef' -> S1; + true -> S1#{flag => lists_reverse(R1, TrUserData)} + end; +dfp_read_field_def_list_flags_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_flags_response(Other, Z1, Z2, F, F@_1, TrUserData). + +dg_read_field_def_list_flags_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_flags_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +dg_read_field_def_list_flags_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_list_flags_response_flag(Rest, 0, 0, 0, F@_1, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_list_flags_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 1 -> skip_64_list_flags_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 2 -> skip_length_delimited_list_flags_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 3 -> skip_group_list_flags_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 5 -> skip_32_list_flags_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) + end + end; +dg_read_field_def_list_flags_response(<<>>, 0, 0, _, R1, TrUserData) -> + S1 = #{}, + if R1 == '$undef' -> S1; + true -> S1#{flag => lists_reverse(R1, TrUserData)} + end. + +d_field_list_flags_response_flag(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_flags_response_flag(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +d_field_list_flags_response_flag(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_flag(Bs, TrUserData), TrUserData), Rest2} end, + dfp_read_field_def_list_flags_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). + +skip_varint_list_flags_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_flags_response(Rest, Z1, Z2, F, F@_1, TrUserData); +skip_varint_list_flags_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_flags_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_length_delimited_list_flags_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_flags_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +skip_length_delimited_list_flags_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_list_flags_response(Rest2, 0, 0, F, F@_1, TrUserData). + +skip_group_list_flags_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_list_flags_response(Rest, 0, Z2, FNum, F@_1, TrUserData). + +skip_32_list_flags_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_flags_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_64_list_flags_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_flags_response(Rest, Z1, Z2, F, F@_1, TrUserData). + +decode_msg_delete_flag_request(Bin, TrUserData) -> dfp_read_field_def_delete_flag_request(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). + +dfp_read_field_def_delete_flag_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_delete_flag_request_name(Rest, Z1, Z2, F, F@_1, TrUserData); +dfp_read_field_def_delete_flag_request(<<>>, 0, 0, _, F@_1, _) -> #{name => F@_1}; +dfp_read_field_def_delete_flag_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_delete_flag_request(Other, Z1, Z2, F, F@_1, TrUserData). + +dg_read_field_def_delete_flag_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_delete_flag_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +dg_read_field_def_delete_flag_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 10 -> d_field_delete_flag_request_name(Rest, 0, 0, 0, F@_1, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_delete_flag_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 1 -> skip_64_delete_flag_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 2 -> skip_length_delimited_delete_flag_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 3 -> skip_group_delete_flag_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); + 5 -> skip_32_delete_flag_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) + end + end; +dg_read_field_def_delete_flag_request(<<>>, 0, 0, _, F@_1, _) -> #{name => F@_1}. + +d_field_delete_flag_request_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_delete_flag_request_name(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +d_field_delete_flag_request_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> + {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, + dfp_read_field_def_delete_flag_request(RestF, 0, 0, F, NewFValue, TrUserData). + +skip_varint_delete_flag_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_delete_flag_request(Rest, Z1, Z2, F, F@_1, TrUserData); +skip_varint_delete_flag_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_delete_flag_request(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_length_delimited_delete_flag_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_delete_flag_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); +skip_length_delimited_delete_flag_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_delete_flag_request(Rest2, 0, 0, F, F@_1, TrUserData). + +skip_group_delete_flag_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_delete_flag_request(Rest, 0, Z2, FNum, F@_1, TrUserData). + +skip_32_delete_flag_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_delete_flag_request(Rest, Z1, Z2, F, F@_1, TrUserData). + +skip_64_delete_flag_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_delete_flag_request(Rest, Z1, Z2, F, F@_1, TrUserData). + +decode_msg_delete_flag_response(Bin, TrUserData) -> dfp_read_field_def_delete_flag_response(Bin, 0, 0, 0, TrUserData). + +dfp_read_field_def_delete_flag_response(<<>>, 0, 0, _, _) -> #{}; +dfp_read_field_def_delete_flag_response(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_delete_flag_response(Other, Z1, Z2, F, TrUserData). + +dg_read_field_def_delete_flag_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_delete_flag_response(Rest, N + 7, X bsl N + Acc, F, TrUserData); +dg_read_field_def_delete_flag_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) -> + Key = X bsl N + Acc, + case Key band 7 of + 0 -> skip_varint_delete_flag_response(Rest, 0, 0, Key bsr 3, TrUserData); + 1 -> skip_64_delete_flag_response(Rest, 0, 0, Key bsr 3, TrUserData); + 2 -> skip_length_delimited_delete_flag_response(Rest, 0, 0, Key bsr 3, TrUserData); + 3 -> skip_group_delete_flag_response(Rest, 0, 0, Key bsr 3, TrUserData); + 5 -> skip_32_delete_flag_response(Rest, 0, 0, Key bsr 3, TrUserData) + end; +dg_read_field_def_delete_flag_response(<<>>, 0, 0, _, _) -> #{}. + +skip_varint_delete_flag_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_delete_flag_response(Rest, Z1, Z2, F, TrUserData); +skip_varint_delete_flag_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_delete_flag_response(Rest, Z1, Z2, F, TrUserData). + +skip_length_delimited_delete_flag_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_delete_flag_response(Rest, N + 7, X bsl N + Acc, F, TrUserData); +skip_length_delimited_delete_flag_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_delete_flag_response(Rest2, 0, 0, F, TrUserData). + +skip_group_delete_flag_response(Bin, _, Z2, FNum, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_delete_flag_response(Rest, 0, Z2, FNum, TrUserData). + +skip_32_delete_flag_response(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_delete_flag_response(Rest, Z1, Z2, F, TrUserData). + +skip_64_delete_flag_response(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_delete_flag_response(Rest, Z1, Z2, F, TrUserData). + +decode_msg_timestamp(Bin, TrUserData) -> dfp_read_field_def_timestamp(Bin, 0, 0, 0, id(0, TrUserData), id(0, TrUserData), TrUserData). + +dfp_read_field_def_timestamp(<<8, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_timestamp_seconds(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_timestamp(<<16, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_timestamp_nanos(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +dfp_read_field_def_timestamp(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{seconds => F@_1, nanos => F@_2}; +dfp_read_field_def_timestamp(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_timestamp(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). + +dg_read_field_def_timestamp(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_timestamp(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +dg_read_field_def_timestamp(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> + Key = X bsl N + Acc, + case Key of + 8 -> d_field_timestamp_seconds(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + 16 -> d_field_timestamp_nanos(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); + _ -> + case Key band 7 of + 0 -> skip_varint_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 1 -> skip_64_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 2 -> skip_length_delimited_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 3 -> skip_group_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); + 5 -> skip_32_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) + end + end; +dg_read_field_def_timestamp(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{seconds => F@_1, nanos => F@_2}. + +d_field_timestamp_seconds(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_timestamp_seconds(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_timestamp_seconds(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> + {NewFValue, RestF} = {begin <> = <<(X bsl N + Acc):64/unsigned-native>>, id(Res, TrUserData) end, Rest}, + dfp_read_field_def_timestamp(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). + +d_field_timestamp_nanos(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_timestamp_nanos(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +d_field_timestamp_nanos(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> + {NewFValue, RestF} = {begin <> = <<(X bsl N + Acc):32/unsigned-native>>, id(Res, TrUserData) end, Rest}, + dfp_read_field_def_timestamp(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). + +skip_varint_timestamp(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_timestamp(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); +skip_varint_timestamp(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_timestamp(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_length_delimited_timestamp(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_timestamp(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); +skip_length_delimited_timestamp(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> + Length = X bsl N + Acc, + <<_:Length/binary, Rest2/binary>> = Rest, + dfp_read_field_def_timestamp(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). + +skip_group_timestamp(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> + {_, Rest} = read_group(Bin, FNum), + dfp_read_field_def_timestamp(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). + +skip_32_timestamp(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_timestamp(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +skip_64_timestamp(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_timestamp(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). + +read_group(Bin, FieldNum) -> + {NumBytes, EndTagLen} = read_gr_b(Bin, 0, 0, 0, 0, FieldNum), + <> = Bin, + {Group, Rest}. + +%% Like skipping over fields, but record the total length, +%% Each field is <(FieldNum bsl 3) bor FieldType> ++ +%% Record the length because varints may be non-optimally encoded. +%% +%% Groups can be nested, but assume the same FieldNum cannot be nested +%% because group field numbers are shared with the rest of the fields +%% numbers. Thus we can search just for an group-end with the same +%% field number. +%% +%% (The only time the same group field number could occur would +%% be in a nested sub message, but then it would be inside a +%% length-delimited entry, which we skip-read by length.) +read_gr_b(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, FieldNum) + when N < (32-7) -> + read_gr_b(Tl, N+7, X bsl N + Acc, NumBytes, TagLen+1, FieldNum); +read_gr_b(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, + FieldNum) -> + Key = X bsl N + Acc, + TagLen1 = TagLen + 1, + case {Key bsr 3, Key band 7} of + {FieldNum, 4} -> % 4 = group_end + {NumBytes, TagLen1}; + {_, 0} -> % 0 = varint + read_gr_vi(Tl, 0, NumBytes + TagLen1, FieldNum); + {_, 1} -> % 1 = bits64 + <<_:64, Tl2/binary>> = Tl, + read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 8, 0, FieldNum); + {_, 2} -> % 2 = length_delimited + read_gr_ld(Tl, 0, 0, NumBytes + TagLen1, FieldNum); + {_, 3} -> % 3 = group_start + read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum); + {_, 4} -> % 4 = group_end + read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum); + {_, 5} -> % 5 = bits32 + <<_:32, Tl2/binary>> = Tl, + read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 4, 0, FieldNum) + end. + +read_gr_vi(<<1:1, _:7, Tl/binary>>, N, NumBytes, FieldNum) + when N < (64-7) -> + read_gr_vi(Tl, N+7, NumBytes+1, FieldNum); +read_gr_vi(<<0:1, _:7, Tl/binary>>, _, NumBytes, FieldNum) -> + read_gr_b(Tl, 0, 0, NumBytes+1, 0, FieldNum). + +read_gr_ld(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) + when N < (64-7) -> + read_gr_ld(Tl, N+7, X bsl N + Acc, NumBytes+1, FieldNum); +read_gr_ld(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) -> + Len = X bsl N + Acc, + NumBytes1 = NumBytes + 1, + <<_:Len/binary, Tl2/binary>> = Tl, + read_gr_b(Tl2, 0, 0, NumBytes1 + Len, 0, FieldNum). + +merge_msgs(Prev, New, MsgName) when is_atom(MsgName) -> merge_msgs(Prev, New, MsgName, []). + +merge_msgs(Prev, New, MsgName, Opts) -> + TrUserData = proplists:get_value(user_data, Opts), + case MsgName of + cart_item -> merge_msg_cart_item(Prev, New, TrUserData); + add_item_request -> merge_msg_add_item_request(Prev, New, TrUserData); + empty_cart_request -> merge_msg_empty_cart_request(Prev, New, TrUserData); + get_cart_request -> merge_msg_get_cart_request(Prev, New, TrUserData); + cart -> merge_msg_cart(Prev, New, TrUserData); + empty -> merge_msg_empty(Prev, New, TrUserData); + list_recommendations_request -> merge_msg_list_recommendations_request(Prev, New, TrUserData); + list_recommendations_response -> merge_msg_list_recommendations_response(Prev, New, TrUserData); + product -> merge_msg_product(Prev, New, TrUserData); + list_products_response -> merge_msg_list_products_response(Prev, New, TrUserData); + get_product_request -> merge_msg_get_product_request(Prev, New, TrUserData); + search_products_request -> merge_msg_search_products_request(Prev, New, TrUserData); + search_products_response -> merge_msg_search_products_response(Prev, New, TrUserData); + get_quote_request -> merge_msg_get_quote_request(Prev, New, TrUserData); + get_quote_response -> merge_msg_get_quote_response(Prev, New, TrUserData); + ship_order_request -> merge_msg_ship_order_request(Prev, New, TrUserData); + ship_order_response -> merge_msg_ship_order_response(Prev, New, TrUserData); + address -> merge_msg_address(Prev, New, TrUserData); + money -> merge_msg_money(Prev, New, TrUserData); + get_supported_currencies_response -> merge_msg_get_supported_currencies_response(Prev, New, TrUserData); + currency_conversion_request -> merge_msg_currency_conversion_request(Prev, New, TrUserData); + credit_card_info -> merge_msg_credit_card_info(Prev, New, TrUserData); + charge_request -> merge_msg_charge_request(Prev, New, TrUserData); + charge_response -> merge_msg_charge_response(Prev, New, TrUserData); + order_item -> merge_msg_order_item(Prev, New, TrUserData); + order_result -> merge_msg_order_result(Prev, New, TrUserData); + send_order_confirmation_request -> merge_msg_send_order_confirmation_request(Prev, New, TrUserData); + place_order_request -> merge_msg_place_order_request(Prev, New, TrUserData); + place_order_response -> merge_msg_place_order_response(Prev, New, TrUserData); + ad_request -> merge_msg_ad_request(Prev, New, TrUserData); + ad_response -> merge_msg_ad_response(Prev, New, TrUserData); + ad -> merge_msg_ad(Prev, New, TrUserData); + flag -> merge_msg_flag(Prev, New, TrUserData); + get_flag_request -> merge_msg_get_flag_request(Prev, New, TrUserData); + get_flag_response -> merge_msg_get_flag_response(Prev, New, TrUserData); + create_flag_request -> merge_msg_create_flag_request(Prev, New, TrUserData); + create_flag_response -> merge_msg_create_flag_response(Prev, New, TrUserData); + update_flag_request -> merge_msg_update_flag_request(Prev, New, TrUserData); + update_flag_response -> merge_msg_update_flag_response(Prev, New, TrUserData); + list_flags_request -> merge_msg_list_flags_request(Prev, New, TrUserData); + list_flags_response -> merge_msg_list_flags_response(Prev, New, TrUserData); + delete_flag_request -> merge_msg_delete_flag_request(Prev, New, TrUserData); + delete_flag_response -> merge_msg_delete_flag_response(Prev, New, TrUserData); + timestamp -> merge_msg_timestamp(Prev, New, TrUserData) + end. + +-compile({nowarn_unused_function,merge_msg_cart_item/3}). +merge_msg_cart_item(PMsg, NMsg, _) -> + S1 = #{}, + S2 = case {PMsg, NMsg} of + {_, #{product_id := NFproduct_id}} -> S1#{product_id => NFproduct_id}; + {#{product_id := PFproduct_id}, _} -> S1#{product_id => PFproduct_id}; + _ -> S1 + end, + case {PMsg, NMsg} of + {_, #{quantity := NFquantity}} -> S2#{quantity => NFquantity}; + {#{quantity := PFquantity}, _} -> S2#{quantity => PFquantity}; + _ -> S2 + end. + +-compile({nowarn_unused_function,merge_msg_add_item_request/3}). +merge_msg_add_item_request(PMsg, NMsg, TrUserData) -> + S1 = #{}, + S2 = case {PMsg, NMsg} of + {_, #{user_id := NFuser_id}} -> S1#{user_id => NFuser_id}; + {#{user_id := PFuser_id}, _} -> S1#{user_id => PFuser_id}; + _ -> S1 + end, + case {PMsg, NMsg} of + {#{item := PFitem}, #{item := NFitem}} -> S2#{item => merge_msg_cart_item(PFitem, NFitem, TrUserData)}; + {_, #{item := NFitem}} -> S2#{item => NFitem}; + {#{item := PFitem}, _} -> S2#{item => PFitem}; + {_, _} -> S2 + end. + +-compile({nowarn_unused_function,merge_msg_empty_cart_request/3}). +merge_msg_empty_cart_request(PMsg, NMsg, _) -> + S1 = #{}, + case {PMsg, NMsg} of + {_, #{user_id := NFuser_id}} -> S1#{user_id => NFuser_id}; + {#{user_id := PFuser_id}, _} -> S1#{user_id => PFuser_id}; + _ -> S1 + end. + +-compile({nowarn_unused_function,merge_msg_get_cart_request/3}). +merge_msg_get_cart_request(PMsg, NMsg, _) -> + S1 = #{}, + case {PMsg, NMsg} of + {_, #{user_id := NFuser_id}} -> S1#{user_id => NFuser_id}; + {#{user_id := PFuser_id}, _} -> S1#{user_id => PFuser_id}; + _ -> S1 + end. + +-compile({nowarn_unused_function,merge_msg_cart/3}). +merge_msg_cart(PMsg, NMsg, TrUserData) -> + S1 = #{}, + S2 = case {PMsg, NMsg} of + {_, #{user_id := NFuser_id}} -> S1#{user_id => NFuser_id}; + {#{user_id := PFuser_id}, _} -> S1#{user_id => PFuser_id}; + _ -> S1 + end, + case {PMsg, NMsg} of + {#{items := PFitems}, #{items := NFitems}} -> S2#{items => 'erlang_++'(PFitems, NFitems, TrUserData)}; + {_, #{items := NFitems}} -> S2#{items => NFitems}; + {#{items := PFitems}, _} -> S2#{items => PFitems}; + {_, _} -> S2 + end. + +-compile({nowarn_unused_function,merge_msg_empty/3}). +merge_msg_empty(_Prev, New, _TrUserData) -> New. + +-compile({nowarn_unused_function,merge_msg_list_recommendations_request/3}). +merge_msg_list_recommendations_request(PMsg, NMsg, TrUserData) -> + S1 = #{}, + S2 = case {PMsg, NMsg} of + {_, #{user_id := NFuser_id}} -> S1#{user_id => NFuser_id}; + {#{user_id := PFuser_id}, _} -> S1#{user_id => PFuser_id}; + _ -> S1 + end, + case {PMsg, NMsg} of + {#{product_ids := PFproduct_ids}, #{product_ids := NFproduct_ids}} -> S2#{product_ids => 'erlang_++'(PFproduct_ids, NFproduct_ids, TrUserData)}; + {_, #{product_ids := NFproduct_ids}} -> S2#{product_ids => NFproduct_ids}; + {#{product_ids := PFproduct_ids}, _} -> S2#{product_ids => PFproduct_ids}; + {_, _} -> S2 + end. + +-compile({nowarn_unused_function,merge_msg_list_recommendations_response/3}). +merge_msg_list_recommendations_response(PMsg, NMsg, TrUserData) -> + S1 = #{}, + case {PMsg, NMsg} of + {#{product_ids := PFproduct_ids}, #{product_ids := NFproduct_ids}} -> S1#{product_ids => 'erlang_++'(PFproduct_ids, NFproduct_ids, TrUserData)}; + {_, #{product_ids := NFproduct_ids}} -> S1#{product_ids => NFproduct_ids}; + {#{product_ids := PFproduct_ids}, _} -> S1#{product_ids => PFproduct_ids}; + {_, _} -> S1 + end. + +-compile({nowarn_unused_function,merge_msg_product/3}). +merge_msg_product(PMsg, NMsg, TrUserData) -> + S1 = #{}, + S2 = case {PMsg, NMsg} of + {_, #{id := NFid}} -> S1#{id => NFid}; + {#{id := PFid}, _} -> S1#{id => PFid}; + _ -> S1 + end, + S3 = case {PMsg, NMsg} of + {_, #{name := NFname}} -> S2#{name => NFname}; + {#{name := PFname}, _} -> S2#{name => PFname}; + _ -> S2 + end, + S4 = case {PMsg, NMsg} of + {_, #{description := NFdescription}} -> S3#{description => NFdescription}; + {#{description := PFdescription}, _} -> S3#{description => PFdescription}; + _ -> S3 + end, + S5 = case {PMsg, NMsg} of + {_, #{picture := NFpicture}} -> S4#{picture => NFpicture}; + {#{picture := PFpicture}, _} -> S4#{picture => PFpicture}; + _ -> S4 + end, + S6 = case {PMsg, NMsg} of + {#{price_usd := PFprice_usd}, #{price_usd := NFprice_usd}} -> S5#{price_usd => merge_msg_money(PFprice_usd, NFprice_usd, TrUserData)}; + {_, #{price_usd := NFprice_usd}} -> S5#{price_usd => NFprice_usd}; + {#{price_usd := PFprice_usd}, _} -> S5#{price_usd => PFprice_usd}; + {_, _} -> S5 + end, + case {PMsg, NMsg} of + {#{categories := PFcategories}, #{categories := NFcategories}} -> S6#{categories => 'erlang_++'(PFcategories, NFcategories, TrUserData)}; + {_, #{categories := NFcategories}} -> S6#{categories => NFcategories}; + {#{categories := PFcategories}, _} -> S6#{categories => PFcategories}; + {_, _} -> S6 + end. + +-compile({nowarn_unused_function,merge_msg_list_products_response/3}). +merge_msg_list_products_response(PMsg, NMsg, TrUserData) -> + S1 = #{}, + case {PMsg, NMsg} of + {#{products := PFproducts}, #{products := NFproducts}} -> S1#{products => 'erlang_++'(PFproducts, NFproducts, TrUserData)}; + {_, #{products := NFproducts}} -> S1#{products => NFproducts}; + {#{products := PFproducts}, _} -> S1#{products => PFproducts}; + {_, _} -> S1 + end. + +-compile({nowarn_unused_function,merge_msg_get_product_request/3}). +merge_msg_get_product_request(PMsg, NMsg, _) -> + S1 = #{}, + case {PMsg, NMsg} of + {_, #{id := NFid}} -> S1#{id => NFid}; + {#{id := PFid}, _} -> S1#{id => PFid}; + _ -> S1 + end. + +-compile({nowarn_unused_function,merge_msg_search_products_request/3}). +merge_msg_search_products_request(PMsg, NMsg, _) -> + S1 = #{}, + case {PMsg, NMsg} of + {_, #{query := NFquery}} -> S1#{query => NFquery}; + {#{query := PFquery}, _} -> S1#{query => PFquery}; + _ -> S1 + end. + +-compile({nowarn_unused_function,merge_msg_search_products_response/3}). +merge_msg_search_products_response(PMsg, NMsg, TrUserData) -> + S1 = #{}, + case {PMsg, NMsg} of + {#{results := PFresults}, #{results := NFresults}} -> S1#{results => 'erlang_++'(PFresults, NFresults, TrUserData)}; + {_, #{results := NFresults}} -> S1#{results => NFresults}; + {#{results := PFresults}, _} -> S1#{results => PFresults}; + {_, _} -> S1 + end. + +-compile({nowarn_unused_function,merge_msg_get_quote_request/3}). +merge_msg_get_quote_request(PMsg, NMsg, TrUserData) -> + S1 = #{}, + S2 = case {PMsg, NMsg} of + {#{address := PFaddress}, #{address := NFaddress}} -> S1#{address => merge_msg_address(PFaddress, NFaddress, TrUserData)}; + {_, #{address := NFaddress}} -> S1#{address => NFaddress}; + {#{address := PFaddress}, _} -> S1#{address => PFaddress}; + {_, _} -> S1 + end, + case {PMsg, NMsg} of + {#{items := PFitems}, #{items := NFitems}} -> S2#{items => 'erlang_++'(PFitems, NFitems, TrUserData)}; + {_, #{items := NFitems}} -> S2#{items => NFitems}; + {#{items := PFitems}, _} -> S2#{items => PFitems}; + {_, _} -> S2 + end. + +-compile({nowarn_unused_function,merge_msg_get_quote_response/3}). +merge_msg_get_quote_response(PMsg, NMsg, TrUserData) -> + S1 = #{}, + case {PMsg, NMsg} of + {#{cost_usd := PFcost_usd}, #{cost_usd := NFcost_usd}} -> S1#{cost_usd => merge_msg_money(PFcost_usd, NFcost_usd, TrUserData)}; + {_, #{cost_usd := NFcost_usd}} -> S1#{cost_usd => NFcost_usd}; + {#{cost_usd := PFcost_usd}, _} -> S1#{cost_usd => PFcost_usd}; + {_, _} -> S1 + end. + +-compile({nowarn_unused_function,merge_msg_ship_order_request/3}). +merge_msg_ship_order_request(PMsg, NMsg, TrUserData) -> + S1 = #{}, + S2 = case {PMsg, NMsg} of + {#{address := PFaddress}, #{address := NFaddress}} -> S1#{address => merge_msg_address(PFaddress, NFaddress, TrUserData)}; + {_, #{address := NFaddress}} -> S1#{address => NFaddress}; + {#{address := PFaddress}, _} -> S1#{address => PFaddress}; + {_, _} -> S1 + end, + case {PMsg, NMsg} of + {#{items := PFitems}, #{items := NFitems}} -> S2#{items => 'erlang_++'(PFitems, NFitems, TrUserData)}; + {_, #{items := NFitems}} -> S2#{items => NFitems}; + {#{items := PFitems}, _} -> S2#{items => PFitems}; + {_, _} -> S2 + end. + +-compile({nowarn_unused_function,merge_msg_ship_order_response/3}). +merge_msg_ship_order_response(PMsg, NMsg, _) -> + S1 = #{}, + case {PMsg, NMsg} of + {_, #{tracking_id := NFtracking_id}} -> S1#{tracking_id => NFtracking_id}; + {#{tracking_id := PFtracking_id}, _} -> S1#{tracking_id => PFtracking_id}; + _ -> S1 + end. + +-compile({nowarn_unused_function,merge_msg_address/3}). +merge_msg_address(PMsg, NMsg, _) -> + S1 = #{}, + S2 = case {PMsg, NMsg} of + {_, #{street_address := NFstreet_address}} -> S1#{street_address => NFstreet_address}; + {#{street_address := PFstreet_address}, _} -> S1#{street_address => PFstreet_address}; + _ -> S1 + end, + S3 = case {PMsg, NMsg} of + {_, #{city := NFcity}} -> S2#{city => NFcity}; + {#{city := PFcity}, _} -> S2#{city => PFcity}; + _ -> S2 + end, + S4 = case {PMsg, NMsg} of + {_, #{state := NFstate}} -> S3#{state => NFstate}; + {#{state := PFstate}, _} -> S3#{state => PFstate}; + _ -> S3 + end, + S5 = case {PMsg, NMsg} of + {_, #{country := NFcountry}} -> S4#{country => NFcountry}; + {#{country := PFcountry}, _} -> S4#{country => PFcountry}; + _ -> S4 + end, + case {PMsg, NMsg} of + {_, #{zip_code := NFzip_code}} -> S5#{zip_code => NFzip_code}; + {#{zip_code := PFzip_code}, _} -> S5#{zip_code => PFzip_code}; + _ -> S5 + end. + +-compile({nowarn_unused_function,merge_msg_money/3}). +merge_msg_money(PMsg, NMsg, _) -> + S1 = #{}, + S2 = case {PMsg, NMsg} of + {_, #{currency_code := NFcurrency_code}} -> S1#{currency_code => NFcurrency_code}; + {#{currency_code := PFcurrency_code}, _} -> S1#{currency_code => PFcurrency_code}; + _ -> S1 + end, + S3 = case {PMsg, NMsg} of + {_, #{units := NFunits}} -> S2#{units => NFunits}; + {#{units := PFunits}, _} -> S2#{units => PFunits}; + _ -> S2 + end, + case {PMsg, NMsg} of + {_, #{nanos := NFnanos}} -> S3#{nanos => NFnanos}; + {#{nanos := PFnanos}, _} -> S3#{nanos => PFnanos}; + _ -> S3 + end. + +-compile({nowarn_unused_function,merge_msg_get_supported_currencies_response/3}). +merge_msg_get_supported_currencies_response(PMsg, NMsg, TrUserData) -> + S1 = #{}, + case {PMsg, NMsg} of + {#{currency_codes := PFcurrency_codes}, #{currency_codes := NFcurrency_codes}} -> S1#{currency_codes => 'erlang_++'(PFcurrency_codes, NFcurrency_codes, TrUserData)}; + {_, #{currency_codes := NFcurrency_codes}} -> S1#{currency_codes => NFcurrency_codes}; + {#{currency_codes := PFcurrency_codes}, _} -> S1#{currency_codes => PFcurrency_codes}; + {_, _} -> S1 + end. + +-compile({nowarn_unused_function,merge_msg_currency_conversion_request/3}). +merge_msg_currency_conversion_request(PMsg, NMsg, TrUserData) -> + S1 = #{}, + S2 = case {PMsg, NMsg} of + {#{from := PFfrom}, #{from := NFfrom}} -> S1#{from => merge_msg_money(PFfrom, NFfrom, TrUserData)}; + {_, #{from := NFfrom}} -> S1#{from => NFfrom}; + {#{from := PFfrom}, _} -> S1#{from => PFfrom}; + {_, _} -> S1 + end, + case {PMsg, NMsg} of + {_, #{to_code := NFto_code}} -> S2#{to_code => NFto_code}; + {#{to_code := PFto_code}, _} -> S2#{to_code => PFto_code}; + _ -> S2 + end. + +-compile({nowarn_unused_function,merge_msg_credit_card_info/3}). +merge_msg_credit_card_info(PMsg, NMsg, _) -> + S1 = #{}, + S2 = case {PMsg, NMsg} of + {_, #{credit_card_number := NFcredit_card_number}} -> S1#{credit_card_number => NFcredit_card_number}; + {#{credit_card_number := PFcredit_card_number}, _} -> S1#{credit_card_number => PFcredit_card_number}; + _ -> S1 + end, + S3 = case {PMsg, NMsg} of + {_, #{credit_card_cvv := NFcredit_card_cvv}} -> S2#{credit_card_cvv => NFcredit_card_cvv}; + {#{credit_card_cvv := PFcredit_card_cvv}, _} -> S2#{credit_card_cvv => PFcredit_card_cvv}; + _ -> S2 + end, + S4 = case {PMsg, NMsg} of + {_, #{credit_card_expiration_year := NFcredit_card_expiration_year}} -> S3#{credit_card_expiration_year => NFcredit_card_expiration_year}; + {#{credit_card_expiration_year := PFcredit_card_expiration_year}, _} -> S3#{credit_card_expiration_year => PFcredit_card_expiration_year}; + _ -> S3 + end, + case {PMsg, NMsg} of + {_, #{credit_card_expiration_month := NFcredit_card_expiration_month}} -> S4#{credit_card_expiration_month => NFcredit_card_expiration_month}; + {#{credit_card_expiration_month := PFcredit_card_expiration_month}, _} -> S4#{credit_card_expiration_month => PFcredit_card_expiration_month}; + _ -> S4 + end. + +-compile({nowarn_unused_function,merge_msg_charge_request/3}). +merge_msg_charge_request(PMsg, NMsg, TrUserData) -> + S1 = #{}, + S2 = case {PMsg, NMsg} of + {#{amount := PFamount}, #{amount := NFamount}} -> S1#{amount => merge_msg_money(PFamount, NFamount, TrUserData)}; + {_, #{amount := NFamount}} -> S1#{amount => NFamount}; + {#{amount := PFamount}, _} -> S1#{amount => PFamount}; + {_, _} -> S1 + end, + case {PMsg, NMsg} of + {#{credit_card := PFcredit_card}, #{credit_card := NFcredit_card}} -> S2#{credit_card => merge_msg_credit_card_info(PFcredit_card, NFcredit_card, TrUserData)}; + {_, #{credit_card := NFcredit_card}} -> S2#{credit_card => NFcredit_card}; + {#{credit_card := PFcredit_card}, _} -> S2#{credit_card => PFcredit_card}; + {_, _} -> S2 + end. + +-compile({nowarn_unused_function,merge_msg_charge_response/3}). +merge_msg_charge_response(PMsg, NMsg, _) -> + S1 = #{}, + case {PMsg, NMsg} of + {_, #{transaction_id := NFtransaction_id}} -> S1#{transaction_id => NFtransaction_id}; + {#{transaction_id := PFtransaction_id}, _} -> S1#{transaction_id => PFtransaction_id}; + _ -> S1 + end. + +-compile({nowarn_unused_function,merge_msg_order_item/3}). +merge_msg_order_item(PMsg, NMsg, TrUserData) -> + S1 = #{}, + S2 = case {PMsg, NMsg} of + {#{item := PFitem}, #{item := NFitem}} -> S1#{item => merge_msg_cart_item(PFitem, NFitem, TrUserData)}; + {_, #{item := NFitem}} -> S1#{item => NFitem}; + {#{item := PFitem}, _} -> S1#{item => PFitem}; + {_, _} -> S1 + end, + case {PMsg, NMsg} of + {#{cost := PFcost}, #{cost := NFcost}} -> S2#{cost => merge_msg_money(PFcost, NFcost, TrUserData)}; + {_, #{cost := NFcost}} -> S2#{cost => NFcost}; + {#{cost := PFcost}, _} -> S2#{cost => PFcost}; + {_, _} -> S2 + end. + +-compile({nowarn_unused_function,merge_msg_order_result/3}). +merge_msg_order_result(PMsg, NMsg, TrUserData) -> + S1 = #{}, + S2 = case {PMsg, NMsg} of + {_, #{order_id := NForder_id}} -> S1#{order_id => NForder_id}; + {#{order_id := PForder_id}, _} -> S1#{order_id => PForder_id}; + _ -> S1 + end, + S3 = case {PMsg, NMsg} of + {_, #{shipping_tracking_id := NFshipping_tracking_id}} -> S2#{shipping_tracking_id => NFshipping_tracking_id}; + {#{shipping_tracking_id := PFshipping_tracking_id}, _} -> S2#{shipping_tracking_id => PFshipping_tracking_id}; + _ -> S2 + end, + S4 = case {PMsg, NMsg} of + {#{shipping_cost := PFshipping_cost}, #{shipping_cost := NFshipping_cost}} -> S3#{shipping_cost => merge_msg_money(PFshipping_cost, NFshipping_cost, TrUserData)}; + {_, #{shipping_cost := NFshipping_cost}} -> S3#{shipping_cost => NFshipping_cost}; + {#{shipping_cost := PFshipping_cost}, _} -> S3#{shipping_cost => PFshipping_cost}; + {_, _} -> S3 + end, + S5 = case {PMsg, NMsg} of + {#{shipping_address := PFshipping_address}, #{shipping_address := NFshipping_address}} -> S4#{shipping_address => merge_msg_address(PFshipping_address, NFshipping_address, TrUserData)}; + {_, #{shipping_address := NFshipping_address}} -> S4#{shipping_address => NFshipping_address}; + {#{shipping_address := PFshipping_address}, _} -> S4#{shipping_address => PFshipping_address}; + {_, _} -> S4 + end, + case {PMsg, NMsg} of + {#{items := PFitems}, #{items := NFitems}} -> S5#{items => 'erlang_++'(PFitems, NFitems, TrUserData)}; + {_, #{items := NFitems}} -> S5#{items => NFitems}; + {#{items := PFitems}, _} -> S5#{items => PFitems}; + {_, _} -> S5 + end. + +-compile({nowarn_unused_function,merge_msg_send_order_confirmation_request/3}). +merge_msg_send_order_confirmation_request(PMsg, NMsg, TrUserData) -> + S1 = #{}, + S2 = case {PMsg, NMsg} of + {_, #{email := NFemail}} -> S1#{email => NFemail}; + {#{email := PFemail}, _} -> S1#{email => PFemail}; + _ -> S1 + end, + case {PMsg, NMsg} of + {#{order := PForder}, #{order := NForder}} -> S2#{order => merge_msg_order_result(PForder, NForder, TrUserData)}; + {_, #{order := NForder}} -> S2#{order => NForder}; + {#{order := PForder}, _} -> S2#{order => PForder}; + {_, _} -> S2 + end. + +-compile({nowarn_unused_function,merge_msg_place_order_request/3}). +merge_msg_place_order_request(PMsg, NMsg, TrUserData) -> + S1 = #{}, + S2 = case {PMsg, NMsg} of + {_, #{user_id := NFuser_id}} -> S1#{user_id => NFuser_id}; + {#{user_id := PFuser_id}, _} -> S1#{user_id => PFuser_id}; + _ -> S1 + end, + S3 = case {PMsg, NMsg} of + {_, #{user_currency := NFuser_currency}} -> S2#{user_currency => NFuser_currency}; + {#{user_currency := PFuser_currency}, _} -> S2#{user_currency => PFuser_currency}; + _ -> S2 + end, + S4 = case {PMsg, NMsg} of + {#{address := PFaddress}, #{address := NFaddress}} -> S3#{address => merge_msg_address(PFaddress, NFaddress, TrUserData)}; + {_, #{address := NFaddress}} -> S3#{address => NFaddress}; + {#{address := PFaddress}, _} -> S3#{address => PFaddress}; + {_, _} -> S3 + end, + S5 = case {PMsg, NMsg} of + {_, #{email := NFemail}} -> S4#{email => NFemail}; + {#{email := PFemail}, _} -> S4#{email => PFemail}; + _ -> S4 + end, + case {PMsg, NMsg} of + {#{credit_card := PFcredit_card}, #{credit_card := NFcredit_card}} -> S5#{credit_card => merge_msg_credit_card_info(PFcredit_card, NFcredit_card, TrUserData)}; + {_, #{credit_card := NFcredit_card}} -> S5#{credit_card => NFcredit_card}; + {#{credit_card := PFcredit_card}, _} -> S5#{credit_card => PFcredit_card}; + {_, _} -> S5 + end. + +-compile({nowarn_unused_function,merge_msg_place_order_response/3}). +merge_msg_place_order_response(PMsg, NMsg, TrUserData) -> + S1 = #{}, + case {PMsg, NMsg} of + {#{order := PForder}, #{order := NForder}} -> S1#{order => merge_msg_order_result(PForder, NForder, TrUserData)}; + {_, #{order := NForder}} -> S1#{order => NForder}; + {#{order := PForder}, _} -> S1#{order => PForder}; + {_, _} -> S1 + end. + +-compile({nowarn_unused_function,merge_msg_ad_request/3}). +merge_msg_ad_request(PMsg, NMsg, TrUserData) -> + S1 = #{}, + case {PMsg, NMsg} of + {#{context_keys := PFcontext_keys}, #{context_keys := NFcontext_keys}} -> S1#{context_keys => 'erlang_++'(PFcontext_keys, NFcontext_keys, TrUserData)}; + {_, #{context_keys := NFcontext_keys}} -> S1#{context_keys => NFcontext_keys}; + {#{context_keys := PFcontext_keys}, _} -> S1#{context_keys => PFcontext_keys}; + {_, _} -> S1 + end. + +-compile({nowarn_unused_function,merge_msg_ad_response/3}). +merge_msg_ad_response(PMsg, NMsg, TrUserData) -> + S1 = #{}, + case {PMsg, NMsg} of + {#{ads := PFads}, #{ads := NFads}} -> S1#{ads => 'erlang_++'(PFads, NFads, TrUserData)}; + {_, #{ads := NFads}} -> S1#{ads => NFads}; + {#{ads := PFads}, _} -> S1#{ads => PFads}; + {_, _} -> S1 + end. + +-compile({nowarn_unused_function,merge_msg_ad/3}). +merge_msg_ad(PMsg, NMsg, _) -> + S1 = #{}, + S2 = case {PMsg, NMsg} of + {_, #{redirect_url := NFredirect_url}} -> S1#{redirect_url => NFredirect_url}; + {#{redirect_url := PFredirect_url}, _} -> S1#{redirect_url => PFredirect_url}; + _ -> S1 + end, + case {PMsg, NMsg} of + {_, #{text := NFtext}} -> S2#{text => NFtext}; + {#{text := PFtext}, _} -> S2#{text => PFtext}; + _ -> S2 + end. + +-compile({nowarn_unused_function,merge_msg_flag/3}). +merge_msg_flag(PMsg, NMsg, TrUserData) -> + S1 = #{}, + S2 = case {PMsg, NMsg} of + {_, #{name := NFname}} -> S1#{name => NFname}; + {#{name := PFname}, _} -> S1#{name => PFname}; + _ -> S1 + end, + S3 = case {PMsg, NMsg} of + {_, #{description := NFdescription}} -> S2#{description => NFdescription}; + {#{description := PFdescription}, _} -> S2#{description => PFdescription}; + _ -> S2 + end, + S4 = case {PMsg, NMsg} of + {_, #{enabled := NFenabled}} -> S3#{enabled => NFenabled}; + {#{enabled := PFenabled}, _} -> S3#{enabled => PFenabled}; + _ -> S3 + end, + S5 = case {PMsg, NMsg} of + {#{created_at := PFcreated_at}, #{created_at := NFcreated_at}} -> S4#{created_at => merge_msg_timestamp(PFcreated_at, NFcreated_at, TrUserData)}; + {_, #{created_at := NFcreated_at}} -> S4#{created_at => NFcreated_at}; + {#{created_at := PFcreated_at}, _} -> S4#{created_at => PFcreated_at}; + {_, _} -> S4 + end, + case {PMsg, NMsg} of + {#{updated_at := PFupdated_at}, #{updated_at := NFupdated_at}} -> S5#{updated_at => merge_msg_timestamp(PFupdated_at, NFupdated_at, TrUserData)}; + {_, #{updated_at := NFupdated_at}} -> S5#{updated_at => NFupdated_at}; + {#{updated_at := PFupdated_at}, _} -> S5#{updated_at => PFupdated_at}; + {_, _} -> S5 + end. + +-compile({nowarn_unused_function,merge_msg_get_flag_request/3}). +merge_msg_get_flag_request(PMsg, NMsg, _) -> + S1 = #{}, + case {PMsg, NMsg} of + {_, #{name := NFname}} -> S1#{name => NFname}; + {#{name := PFname}, _} -> S1#{name => PFname}; + _ -> S1 + end. + +-compile({nowarn_unused_function,merge_msg_get_flag_response/3}). +merge_msg_get_flag_response(PMsg, NMsg, TrUserData) -> + S1 = #{}, + case {PMsg, NMsg} of + {#{flag := PFflag}, #{flag := NFflag}} -> S1#{flag => merge_msg_flag(PFflag, NFflag, TrUserData)}; + {_, #{flag := NFflag}} -> S1#{flag => NFflag}; + {#{flag := PFflag}, _} -> S1#{flag => PFflag}; + {_, _} -> S1 + end. + +-compile({nowarn_unused_function,merge_msg_create_flag_request/3}). +merge_msg_create_flag_request(PMsg, NMsg, _) -> + S1 = #{}, + S2 = case {PMsg, NMsg} of + {_, #{name := NFname}} -> S1#{name => NFname}; + {#{name := PFname}, _} -> S1#{name => PFname}; + _ -> S1 + end, + S3 = case {PMsg, NMsg} of + {_, #{description := NFdescription}} -> S2#{description => NFdescription}; + {#{description := PFdescription}, _} -> S2#{description => PFdescription}; + _ -> S2 + end, + case {PMsg, NMsg} of + {_, #{enabled := NFenabled}} -> S3#{enabled => NFenabled}; + {#{enabled := PFenabled}, _} -> S3#{enabled => PFenabled}; + _ -> S3 + end. + +-compile({nowarn_unused_function,merge_msg_create_flag_response/3}). +merge_msg_create_flag_response(PMsg, NMsg, TrUserData) -> + S1 = #{}, + case {PMsg, NMsg} of + {#{flag := PFflag}, #{flag := NFflag}} -> S1#{flag => merge_msg_flag(PFflag, NFflag, TrUserData)}; + {_, #{flag := NFflag}} -> S1#{flag => NFflag}; + {#{flag := PFflag}, _} -> S1#{flag => PFflag}; + {_, _} -> S1 + end. + +-compile({nowarn_unused_function,merge_msg_update_flag_request/3}). +merge_msg_update_flag_request(PMsg, NMsg, _) -> + S1 = #{}, + S2 = case {PMsg, NMsg} of + {_, #{name := NFname}} -> S1#{name => NFname}; + {#{name := PFname}, _} -> S1#{name => PFname}; + _ -> S1 + end, + case {PMsg, NMsg} of + {_, #{enabled := NFenabled}} -> S2#{enabled => NFenabled}; + {#{enabled := PFenabled}, _} -> S2#{enabled => PFenabled}; + _ -> S2 + end. + +-compile({nowarn_unused_function,merge_msg_update_flag_response/3}). +merge_msg_update_flag_response(_Prev, New, _TrUserData) -> New. + +-compile({nowarn_unused_function,merge_msg_list_flags_request/3}). +merge_msg_list_flags_request(_Prev, New, _TrUserData) -> New. + +-compile({nowarn_unused_function,merge_msg_list_flags_response/3}). +merge_msg_list_flags_response(PMsg, NMsg, TrUserData) -> + S1 = #{}, + case {PMsg, NMsg} of + {#{flag := PFflag}, #{flag := NFflag}} -> S1#{flag => 'erlang_++'(PFflag, NFflag, TrUserData)}; + {_, #{flag := NFflag}} -> S1#{flag => NFflag}; + {#{flag := PFflag}, _} -> S1#{flag => PFflag}; + {_, _} -> S1 + end. + +-compile({nowarn_unused_function,merge_msg_delete_flag_request/3}). +merge_msg_delete_flag_request(PMsg, NMsg, _) -> + S1 = #{}, + case {PMsg, NMsg} of + {_, #{name := NFname}} -> S1#{name => NFname}; + {#{name := PFname}, _} -> S1#{name => PFname}; + _ -> S1 + end. + +-compile({nowarn_unused_function,merge_msg_delete_flag_response/3}). +merge_msg_delete_flag_response(_Prev, New, _TrUserData) -> New. + +-compile({nowarn_unused_function,merge_msg_timestamp/3}). +merge_msg_timestamp(PMsg, NMsg, _) -> + S1 = #{}, + S2 = case {PMsg, NMsg} of + {_, #{seconds := NFseconds}} -> S1#{seconds => NFseconds}; + {#{seconds := PFseconds}, _} -> S1#{seconds => PFseconds}; + _ -> S1 + end, + case {PMsg, NMsg} of + {_, #{nanos := NFnanos}} -> S2#{nanos => NFnanos}; + {#{nanos := PFnanos}, _} -> S2#{nanos => PFnanos}; + _ -> S2 + end. + + +verify_msg(Msg, MsgName) when is_atom(MsgName) -> verify_msg(Msg, MsgName, []). + +verify_msg(Msg, MsgName, Opts) -> + TrUserData = proplists:get_value(user_data, Opts), + case MsgName of + cart_item -> v_msg_cart_item(Msg, [MsgName], TrUserData); + add_item_request -> v_msg_add_item_request(Msg, [MsgName], TrUserData); + empty_cart_request -> v_msg_empty_cart_request(Msg, [MsgName], TrUserData); + get_cart_request -> v_msg_get_cart_request(Msg, [MsgName], TrUserData); + cart -> v_msg_cart(Msg, [MsgName], TrUserData); + empty -> v_msg_empty(Msg, [MsgName], TrUserData); + list_recommendations_request -> v_msg_list_recommendations_request(Msg, [MsgName], TrUserData); + list_recommendations_response -> v_msg_list_recommendations_response(Msg, [MsgName], TrUserData); + product -> v_msg_product(Msg, [MsgName], TrUserData); + list_products_response -> v_msg_list_products_response(Msg, [MsgName], TrUserData); + get_product_request -> v_msg_get_product_request(Msg, [MsgName], TrUserData); + search_products_request -> v_msg_search_products_request(Msg, [MsgName], TrUserData); + search_products_response -> v_msg_search_products_response(Msg, [MsgName], TrUserData); + get_quote_request -> v_msg_get_quote_request(Msg, [MsgName], TrUserData); + get_quote_response -> v_msg_get_quote_response(Msg, [MsgName], TrUserData); + ship_order_request -> v_msg_ship_order_request(Msg, [MsgName], TrUserData); + ship_order_response -> v_msg_ship_order_response(Msg, [MsgName], TrUserData); + address -> v_msg_address(Msg, [MsgName], TrUserData); + money -> v_msg_money(Msg, [MsgName], TrUserData); + get_supported_currencies_response -> v_msg_get_supported_currencies_response(Msg, [MsgName], TrUserData); + currency_conversion_request -> v_msg_currency_conversion_request(Msg, [MsgName], TrUserData); + credit_card_info -> v_msg_credit_card_info(Msg, [MsgName], TrUserData); + charge_request -> v_msg_charge_request(Msg, [MsgName], TrUserData); + charge_response -> v_msg_charge_response(Msg, [MsgName], TrUserData); + order_item -> v_msg_order_item(Msg, [MsgName], TrUserData); + order_result -> v_msg_order_result(Msg, [MsgName], TrUserData); + send_order_confirmation_request -> v_msg_send_order_confirmation_request(Msg, [MsgName], TrUserData); + place_order_request -> v_msg_place_order_request(Msg, [MsgName], TrUserData); + place_order_response -> v_msg_place_order_response(Msg, [MsgName], TrUserData); + ad_request -> v_msg_ad_request(Msg, [MsgName], TrUserData); + ad_response -> v_msg_ad_response(Msg, [MsgName], TrUserData); + ad -> v_msg_ad(Msg, [MsgName], TrUserData); + flag -> v_msg_flag(Msg, [MsgName], TrUserData); + get_flag_request -> v_msg_get_flag_request(Msg, [MsgName], TrUserData); + get_flag_response -> v_msg_get_flag_response(Msg, [MsgName], TrUserData); + create_flag_request -> v_msg_create_flag_request(Msg, [MsgName], TrUserData); + create_flag_response -> v_msg_create_flag_response(Msg, [MsgName], TrUserData); + update_flag_request -> v_msg_update_flag_request(Msg, [MsgName], TrUserData); + update_flag_response -> v_msg_update_flag_response(Msg, [MsgName], TrUserData); + list_flags_request -> v_msg_list_flags_request(Msg, [MsgName], TrUserData); + list_flags_response -> v_msg_list_flags_response(Msg, [MsgName], TrUserData); + delete_flag_request -> v_msg_delete_flag_request(Msg, [MsgName], TrUserData); + delete_flag_response -> v_msg_delete_flag_response(Msg, [MsgName], TrUserData); + timestamp -> v_msg_timestamp(Msg, [MsgName], TrUserData); + _ -> mk_type_error(not_a_known_message, Msg, []) + end. + + +-compile({nowarn_unused_function,v_msg_cart_item/3}). +-dialyzer({nowarn_function,v_msg_cart_item/3}). +v_msg_cart_item(#{} = M, Path, TrUserData) -> + case M of + #{product_id := F1} -> v_type_string(F1, [product_id | Path], TrUserData); + _ -> ok + end, + case M of + #{quantity := F2} -> v_type_int32(F2, [quantity | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (product_id) -> ok; + (quantity) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_cart_item(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), cart_item}, M, Path); +v_msg_cart_item(X, Path, _TrUserData) -> mk_type_error({expected_msg, cart_item}, X, Path). + +-compile({nowarn_unused_function,v_msg_add_item_request/3}). +-dialyzer({nowarn_function,v_msg_add_item_request/3}). +v_msg_add_item_request(#{} = M, Path, TrUserData) -> + case M of + #{user_id := F1} -> v_type_string(F1, [user_id | Path], TrUserData); + _ -> ok + end, + case M of + #{item := F2} -> v_msg_cart_item(F2, [item | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (user_id) -> ok; + (item) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_add_item_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), add_item_request}, M, Path); +v_msg_add_item_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, add_item_request}, X, Path). + +-compile({nowarn_unused_function,v_msg_empty_cart_request/3}). +-dialyzer({nowarn_function,v_msg_empty_cart_request/3}). +v_msg_empty_cart_request(#{} = M, Path, TrUserData) -> + case M of + #{user_id := F1} -> v_type_string(F1, [user_id | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (user_id) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_empty_cart_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), empty_cart_request}, M, Path); +v_msg_empty_cart_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, empty_cart_request}, X, Path). + +-compile({nowarn_unused_function,v_msg_get_cart_request/3}). +-dialyzer({nowarn_function,v_msg_get_cart_request/3}). +v_msg_get_cart_request(#{} = M, Path, TrUserData) -> + case M of + #{user_id := F1} -> v_type_string(F1, [user_id | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (user_id) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_get_cart_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), get_cart_request}, M, Path); +v_msg_get_cart_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, get_cart_request}, X, Path). + +-compile({nowarn_unused_function,v_msg_cart/3}). +-dialyzer({nowarn_function,v_msg_cart/3}). +v_msg_cart(#{} = M, Path, TrUserData) -> + case M of + #{user_id := F1} -> v_type_string(F1, [user_id | Path], TrUserData); + _ -> ok + end, + case M of + #{items := F2} -> + if is_list(F2) -> + _ = [v_msg_cart_item(Elem, [items | Path], TrUserData) || Elem <- F2], + ok; + true -> mk_type_error({invalid_list_of, {msg, cart_item}}, F2, [items | Path]) + end; + _ -> ok + end, + lists:foreach(fun (user_id) -> ok; + (items) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_cart(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), cart}, M, Path); +v_msg_cart(X, Path, _TrUserData) -> mk_type_error({expected_msg, cart}, X, Path). + +-compile({nowarn_unused_function,v_msg_empty/3}). +-dialyzer({nowarn_function,v_msg_empty/3}). +v_msg_empty(#{} = M, Path, _) -> + lists:foreach(fun (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) end, maps:keys(M)), + ok; +v_msg_empty(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), empty}, M, Path); +v_msg_empty(X, Path, _TrUserData) -> mk_type_error({expected_msg, empty}, X, Path). + +-compile({nowarn_unused_function,v_msg_list_recommendations_request/3}). +-dialyzer({nowarn_function,v_msg_list_recommendations_request/3}). +v_msg_list_recommendations_request(#{} = M, Path, TrUserData) -> + case M of + #{user_id := F1} -> v_type_string(F1, [user_id | Path], TrUserData); + _ -> ok + end, + case M of + #{product_ids := F2} -> + if is_list(F2) -> + _ = [v_type_string(Elem, [product_ids | Path], TrUserData) || Elem <- F2], + ok; + true -> mk_type_error({invalid_list_of, string}, F2, [product_ids | Path]) + end; + _ -> ok + end, + lists:foreach(fun (user_id) -> ok; + (product_ids) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_list_recommendations_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_recommendations_request}, M, Path); +v_msg_list_recommendations_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_recommendations_request}, X, Path). + +-compile({nowarn_unused_function,v_msg_list_recommendations_response/3}). +-dialyzer({nowarn_function,v_msg_list_recommendations_response/3}). +v_msg_list_recommendations_response(#{} = M, Path, TrUserData) -> + case M of + #{product_ids := F1} -> + if is_list(F1) -> + _ = [v_type_string(Elem, [product_ids | Path], TrUserData) || Elem <- F1], + ok; + true -> mk_type_error({invalid_list_of, string}, F1, [product_ids | Path]) + end; + _ -> ok + end, + lists:foreach(fun (product_ids) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_list_recommendations_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_recommendations_response}, M, Path); +v_msg_list_recommendations_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_recommendations_response}, X, Path). + +-compile({nowarn_unused_function,v_msg_product/3}). +-dialyzer({nowarn_function,v_msg_product/3}). +v_msg_product(#{} = M, Path, TrUserData) -> + case M of + #{id := F1} -> v_type_string(F1, [id | Path], TrUserData); + _ -> ok + end, + case M of + #{name := F2} -> v_type_string(F2, [name | Path], TrUserData); + _ -> ok + end, + case M of + #{description := F3} -> v_type_string(F3, [description | Path], TrUserData); + _ -> ok + end, + case M of + #{picture := F4} -> v_type_string(F4, [picture | Path], TrUserData); + _ -> ok + end, + case M of + #{price_usd := F5} -> v_msg_money(F5, [price_usd | Path], TrUserData); + _ -> ok + end, + case M of + #{categories := F6} -> + if is_list(F6) -> + _ = [v_type_string(Elem, [categories | Path], TrUserData) || Elem <- F6], + ok; + true -> mk_type_error({invalid_list_of, string}, F6, [categories | Path]) + end; + _ -> ok + end, + lists:foreach(fun (id) -> ok; + (name) -> ok; + (description) -> ok; + (picture) -> ok; + (price_usd) -> ok; + (categories) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_product(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), product}, M, Path); +v_msg_product(X, Path, _TrUserData) -> mk_type_error({expected_msg, product}, X, Path). + +-compile({nowarn_unused_function,v_msg_list_products_response/3}). +-dialyzer({nowarn_function,v_msg_list_products_response/3}). +v_msg_list_products_response(#{} = M, Path, TrUserData) -> + case M of + #{products := F1} -> + if is_list(F1) -> + _ = [v_msg_product(Elem, [products | Path], TrUserData) || Elem <- F1], + ok; + true -> mk_type_error({invalid_list_of, {msg, product}}, F1, [products | Path]) + end; + _ -> ok + end, + lists:foreach(fun (products) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_list_products_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_products_response}, M, Path); +v_msg_list_products_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_products_response}, X, Path). + +-compile({nowarn_unused_function,v_msg_get_product_request/3}). +-dialyzer({nowarn_function,v_msg_get_product_request/3}). +v_msg_get_product_request(#{} = M, Path, TrUserData) -> + case M of + #{id := F1} -> v_type_string(F1, [id | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (id) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_get_product_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), get_product_request}, M, Path); +v_msg_get_product_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, get_product_request}, X, Path). + +-compile({nowarn_unused_function,v_msg_search_products_request/3}). +-dialyzer({nowarn_function,v_msg_search_products_request/3}). +v_msg_search_products_request(#{} = M, Path, TrUserData) -> + case M of + #{query := F1} -> v_type_string(F1, [query | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (query) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_search_products_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), search_products_request}, M, Path); +v_msg_search_products_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, search_products_request}, X, Path). + +-compile({nowarn_unused_function,v_msg_search_products_response/3}). +-dialyzer({nowarn_function,v_msg_search_products_response/3}). +v_msg_search_products_response(#{} = M, Path, TrUserData) -> + case M of + #{results := F1} -> + if is_list(F1) -> + _ = [v_msg_product(Elem, [results | Path], TrUserData) || Elem <- F1], + ok; + true -> mk_type_error({invalid_list_of, {msg, product}}, F1, [results | Path]) + end; + _ -> ok + end, + lists:foreach(fun (results) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_search_products_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), search_products_response}, M, Path); +v_msg_search_products_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, search_products_response}, X, Path). + +-compile({nowarn_unused_function,v_msg_get_quote_request/3}). +-dialyzer({nowarn_function,v_msg_get_quote_request/3}). +v_msg_get_quote_request(#{} = M, Path, TrUserData) -> + case M of + #{address := F1} -> v_msg_address(F1, [address | Path], TrUserData); + _ -> ok + end, + case M of + #{items := F2} -> + if is_list(F2) -> + _ = [v_msg_cart_item(Elem, [items | Path], TrUserData) || Elem <- F2], + ok; + true -> mk_type_error({invalid_list_of, {msg, cart_item}}, F2, [items | Path]) + end; + _ -> ok + end, + lists:foreach(fun (address) -> ok; + (items) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_get_quote_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), get_quote_request}, M, Path); +v_msg_get_quote_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, get_quote_request}, X, Path). + +-compile({nowarn_unused_function,v_msg_get_quote_response/3}). +-dialyzer({nowarn_function,v_msg_get_quote_response/3}). +v_msg_get_quote_response(#{} = M, Path, TrUserData) -> + case M of + #{cost_usd := F1} -> v_msg_money(F1, [cost_usd | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (cost_usd) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_get_quote_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), get_quote_response}, M, Path); +v_msg_get_quote_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, get_quote_response}, X, Path). + +-compile({nowarn_unused_function,v_msg_ship_order_request/3}). +-dialyzer({nowarn_function,v_msg_ship_order_request/3}). +v_msg_ship_order_request(#{} = M, Path, TrUserData) -> + case M of + #{address := F1} -> v_msg_address(F1, [address | Path], TrUserData); + _ -> ok + end, + case M of + #{items := F2} -> + if is_list(F2) -> + _ = [v_msg_cart_item(Elem, [items | Path], TrUserData) || Elem <- F2], + ok; + true -> mk_type_error({invalid_list_of, {msg, cart_item}}, F2, [items | Path]) + end; + _ -> ok + end, + lists:foreach(fun (address) -> ok; + (items) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_ship_order_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), ship_order_request}, M, Path); +v_msg_ship_order_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, ship_order_request}, X, Path). + +-compile({nowarn_unused_function,v_msg_ship_order_response/3}). +-dialyzer({nowarn_function,v_msg_ship_order_response/3}). +v_msg_ship_order_response(#{} = M, Path, TrUserData) -> + case M of + #{tracking_id := F1} -> v_type_string(F1, [tracking_id | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (tracking_id) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_ship_order_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), ship_order_response}, M, Path); +v_msg_ship_order_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, ship_order_response}, X, Path). + +-compile({nowarn_unused_function,v_msg_address/3}). +-dialyzer({nowarn_function,v_msg_address/3}). +v_msg_address(#{} = M, Path, TrUserData) -> + case M of + #{street_address := F1} -> v_type_string(F1, [street_address | Path], TrUserData); + _ -> ok + end, + case M of + #{city := F2} -> v_type_string(F2, [city | Path], TrUserData); + _ -> ok + end, + case M of + #{state := F3} -> v_type_string(F3, [state | Path], TrUserData); + _ -> ok + end, + case M of + #{country := F4} -> v_type_string(F4, [country | Path], TrUserData); + _ -> ok + end, + case M of + #{zip_code := F5} -> v_type_int32(F5, [zip_code | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (street_address) -> ok; + (city) -> ok; + (state) -> ok; + (country) -> ok; + (zip_code) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_address(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), address}, M, Path); +v_msg_address(X, Path, _TrUserData) -> mk_type_error({expected_msg, address}, X, Path). + +-compile({nowarn_unused_function,v_msg_money/3}). +-dialyzer({nowarn_function,v_msg_money/3}). +v_msg_money(#{} = M, Path, TrUserData) -> + case M of + #{currency_code := F1} -> v_type_string(F1, [currency_code | Path], TrUserData); + _ -> ok + end, + case M of + #{units := F2} -> v_type_int64(F2, [units | Path], TrUserData); + _ -> ok + end, + case M of + #{nanos := F3} -> v_type_int32(F3, [nanos | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (currency_code) -> ok; + (units) -> ok; + (nanos) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_money(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), money}, M, Path); +v_msg_money(X, Path, _TrUserData) -> mk_type_error({expected_msg, money}, X, Path). + +-compile({nowarn_unused_function,v_msg_get_supported_currencies_response/3}). +-dialyzer({nowarn_function,v_msg_get_supported_currencies_response/3}). +v_msg_get_supported_currencies_response(#{} = M, Path, TrUserData) -> + case M of + #{currency_codes := F1} -> + if is_list(F1) -> + _ = [v_type_string(Elem, [currency_codes | Path], TrUserData) || Elem <- F1], + ok; + true -> mk_type_error({invalid_list_of, string}, F1, [currency_codes | Path]) + end; + _ -> ok + end, + lists:foreach(fun (currency_codes) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_get_supported_currencies_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), get_supported_currencies_response}, M, Path); +v_msg_get_supported_currencies_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, get_supported_currencies_response}, X, Path). + +-compile({nowarn_unused_function,v_msg_currency_conversion_request/3}). +-dialyzer({nowarn_function,v_msg_currency_conversion_request/3}). +v_msg_currency_conversion_request(#{} = M, Path, TrUserData) -> + case M of + #{from := F1} -> v_msg_money(F1, [from | Path], TrUserData); + _ -> ok + end, + case M of + #{to_code := F2} -> v_type_string(F2, [to_code | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (from) -> ok; + (to_code) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_currency_conversion_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), currency_conversion_request}, M, Path); +v_msg_currency_conversion_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, currency_conversion_request}, X, Path). + +-compile({nowarn_unused_function,v_msg_credit_card_info/3}). +-dialyzer({nowarn_function,v_msg_credit_card_info/3}). +v_msg_credit_card_info(#{} = M, Path, TrUserData) -> + case M of + #{credit_card_number := F1} -> v_type_string(F1, [credit_card_number | Path], TrUserData); + _ -> ok + end, + case M of + #{credit_card_cvv := F2} -> v_type_int32(F2, [credit_card_cvv | Path], TrUserData); + _ -> ok + end, + case M of + #{credit_card_expiration_year := F3} -> v_type_int32(F3, [credit_card_expiration_year | Path], TrUserData); + _ -> ok + end, + case M of + #{credit_card_expiration_month := F4} -> v_type_int32(F4, [credit_card_expiration_month | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (credit_card_number) -> ok; + (credit_card_cvv) -> ok; + (credit_card_expiration_year) -> ok; + (credit_card_expiration_month) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_credit_card_info(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), credit_card_info}, M, Path); +v_msg_credit_card_info(X, Path, _TrUserData) -> mk_type_error({expected_msg, credit_card_info}, X, Path). + +-compile({nowarn_unused_function,v_msg_charge_request/3}). +-dialyzer({nowarn_function,v_msg_charge_request/3}). +v_msg_charge_request(#{} = M, Path, TrUserData) -> + case M of + #{amount := F1} -> v_msg_money(F1, [amount | Path], TrUserData); + _ -> ok + end, + case M of + #{credit_card := F2} -> v_msg_credit_card_info(F2, [credit_card | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (amount) -> ok; + (credit_card) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_charge_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), charge_request}, M, Path); +v_msg_charge_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, charge_request}, X, Path). + +-compile({nowarn_unused_function,v_msg_charge_response/3}). +-dialyzer({nowarn_function,v_msg_charge_response/3}). +v_msg_charge_response(#{} = M, Path, TrUserData) -> + case M of + #{transaction_id := F1} -> v_type_string(F1, [transaction_id | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (transaction_id) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_charge_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), charge_response}, M, Path); +v_msg_charge_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, charge_response}, X, Path). + +-compile({nowarn_unused_function,v_msg_order_item/3}). +-dialyzer({nowarn_function,v_msg_order_item/3}). +v_msg_order_item(#{} = M, Path, TrUserData) -> + case M of + #{item := F1} -> v_msg_cart_item(F1, [item | Path], TrUserData); + _ -> ok + end, + case M of + #{cost := F2} -> v_msg_money(F2, [cost | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (item) -> ok; + (cost) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_order_item(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), order_item}, M, Path); +v_msg_order_item(X, Path, _TrUserData) -> mk_type_error({expected_msg, order_item}, X, Path). + +-compile({nowarn_unused_function,v_msg_order_result/3}). +-dialyzer({nowarn_function,v_msg_order_result/3}). +v_msg_order_result(#{} = M, Path, TrUserData) -> + case M of + #{order_id := F1} -> v_type_string(F1, [order_id | Path], TrUserData); + _ -> ok + end, + case M of + #{shipping_tracking_id := F2} -> v_type_string(F2, [shipping_tracking_id | Path], TrUserData); + _ -> ok + end, + case M of + #{shipping_cost := F3} -> v_msg_money(F3, [shipping_cost | Path], TrUserData); + _ -> ok + end, + case M of + #{shipping_address := F4} -> v_msg_address(F4, [shipping_address | Path], TrUserData); + _ -> ok + end, + case M of + #{items := F5} -> + if is_list(F5) -> + _ = [v_msg_order_item(Elem, [items | Path], TrUserData) || Elem <- F5], + ok; + true -> mk_type_error({invalid_list_of, {msg, order_item}}, F5, [items | Path]) + end; + _ -> ok + end, + lists:foreach(fun (order_id) -> ok; + (shipping_tracking_id) -> ok; + (shipping_cost) -> ok; + (shipping_address) -> ok; + (items) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_order_result(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), order_result}, M, Path); +v_msg_order_result(X, Path, _TrUserData) -> mk_type_error({expected_msg, order_result}, X, Path). + +-compile({nowarn_unused_function,v_msg_send_order_confirmation_request/3}). +-dialyzer({nowarn_function,v_msg_send_order_confirmation_request/3}). +v_msg_send_order_confirmation_request(#{} = M, Path, TrUserData) -> + case M of + #{email := F1} -> v_type_string(F1, [email | Path], TrUserData); + _ -> ok + end, + case M of + #{order := F2} -> v_msg_order_result(F2, [order | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (email) -> ok; + (order) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_send_order_confirmation_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), send_order_confirmation_request}, M, Path); +v_msg_send_order_confirmation_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, send_order_confirmation_request}, X, Path). + +-compile({nowarn_unused_function,v_msg_place_order_request/3}). +-dialyzer({nowarn_function,v_msg_place_order_request/3}). +v_msg_place_order_request(#{} = M, Path, TrUserData) -> + case M of + #{user_id := F1} -> v_type_string(F1, [user_id | Path], TrUserData); + _ -> ok + end, + case M of + #{user_currency := F2} -> v_type_string(F2, [user_currency | Path], TrUserData); + _ -> ok + end, + case M of + #{address := F3} -> v_msg_address(F3, [address | Path], TrUserData); + _ -> ok + end, + case M of + #{email := F4} -> v_type_string(F4, [email | Path], TrUserData); + _ -> ok + end, + case M of + #{credit_card := F5} -> v_msg_credit_card_info(F5, [credit_card | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (user_id) -> ok; + (user_currency) -> ok; + (address) -> ok; + (email) -> ok; + (credit_card) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_place_order_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), place_order_request}, M, Path); +v_msg_place_order_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, place_order_request}, X, Path). + +-compile({nowarn_unused_function,v_msg_place_order_response/3}). +-dialyzer({nowarn_function,v_msg_place_order_response/3}). +v_msg_place_order_response(#{} = M, Path, TrUserData) -> + case M of + #{order := F1} -> v_msg_order_result(F1, [order | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (order) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_place_order_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), place_order_response}, M, Path); +v_msg_place_order_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, place_order_response}, X, Path). + +-compile({nowarn_unused_function,v_msg_ad_request/3}). +-dialyzer({nowarn_function,v_msg_ad_request/3}). +v_msg_ad_request(#{} = M, Path, TrUserData) -> + case M of + #{context_keys := F1} -> + if is_list(F1) -> + _ = [v_type_string(Elem, [context_keys | Path], TrUserData) || Elem <- F1], + ok; + true -> mk_type_error({invalid_list_of, string}, F1, [context_keys | Path]) + end; + _ -> ok + end, + lists:foreach(fun (context_keys) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_ad_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), ad_request}, M, Path); +v_msg_ad_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, ad_request}, X, Path). + +-compile({nowarn_unused_function,v_msg_ad_response/3}). +-dialyzer({nowarn_function,v_msg_ad_response/3}). +v_msg_ad_response(#{} = M, Path, TrUserData) -> + case M of + #{ads := F1} -> + if is_list(F1) -> + _ = [v_msg_ad(Elem, [ads | Path], TrUserData) || Elem <- F1], + ok; + true -> mk_type_error({invalid_list_of, {msg, ad}}, F1, [ads | Path]) + end; + _ -> ok + end, + lists:foreach(fun (ads) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_ad_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), ad_response}, M, Path); +v_msg_ad_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, ad_response}, X, Path). + +-compile({nowarn_unused_function,v_msg_ad/3}). +-dialyzer({nowarn_function,v_msg_ad/3}). +v_msg_ad(#{} = M, Path, TrUserData) -> + case M of + #{redirect_url := F1} -> v_type_string(F1, [redirect_url | Path], TrUserData); + _ -> ok + end, + case M of + #{text := F2} -> v_type_string(F2, [text | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (redirect_url) -> ok; + (text) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_ad(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), ad}, M, Path); +v_msg_ad(X, Path, _TrUserData) -> mk_type_error({expected_msg, ad}, X, Path). + +-compile({nowarn_unused_function,v_msg_flag/3}). +-dialyzer({nowarn_function,v_msg_flag/3}). +v_msg_flag(#{} = M, Path, TrUserData) -> + case M of + #{name := F1} -> v_type_string(F1, [name | Path], TrUserData); + _ -> ok + end, + case M of + #{description := F2} -> v_type_string(F2, [description | Path], TrUserData); + _ -> ok + end, + case M of + #{enabled := F3} -> v_type_bool(F3, [enabled | Path], TrUserData); + _ -> ok + end, + case M of + #{created_at := F4} -> v_msg_timestamp(F4, [created_at | Path], TrUserData); + _ -> ok + end, + case M of + #{updated_at := F5} -> v_msg_timestamp(F5, [updated_at | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (name) -> ok; + (description) -> ok; + (enabled) -> ok; + (created_at) -> ok; + (updated_at) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_flag(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), flag}, M, Path); +v_msg_flag(X, Path, _TrUserData) -> mk_type_error({expected_msg, flag}, X, Path). + +-compile({nowarn_unused_function,v_msg_get_flag_request/3}). +-dialyzer({nowarn_function,v_msg_get_flag_request/3}). +v_msg_get_flag_request(#{} = M, Path, TrUserData) -> + case M of + #{name := F1} -> v_type_string(F1, [name | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (name) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_get_flag_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), get_flag_request}, M, Path); +v_msg_get_flag_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, get_flag_request}, X, Path). + +-compile({nowarn_unused_function,v_msg_get_flag_response/3}). +-dialyzer({nowarn_function,v_msg_get_flag_response/3}). +v_msg_get_flag_response(#{} = M, Path, TrUserData) -> + case M of + #{flag := F1} -> v_msg_flag(F1, [flag | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (flag) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_get_flag_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), get_flag_response}, M, Path); +v_msg_get_flag_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, get_flag_response}, X, Path). + +-compile({nowarn_unused_function,v_msg_create_flag_request/3}). +-dialyzer({nowarn_function,v_msg_create_flag_request/3}). +v_msg_create_flag_request(#{} = M, Path, TrUserData) -> + case M of + #{name := F1} -> v_type_string(F1, [name | Path], TrUserData); + _ -> ok + end, + case M of + #{description := F2} -> v_type_string(F2, [description | Path], TrUserData); + _ -> ok + end, + case M of + #{enabled := F3} -> v_type_bool(F3, [enabled | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (name) -> ok; + (description) -> ok; + (enabled) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_create_flag_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), create_flag_request}, M, Path); +v_msg_create_flag_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, create_flag_request}, X, Path). + +-compile({nowarn_unused_function,v_msg_create_flag_response/3}). +-dialyzer({nowarn_function,v_msg_create_flag_response/3}). +v_msg_create_flag_response(#{} = M, Path, TrUserData) -> + case M of + #{flag := F1} -> v_msg_flag(F1, [flag | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (flag) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_create_flag_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), create_flag_response}, M, Path); +v_msg_create_flag_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, create_flag_response}, X, Path). + +-compile({nowarn_unused_function,v_msg_update_flag_request/3}). +-dialyzer({nowarn_function,v_msg_update_flag_request/3}). +v_msg_update_flag_request(#{} = M, Path, TrUserData) -> + case M of + #{name := F1} -> v_type_string(F1, [name | Path], TrUserData); + _ -> ok + end, + case M of + #{enabled := F2} -> v_type_bool(F2, [enabled | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (name) -> ok; + (enabled) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_update_flag_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), update_flag_request}, M, Path); +v_msg_update_flag_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, update_flag_request}, X, Path). + +-compile({nowarn_unused_function,v_msg_update_flag_response/3}). +-dialyzer({nowarn_function,v_msg_update_flag_response/3}). +v_msg_update_flag_response(#{} = M, Path, _) -> + lists:foreach(fun (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) end, maps:keys(M)), + ok; +v_msg_update_flag_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), update_flag_response}, M, Path); +v_msg_update_flag_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, update_flag_response}, X, Path). + +-compile({nowarn_unused_function,v_msg_list_flags_request/3}). +-dialyzer({nowarn_function,v_msg_list_flags_request/3}). +v_msg_list_flags_request(#{} = M, Path, _) -> + lists:foreach(fun (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) end, maps:keys(M)), + ok; +v_msg_list_flags_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_flags_request}, M, Path); +v_msg_list_flags_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_flags_request}, X, Path). + +-compile({nowarn_unused_function,v_msg_list_flags_response/3}). +-dialyzer({nowarn_function,v_msg_list_flags_response/3}). +v_msg_list_flags_response(#{} = M, Path, TrUserData) -> + case M of + #{flag := F1} -> + if is_list(F1) -> + _ = [v_msg_flag(Elem, [flag | Path], TrUserData) || Elem <- F1], + ok; + true -> mk_type_error({invalid_list_of, {msg, flag}}, F1, [flag | Path]) + end; + _ -> ok + end, + lists:foreach(fun (flag) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_list_flags_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_flags_response}, M, Path); +v_msg_list_flags_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_flags_response}, X, Path). + +-compile({nowarn_unused_function,v_msg_delete_flag_request/3}). +-dialyzer({nowarn_function,v_msg_delete_flag_request/3}). +v_msg_delete_flag_request(#{} = M, Path, TrUserData) -> + case M of + #{name := F1} -> v_type_string(F1, [name | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (name) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_delete_flag_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), delete_flag_request}, M, Path); +v_msg_delete_flag_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, delete_flag_request}, X, Path). + +-compile({nowarn_unused_function,v_msg_delete_flag_response/3}). +-dialyzer({nowarn_function,v_msg_delete_flag_response/3}). +v_msg_delete_flag_response(#{} = M, Path, _) -> + lists:foreach(fun (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) end, maps:keys(M)), + ok; +v_msg_delete_flag_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), delete_flag_response}, M, Path); +v_msg_delete_flag_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, delete_flag_response}, X, Path). + +-compile({nowarn_unused_function,v_msg_timestamp/3}). +-dialyzer({nowarn_function,v_msg_timestamp/3}). +v_msg_timestamp(#{} = M, Path, TrUserData) -> + case M of + #{seconds := F1} -> v_type_int64(F1, [seconds | Path], TrUserData); + _ -> ok + end, + case M of + #{nanos := F2} -> v_type_int32(F2, [nanos | Path], TrUserData); + _ -> ok + end, + lists:foreach(fun (seconds) -> ok; + (nanos) -> ok; + (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) + end, + maps:keys(M)), + ok; +v_msg_timestamp(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), timestamp}, M, Path); +v_msg_timestamp(X, Path, _TrUserData) -> mk_type_error({expected_msg, timestamp}, X, Path). + +-compile({nowarn_unused_function,v_type_int32/3}). +-dialyzer({nowarn_function,v_type_int32/3}). +v_type_int32(N, _Path, _TrUserData) when -2147483648 =< N, N =< 2147483647 -> ok; +v_type_int32(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, int32, signed, 32}, N, Path); +v_type_int32(X, Path, _TrUserData) -> mk_type_error({bad_integer, int32, signed, 32}, X, Path). + +-compile({nowarn_unused_function,v_type_int64/3}). +-dialyzer({nowarn_function,v_type_int64/3}). +v_type_int64(N, _Path, _TrUserData) when -9223372036854775808 =< N, N =< 9223372036854775807 -> ok; +v_type_int64(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, int64, signed, 64}, N, Path); +v_type_int64(X, Path, _TrUserData) -> mk_type_error({bad_integer, int64, signed, 64}, X, Path). + +-compile({nowarn_unused_function,v_type_bool/3}). +-dialyzer({nowarn_function,v_type_bool/3}). +v_type_bool(false, _Path, _TrUserData) -> ok; +v_type_bool(true, _Path, _TrUserData) -> ok; +v_type_bool(0, _Path, _TrUserData) -> ok; +v_type_bool(1, _Path, _TrUserData) -> ok; +v_type_bool(X, Path, _TrUserData) -> mk_type_error(bad_boolean_value, X, Path). + +-compile({nowarn_unused_function,v_type_string/3}). +-dialyzer({nowarn_function,v_type_string/3}). +v_type_string(S, Path, _TrUserData) when is_list(S); is_binary(S) -> + try unicode:characters_to_binary(S) of + B when is_binary(B) -> ok; + {error, _, _} -> mk_type_error(bad_unicode_string, S, Path) + catch + error:badarg -> mk_type_error(bad_unicode_string, S, Path) + end; +v_type_string(X, Path, _TrUserData) -> mk_type_error(bad_unicode_string, X, Path). + +-compile({nowarn_unused_function,mk_type_error/3}). +-spec mk_type_error(_, _, list()) -> no_return(). +mk_type_error(Error, ValueSeen, Path) -> + Path2 = prettify_path(Path), + erlang:error({gpb_type_error, {Error, [{value, ValueSeen}, {path, Path2}]}}). + + +-compile({nowarn_unused_function,prettify_path/1}). +-dialyzer({nowarn_function,prettify_path/1}). +prettify_path([]) -> top_level; +prettify_path(PathR) -> lists:append(lists:join(".", lists:map(fun atom_to_list/1, lists:reverse(PathR)))). + + +-compile({nowarn_unused_function,id/2}). +-compile({inline,id/2}). +id(X, _TrUserData) -> X. + +-compile({nowarn_unused_function,v_ok/3}). +-compile({inline,v_ok/3}). +v_ok(_Value, _Path, _TrUserData) -> ok. + +-compile({nowarn_unused_function,m_overwrite/3}). +-compile({inline,m_overwrite/3}). +m_overwrite(_Prev, New, _TrUserData) -> New. + +-compile({nowarn_unused_function,cons/3}). +-compile({inline,cons/3}). +cons(Elem, Acc, _TrUserData) -> [Elem | Acc]. + +-compile({nowarn_unused_function,lists_reverse/2}). +-compile({inline,lists_reverse/2}). +'lists_reverse'(L, _TrUserData) -> lists:reverse(L). +-compile({nowarn_unused_function,'erlang_++'/3}). +-compile({inline,'erlang_++'/3}). +'erlang_++'(A, B, _TrUserData) -> A ++ B. + + +get_msg_defs() -> + [{{msg, cart_item}, [#{name => product_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => quantity, fnum => 2, rnum => 3, type => int32, occurrence => optional, opts => []}]}, + {{msg, add_item_request}, [#{name => user_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => item, fnum => 2, rnum => 3, type => {msg, cart_item}, occurrence => optional, opts => []}]}, + {{msg, empty_cart_request}, [#{name => user_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, + {{msg, get_cart_request}, [#{name => user_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, + {{msg, cart}, [#{name => user_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => items, fnum => 2, rnum => 3, type => {msg, cart_item}, occurrence => repeated, opts => []}]}, + {{msg, empty}, []}, + {{msg, list_recommendations_request}, [#{name => user_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => product_ids, fnum => 2, rnum => 3, type => string, occurrence => repeated, opts => []}]}, + {{msg, list_recommendations_response}, [#{name => product_ids, fnum => 1, rnum => 2, type => string, occurrence => repeated, opts => []}]}, + {{msg, product}, + [#{name => id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, + #{name => name, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, + #{name => description, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}, + #{name => picture, fnum => 4, rnum => 5, type => string, occurrence => optional, opts => []}, + #{name => price_usd, fnum => 5, rnum => 6, type => {msg, money}, occurrence => optional, opts => []}, + #{name => categories, fnum => 6, rnum => 7, type => string, occurrence => repeated, opts => []}]}, + {{msg, list_products_response}, [#{name => products, fnum => 1, rnum => 2, type => {msg, product}, occurrence => repeated, opts => []}]}, + {{msg, get_product_request}, [#{name => id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, + {{msg, search_products_request}, [#{name => query, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, + {{msg, search_products_response}, [#{name => results, fnum => 1, rnum => 2, type => {msg, product}, occurrence => repeated, opts => []}]}, + {{msg, get_quote_request}, [#{name => address, fnum => 1, rnum => 2, type => {msg, address}, occurrence => optional, opts => []}, #{name => items, fnum => 2, rnum => 3, type => {msg, cart_item}, occurrence => repeated, opts => []}]}, + {{msg, get_quote_response}, [#{name => cost_usd, fnum => 1, rnum => 2, type => {msg, money}, occurrence => optional, opts => []}]}, + {{msg, ship_order_request}, [#{name => address, fnum => 1, rnum => 2, type => {msg, address}, occurrence => optional, opts => []}, #{name => items, fnum => 2, rnum => 3, type => {msg, cart_item}, occurrence => repeated, opts => []}]}, + {{msg, ship_order_response}, [#{name => tracking_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, + {{msg, address}, + [#{name => street_address, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, + #{name => city, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, + #{name => state, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}, + #{name => country, fnum => 4, rnum => 5, type => string, occurrence => optional, opts => []}, + #{name => zip_code, fnum => 5, rnum => 6, type => int32, occurrence => optional, opts => []}]}, + {{msg, money}, + [#{name => currency_code, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, + #{name => units, fnum => 2, rnum => 3, type => int64, occurrence => optional, opts => []}, + #{name => nanos, fnum => 3, rnum => 4, type => int32, occurrence => optional, opts => []}]}, + {{msg, get_supported_currencies_response}, [#{name => currency_codes, fnum => 1, rnum => 2, type => string, occurrence => repeated, opts => []}]}, + {{msg, currency_conversion_request}, [#{name => from, fnum => 1, rnum => 2, type => {msg, money}, occurrence => optional, opts => []}, #{name => to_code, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, + {{msg, credit_card_info}, + [#{name => credit_card_number, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, + #{name => credit_card_cvv, fnum => 2, rnum => 3, type => int32, occurrence => optional, opts => []}, + #{name => credit_card_expiration_year, fnum => 3, rnum => 4, type => int32, occurrence => optional, opts => []}, + #{name => credit_card_expiration_month, fnum => 4, rnum => 5, type => int32, occurrence => optional, opts => []}]}, + {{msg, charge_request}, [#{name => amount, fnum => 1, rnum => 2, type => {msg, money}, occurrence => optional, opts => []}, #{name => credit_card, fnum => 2, rnum => 3, type => {msg, credit_card_info}, occurrence => optional, opts => []}]}, + {{msg, charge_response}, [#{name => transaction_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, + {{msg, order_item}, [#{name => item, fnum => 1, rnum => 2, type => {msg, cart_item}, occurrence => optional, opts => []}, #{name => cost, fnum => 2, rnum => 3, type => {msg, money}, occurrence => optional, opts => []}]}, + {{msg, order_result}, + [#{name => order_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, + #{name => shipping_tracking_id, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, + #{name => shipping_cost, fnum => 3, rnum => 4, type => {msg, money}, occurrence => optional, opts => []}, + #{name => shipping_address, fnum => 4, rnum => 5, type => {msg, address}, occurrence => optional, opts => []}, + #{name => items, fnum => 5, rnum => 6, type => {msg, order_item}, occurrence => repeated, opts => []}]}, + {{msg, send_order_confirmation_request}, [#{name => email, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => order, fnum => 2, rnum => 3, type => {msg, order_result}, occurrence => optional, opts => []}]}, + {{msg, place_order_request}, + [#{name => user_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, + #{name => user_currency, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, + #{name => address, fnum => 3, rnum => 4, type => {msg, address}, occurrence => optional, opts => []}, + #{name => email, fnum => 5, rnum => 5, type => string, occurrence => optional, opts => []}, + #{name => credit_card, fnum => 6, rnum => 6, type => {msg, credit_card_info}, occurrence => optional, opts => []}]}, + {{msg, place_order_response}, [#{name => order, fnum => 1, rnum => 2, type => {msg, order_result}, occurrence => optional, opts => []}]}, + {{msg, ad_request}, [#{name => context_keys, fnum => 1, rnum => 2, type => string, occurrence => repeated, opts => []}]}, + {{msg, ad_response}, [#{name => ads, fnum => 1, rnum => 2, type => {msg, ad}, occurrence => repeated, opts => []}]}, + {{msg, ad}, [#{name => redirect_url, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => text, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]}, + {{msg, flag}, + [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, + #{name => description, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, + #{name => enabled, fnum => 3, rnum => 4, type => bool, occurrence => optional, opts => []}, + #{name => created_at, fnum => 4, rnum => 5, type => {msg, timestamp}, occurrence => optional, opts => []}, + #{name => updated_at, fnum => 5, rnum => 6, type => {msg, timestamp}, occurrence => optional, opts => []}]}, + {{msg, get_flag_request}, [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, + {{msg, get_flag_response}, [#{name => flag, fnum => 1, rnum => 2, type => {msg, flag}, occurrence => optional, opts => []}]}, + {{msg, create_flag_request}, + [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, + #{name => description, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, + #{name => enabled, fnum => 3, rnum => 4, type => bool, occurrence => optional, opts => []}]}, + {{msg, create_flag_response}, [#{name => flag, fnum => 1, rnum => 2, type => {msg, flag}, occurrence => optional, opts => []}]}, + {{msg, update_flag_request}, [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => enabled, fnum => 2, rnum => 3, type => bool, occurrence => optional, opts => []}]}, + {{msg, update_flag_response}, []}, + {{msg, list_flags_request}, []}, + {{msg, list_flags_response}, [#{name => flag, fnum => 1, rnum => 2, type => {msg, flag}, occurrence => repeated, opts => []}]}, + {{msg, delete_flag_request}, [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, + {{msg, delete_flag_response}, []}, + {{msg, timestamp}, [#{name => seconds, fnum => 1, rnum => 2, type => int64, occurrence => optional, opts => []}, #{name => nanos, fnum => 2, rnum => 3, type => int32, occurrence => optional, opts => []}]}]. + + +get_msg_names() -> + [cart_item, + add_item_request, + empty_cart_request, + get_cart_request, + cart, + empty, + list_recommendations_request, + list_recommendations_response, + product, + list_products_response, + get_product_request, + search_products_request, + search_products_response, + get_quote_request, + get_quote_response, + ship_order_request, + ship_order_response, + address, + money, + get_supported_currencies_response, + currency_conversion_request, + credit_card_info, + charge_request, + charge_response, + order_item, + order_result, + send_order_confirmation_request, + place_order_request, + place_order_response, + ad_request, + ad_response, + ad, + flag, + get_flag_request, + get_flag_response, + create_flag_request, + create_flag_response, + update_flag_request, + update_flag_response, + list_flags_request, + list_flags_response, + delete_flag_request, + delete_flag_response, + timestamp]. + + +get_group_names() -> []. + + +get_msg_or_group_names() -> + [cart_item, + add_item_request, + empty_cart_request, + get_cart_request, + cart, + empty, + list_recommendations_request, + list_recommendations_response, + product, + list_products_response, + get_product_request, + search_products_request, + search_products_response, + get_quote_request, + get_quote_response, + ship_order_request, + ship_order_response, + address, + money, + get_supported_currencies_response, + currency_conversion_request, + credit_card_info, + charge_request, + charge_response, + order_item, + order_result, + send_order_confirmation_request, + place_order_request, + place_order_response, + ad_request, + ad_response, + ad, + flag, + get_flag_request, + get_flag_response, + create_flag_request, + create_flag_response, + update_flag_request, + update_flag_response, + list_flags_request, + list_flags_response, + delete_flag_request, + delete_flag_response, + timestamp]. + + +get_enum_names() -> []. + + +fetch_msg_def(MsgName) -> + case find_msg_def(MsgName) of + Fs when is_list(Fs) -> Fs; + error -> erlang:error({no_such_msg, MsgName}) + end. + + +-spec fetch_enum_def(_) -> no_return(). +fetch_enum_def(EnumName) -> erlang:error({no_such_enum, EnumName}). + + +find_msg_def(cart_item) -> [#{name => product_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => quantity, fnum => 2, rnum => 3, type => int32, occurrence => optional, opts => []}]; +find_msg_def(add_item_request) -> [#{name => user_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => item, fnum => 2, rnum => 3, type => {msg, cart_item}, occurrence => optional, opts => []}]; +find_msg_def(empty_cart_request) -> [#{name => user_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; +find_msg_def(get_cart_request) -> [#{name => user_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; +find_msg_def(cart) -> [#{name => user_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => items, fnum => 2, rnum => 3, type => {msg, cart_item}, occurrence => repeated, opts => []}]; +find_msg_def(empty) -> []; +find_msg_def(list_recommendations_request) -> [#{name => user_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => product_ids, fnum => 2, rnum => 3, type => string, occurrence => repeated, opts => []}]; +find_msg_def(list_recommendations_response) -> [#{name => product_ids, fnum => 1, rnum => 2, type => string, occurrence => repeated, opts => []}]; +find_msg_def(product) -> + [#{name => id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, + #{name => name, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, + #{name => description, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}, + #{name => picture, fnum => 4, rnum => 5, type => string, occurrence => optional, opts => []}, + #{name => price_usd, fnum => 5, rnum => 6, type => {msg, money}, occurrence => optional, opts => []}, + #{name => categories, fnum => 6, rnum => 7, type => string, occurrence => repeated, opts => []}]; +find_msg_def(list_products_response) -> [#{name => products, fnum => 1, rnum => 2, type => {msg, product}, occurrence => repeated, opts => []}]; +find_msg_def(get_product_request) -> [#{name => id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; +find_msg_def(search_products_request) -> [#{name => query, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; +find_msg_def(search_products_response) -> [#{name => results, fnum => 1, rnum => 2, type => {msg, product}, occurrence => repeated, opts => []}]; +find_msg_def(get_quote_request) -> [#{name => address, fnum => 1, rnum => 2, type => {msg, address}, occurrence => optional, opts => []}, #{name => items, fnum => 2, rnum => 3, type => {msg, cart_item}, occurrence => repeated, opts => []}]; +find_msg_def(get_quote_response) -> [#{name => cost_usd, fnum => 1, rnum => 2, type => {msg, money}, occurrence => optional, opts => []}]; +find_msg_def(ship_order_request) -> [#{name => address, fnum => 1, rnum => 2, type => {msg, address}, occurrence => optional, opts => []}, #{name => items, fnum => 2, rnum => 3, type => {msg, cart_item}, occurrence => repeated, opts => []}]; +find_msg_def(ship_order_response) -> [#{name => tracking_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; +find_msg_def(address) -> + [#{name => street_address, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, + #{name => city, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, + #{name => state, fnum => 3, rnum => 4, type => string, occurrence => optional, opts => []}, + #{name => country, fnum => 4, rnum => 5, type => string, occurrence => optional, opts => []}, + #{name => zip_code, fnum => 5, rnum => 6, type => int32, occurrence => optional, opts => []}]; +find_msg_def(money) -> + [#{name => currency_code, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, + #{name => units, fnum => 2, rnum => 3, type => int64, occurrence => optional, opts => []}, + #{name => nanos, fnum => 3, rnum => 4, type => int32, occurrence => optional, opts => []}]; +find_msg_def(get_supported_currencies_response) -> [#{name => currency_codes, fnum => 1, rnum => 2, type => string, occurrence => repeated, opts => []}]; +find_msg_def(currency_conversion_request) -> [#{name => from, fnum => 1, rnum => 2, type => {msg, money}, occurrence => optional, opts => []}, #{name => to_code, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; +find_msg_def(credit_card_info) -> + [#{name => credit_card_number, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, + #{name => credit_card_cvv, fnum => 2, rnum => 3, type => int32, occurrence => optional, opts => []}, + #{name => credit_card_expiration_year, fnum => 3, rnum => 4, type => int32, occurrence => optional, opts => []}, + #{name => credit_card_expiration_month, fnum => 4, rnum => 5, type => int32, occurrence => optional, opts => []}]; +find_msg_def(charge_request) -> [#{name => amount, fnum => 1, rnum => 2, type => {msg, money}, occurrence => optional, opts => []}, #{name => credit_card, fnum => 2, rnum => 3, type => {msg, credit_card_info}, occurrence => optional, opts => []}]; +find_msg_def(charge_response) -> [#{name => transaction_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; +find_msg_def(order_item) -> [#{name => item, fnum => 1, rnum => 2, type => {msg, cart_item}, occurrence => optional, opts => []}, #{name => cost, fnum => 2, rnum => 3, type => {msg, money}, occurrence => optional, opts => []}]; +find_msg_def(order_result) -> + [#{name => order_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, + #{name => shipping_tracking_id, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, + #{name => shipping_cost, fnum => 3, rnum => 4, type => {msg, money}, occurrence => optional, opts => []}, + #{name => shipping_address, fnum => 4, rnum => 5, type => {msg, address}, occurrence => optional, opts => []}, + #{name => items, fnum => 5, rnum => 6, type => {msg, order_item}, occurrence => repeated, opts => []}]; +find_msg_def(send_order_confirmation_request) -> [#{name => email, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => order, fnum => 2, rnum => 3, type => {msg, order_result}, occurrence => optional, opts => []}]; +find_msg_def(place_order_request) -> + [#{name => user_id, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, + #{name => user_currency, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, + #{name => address, fnum => 3, rnum => 4, type => {msg, address}, occurrence => optional, opts => []}, + #{name => email, fnum => 5, rnum => 5, type => string, occurrence => optional, opts => []}, + #{name => credit_card, fnum => 6, rnum => 6, type => {msg, credit_card_info}, occurrence => optional, opts => []}]; +find_msg_def(place_order_response) -> [#{name => order, fnum => 1, rnum => 2, type => {msg, order_result}, occurrence => optional, opts => []}]; +find_msg_def(ad_request) -> [#{name => context_keys, fnum => 1, rnum => 2, type => string, occurrence => repeated, opts => []}]; +find_msg_def(ad_response) -> [#{name => ads, fnum => 1, rnum => 2, type => {msg, ad}, occurrence => repeated, opts => []}]; +find_msg_def(ad) -> [#{name => redirect_url, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => text, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]; +find_msg_def(flag) -> + [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, + #{name => description, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, + #{name => enabled, fnum => 3, rnum => 4, type => bool, occurrence => optional, opts => []}, + #{name => created_at, fnum => 4, rnum => 5, type => {msg, timestamp}, occurrence => optional, opts => []}, + #{name => updated_at, fnum => 5, rnum => 6, type => {msg, timestamp}, occurrence => optional, opts => []}]; +find_msg_def(get_flag_request) -> [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; +find_msg_def(get_flag_response) -> [#{name => flag, fnum => 1, rnum => 2, type => {msg, flag}, occurrence => optional, opts => []}]; +find_msg_def(create_flag_request) -> + [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, + #{name => description, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, + #{name => enabled, fnum => 3, rnum => 4, type => bool, occurrence => optional, opts => []}]; +find_msg_def(create_flag_response) -> [#{name => flag, fnum => 1, rnum => 2, type => {msg, flag}, occurrence => optional, opts => []}]; +find_msg_def(update_flag_request) -> [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => enabled, fnum => 2, rnum => 3, type => bool, occurrence => optional, opts => []}]; +find_msg_def(update_flag_response) -> []; +find_msg_def(list_flags_request) -> []; +find_msg_def(list_flags_response) -> [#{name => flag, fnum => 1, rnum => 2, type => {msg, flag}, occurrence => repeated, opts => []}]; +find_msg_def(delete_flag_request) -> [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; +find_msg_def(delete_flag_response) -> []; +find_msg_def(timestamp) -> [#{name => seconds, fnum => 1, rnum => 2, type => int64, occurrence => optional, opts => []}, #{name => nanos, fnum => 2, rnum => 3, type => int32, occurrence => optional, opts => []}]; +find_msg_def(_) -> error. + + +find_enum_def(_) -> error. + + +-spec enum_symbol_by_value(_, _) -> no_return(). +enum_symbol_by_value(E, V) -> erlang:error({no_enum_defs, E, V}). + + +-spec enum_value_by_symbol(_, _) -> no_return(). +enum_value_by_symbol(E, V) -> erlang:error({no_enum_defs, E, V}). + + + +get_service_names() -> + ['hipstershop.CartService', + 'hipstershop.RecommendationService', + 'hipstershop.ProductCatalogService', + 'hipstershop.ShippingService', + 'hipstershop.CurrencyService', + 'hipstershop.PaymentService', + 'hipstershop.EmailService', + 'hipstershop.CheckoutService', + 'hipstershop.AdService', + 'hipstershop.FeatureFlagService']. + + +get_service_def('hipstershop.CartService') -> + {{service, 'hipstershop.CartService'}, + [#{name => 'AddItem', input => add_item_request, output => empty, input_stream => false, output_stream => false, opts => []}, + #{name => 'GetCart', input => get_cart_request, output => cart, input_stream => false, output_stream => false, opts => []}, + #{name => 'EmptyCart', input => empty_cart_request, output => empty, input_stream => false, output_stream => false, opts => []}]}; +get_service_def('hipstershop.RecommendationService') -> + {{service, 'hipstershop.RecommendationService'}, [#{name => 'ListRecommendations', input => list_recommendations_request, output => list_recommendations_response, input_stream => false, output_stream => false, opts => []}]}; +get_service_def('hipstershop.ProductCatalogService') -> + {{service, 'hipstershop.ProductCatalogService'}, + [#{name => 'ListProducts', input => empty, output => list_products_response, input_stream => false, output_stream => false, opts => []}, + #{name => 'GetProduct', input => get_product_request, output => product, input_stream => false, output_stream => false, opts => []}, + #{name => 'SearchProducts', input => search_products_request, output => search_products_response, input_stream => false, output_stream => false, opts => []}]}; +get_service_def('hipstershop.ShippingService') -> + {{service, 'hipstershop.ShippingService'}, + [#{name => 'GetQuote', input => get_quote_request, output => get_quote_response, input_stream => false, output_stream => false, opts => []}, + #{name => 'ShipOrder', input => ship_order_request, output => ship_order_response, input_stream => false, output_stream => false, opts => []}]}; +get_service_def('hipstershop.CurrencyService') -> + {{service, 'hipstershop.CurrencyService'}, + [#{name => 'GetSupportedCurrencies', input => empty, output => get_supported_currencies_response, input_stream => false, output_stream => false, opts => []}, + #{name => 'Convert', input => currency_conversion_request, output => money, input_stream => false, output_stream => false, opts => []}]}; +get_service_def('hipstershop.PaymentService') -> {{service, 'hipstershop.PaymentService'}, [#{name => 'Charge', input => charge_request, output => charge_response, input_stream => false, output_stream => false, opts => []}]}; +get_service_def('hipstershop.EmailService') -> {{service, 'hipstershop.EmailService'}, [#{name => 'SendOrderConfirmation', input => send_order_confirmation_request, output => empty, input_stream => false, output_stream => false, opts => []}]}; +get_service_def('hipstershop.CheckoutService') -> {{service, 'hipstershop.CheckoutService'}, [#{name => 'PlaceOrder', input => place_order_request, output => place_order_response, input_stream => false, output_stream => false, opts => []}]}; +get_service_def('hipstershop.AdService') -> {{service, 'hipstershop.AdService'}, [#{name => 'GetAds', input => ad_request, output => ad_response, input_stream => false, output_stream => false, opts => []}]}; +get_service_def('hipstershop.FeatureFlagService') -> + {{service, 'hipstershop.FeatureFlagService'}, + [#{name => 'GetFlag', input => get_flag_request, output => get_flag_response, input_stream => false, output_stream => false, opts => []}, + #{name => 'CreateFlag', input => create_flag_request, output => create_flag_response, input_stream => false, output_stream => false, opts => []}, + #{name => 'UpdateFlag', input => update_flag_request, output => update_flag_response, input_stream => false, output_stream => false, opts => []}, + #{name => 'ListFlags', input => list_flags_request, output => list_flags_response, input_stream => false, output_stream => false, opts => []}, + #{name => 'DeleteFlag', input => delete_flag_request, output => delete_flag_response, input_stream => false, output_stream => false, opts => []}]}; +get_service_def(_) -> error. + + +get_rpc_names('hipstershop.CartService') -> ['AddItem', 'GetCart', 'EmptyCart']; +get_rpc_names('hipstershop.RecommendationService') -> ['ListRecommendations']; +get_rpc_names('hipstershop.ProductCatalogService') -> ['ListProducts', 'GetProduct', 'SearchProducts']; +get_rpc_names('hipstershop.ShippingService') -> ['GetQuote', 'ShipOrder']; +get_rpc_names('hipstershop.CurrencyService') -> ['GetSupportedCurrencies', 'Convert']; +get_rpc_names('hipstershop.PaymentService') -> ['Charge']; +get_rpc_names('hipstershop.EmailService') -> ['SendOrderConfirmation']; +get_rpc_names('hipstershop.CheckoutService') -> ['PlaceOrder']; +get_rpc_names('hipstershop.AdService') -> ['GetAds']; +get_rpc_names('hipstershop.FeatureFlagService') -> ['GetFlag', 'CreateFlag', 'UpdateFlag', 'ListFlags', 'DeleteFlag']; +get_rpc_names(_) -> error. + + +find_rpc_def('hipstershop.CartService', RpcName) -> 'find_rpc_def_hipstershop.CartService'(RpcName); +find_rpc_def('hipstershop.RecommendationService', RpcName) -> 'find_rpc_def_hipstershop.RecommendationService'(RpcName); +find_rpc_def('hipstershop.ProductCatalogService', RpcName) -> 'find_rpc_def_hipstershop.ProductCatalogService'(RpcName); +find_rpc_def('hipstershop.ShippingService', RpcName) -> 'find_rpc_def_hipstershop.ShippingService'(RpcName); +find_rpc_def('hipstershop.CurrencyService', RpcName) -> 'find_rpc_def_hipstershop.CurrencyService'(RpcName); +find_rpc_def('hipstershop.PaymentService', RpcName) -> 'find_rpc_def_hipstershop.PaymentService'(RpcName); +find_rpc_def('hipstershop.EmailService', RpcName) -> 'find_rpc_def_hipstershop.EmailService'(RpcName); +find_rpc_def('hipstershop.CheckoutService', RpcName) -> 'find_rpc_def_hipstershop.CheckoutService'(RpcName); +find_rpc_def('hipstershop.AdService', RpcName) -> 'find_rpc_def_hipstershop.AdService'(RpcName); +find_rpc_def('hipstershop.FeatureFlagService', RpcName) -> 'find_rpc_def_hipstershop.FeatureFlagService'(RpcName); +find_rpc_def(_, _) -> error. + + +'find_rpc_def_hipstershop.CartService'('AddItem') -> #{name => 'AddItem', input => add_item_request, output => empty, input_stream => false, output_stream => false, opts => []}; +'find_rpc_def_hipstershop.CartService'('GetCart') -> #{name => 'GetCart', input => get_cart_request, output => cart, input_stream => false, output_stream => false, opts => []}; +'find_rpc_def_hipstershop.CartService'('EmptyCart') -> #{name => 'EmptyCart', input => empty_cart_request, output => empty, input_stream => false, output_stream => false, opts => []}; +'find_rpc_def_hipstershop.CartService'(_) -> error. + +'find_rpc_def_hipstershop.RecommendationService'('ListRecommendations') -> #{name => 'ListRecommendations', input => list_recommendations_request, output => list_recommendations_response, input_stream => false, output_stream => false, opts => []}; +'find_rpc_def_hipstershop.RecommendationService'(_) -> error. + +'find_rpc_def_hipstershop.ProductCatalogService'('ListProducts') -> #{name => 'ListProducts', input => empty, output => list_products_response, input_stream => false, output_stream => false, opts => []}; +'find_rpc_def_hipstershop.ProductCatalogService'('GetProduct') -> #{name => 'GetProduct', input => get_product_request, output => product, input_stream => false, output_stream => false, opts => []}; +'find_rpc_def_hipstershop.ProductCatalogService'('SearchProducts') -> #{name => 'SearchProducts', input => search_products_request, output => search_products_response, input_stream => false, output_stream => false, opts => []}; +'find_rpc_def_hipstershop.ProductCatalogService'(_) -> error. + +'find_rpc_def_hipstershop.ShippingService'('GetQuote') -> #{name => 'GetQuote', input => get_quote_request, output => get_quote_response, input_stream => false, output_stream => false, opts => []}; +'find_rpc_def_hipstershop.ShippingService'('ShipOrder') -> #{name => 'ShipOrder', input => ship_order_request, output => ship_order_response, input_stream => false, output_stream => false, opts => []}; +'find_rpc_def_hipstershop.ShippingService'(_) -> error. + +'find_rpc_def_hipstershop.CurrencyService'('GetSupportedCurrencies') -> #{name => 'GetSupportedCurrencies', input => empty, output => get_supported_currencies_response, input_stream => false, output_stream => false, opts => []}; +'find_rpc_def_hipstershop.CurrencyService'('Convert') -> #{name => 'Convert', input => currency_conversion_request, output => money, input_stream => false, output_stream => false, opts => []}; +'find_rpc_def_hipstershop.CurrencyService'(_) -> error. + +'find_rpc_def_hipstershop.PaymentService'('Charge') -> #{name => 'Charge', input => charge_request, output => charge_response, input_stream => false, output_stream => false, opts => []}; +'find_rpc_def_hipstershop.PaymentService'(_) -> error. + +'find_rpc_def_hipstershop.EmailService'('SendOrderConfirmation') -> #{name => 'SendOrderConfirmation', input => send_order_confirmation_request, output => empty, input_stream => false, output_stream => false, opts => []}; +'find_rpc_def_hipstershop.EmailService'(_) -> error. + +'find_rpc_def_hipstershop.CheckoutService'('PlaceOrder') -> #{name => 'PlaceOrder', input => place_order_request, output => place_order_response, input_stream => false, output_stream => false, opts => []}; +'find_rpc_def_hipstershop.CheckoutService'(_) -> error. + +'find_rpc_def_hipstershop.AdService'('GetAds') -> #{name => 'GetAds', input => ad_request, output => ad_response, input_stream => false, output_stream => false, opts => []}; +'find_rpc_def_hipstershop.AdService'(_) -> error. + +'find_rpc_def_hipstershop.FeatureFlagService'('GetFlag') -> #{name => 'GetFlag', input => get_flag_request, output => get_flag_response, input_stream => false, output_stream => false, opts => []}; +'find_rpc_def_hipstershop.FeatureFlagService'('CreateFlag') -> #{name => 'CreateFlag', input => create_flag_request, output => create_flag_response, input_stream => false, output_stream => false, opts => []}; +'find_rpc_def_hipstershop.FeatureFlagService'('UpdateFlag') -> #{name => 'UpdateFlag', input => update_flag_request, output => update_flag_response, input_stream => false, output_stream => false, opts => []}; +'find_rpc_def_hipstershop.FeatureFlagService'('ListFlags') -> #{name => 'ListFlags', input => list_flags_request, output => list_flags_response, input_stream => false, output_stream => false, opts => []}; +'find_rpc_def_hipstershop.FeatureFlagService'('DeleteFlag') -> #{name => 'DeleteFlag', input => delete_flag_request, output => delete_flag_response, input_stream => false, output_stream => false, opts => []}; +'find_rpc_def_hipstershop.FeatureFlagService'(_) -> error. + + +fetch_rpc_def(ServiceName, RpcName) -> + case find_rpc_def(ServiceName, RpcName) of + Def when is_map(Def) -> Def; + error -> erlang:error({no_such_rpc, ServiceName, RpcName}) + end. + + +%% Convert a a fully qualified (ie with package name) service name +%% as a binary to a service name as an atom. +fqbin_to_service_name(<<"hipstershop.CartService">>) -> 'hipstershop.CartService'; +fqbin_to_service_name(<<"hipstershop.RecommendationService">>) -> 'hipstershop.RecommendationService'; +fqbin_to_service_name(<<"hipstershop.ProductCatalogService">>) -> 'hipstershop.ProductCatalogService'; +fqbin_to_service_name(<<"hipstershop.ShippingService">>) -> 'hipstershop.ShippingService'; +fqbin_to_service_name(<<"hipstershop.CurrencyService">>) -> 'hipstershop.CurrencyService'; +fqbin_to_service_name(<<"hipstershop.PaymentService">>) -> 'hipstershop.PaymentService'; +fqbin_to_service_name(<<"hipstershop.EmailService">>) -> 'hipstershop.EmailService'; +fqbin_to_service_name(<<"hipstershop.CheckoutService">>) -> 'hipstershop.CheckoutService'; +fqbin_to_service_name(<<"hipstershop.AdService">>) -> 'hipstershop.AdService'; +fqbin_to_service_name(<<"hipstershop.FeatureFlagService">>) -> 'hipstershop.FeatureFlagService'; +fqbin_to_service_name(X) -> error({gpb_error, {badservice, X}}). + + +%% Convert a service name as an atom to a fully qualified +%% (ie with package name) name as a binary. +service_name_to_fqbin('hipstershop.CartService') -> <<"hipstershop.CartService">>; +service_name_to_fqbin('hipstershop.RecommendationService') -> <<"hipstershop.RecommendationService">>; +service_name_to_fqbin('hipstershop.ProductCatalogService') -> <<"hipstershop.ProductCatalogService">>; +service_name_to_fqbin('hipstershop.ShippingService') -> <<"hipstershop.ShippingService">>; +service_name_to_fqbin('hipstershop.CurrencyService') -> <<"hipstershop.CurrencyService">>; +service_name_to_fqbin('hipstershop.PaymentService') -> <<"hipstershop.PaymentService">>; +service_name_to_fqbin('hipstershop.EmailService') -> <<"hipstershop.EmailService">>; +service_name_to_fqbin('hipstershop.CheckoutService') -> <<"hipstershop.CheckoutService">>; +service_name_to_fqbin('hipstershop.AdService') -> <<"hipstershop.AdService">>; +service_name_to_fqbin('hipstershop.FeatureFlagService') -> <<"hipstershop.FeatureFlagService">>; +service_name_to_fqbin(X) -> error({gpb_error, {badservice, X}}). + + +%% Convert a a fully qualified (ie with package name) service name +%% and an rpc name, both as binaries to a service name and an rpc +%% name, as atoms. +fqbins_to_service_and_rpc_name(<<"hipstershop.CartService">>, <<"AddItem">>) -> {'hipstershop.CartService', 'AddItem'}; +fqbins_to_service_and_rpc_name(<<"hipstershop.CartService">>, <<"GetCart">>) -> {'hipstershop.CartService', 'GetCart'}; +fqbins_to_service_and_rpc_name(<<"hipstershop.CartService">>, <<"EmptyCart">>) -> {'hipstershop.CartService', 'EmptyCart'}; +fqbins_to_service_and_rpc_name(<<"hipstershop.RecommendationService">>, <<"ListRecommendations">>) -> {'hipstershop.RecommendationService', 'ListRecommendations'}; +fqbins_to_service_and_rpc_name(<<"hipstershop.ProductCatalogService">>, <<"ListProducts">>) -> {'hipstershop.ProductCatalogService', 'ListProducts'}; +fqbins_to_service_and_rpc_name(<<"hipstershop.ProductCatalogService">>, <<"GetProduct">>) -> {'hipstershop.ProductCatalogService', 'GetProduct'}; +fqbins_to_service_and_rpc_name(<<"hipstershop.ProductCatalogService">>, <<"SearchProducts">>) -> {'hipstershop.ProductCatalogService', 'SearchProducts'}; +fqbins_to_service_and_rpc_name(<<"hipstershop.ShippingService">>, <<"GetQuote">>) -> {'hipstershop.ShippingService', 'GetQuote'}; +fqbins_to_service_and_rpc_name(<<"hipstershop.ShippingService">>, <<"ShipOrder">>) -> {'hipstershop.ShippingService', 'ShipOrder'}; +fqbins_to_service_and_rpc_name(<<"hipstershop.CurrencyService">>, <<"GetSupportedCurrencies">>) -> {'hipstershop.CurrencyService', 'GetSupportedCurrencies'}; +fqbins_to_service_and_rpc_name(<<"hipstershop.CurrencyService">>, <<"Convert">>) -> {'hipstershop.CurrencyService', 'Convert'}; +fqbins_to_service_and_rpc_name(<<"hipstershop.PaymentService">>, <<"Charge">>) -> {'hipstershop.PaymentService', 'Charge'}; +fqbins_to_service_and_rpc_name(<<"hipstershop.EmailService">>, <<"SendOrderConfirmation">>) -> {'hipstershop.EmailService', 'SendOrderConfirmation'}; +fqbins_to_service_and_rpc_name(<<"hipstershop.CheckoutService">>, <<"PlaceOrder">>) -> {'hipstershop.CheckoutService', 'PlaceOrder'}; +fqbins_to_service_and_rpc_name(<<"hipstershop.AdService">>, <<"GetAds">>) -> {'hipstershop.AdService', 'GetAds'}; +fqbins_to_service_and_rpc_name(<<"hipstershop.FeatureFlagService">>, <<"GetFlag">>) -> {'hipstershop.FeatureFlagService', 'GetFlag'}; +fqbins_to_service_and_rpc_name(<<"hipstershop.FeatureFlagService">>, <<"CreateFlag">>) -> {'hipstershop.FeatureFlagService', 'CreateFlag'}; +fqbins_to_service_and_rpc_name(<<"hipstershop.FeatureFlagService">>, <<"UpdateFlag">>) -> {'hipstershop.FeatureFlagService', 'UpdateFlag'}; +fqbins_to_service_and_rpc_name(<<"hipstershop.FeatureFlagService">>, <<"ListFlags">>) -> {'hipstershop.FeatureFlagService', 'ListFlags'}; +fqbins_to_service_and_rpc_name(<<"hipstershop.FeatureFlagService">>, <<"DeleteFlag">>) -> {'hipstershop.FeatureFlagService', 'DeleteFlag'}; +fqbins_to_service_and_rpc_name(S, R) -> error({gpb_error, {badservice_or_rpc, {S, R}}}). + + +%% Convert a service name and an rpc name, both as atoms, +%% to a fully qualified (ie with package name) service name and +%% an rpc name as binaries. +service_and_rpc_name_to_fqbins('hipstershop.CartService', 'AddItem') -> {<<"hipstershop.CartService">>, <<"AddItem">>}; +service_and_rpc_name_to_fqbins('hipstershop.CartService', 'GetCart') -> {<<"hipstershop.CartService">>, <<"GetCart">>}; +service_and_rpc_name_to_fqbins('hipstershop.CartService', 'EmptyCart') -> {<<"hipstershop.CartService">>, <<"EmptyCart">>}; +service_and_rpc_name_to_fqbins('hipstershop.RecommendationService', 'ListRecommendations') -> {<<"hipstershop.RecommendationService">>, <<"ListRecommendations">>}; +service_and_rpc_name_to_fqbins('hipstershop.ProductCatalogService', 'ListProducts') -> {<<"hipstershop.ProductCatalogService">>, <<"ListProducts">>}; +service_and_rpc_name_to_fqbins('hipstershop.ProductCatalogService', 'GetProduct') -> {<<"hipstershop.ProductCatalogService">>, <<"GetProduct">>}; +service_and_rpc_name_to_fqbins('hipstershop.ProductCatalogService', 'SearchProducts') -> {<<"hipstershop.ProductCatalogService">>, <<"SearchProducts">>}; +service_and_rpc_name_to_fqbins('hipstershop.ShippingService', 'GetQuote') -> {<<"hipstershop.ShippingService">>, <<"GetQuote">>}; +service_and_rpc_name_to_fqbins('hipstershop.ShippingService', 'ShipOrder') -> {<<"hipstershop.ShippingService">>, <<"ShipOrder">>}; +service_and_rpc_name_to_fqbins('hipstershop.CurrencyService', 'GetSupportedCurrencies') -> {<<"hipstershop.CurrencyService">>, <<"GetSupportedCurrencies">>}; +service_and_rpc_name_to_fqbins('hipstershop.CurrencyService', 'Convert') -> {<<"hipstershop.CurrencyService">>, <<"Convert">>}; +service_and_rpc_name_to_fqbins('hipstershop.PaymentService', 'Charge') -> {<<"hipstershop.PaymentService">>, <<"Charge">>}; +service_and_rpc_name_to_fqbins('hipstershop.EmailService', 'SendOrderConfirmation') -> {<<"hipstershop.EmailService">>, <<"SendOrderConfirmation">>}; +service_and_rpc_name_to_fqbins('hipstershop.CheckoutService', 'PlaceOrder') -> {<<"hipstershop.CheckoutService">>, <<"PlaceOrder">>}; +service_and_rpc_name_to_fqbins('hipstershop.AdService', 'GetAds') -> {<<"hipstershop.AdService">>, <<"GetAds">>}; +service_and_rpc_name_to_fqbins('hipstershop.FeatureFlagService', 'GetFlag') -> {<<"hipstershop.FeatureFlagService">>, <<"GetFlag">>}; +service_and_rpc_name_to_fqbins('hipstershop.FeatureFlagService', 'CreateFlag') -> {<<"hipstershop.FeatureFlagService">>, <<"CreateFlag">>}; +service_and_rpc_name_to_fqbins('hipstershop.FeatureFlagService', 'UpdateFlag') -> {<<"hipstershop.FeatureFlagService">>, <<"UpdateFlag">>}; +service_and_rpc_name_to_fqbins('hipstershop.FeatureFlagService', 'ListFlags') -> {<<"hipstershop.FeatureFlagService">>, <<"ListFlags">>}; +service_and_rpc_name_to_fqbins('hipstershop.FeatureFlagService', 'DeleteFlag') -> {<<"hipstershop.FeatureFlagService">>, <<"DeleteFlag">>}; +service_and_rpc_name_to_fqbins(S, R) -> error({gpb_error, {badservice_or_rpc, {S, R}}}). + + +fqbin_to_msg_name(<<"hipstershop.CartItem">>) -> cart_item; +fqbin_to_msg_name(<<"hipstershop.AddItemRequest">>) -> add_item_request; +fqbin_to_msg_name(<<"hipstershop.EmptyCartRequest">>) -> empty_cart_request; +fqbin_to_msg_name(<<"hipstershop.GetCartRequest">>) -> get_cart_request; +fqbin_to_msg_name(<<"hipstershop.Cart">>) -> cart; +fqbin_to_msg_name(<<"hipstershop.Empty">>) -> empty; +fqbin_to_msg_name(<<"hipstershop.ListRecommendationsRequest">>) -> list_recommendations_request; +fqbin_to_msg_name(<<"hipstershop.ListRecommendationsResponse">>) -> list_recommendations_response; +fqbin_to_msg_name(<<"hipstershop.Product">>) -> product; +fqbin_to_msg_name(<<"hipstershop.ListProductsResponse">>) -> list_products_response; +fqbin_to_msg_name(<<"hipstershop.GetProductRequest">>) -> get_product_request; +fqbin_to_msg_name(<<"hipstershop.SearchProductsRequest">>) -> search_products_request; +fqbin_to_msg_name(<<"hipstershop.SearchProductsResponse">>) -> search_products_response; +fqbin_to_msg_name(<<"hipstershop.GetQuoteRequest">>) -> get_quote_request; +fqbin_to_msg_name(<<"hipstershop.GetQuoteResponse">>) -> get_quote_response; +fqbin_to_msg_name(<<"hipstershop.ShipOrderRequest">>) -> ship_order_request; +fqbin_to_msg_name(<<"hipstershop.ShipOrderResponse">>) -> ship_order_response; +fqbin_to_msg_name(<<"hipstershop.Address">>) -> address; +fqbin_to_msg_name(<<"hipstershop.Money">>) -> money; +fqbin_to_msg_name(<<"hipstershop.GetSupportedCurrenciesResponse">>) -> get_supported_currencies_response; +fqbin_to_msg_name(<<"hipstershop.CurrencyConversionRequest">>) -> currency_conversion_request; +fqbin_to_msg_name(<<"hipstershop.CreditCardInfo">>) -> credit_card_info; +fqbin_to_msg_name(<<"hipstershop.ChargeRequest">>) -> charge_request; +fqbin_to_msg_name(<<"hipstershop.ChargeResponse">>) -> charge_response; +fqbin_to_msg_name(<<"hipstershop.OrderItem">>) -> order_item; +fqbin_to_msg_name(<<"hipstershop.OrderResult">>) -> order_result; +fqbin_to_msg_name(<<"hipstershop.SendOrderConfirmationRequest">>) -> send_order_confirmation_request; +fqbin_to_msg_name(<<"hipstershop.PlaceOrderRequest">>) -> place_order_request; +fqbin_to_msg_name(<<"hipstershop.PlaceOrderResponse">>) -> place_order_response; +fqbin_to_msg_name(<<"hipstershop.AdRequest">>) -> ad_request; +fqbin_to_msg_name(<<"hipstershop.AdResponse">>) -> ad_response; +fqbin_to_msg_name(<<"hipstershop.Ad">>) -> ad; +fqbin_to_msg_name(<<"hipstershop.Flag">>) -> flag; +fqbin_to_msg_name(<<"hipstershop.GetFlagRequest">>) -> get_flag_request; +fqbin_to_msg_name(<<"hipstershop.GetFlagResponse">>) -> get_flag_response; +fqbin_to_msg_name(<<"hipstershop.CreateFlagRequest">>) -> create_flag_request; +fqbin_to_msg_name(<<"hipstershop.CreateFlagResponse">>) -> create_flag_response; +fqbin_to_msg_name(<<"hipstershop.UpdateFlagRequest">>) -> update_flag_request; +fqbin_to_msg_name(<<"hipstershop.UpdateFlagResponse">>) -> update_flag_response; +fqbin_to_msg_name(<<"hipstershop.ListFlagsRequest">>) -> list_flags_request; +fqbin_to_msg_name(<<"hipstershop.ListFlagsResponse">>) -> list_flags_response; +fqbin_to_msg_name(<<"hipstershop.DeleteFlagRequest">>) -> delete_flag_request; +fqbin_to_msg_name(<<"hipstershop.DeleteFlagResponse">>) -> delete_flag_response; +fqbin_to_msg_name(<<"google.protobuf.Timestamp">>) -> timestamp; +fqbin_to_msg_name(E) -> error({gpb_error, {badmsg, E}}). + + +msg_name_to_fqbin(cart_item) -> <<"hipstershop.CartItem">>; +msg_name_to_fqbin(add_item_request) -> <<"hipstershop.AddItemRequest">>; +msg_name_to_fqbin(empty_cart_request) -> <<"hipstershop.EmptyCartRequest">>; +msg_name_to_fqbin(get_cart_request) -> <<"hipstershop.GetCartRequest">>; +msg_name_to_fqbin(cart) -> <<"hipstershop.Cart">>; +msg_name_to_fqbin(empty) -> <<"hipstershop.Empty">>; +msg_name_to_fqbin(list_recommendations_request) -> <<"hipstershop.ListRecommendationsRequest">>; +msg_name_to_fqbin(list_recommendations_response) -> <<"hipstershop.ListRecommendationsResponse">>; +msg_name_to_fqbin(product) -> <<"hipstershop.Product">>; +msg_name_to_fqbin(list_products_response) -> <<"hipstershop.ListProductsResponse">>; +msg_name_to_fqbin(get_product_request) -> <<"hipstershop.GetProductRequest">>; +msg_name_to_fqbin(search_products_request) -> <<"hipstershop.SearchProductsRequest">>; +msg_name_to_fqbin(search_products_response) -> <<"hipstershop.SearchProductsResponse">>; +msg_name_to_fqbin(get_quote_request) -> <<"hipstershop.GetQuoteRequest">>; +msg_name_to_fqbin(get_quote_response) -> <<"hipstershop.GetQuoteResponse">>; +msg_name_to_fqbin(ship_order_request) -> <<"hipstershop.ShipOrderRequest">>; +msg_name_to_fqbin(ship_order_response) -> <<"hipstershop.ShipOrderResponse">>; +msg_name_to_fqbin(address) -> <<"hipstershop.Address">>; +msg_name_to_fqbin(money) -> <<"hipstershop.Money">>; +msg_name_to_fqbin(get_supported_currencies_response) -> <<"hipstershop.GetSupportedCurrenciesResponse">>; +msg_name_to_fqbin(currency_conversion_request) -> <<"hipstershop.CurrencyConversionRequest">>; +msg_name_to_fqbin(credit_card_info) -> <<"hipstershop.CreditCardInfo">>; +msg_name_to_fqbin(charge_request) -> <<"hipstershop.ChargeRequest">>; +msg_name_to_fqbin(charge_response) -> <<"hipstershop.ChargeResponse">>; +msg_name_to_fqbin(order_item) -> <<"hipstershop.OrderItem">>; +msg_name_to_fqbin(order_result) -> <<"hipstershop.OrderResult">>; +msg_name_to_fqbin(send_order_confirmation_request) -> <<"hipstershop.SendOrderConfirmationRequest">>; +msg_name_to_fqbin(place_order_request) -> <<"hipstershop.PlaceOrderRequest">>; +msg_name_to_fqbin(place_order_response) -> <<"hipstershop.PlaceOrderResponse">>; +msg_name_to_fqbin(ad_request) -> <<"hipstershop.AdRequest">>; +msg_name_to_fqbin(ad_response) -> <<"hipstershop.AdResponse">>; +msg_name_to_fqbin(ad) -> <<"hipstershop.Ad">>; +msg_name_to_fqbin(flag) -> <<"hipstershop.Flag">>; +msg_name_to_fqbin(get_flag_request) -> <<"hipstershop.GetFlagRequest">>; +msg_name_to_fqbin(get_flag_response) -> <<"hipstershop.GetFlagResponse">>; +msg_name_to_fqbin(create_flag_request) -> <<"hipstershop.CreateFlagRequest">>; +msg_name_to_fqbin(create_flag_response) -> <<"hipstershop.CreateFlagResponse">>; +msg_name_to_fqbin(update_flag_request) -> <<"hipstershop.UpdateFlagRequest">>; +msg_name_to_fqbin(update_flag_response) -> <<"hipstershop.UpdateFlagResponse">>; +msg_name_to_fqbin(list_flags_request) -> <<"hipstershop.ListFlagsRequest">>; +msg_name_to_fqbin(list_flags_response) -> <<"hipstershop.ListFlagsResponse">>; +msg_name_to_fqbin(delete_flag_request) -> <<"hipstershop.DeleteFlagRequest">>; +msg_name_to_fqbin(delete_flag_response) -> <<"hipstershop.DeleteFlagResponse">>; +msg_name_to_fqbin(timestamp) -> <<"google.protobuf.Timestamp">>; +msg_name_to_fqbin(E) -> error({gpb_error, {badmsg, E}}). + + +-spec fqbin_to_enum_name(_) -> no_return(). +fqbin_to_enum_name(E) -> error({gpb_error, {badenum, E}}). + + +-spec enum_name_to_fqbin(_) -> no_return(). +enum_name_to_fqbin(E) -> error({gpb_error, {badenum, E}}). + + +get_package_name() -> hipstershop. + + +%% Whether or not the message names +%% are prepended with package name or not. +uses_packages() -> true. + + +source_basename() -> "demo.proto". + + +%% Retrieve all proto file names, also imported ones. +%% The order is top-down. The first element is always the main +%% source file. The files are returned with extension, +%% see get_all_proto_names/0 for a version that returns +%% the basenames sans extension +get_all_source_basenames() -> ["demo.proto", "timestamp.proto"]. + + +%% Retrieve all proto file names, also imported ones. +%% The order is top-down. The first element is always the main +%% source file. The files are returned sans .proto extension, +%% to make it easier to use them with the various get_xyz_containment +%% functions. +get_all_proto_names() -> ["demo", "timestamp"]. + + +get_msg_containment("demo") -> + [ad, + ad_request, + ad_response, + add_item_request, + address, + cart, + cart_item, + charge_request, + charge_response, + create_flag_request, + create_flag_response, + credit_card_info, + currency_conversion_request, + delete_flag_request, + delete_flag_response, + empty, + empty_cart_request, + flag, + get_cart_request, + get_flag_request, + get_flag_response, + get_product_request, + get_quote_request, + get_quote_response, + get_supported_currencies_response, + list_flags_request, + list_flags_response, + list_products_response, + list_recommendations_request, + list_recommendations_response, + money, + order_item, + order_result, + place_order_request, + place_order_response, + product, + search_products_request, + search_products_response, + send_order_confirmation_request, + ship_order_request, + ship_order_response, + update_flag_request, + update_flag_response]; +get_msg_containment("timestamp") -> [timestamp]; +get_msg_containment(P) -> error({gpb_error, {badproto, P}}). + + +get_pkg_containment("demo") -> hipstershop; +get_pkg_containment("timestamp") -> 'google.protobuf'; +get_pkg_containment(P) -> error({gpb_error, {badproto, P}}). + + +get_service_containment("demo") -> + ['hipstershop.AdService', + 'hipstershop.CartService', + 'hipstershop.CheckoutService', + 'hipstershop.CurrencyService', + 'hipstershop.EmailService', + 'hipstershop.FeatureFlagService', + 'hipstershop.PaymentService', + 'hipstershop.ProductCatalogService', + 'hipstershop.RecommendationService', + 'hipstershop.ShippingService']; +get_service_containment("timestamp") -> []; +get_service_containment(P) -> error({gpb_error, {badproto, P}}). + + +get_rpc_containment("demo") -> + [{'hipstershop.CartService', 'AddItem'}, + {'hipstershop.CartService', 'GetCart'}, + {'hipstershop.CartService', 'EmptyCart'}, + {'hipstershop.RecommendationService', 'ListRecommendations'}, + {'hipstershop.ProductCatalogService', 'ListProducts'}, + {'hipstershop.ProductCatalogService', 'GetProduct'}, + {'hipstershop.ProductCatalogService', 'SearchProducts'}, + {'hipstershop.ShippingService', 'GetQuote'}, + {'hipstershop.ShippingService', 'ShipOrder'}, + {'hipstershop.CurrencyService', 'GetSupportedCurrencies'}, + {'hipstershop.CurrencyService', 'Convert'}, + {'hipstershop.PaymentService', 'Charge'}, + {'hipstershop.EmailService', 'SendOrderConfirmation'}, + {'hipstershop.CheckoutService', 'PlaceOrder'}, + {'hipstershop.AdService', 'GetAds'}, + {'hipstershop.FeatureFlagService', 'GetFlag'}, + {'hipstershop.FeatureFlagService', 'CreateFlag'}, + {'hipstershop.FeatureFlagService', 'UpdateFlag'}, + {'hipstershop.FeatureFlagService', 'ListFlags'}, + {'hipstershop.FeatureFlagService', 'DeleteFlag'}]; +get_rpc_containment("timestamp") -> []; +get_rpc_containment(P) -> error({gpb_error, {badproto, P}}). + + +get_enum_containment("demo") -> []; +get_enum_containment("timestamp") -> []; +get_enum_containment(P) -> error({gpb_error, {badproto, P}}). + + +get_proto_by_msg_name_as_fqbin(<<"google.protobuf.Timestamp">>) -> "timestamp"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.Address">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.UpdateFlagRequest">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.ShipOrderRequest">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.SendOrderConfirmationRequest">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.SearchProductsRequest">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.Product">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.PlaceOrderRequest">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.OrderResult">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.ListRecommendationsRequest">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.ListFlagsRequest">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.GetQuoteRequest">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.GetProductRequest">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.GetFlagRequest">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.GetCartRequest">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.EmptyCartRequest">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.DeleteFlagRequest">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.CurrencyConversionRequest">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.CreateFlagRequest">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.ChargeRequest">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.Cart">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.AddItemRequest">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.AdRequest">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.Ad">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.UpdateFlagResponse">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.ShipOrderResponse">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.SearchProductsResponse">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.PlaceOrderResponse">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.ListRecommendationsResponse">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.ListProductsResponse">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.ListFlagsResponse">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.GetSupportedCurrenciesResponse">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.GetQuoteResponse">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.GetFlagResponse">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.DeleteFlagResponse">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.CreateFlagResponse">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.ChargeResponse">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.AdResponse">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.Flag">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.Money">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.Empty">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.OrderItem">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.CartItem">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(<<"hipstershop.CreditCardInfo">>) -> "demo"; +get_proto_by_msg_name_as_fqbin(E) -> error({gpb_error, {badmsg, E}}). + + +get_proto_by_service_name_as_fqbin(<<"hipstershop.ShippingService">>) -> "demo"; +get_proto_by_service_name_as_fqbin(<<"hipstershop.RecommendationService">>) -> "demo"; +get_proto_by_service_name_as_fqbin(<<"hipstershop.ProductCatalogService">>) -> "demo"; +get_proto_by_service_name_as_fqbin(<<"hipstershop.PaymentService">>) -> "demo"; +get_proto_by_service_name_as_fqbin(<<"hipstershop.FeatureFlagService">>) -> "demo"; +get_proto_by_service_name_as_fqbin(<<"hipstershop.EmailService">>) -> "demo"; +get_proto_by_service_name_as_fqbin(<<"hipstershop.CurrencyService">>) -> "demo"; +get_proto_by_service_name_as_fqbin(<<"hipstershop.CheckoutService">>) -> "demo"; +get_proto_by_service_name_as_fqbin(<<"hipstershop.CartService">>) -> "demo"; +get_proto_by_service_name_as_fqbin(<<"hipstershop.AdService">>) -> "demo"; +get_proto_by_service_name_as_fqbin(E) -> error({gpb_error, {badservice, E}}). + + +-spec get_proto_by_enum_name_as_fqbin(_) -> no_return(). +get_proto_by_enum_name_as_fqbin(E) -> error({gpb_error, {badenum, E}}). + + +get_protos_by_pkg_name_as_fqbin(<<"hipstershop">>) -> ["demo"]; +get_protos_by_pkg_name_as_fqbin(<<"google.protobuf">>) -> ["timestamp"]; +get_protos_by_pkg_name_as_fqbin(E) -> error({gpb_error, {badpkg, E}}). + + +descriptor() -> + <<10, 245, 36, 10, 22, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 47, 100, 101, 109, 111, 46, 112, 114, 111, 116, 111, 18, 11, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 34, 40, 10, 2, 65, 100, 18, 20, 10, 12, 114, 101, 100, + 105, 114, 101, 99, 116, 95, 117, 114, 108, 24, 1, 32, 1, 40, 9, 18, 12, 10, 4, 116, 101, 120, 116, 24, 2, 32, 1, 40, 9, 34, 33, 10, 9, 65, 100, 82, 101, 113, 117, 101, 115, 116, 18, 20, 10, 12, 99, 111, 110, 116, 101, 120, 116, 95, 107, 101, 121, + 115, 24, 1, 32, 3, 40, 9, 34, 42, 10, 10, 65, 100, 82, 101, 115, 112, 111, 110, 115, 101, 18, 28, 10, 3, 97, 100, 115, 24, 1, 32, 3, 40, 11, 50, 15, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 65, 100, 34, 70, 10, 14, 65, 100, 100, + 73, 116, 101, 109, 82, 101, 113, 117, 101, 115, 116, 18, 15, 10, 7, 117, 115, 101, 114, 95, 105, 100, 24, 1, 32, 1, 40, 9, 18, 35, 10, 4, 105, 116, 101, 109, 24, 2, 32, 1, 40, 11, 50, 21, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, + 67, 97, 114, 116, 73, 116, 101, 109, 34, 97, 10, 7, 65, 100, 100, 114, 101, 115, 115, 18, 22, 10, 14, 115, 116, 114, 101, 101, 116, 95, 97, 100, 100, 114, 101, 115, 115, 24, 1, 32, 1, 40, 9, 18, 12, 10, 4, 99, 105, 116, 121, 24, 2, 32, 1, 40, 9, 18, + 13, 10, 5, 115, 116, 97, 116, 101, 24, 3, 32, 1, 40, 9, 18, 15, 10, 7, 99, 111, 117, 110, 116, 114, 121, 24, 4, 32, 1, 40, 9, 18, 16, 10, 8, 122, 105, 112, 95, 99, 111, 100, 101, 24, 5, 32, 1, 40, 5, 34, 61, 10, 4, 67, 97, 114, 116, 18, 15, 10, 7, + 117, 115, 101, 114, 95, 105, 100, 24, 1, 32, 1, 40, 9, 18, 36, 10, 5, 105, 116, 101, 109, 115, 24, 2, 32, 3, 40, 11, 50, 21, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 67, 97, 114, 116, 73, 116, 101, 109, 34, 48, 10, 8, 67, 97, + 114, 116, 73, 116, 101, 109, 18, 18, 10, 10, 112, 114, 111, 100, 117, 99, 116, 95, 105, 100, 24, 1, 32, 1, 40, 9, 18, 16, 10, 8, 113, 117, 97, 110, 116, 105, 116, 121, 24, 2, 32, 1, 40, 5, 34, 101, 10, 13, 67, 104, 97, 114, 103, 101, 82, 101, 113, + 117, 101, 115, 116, 18, 34, 10, 6, 97, 109, 111, 117, 110, 116, 24, 1, 32, 1, 40, 11, 50, 18, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 77, 111, 110, 101, 121, 18, 48, 10, 11, 99, 114, 101, 100, 105, 116, 95, 99, 97, 114, 100, + 24, 2, 32, 1, 40, 11, 50, 27, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 67, 114, 101, 100, 105, 116, 67, 97, 114, 100, 73, 110, 102, 111, 34, 40, 10, 14, 67, 104, 97, 114, 103, 101, 82, 101, 115, 112, 111, 110, 115, 101, 18, 22, + 10, 14, 116, 114, 97, 110, 115, 97, 99, 116, 105, 111, 110, 95, 105, 100, 24, 1, 32, 1, 40, 9, 34, 71, 10, 17, 67, 114, 101, 97, 116, 101, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 18, 12, 10, 4, 110, 97, 109, 101, 24, 1, 32, 1, 40, 9, 18, + 19, 10, 11, 100, 101, 115, 99, 114, 105, 112, 116, 105, 111, 110, 24, 2, 32, 1, 40, 9, 18, 15, 10, 7, 101, 110, 97, 98, 108, 101, 100, 24, 3, 32, 1, 40, 8, 34, 53, 10, 18, 67, 114, 101, 97, 116, 101, 70, 108, 97, 103, 82, 101, 115, 112, 111, 110, + 115, 101, 18, 31, 10, 4, 102, 108, 97, 103, 24, 1, 32, 1, 40, 11, 50, 17, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 70, 108, 97, 103, 34, 144, 1, 10, 14, 67, 114, 101, 100, 105, 116, 67, 97, 114, 100, 73, 110, 102, 111, 18, 26, + 10, 18, 99, 114, 101, 100, 105, 116, 95, 99, 97, 114, 100, 95, 110, 117, 109, 98, 101, 114, 24, 1, 32, 1, 40, 9, 18, 23, 10, 15, 99, 114, 101, 100, 105, 116, 95, 99, 97, 114, 100, 95, 99, 118, 118, 24, 2, 32, 1, 40, 5, 18, 35, 10, 27, 99, 114, 101, + 100, 105, 116, 95, 99, 97, 114, 100, 95, 101, 120, 112, 105, 114, 97, 116, 105, 111, 110, 95, 121, 101, 97, 114, 24, 3, 32, 1, 40, 5, 18, 36, 10, 28, 99, 114, 101, 100, 105, 116, 95, 99, 97, 114, 100, 95, 101, 120, 112, 105, 114, 97, 116, 105, 111, + 110, 95, 109, 111, 110, 116, 104, 24, 4, 32, 1, 40, 5, 34, 78, 10, 25, 67, 117, 114, 114, 101, 110, 99, 121, 67, 111, 110, 118, 101, 114, 115, 105, 111, 110, 82, 101, 113, 117, 101, 115, 116, 18, 32, 10, 4, 102, 114, 111, 109, 24, 1, 32, 1, 40, 11, + 50, 18, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 77, 111, 110, 101, 121, 18, 15, 10, 7, 116, 111, 95, 99, 111, 100, 101, 24, 2, 32, 1, 40, 9, 34, 33, 10, 17, 68, 101, 108, 101, 116, 101, 70, 108, 97, 103, 82, 101, 113, 117, 101, + 115, 116, 18, 12, 10, 4, 110, 97, 109, 101, 24, 1, 32, 1, 40, 9, 34, 20, 10, 18, 68, 101, 108, 101, 116, 101, 70, 108, 97, 103, 82, 101, 115, 112, 111, 110, 115, 101, 34, 7, 10, 5, 69, 109, 112, 116, 121, 34, 35, 10, 16, 69, 109, 112, 116, 121, 67, + 97, 114, 116, 82, 101, 113, 117, 101, 115, 116, 18, 15, 10, 7, 117, 115, 101, 114, 95, 105, 100, 24, 1, 32, 1, 40, 9, 34, 154, 1, 10, 4, 70, 108, 97, 103, 18, 12, 10, 4, 110, 97, 109, 101, 24, 1, 32, 1, 40, 9, 18, 19, 10, 11, 100, 101, 115, 99, 114, + 105, 112, 116, 105, 111, 110, 24, 2, 32, 1, 40, 9, 18, 15, 10, 7, 101, 110, 97, 98, 108, 101, 100, 24, 3, 32, 1, 40, 8, 18, 46, 10, 10, 99, 114, 101, 97, 116, 101, 100, 95, 97, 116, 24, 4, 32, 1, 40, 11, 50, 26, 46, 103, 111, 111, 103, 108, 101, 46, + 112, 114, 111, 116, 111, 98, 117, 102, 46, 84, 105, 109, 101, 115, 116, 97, 109, 112, 18, 46, 10, 10, 117, 112, 100, 97, 116, 101, 100, 95, 97, 116, 24, 5, 32, 1, 40, 11, 50, 26, 46, 103, 111, 111, 103, 108, 101, 46, 112, 114, 111, 116, 111, 98, 117, + 102, 46, 84, 105, 109, 101, 115, 116, 97, 109, 112, 34, 33, 10, 14, 71, 101, 116, 67, 97, 114, 116, 82, 101, 113, 117, 101, 115, 116, 18, 15, 10, 7, 117, 115, 101, 114, 95, 105, 100, 24, 1, 32, 1, 40, 9, 34, 30, 10, 14, 71, 101, 116, 70, 108, 97, + 103, 82, 101, 113, 117, 101, 115, 116, 18, 12, 10, 4, 110, 97, 109, 101, 24, 1, 32, 1, 40, 9, 34, 50, 10, 15, 71, 101, 116, 70, 108, 97, 103, 82, 101, 115, 112, 111, 110, 115, 101, 18, 31, 10, 4, 102, 108, 97, 103, 24, 1, 32, 1, 40, 11, 50, 17, 46, + 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 70, 108, 97, 103, 34, 31, 10, 17, 71, 101, 116, 80, 114, 111, 100, 117, 99, 116, 82, 101, 113, 117, 101, 115, 116, 18, 10, 10, 2, 105, 100, 24, 1, 32, 1, 40, 9, 34, 94, 10, 15, 71, 101, 116, + 81, 117, 111, 116, 101, 82, 101, 113, 117, 101, 115, 116, 18, 37, 10, 7, 97, 100, 100, 114, 101, 115, 115, 24, 1, 32, 1, 40, 11, 50, 20, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 65, 100, 100, 114, 101, 115, 115, 18, 36, 10, 5, + 105, 116, 101, 109, 115, 24, 2, 32, 3, 40, 11, 50, 21, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 67, 97, 114, 116, 73, 116, 101, 109, 34, 56, 10, 16, 71, 101, 116, 81, 117, 111, 116, 101, 82, 101, 115, 112, 111, 110, 115, 101, + 18, 36, 10, 8, 99, 111, 115, 116, 95, 117, 115, 100, 24, 1, 32, 1, 40, 11, 50, 18, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 77, 111, 110, 101, 121, 34, 56, 10, 30, 71, 101, 116, 83, 117, 112, 112, 111, 114, 116, 101, 100, 67, + 117, 114, 114, 101, 110, 99, 105, 101, 115, 82, 101, 115, 112, 111, 110, 115, 101, 18, 22, 10, 14, 99, 117, 114, 114, 101, 110, 99, 121, 95, 99, 111, 100, 101, 115, 24, 1, 32, 3, 40, 9, 34, 18, 10, 16, 76, 105, 115, 116, 70, 108, 97, 103, 115, 82, + 101, 113, 117, 101, 115, 116, 34, 52, 10, 17, 76, 105, 115, 116, 70, 108, 97, 103, 115, 82, 101, 115, 112, 111, 110, 115, 101, 18, 31, 10, 4, 102, 108, 97, 103, 24, 1, 32, 3, 40, 11, 50, 17, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, + 46, 70, 108, 97, 103, 34, 62, 10, 20, 76, 105, 115, 116, 80, 114, 111, 100, 117, 99, 116, 115, 82, 101, 115, 112, 111, 110, 115, 101, 18, 38, 10, 8, 112, 114, 111, 100, 117, 99, 116, 115, 24, 1, 32, 3, 40, 11, 50, 20, 46, 104, 105, 112, 115, 116, + 101, 114, 115, 104, 111, 112, 46, 80, 114, 111, 100, 117, 99, 116, 34, 66, 10, 26, 76, 105, 115, 116, 82, 101, 99, 111, 109, 109, 101, 110, 100, 97, 116, 105, 111, 110, 115, 82, 101, 113, 117, 101, 115, 116, 18, 15, 10, 7, 117, 115, 101, 114, 95, + 105, 100, 24, 1, 32, 1, 40, 9, 18, 19, 10, 11, 112, 114, 111, 100, 117, 99, 116, 95, 105, 100, 115, 24, 2, 32, 3, 40, 9, 34, 50, 10, 27, 76, 105, 115, 116, 82, 101, 99, 111, 109, 109, 101, 110, 100, 97, 116, 105, 111, 110, 115, 82, 101, 115, 112, + 111, 110, 115, 101, 18, 19, 10, 11, 112, 114, 111, 100, 117, 99, 116, 95, 105, 100, 115, 24, 1, 32, 3, 40, 9, 34, 60, 10, 5, 77, 111, 110, 101, 121, 18, 21, 10, 13, 99, 117, 114, 114, 101, 110, 99, 121, 95, 99, 111, 100, 101, 24, 1, 32, 1, 40, 9, 18, + 13, 10, 5, 117, 110, 105, 116, 115, 24, 2, 32, 1, 40, 3, 18, 13, 10, 5, 110, 97, 110, 111, 115, 24, 3, 32, 1, 40, 5, 34, 82, 10, 9, 79, 114, 100, 101, 114, 73, 116, 101, 109, 18, 35, 10, 4, 105, 116, 101, 109, 24, 1, 32, 1, 40, 11, 50, 21, 46, 104, + 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 67, 97, 114, 116, 73, 116, 101, 109, 18, 32, 10, 4, 99, 111, 115, 116, 24, 2, 32, 1, 40, 11, 50, 18, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 77, 111, 110, 101, 121, 34, 191, + 1, 10, 11, 79, 114, 100, 101, 114, 82, 101, 115, 117, 108, 116, 18, 16, 10, 8, 111, 114, 100, 101, 114, 95, 105, 100, 24, 1, 32, 1, 40, 9, 18, 28, 10, 20, 115, 104, 105, 112, 112, 105, 110, 103, 95, 116, 114, 97, 99, 107, 105, 110, 103, 95, 105, 100, + 24, 2, 32, 1, 40, 9, 18, 41, 10, 13, 115, 104, 105, 112, 112, 105, 110, 103, 95, 99, 111, 115, 116, 24, 3, 32, 1, 40, 11, 50, 18, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 77, 111, 110, 101, 121, 18, 46, 10, 16, 115, 104, 105, + 112, 112, 105, 110, 103, 95, 97, 100, 100, 114, 101, 115, 115, 24, 4, 32, 1, 40, 11, 50, 20, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 65, 100, 100, 114, 101, 115, 115, 18, 37, 10, 5, 105, 116, 101, 109, 115, 24, 5, 32, 3, 40, + 11, 50, 22, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 79, 114, 100, 101, 114, 73, 116, 101, 109, 34, 163, 1, 10, 17, 80, 108, 97, 99, 101, 79, 114, 100, 101, 114, 82, 101, 113, 117, 101, 115, 116, 18, 15, 10, 7, 117, 115, 101, + 114, 95, 105, 100, 24, 1, 32, 1, 40, 9, 18, 21, 10, 13, 117, 115, 101, 114, 95, 99, 117, 114, 114, 101, 110, 99, 121, 24, 2, 32, 1, 40, 9, 18, 37, 10, 7, 97, 100, 100, 114, 101, 115, 115, 24, 3, 32, 1, 40, 11, 50, 20, 46, 104, 105, 112, 115, 116, + 101, 114, 115, 104, 111, 112, 46, 65, 100, 100, 114, 101, 115, 115, 18, 13, 10, 5, 101, 109, 97, 105, 108, 24, 5, 32, 1, 40, 9, 18, 48, 10, 11, 99, 114, 101, 100, 105, 116, 95, 99, 97, 114, 100, 24, 6, 32, 1, 40, 11, 50, 27, 46, 104, 105, 112, 115, + 116, 101, 114, 115, 104, 111, 112, 46, 67, 114, 101, 100, 105, 116, 67, 97, 114, 100, 73, 110, 102, 111, 34, 61, 10, 18, 80, 108, 97, 99, 101, 79, 114, 100, 101, 114, 82, 101, 115, 112, 111, 110, 115, 101, 18, 39, 10, 5, 111, 114, 100, 101, 114, 24, + 1, 32, 1, 40, 11, 50, 24, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 79, 114, 100, 101, 114, 82, 101, 115, 117, 108, 116, 34, 132, 1, 10, 7, 80, 114, 111, 100, 117, 99, 116, 18, 10, 10, 2, 105, 100, 24, 1, 32, 1, 40, 9, 18, 12, + 10, 4, 110, 97, 109, 101, 24, 2, 32, 1, 40, 9, 18, 19, 10, 11, 100, 101, 115, 99, 114, 105, 112, 116, 105, 111, 110, 24, 3, 32, 1, 40, 9, 18, 15, 10, 7, 112, 105, 99, 116, 117, 114, 101, 24, 4, 32, 1, 40, 9, 18, 37, 10, 9, 112, 114, 105, 99, 101, 95, + 117, 115, 100, 24, 5, 32, 1, 40, 11, 50, 18, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 77, 111, 110, 101, 121, 18, 18, 10, 10, 99, 97, 116, 101, 103, 111, 114, 105, 101, 115, 24, 6, 32, 3, 40, 9, 34, 38, 10, 21, 83, 101, 97, 114, + 99, 104, 80, 114, 111, 100, 117, 99, 116, 115, 82, 101, 113, 117, 101, 115, 116, 18, 13, 10, 5, 113, 117, 101, 114, 121, 24, 1, 32, 1, 40, 9, 34, 63, 10, 22, 83, 101, 97, 114, 99, 104, 80, 114, 111, 100, 117, 99, 116, 115, 82, 101, 115, 112, 111, + 110, 115, 101, 18, 37, 10, 7, 114, 101, 115, 117, 108, 116, 115, 24, 1, 32, 3, 40, 11, 50, 20, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 80, 114, 111, 100, 117, 99, 116, 34, 86, 10, 28, 83, 101, 110, 100, 79, 114, 100, 101, 114, + 67, 111, 110, 102, 105, 114, 109, 97, 116, 105, 111, 110, 82, 101, 113, 117, 101, 115, 116, 18, 13, 10, 5, 101, 109, 97, 105, 108, 24, 1, 32, 1, 40, 9, 18, 39, 10, 5, 111, 114, 100, 101, 114, 24, 2, 32, 1, 40, 11, 50, 24, 46, 104, 105, 112, 115, 116, + 101, 114, 115, 104, 111, 112, 46, 79, 114, 100, 101, 114, 82, 101, 115, 117, 108, 116, 34, 95, 10, 16, 83, 104, 105, 112, 79, 114, 100, 101, 114, 82, 101, 113, 117, 101, 115, 116, 18, 37, 10, 7, 97, 100, 100, 114, 101, 115, 115, 24, 1, 32, 1, 40, 11, + 50, 20, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 65, 100, 100, 114, 101, 115, 115, 18, 36, 10, 5, 105, 116, 101, 109, 115, 24, 2, 32, 3, 40, 11, 50, 21, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 67, 97, 114, + 116, 73, 116, 101, 109, 34, 40, 10, 17, 83, 104, 105, 112, 79, 114, 100, 101, 114, 82, 101, 115, 112, 111, 110, 115, 101, 18, 19, 10, 11, 116, 114, 97, 99, 107, 105, 110, 103, 95, 105, 100, 24, 1, 32, 1, 40, 9, 34, 50, 10, 17, 85, 112, 100, 97, 116, + 101, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 18, 12, 10, 4, 110, 97, 109, 101, 24, 1, 32, 1, 40, 9, 18, 15, 10, 7, 101, 110, 97, 98, 108, 101, 100, 24, 2, 32, 1, 40, 8, 34, 20, 10, 18, 85, 112, 100, 97, 116, 101, 70, 108, 97, 103, 82, + 101, 115, 112, 111, 110, 115, 101, 50, 208, 1, 10, 11, 67, 97, 114, 116, 83, 101, 114, 118, 105, 99, 101, 18, 62, 10, 7, 65, 100, 100, 73, 116, 101, 109, 18, 27, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 65, 100, 100, 73, 116, + 101, 109, 82, 101, 113, 117, 101, 115, 116, 26, 18, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 69, 109, 112, 116, 121, 40, 0, 48, 0, 18, 61, 10, 7, 71, 101, 116, 67, 97, 114, 116, 18, 27, 46, 104, 105, 112, 115, 116, 101, 114, + 115, 104, 111, 112, 46, 71, 101, 116, 67, 97, 114, 116, 82, 101, 113, 117, 101, 115, 116, 26, 17, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 67, 97, 114, 116, 40, 0, 48, 0, 18, 66, 10, 9, 69, 109, 112, 116, 121, 67, 97, 114, 116, + 18, 29, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 69, 109, 112, 116, 121, 67, 97, 114, 116, 82, 101, 113, 117, 101, 115, 116, 26, 18, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 69, 109, 112, 116, 121, 40, 0, + 48, 0, 50, 133, 1, 10, 21, 82, 101, 99, 111, 109, 109, 101, 110, 100, 97, 116, 105, 111, 110, 83, 101, 114, 118, 105, 99, 101, 18, 108, 10, 19, 76, 105, 115, 116, 82, 101, 99, 111, 109, 109, 101, 110, 100, 97, 116, 105, 111, 110, 115, 18, 39, 46, + 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 76, 105, 115, 116, 82, 101, 99, 111, 109, 109, 101, 110, 100, 97, 116, 105, 111, 110, 115, 82, 101, 113, 117, 101, 115, 116, 26, 40, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, + 46, 76, 105, 115, 116, 82, 101, 99, 111, 109, 109, 101, 110, 100, 97, 116, 105, 111, 110, 115, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 50, 137, 2, 10, 21, 80, 114, 111, 100, 117, 99, 116, 67, 97, 116, 97, 108, 111, 103, 83, 101, 114, + 118, 105, 99, 101, 18, 73, 10, 12, 76, 105, 115, 116, 80, 114, 111, 100, 117, 99, 116, 115, 18, 18, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 69, 109, 112, 116, 121, 26, 33, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, + 112, 46, 76, 105, 115, 116, 80, 114, 111, 100, 117, 99, 116, 115, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 18, 70, 10, 10, 71, 101, 116, 80, 114, 111, 100, 117, 99, 116, 18, 30, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, + 46, 71, 101, 116, 80, 114, 111, 100, 117, 99, 116, 82, 101, 113, 117, 101, 115, 116, 26, 20, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 80, 114, 111, 100, 117, 99, 116, 40, 0, 48, 0, 18, 93, 10, 14, 83, 101, 97, 114, 99, 104, 80, + 114, 111, 100, 117, 99, 116, 115, 18, 34, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 83, 101, 97, 114, 99, 104, 80, 114, 111, 100, 117, 99, 116, 115, 82, 101, 113, 117, 101, 115, 116, 26, 35, 46, 104, 105, 112, 115, 116, 101, 114, + 115, 104, 111, 112, 46, 83, 101, 97, 114, 99, 104, 80, 114, 111, 100, 117, 99, 116, 115, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 50, 174, 1, 10, 15, 83, 104, 105, 112, 112, 105, 110, 103, 83, 101, 114, 118, 105, 99, 101, 18, 75, 10, 8, + 71, 101, 116, 81, 117, 111, 116, 101, 18, 28, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 71, 101, 116, 81, 117, 111, 116, 101, 82, 101, 113, 117, 101, 115, 116, 26, 29, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, + 46, 71, 101, 116, 81, 117, 111, 116, 101, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 18, 78, 10, 9, 83, 104, 105, 112, 79, 114, 100, 101, 114, 18, 29, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 83, 104, 105, 112, 79, + 114, 100, 101, 114, 82, 101, 113, 117, 101, 115, 116, 26, 30, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 83, 104, 105, 112, 79, 114, 100, 101, 114, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 50, 187, 1, 10, 15, 67, 117, + 114, 114, 101, 110, 99, 121, 83, 101, 114, 118, 105, 99, 101, 18, 93, 10, 22, 71, 101, 116, 83, 117, 112, 112, 111, 114, 116, 101, 100, 67, 117, 114, 114, 101, 110, 99, 105, 101, 115, 18, 18, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, + 46, 69, 109, 112, 116, 121, 26, 43, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 71, 101, 116, 83, 117, 112, 112, 111, 114, 116, 101, 100, 67, 117, 114, 114, 101, 110, 99, 105, 101, 115, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, + 48, 0, 18, 73, 10, 7, 67, 111, 110, 118, 101, 114, 116, 18, 38, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 67, 117, 114, 114, 101, 110, 99, 121, 67, 111, 110, 118, 101, 114, 115, 105, 111, 110, 82, 101, 113, 117, 101, 115, 116, + 26, 18, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 77, 111, 110, 101, 121, 40, 0, 48, 0, 50, 87, 10, 14, 80, 97, 121, 109, 101, 110, 116, 83, 101, 114, 118, 105, 99, 101, 18, 69, 10, 6, 67, 104, 97, 114, 103, 101, 18, 26, 46, 104, + 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 67, 104, 97, 114, 103, 101, 82, 101, 113, 117, 101, 115, 116, 26, 27, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 67, 104, 97, 114, 103, 101, 82, 101, 115, 112, 111, 110, 115, + 101, 40, 0, 48, 0, 50, 106, 10, 12, 69, 109, 97, 105, 108, 83, 101, 114, 118, 105, 99, 101, 18, 90, 10, 21, 83, 101, 110, 100, 79, 114, 100, 101, 114, 67, 111, 110, 102, 105, 114, 109, 97, 116, 105, 111, 110, 18, 41, 46, 104, 105, 112, 115, 116, 101, + 114, 115, 104, 111, 112, 46, 83, 101, 110, 100, 79, 114, 100, 101, 114, 67, 111, 110, 102, 105, 114, 109, 97, 116, 105, 111, 110, 82, 101, 113, 117, 101, 115, 116, 26, 18, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 69, 109, 112, + 116, 121, 40, 0, 48, 0, 50, 100, 10, 15, 67, 104, 101, 99, 107, 111, 117, 116, 83, 101, 114, 118, 105, 99, 101, 18, 81, 10, 10, 80, 108, 97, 99, 101, 79, 114, 100, 101, 114, 18, 30, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 80, + 108, 97, 99, 101, 79, 114, 100, 101, 114, 82, 101, 113, 117, 101, 115, 116, 26, 31, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 80, 108, 97, 99, 101, 79, 114, 100, 101, 114, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 50, + 74, 10, 9, 65, 100, 83, 101, 114, 118, 105, 99, 101, 18, 61, 10, 6, 71, 101, 116, 65, 100, 115, 18, 22, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 65, 100, 82, 101, 113, 117, 101, 115, 116, 26, 23, 46, 104, 105, 112, 115, 116, + 101, 114, 115, 104, 111, 112, 46, 65, 100, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 50, 167, 3, 10, 18, 70, 101, 97, 116, 117, 114, 101, 70, 108, 97, 103, 83, 101, 114, 118, 105, 99, 101, 18, 72, 10, 7, 71, 101, 116, 70, 108, 97, 103, 18, + 27, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 71, 101, 116, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 26, 28, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 71, 101, 116, 70, 108, 97, 103, 82, 101, 115, + 112, 111, 110, 115, 101, 40, 0, 48, 0, 18, 81, 10, 10, 67, 114, 101, 97, 116, 101, 70, 108, 97, 103, 18, 30, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 67, 114, 101, 97, 116, 101, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, + 116, 26, 31, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 67, 114, 101, 97, 116, 101, 70, 108, 97, 103, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 18, 81, 10, 10, 85, 112, 100, 97, 116, 101, 70, 108, 97, 103, 18, 30, 46, + 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 85, 112, 100, 97, 116, 101, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 26, 31, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 85, 112, 100, 97, 116, 101, 70, 108, 97, + 103, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 18, 78, 10, 9, 76, 105, 115, 116, 70, 108, 97, 103, 115, 18, 29, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 76, 105, 115, 116, 70, 108, 97, 103, 115, 82, 101, 113, 117, + 101, 115, 116, 26, 30, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 76, 105, 115, 116, 70, 108, 97, 103, 115, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 18, 81, 10, 10, 68, 101, 108, 101, 116, 101, 70, 108, 97, 103, 18, + 30, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 68, 101, 108, 101, 116, 101, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 26, 31, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 68, 101, 108, 101, 116, 101, + 70, 108, 97, 103, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 98, 6, 112, 114, 111, 116, 111, 51, 10, 103, 10, 31, 103, 111, 111, 103, 108, 101, 47, 112, 114, 111, 116, 111, 98, 117, 102, 47, 116, 105, 109, 101, 115, 116, 97, 109, 112, 46, + 112, 114, 111, 116, 111, 18, 15, 103, 111, 111, 103, 108, 101, 46, 112, 114, 111, 116, 111, 98, 117, 102, 34, 43, 10, 9, 84, 105, 109, 101, 115, 116, 97, 109, 112, 18, 15, 10, 7, 115, 101, 99, 111, 110, 100, 115, 24, 1, 32, 1, 40, 3, 18, 13, 10, 5, + 110, 97, 110, 111, 115, 24, 2, 32, 1, 40, 5, 98, 6, 112, 114, 111, 116, 111, 51>>. + +descriptor("demo") -> + <<10, 22, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 47, 100, 101, 109, 111, 46, 112, 114, 111, 116, 111, 18, 11, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 34, 40, 10, 2, 65, 100, 18, 20, 10, 12, 114, 101, 100, 105, 114, 101, + 99, 116, 95, 117, 114, 108, 24, 1, 32, 1, 40, 9, 18, 12, 10, 4, 116, 101, 120, 116, 24, 2, 32, 1, 40, 9, 34, 33, 10, 9, 65, 100, 82, 101, 113, 117, 101, 115, 116, 18, 20, 10, 12, 99, 111, 110, 116, 101, 120, 116, 95, 107, 101, 121, 115, 24, 1, 32, 3, + 40, 9, 34, 42, 10, 10, 65, 100, 82, 101, 115, 112, 111, 110, 115, 101, 18, 28, 10, 3, 97, 100, 115, 24, 1, 32, 3, 40, 11, 50, 15, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 65, 100, 34, 70, 10, 14, 65, 100, 100, 73, 116, 101, 109, + 82, 101, 113, 117, 101, 115, 116, 18, 15, 10, 7, 117, 115, 101, 114, 95, 105, 100, 24, 1, 32, 1, 40, 9, 18, 35, 10, 4, 105, 116, 101, 109, 24, 2, 32, 1, 40, 11, 50, 21, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 67, 97, 114, 116, + 73, 116, 101, 109, 34, 97, 10, 7, 65, 100, 100, 114, 101, 115, 115, 18, 22, 10, 14, 115, 116, 114, 101, 101, 116, 95, 97, 100, 100, 114, 101, 115, 115, 24, 1, 32, 1, 40, 9, 18, 12, 10, 4, 99, 105, 116, 121, 24, 2, 32, 1, 40, 9, 18, 13, 10, 5, 115, + 116, 97, 116, 101, 24, 3, 32, 1, 40, 9, 18, 15, 10, 7, 99, 111, 117, 110, 116, 114, 121, 24, 4, 32, 1, 40, 9, 18, 16, 10, 8, 122, 105, 112, 95, 99, 111, 100, 101, 24, 5, 32, 1, 40, 5, 34, 61, 10, 4, 67, 97, 114, 116, 18, 15, 10, 7, 117, 115, 101, + 114, 95, 105, 100, 24, 1, 32, 1, 40, 9, 18, 36, 10, 5, 105, 116, 101, 109, 115, 24, 2, 32, 3, 40, 11, 50, 21, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 67, 97, 114, 116, 73, 116, 101, 109, 34, 48, 10, 8, 67, 97, 114, 116, 73, + 116, 101, 109, 18, 18, 10, 10, 112, 114, 111, 100, 117, 99, 116, 95, 105, 100, 24, 1, 32, 1, 40, 9, 18, 16, 10, 8, 113, 117, 97, 110, 116, 105, 116, 121, 24, 2, 32, 1, 40, 5, 34, 101, 10, 13, 67, 104, 97, 114, 103, 101, 82, 101, 113, 117, 101, 115, + 116, 18, 34, 10, 6, 97, 109, 111, 117, 110, 116, 24, 1, 32, 1, 40, 11, 50, 18, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 77, 111, 110, 101, 121, 18, 48, 10, 11, 99, 114, 101, 100, 105, 116, 95, 99, 97, 114, 100, 24, 2, 32, 1, 40, + 11, 50, 27, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 67, 114, 101, 100, 105, 116, 67, 97, 114, 100, 73, 110, 102, 111, 34, 40, 10, 14, 67, 104, 97, 114, 103, 101, 82, 101, 115, 112, 111, 110, 115, 101, 18, 22, 10, 14, 116, 114, + 97, 110, 115, 97, 99, 116, 105, 111, 110, 95, 105, 100, 24, 1, 32, 1, 40, 9, 34, 71, 10, 17, 67, 114, 101, 97, 116, 101, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 18, 12, 10, 4, 110, 97, 109, 101, 24, 1, 32, 1, 40, 9, 18, 19, 10, 11, 100, + 101, 115, 99, 114, 105, 112, 116, 105, 111, 110, 24, 2, 32, 1, 40, 9, 18, 15, 10, 7, 101, 110, 97, 98, 108, 101, 100, 24, 3, 32, 1, 40, 8, 34, 53, 10, 18, 67, 114, 101, 97, 116, 101, 70, 108, 97, 103, 82, 101, 115, 112, 111, 110, 115, 101, 18, 31, + 10, 4, 102, 108, 97, 103, 24, 1, 32, 1, 40, 11, 50, 17, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 70, 108, 97, 103, 34, 144, 1, 10, 14, 67, 114, 101, 100, 105, 116, 67, 97, 114, 100, 73, 110, 102, 111, 18, 26, 10, 18, 99, 114, + 101, 100, 105, 116, 95, 99, 97, 114, 100, 95, 110, 117, 109, 98, 101, 114, 24, 1, 32, 1, 40, 9, 18, 23, 10, 15, 99, 114, 101, 100, 105, 116, 95, 99, 97, 114, 100, 95, 99, 118, 118, 24, 2, 32, 1, 40, 5, 18, 35, 10, 27, 99, 114, 101, 100, 105, 116, 95, + 99, 97, 114, 100, 95, 101, 120, 112, 105, 114, 97, 116, 105, 111, 110, 95, 121, 101, 97, 114, 24, 3, 32, 1, 40, 5, 18, 36, 10, 28, 99, 114, 101, 100, 105, 116, 95, 99, 97, 114, 100, 95, 101, 120, 112, 105, 114, 97, 116, 105, 111, 110, 95, 109, 111, + 110, 116, 104, 24, 4, 32, 1, 40, 5, 34, 78, 10, 25, 67, 117, 114, 114, 101, 110, 99, 121, 67, 111, 110, 118, 101, 114, 115, 105, 111, 110, 82, 101, 113, 117, 101, 115, 116, 18, 32, 10, 4, 102, 114, 111, 109, 24, 1, 32, 1, 40, 11, 50, 18, 46, 104, + 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 77, 111, 110, 101, 121, 18, 15, 10, 7, 116, 111, 95, 99, 111, 100, 101, 24, 2, 32, 1, 40, 9, 34, 33, 10, 17, 68, 101, 108, 101, 116, 101, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 18, + 12, 10, 4, 110, 97, 109, 101, 24, 1, 32, 1, 40, 9, 34, 20, 10, 18, 68, 101, 108, 101, 116, 101, 70, 108, 97, 103, 82, 101, 115, 112, 111, 110, 115, 101, 34, 7, 10, 5, 69, 109, 112, 116, 121, 34, 35, 10, 16, 69, 109, 112, 116, 121, 67, 97, 114, 116, + 82, 101, 113, 117, 101, 115, 116, 18, 15, 10, 7, 117, 115, 101, 114, 95, 105, 100, 24, 1, 32, 1, 40, 9, 34, 154, 1, 10, 4, 70, 108, 97, 103, 18, 12, 10, 4, 110, 97, 109, 101, 24, 1, 32, 1, 40, 9, 18, 19, 10, 11, 100, 101, 115, 99, 114, 105, 112, 116, + 105, 111, 110, 24, 2, 32, 1, 40, 9, 18, 15, 10, 7, 101, 110, 97, 98, 108, 101, 100, 24, 3, 32, 1, 40, 8, 18, 46, 10, 10, 99, 114, 101, 97, 116, 101, 100, 95, 97, 116, 24, 4, 32, 1, 40, 11, 50, 26, 46, 103, 111, 111, 103, 108, 101, 46, 112, 114, 111, + 116, 111, 98, 117, 102, 46, 84, 105, 109, 101, 115, 116, 97, 109, 112, 18, 46, 10, 10, 117, 112, 100, 97, 116, 101, 100, 95, 97, 116, 24, 5, 32, 1, 40, 11, 50, 26, 46, 103, 111, 111, 103, 108, 101, 46, 112, 114, 111, 116, 111, 98, 117, 102, 46, 84, + 105, 109, 101, 115, 116, 97, 109, 112, 34, 33, 10, 14, 71, 101, 116, 67, 97, 114, 116, 82, 101, 113, 117, 101, 115, 116, 18, 15, 10, 7, 117, 115, 101, 114, 95, 105, 100, 24, 1, 32, 1, 40, 9, 34, 30, 10, 14, 71, 101, 116, 70, 108, 97, 103, 82, 101, + 113, 117, 101, 115, 116, 18, 12, 10, 4, 110, 97, 109, 101, 24, 1, 32, 1, 40, 9, 34, 50, 10, 15, 71, 101, 116, 70, 108, 97, 103, 82, 101, 115, 112, 111, 110, 115, 101, 18, 31, 10, 4, 102, 108, 97, 103, 24, 1, 32, 1, 40, 11, 50, 17, 46, 104, 105, 112, + 115, 116, 101, 114, 115, 104, 111, 112, 46, 70, 108, 97, 103, 34, 31, 10, 17, 71, 101, 116, 80, 114, 111, 100, 117, 99, 116, 82, 101, 113, 117, 101, 115, 116, 18, 10, 10, 2, 105, 100, 24, 1, 32, 1, 40, 9, 34, 94, 10, 15, 71, 101, 116, 81, 117, 111, + 116, 101, 82, 101, 113, 117, 101, 115, 116, 18, 37, 10, 7, 97, 100, 100, 114, 101, 115, 115, 24, 1, 32, 1, 40, 11, 50, 20, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 65, 100, 100, 114, 101, 115, 115, 18, 36, 10, 5, 105, 116, 101, + 109, 115, 24, 2, 32, 3, 40, 11, 50, 21, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 67, 97, 114, 116, 73, 116, 101, 109, 34, 56, 10, 16, 71, 101, 116, 81, 117, 111, 116, 101, 82, 101, 115, 112, 111, 110, 115, 101, 18, 36, 10, 8, + 99, 111, 115, 116, 95, 117, 115, 100, 24, 1, 32, 1, 40, 11, 50, 18, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 77, 111, 110, 101, 121, 34, 56, 10, 30, 71, 101, 116, 83, 117, 112, 112, 111, 114, 116, 101, 100, 67, 117, 114, 114, + 101, 110, 99, 105, 101, 115, 82, 101, 115, 112, 111, 110, 115, 101, 18, 22, 10, 14, 99, 117, 114, 114, 101, 110, 99, 121, 95, 99, 111, 100, 101, 115, 24, 1, 32, 3, 40, 9, 34, 18, 10, 16, 76, 105, 115, 116, 70, 108, 97, 103, 115, 82, 101, 113, 117, + 101, 115, 116, 34, 52, 10, 17, 76, 105, 115, 116, 70, 108, 97, 103, 115, 82, 101, 115, 112, 111, 110, 115, 101, 18, 31, 10, 4, 102, 108, 97, 103, 24, 1, 32, 3, 40, 11, 50, 17, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 70, 108, + 97, 103, 34, 62, 10, 20, 76, 105, 115, 116, 80, 114, 111, 100, 117, 99, 116, 115, 82, 101, 115, 112, 111, 110, 115, 101, 18, 38, 10, 8, 112, 114, 111, 100, 117, 99, 116, 115, 24, 1, 32, 3, 40, 11, 50, 20, 46, 104, 105, 112, 115, 116, 101, 114, 115, + 104, 111, 112, 46, 80, 114, 111, 100, 117, 99, 116, 34, 66, 10, 26, 76, 105, 115, 116, 82, 101, 99, 111, 109, 109, 101, 110, 100, 97, 116, 105, 111, 110, 115, 82, 101, 113, 117, 101, 115, 116, 18, 15, 10, 7, 117, 115, 101, 114, 95, 105, 100, 24, 1, + 32, 1, 40, 9, 18, 19, 10, 11, 112, 114, 111, 100, 117, 99, 116, 95, 105, 100, 115, 24, 2, 32, 3, 40, 9, 34, 50, 10, 27, 76, 105, 115, 116, 82, 101, 99, 111, 109, 109, 101, 110, 100, 97, 116, 105, 111, 110, 115, 82, 101, 115, 112, 111, 110, 115, 101, + 18, 19, 10, 11, 112, 114, 111, 100, 117, 99, 116, 95, 105, 100, 115, 24, 1, 32, 3, 40, 9, 34, 60, 10, 5, 77, 111, 110, 101, 121, 18, 21, 10, 13, 99, 117, 114, 114, 101, 110, 99, 121, 95, 99, 111, 100, 101, 24, 1, 32, 1, 40, 9, 18, 13, 10, 5, 117, + 110, 105, 116, 115, 24, 2, 32, 1, 40, 3, 18, 13, 10, 5, 110, 97, 110, 111, 115, 24, 3, 32, 1, 40, 5, 34, 82, 10, 9, 79, 114, 100, 101, 114, 73, 116, 101, 109, 18, 35, 10, 4, 105, 116, 101, 109, 24, 1, 32, 1, 40, 11, 50, 21, 46, 104, 105, 112, 115, + 116, 101, 114, 115, 104, 111, 112, 46, 67, 97, 114, 116, 73, 116, 101, 109, 18, 32, 10, 4, 99, 111, 115, 116, 24, 2, 32, 1, 40, 11, 50, 18, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 77, 111, 110, 101, 121, 34, 191, 1, 10, 11, 79, + 114, 100, 101, 114, 82, 101, 115, 117, 108, 116, 18, 16, 10, 8, 111, 114, 100, 101, 114, 95, 105, 100, 24, 1, 32, 1, 40, 9, 18, 28, 10, 20, 115, 104, 105, 112, 112, 105, 110, 103, 95, 116, 114, 97, 99, 107, 105, 110, 103, 95, 105, 100, 24, 2, 32, 1, + 40, 9, 18, 41, 10, 13, 115, 104, 105, 112, 112, 105, 110, 103, 95, 99, 111, 115, 116, 24, 3, 32, 1, 40, 11, 50, 18, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 77, 111, 110, 101, 121, 18, 46, 10, 16, 115, 104, 105, 112, 112, 105, + 110, 103, 95, 97, 100, 100, 114, 101, 115, 115, 24, 4, 32, 1, 40, 11, 50, 20, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 65, 100, 100, 114, 101, 115, 115, 18, 37, 10, 5, 105, 116, 101, 109, 115, 24, 5, 32, 3, 40, 11, 50, 22, 46, + 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 79, 114, 100, 101, 114, 73, 116, 101, 109, 34, 163, 1, 10, 17, 80, 108, 97, 99, 101, 79, 114, 100, 101, 114, 82, 101, 113, 117, 101, 115, 116, 18, 15, 10, 7, 117, 115, 101, 114, 95, 105, 100, + 24, 1, 32, 1, 40, 9, 18, 21, 10, 13, 117, 115, 101, 114, 95, 99, 117, 114, 114, 101, 110, 99, 121, 24, 2, 32, 1, 40, 9, 18, 37, 10, 7, 97, 100, 100, 114, 101, 115, 115, 24, 3, 32, 1, 40, 11, 50, 20, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, + 111, 112, 46, 65, 100, 100, 114, 101, 115, 115, 18, 13, 10, 5, 101, 109, 97, 105, 108, 24, 5, 32, 1, 40, 9, 18, 48, 10, 11, 99, 114, 101, 100, 105, 116, 95, 99, 97, 114, 100, 24, 6, 32, 1, 40, 11, 50, 27, 46, 104, 105, 112, 115, 116, 101, 114, 115, + 104, 111, 112, 46, 67, 114, 101, 100, 105, 116, 67, 97, 114, 100, 73, 110, 102, 111, 34, 61, 10, 18, 80, 108, 97, 99, 101, 79, 114, 100, 101, 114, 82, 101, 115, 112, 111, 110, 115, 101, 18, 39, 10, 5, 111, 114, 100, 101, 114, 24, 1, 32, 1, 40, 11, + 50, 24, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 79, 114, 100, 101, 114, 82, 101, 115, 117, 108, 116, 34, 132, 1, 10, 7, 80, 114, 111, 100, 117, 99, 116, 18, 10, 10, 2, 105, 100, 24, 1, 32, 1, 40, 9, 18, 12, 10, 4, 110, 97, 109, + 101, 24, 2, 32, 1, 40, 9, 18, 19, 10, 11, 100, 101, 115, 99, 114, 105, 112, 116, 105, 111, 110, 24, 3, 32, 1, 40, 9, 18, 15, 10, 7, 112, 105, 99, 116, 117, 114, 101, 24, 4, 32, 1, 40, 9, 18, 37, 10, 9, 112, 114, 105, 99, 101, 95, 117, 115, 100, 24, + 5, 32, 1, 40, 11, 50, 18, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 77, 111, 110, 101, 121, 18, 18, 10, 10, 99, 97, 116, 101, 103, 111, 114, 105, 101, 115, 24, 6, 32, 3, 40, 9, 34, 38, 10, 21, 83, 101, 97, 114, 99, 104, 80, 114, + 111, 100, 117, 99, 116, 115, 82, 101, 113, 117, 101, 115, 116, 18, 13, 10, 5, 113, 117, 101, 114, 121, 24, 1, 32, 1, 40, 9, 34, 63, 10, 22, 83, 101, 97, 114, 99, 104, 80, 114, 111, 100, 117, 99, 116, 115, 82, 101, 115, 112, 111, 110, 115, 101, 18, + 37, 10, 7, 114, 101, 115, 117, 108, 116, 115, 24, 1, 32, 3, 40, 11, 50, 20, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 80, 114, 111, 100, 117, 99, 116, 34, 86, 10, 28, 83, 101, 110, 100, 79, 114, 100, 101, 114, 67, 111, 110, 102, + 105, 114, 109, 97, 116, 105, 111, 110, 82, 101, 113, 117, 101, 115, 116, 18, 13, 10, 5, 101, 109, 97, 105, 108, 24, 1, 32, 1, 40, 9, 18, 39, 10, 5, 111, 114, 100, 101, 114, 24, 2, 32, 1, 40, 11, 50, 24, 46, 104, 105, 112, 115, 116, 101, 114, 115, + 104, 111, 112, 46, 79, 114, 100, 101, 114, 82, 101, 115, 117, 108, 116, 34, 95, 10, 16, 83, 104, 105, 112, 79, 114, 100, 101, 114, 82, 101, 113, 117, 101, 115, 116, 18, 37, 10, 7, 97, 100, 100, 114, 101, 115, 115, 24, 1, 32, 1, 40, 11, 50, 20, 46, + 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 65, 100, 100, 114, 101, 115, 115, 18, 36, 10, 5, 105, 116, 101, 109, 115, 24, 2, 32, 3, 40, 11, 50, 21, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 67, 97, 114, 116, 73, + 116, 101, 109, 34, 40, 10, 17, 83, 104, 105, 112, 79, 114, 100, 101, 114, 82, 101, 115, 112, 111, 110, 115, 101, 18, 19, 10, 11, 116, 114, 97, 99, 107, 105, 110, 103, 95, 105, 100, 24, 1, 32, 1, 40, 9, 34, 50, 10, 17, 85, 112, 100, 97, 116, 101, 70, + 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 18, 12, 10, 4, 110, 97, 109, 101, 24, 1, 32, 1, 40, 9, 18, 15, 10, 7, 101, 110, 97, 98, 108, 101, 100, 24, 2, 32, 1, 40, 8, 34, 20, 10, 18, 85, 112, 100, 97, 116, 101, 70, 108, 97, 103, 82, 101, 115, + 112, 111, 110, 115, 101, 50, 208, 1, 10, 11, 67, 97, 114, 116, 83, 101, 114, 118, 105, 99, 101, 18, 62, 10, 7, 65, 100, 100, 73, 116, 101, 109, 18, 27, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 65, 100, 100, 73, 116, 101, 109, + 82, 101, 113, 117, 101, 115, 116, 26, 18, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 69, 109, 112, 116, 121, 40, 0, 48, 0, 18, 61, 10, 7, 71, 101, 116, 67, 97, 114, 116, 18, 27, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, + 111, 112, 46, 71, 101, 116, 67, 97, 114, 116, 82, 101, 113, 117, 101, 115, 116, 26, 17, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 67, 97, 114, 116, 40, 0, 48, 0, 18, 66, 10, 9, 69, 109, 112, 116, 121, 67, 97, 114, 116, 18, 29, + 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 69, 109, 112, 116, 121, 67, 97, 114, 116, 82, 101, 113, 117, 101, 115, 116, 26, 18, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 69, 109, 112, 116, 121, 40, 0, 48, 0, + 50, 133, 1, 10, 21, 82, 101, 99, 111, 109, 109, 101, 110, 100, 97, 116, 105, 111, 110, 83, 101, 114, 118, 105, 99, 101, 18, 108, 10, 19, 76, 105, 115, 116, 82, 101, 99, 111, 109, 109, 101, 110, 100, 97, 116, 105, 111, 110, 115, 18, 39, 46, 104, 105, + 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 76, 105, 115, 116, 82, 101, 99, 111, 109, 109, 101, 110, 100, 97, 116, 105, 111, 110, 115, 82, 101, 113, 117, 101, 115, 116, 26, 40, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 76, + 105, 115, 116, 82, 101, 99, 111, 109, 109, 101, 110, 100, 97, 116, 105, 111, 110, 115, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 50, 137, 2, 10, 21, 80, 114, 111, 100, 117, 99, 116, 67, 97, 116, 97, 108, 111, 103, 83, 101, 114, 118, 105, + 99, 101, 18, 73, 10, 12, 76, 105, 115, 116, 80, 114, 111, 100, 117, 99, 116, 115, 18, 18, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 69, 109, 112, 116, 121, 26, 33, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, + 76, 105, 115, 116, 80, 114, 111, 100, 117, 99, 116, 115, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 18, 70, 10, 10, 71, 101, 116, 80, 114, 111, 100, 117, 99, 116, 18, 30, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 71, + 101, 116, 80, 114, 111, 100, 117, 99, 116, 82, 101, 113, 117, 101, 115, 116, 26, 20, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 80, 114, 111, 100, 117, 99, 116, 40, 0, 48, 0, 18, 93, 10, 14, 83, 101, 97, 114, 99, 104, 80, 114, + 111, 100, 117, 99, 116, 115, 18, 34, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 83, 101, 97, 114, 99, 104, 80, 114, 111, 100, 117, 99, 116, 115, 82, 101, 113, 117, 101, 115, 116, 26, 35, 46, 104, 105, 112, 115, 116, 101, 114, 115, + 104, 111, 112, 46, 83, 101, 97, 114, 99, 104, 80, 114, 111, 100, 117, 99, 116, 115, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 50, 174, 1, 10, 15, 83, 104, 105, 112, 112, 105, 110, 103, 83, 101, 114, 118, 105, 99, 101, 18, 75, 10, 8, 71, + 101, 116, 81, 117, 111, 116, 101, 18, 28, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 71, 101, 116, 81, 117, 111, 116, 101, 82, 101, 113, 117, 101, 115, 116, 26, 29, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, + 71, 101, 116, 81, 117, 111, 116, 101, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 18, 78, 10, 9, 83, 104, 105, 112, 79, 114, 100, 101, 114, 18, 29, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 83, 104, 105, 112, 79, 114, + 100, 101, 114, 82, 101, 113, 117, 101, 115, 116, 26, 30, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 83, 104, 105, 112, 79, 114, 100, 101, 114, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 50, 187, 1, 10, 15, 67, 117, 114, + 114, 101, 110, 99, 121, 83, 101, 114, 118, 105, 99, 101, 18, 93, 10, 22, 71, 101, 116, 83, 117, 112, 112, 111, 114, 116, 101, 100, 67, 117, 114, 114, 101, 110, 99, 105, 101, 115, 18, 18, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, + 69, 109, 112, 116, 121, 26, 43, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 71, 101, 116, 83, 117, 112, 112, 111, 114, 116, 101, 100, 67, 117, 114, 114, 101, 110, 99, 105, 101, 115, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, + 0, 18, 73, 10, 7, 67, 111, 110, 118, 101, 114, 116, 18, 38, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 67, 117, 114, 114, 101, 110, 99, 121, 67, 111, 110, 118, 101, 114, 115, 105, 111, 110, 82, 101, 113, 117, 101, 115, 116, 26, + 18, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 77, 111, 110, 101, 121, 40, 0, 48, 0, 50, 87, 10, 14, 80, 97, 121, 109, 101, 110, 116, 83, 101, 114, 118, 105, 99, 101, 18, 69, 10, 6, 67, 104, 97, 114, 103, 101, 18, 26, 46, 104, + 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 67, 104, 97, 114, 103, 101, 82, 101, 113, 117, 101, 115, 116, 26, 27, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 67, 104, 97, 114, 103, 101, 82, 101, 115, 112, 111, 110, 115, + 101, 40, 0, 48, 0, 50, 106, 10, 12, 69, 109, 97, 105, 108, 83, 101, 114, 118, 105, 99, 101, 18, 90, 10, 21, 83, 101, 110, 100, 79, 114, 100, 101, 114, 67, 111, 110, 102, 105, 114, 109, 97, 116, 105, 111, 110, 18, 41, 46, 104, 105, 112, 115, 116, 101, + 114, 115, 104, 111, 112, 46, 83, 101, 110, 100, 79, 114, 100, 101, 114, 67, 111, 110, 102, 105, 114, 109, 97, 116, 105, 111, 110, 82, 101, 113, 117, 101, 115, 116, 26, 18, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 69, 109, 112, + 116, 121, 40, 0, 48, 0, 50, 100, 10, 15, 67, 104, 101, 99, 107, 111, 117, 116, 83, 101, 114, 118, 105, 99, 101, 18, 81, 10, 10, 80, 108, 97, 99, 101, 79, 114, 100, 101, 114, 18, 30, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 80, + 108, 97, 99, 101, 79, 114, 100, 101, 114, 82, 101, 113, 117, 101, 115, 116, 26, 31, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 80, 108, 97, 99, 101, 79, 114, 100, 101, 114, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 50, + 74, 10, 9, 65, 100, 83, 101, 114, 118, 105, 99, 101, 18, 61, 10, 6, 71, 101, 116, 65, 100, 115, 18, 22, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 65, 100, 82, 101, 113, 117, 101, 115, 116, 26, 23, 46, 104, 105, 112, 115, 116, + 101, 114, 115, 104, 111, 112, 46, 65, 100, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 50, 167, 3, 10, 18, 70, 101, 97, 116, 117, 114, 101, 70, 108, 97, 103, 83, 101, 114, 118, 105, 99, 101, 18, 72, 10, 7, 71, 101, 116, 70, 108, 97, 103, 18, + 27, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 71, 101, 116, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 26, 28, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 71, 101, 116, 70, 108, 97, 103, 82, 101, 115, + 112, 111, 110, 115, 101, 40, 0, 48, 0, 18, 81, 10, 10, 67, 114, 101, 97, 116, 101, 70, 108, 97, 103, 18, 30, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 67, 114, 101, 97, 116, 101, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, + 116, 26, 31, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 67, 114, 101, 97, 116, 101, 70, 108, 97, 103, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 18, 81, 10, 10, 85, 112, 100, 97, 116, 101, 70, 108, 97, 103, 18, 30, 46, + 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 85, 112, 100, 97, 116, 101, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 26, 31, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 85, 112, 100, 97, 116, 101, 70, 108, 97, + 103, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 18, 78, 10, 9, 76, 105, 115, 116, 70, 108, 97, 103, 115, 18, 29, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 76, 105, 115, 116, 70, 108, 97, 103, 115, 82, 101, 113, 117, + 101, 115, 116, 26, 30, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 76, 105, 115, 116, 70, 108, 97, 103, 115, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 18, 81, 10, 10, 68, 101, 108, 101, 116, 101, 70, 108, 97, 103, 18, + 30, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 68, 101, 108, 101, 116, 101, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 26, 31, 46, 104, 105, 112, 115, 116, 101, 114, 115, 104, 111, 112, 46, 68, 101, 108, 101, 116, 101, + 70, 108, 97, 103, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 98, 6, 112, 114, 111, 116, 111, 51>>; +descriptor("timestamp") -> + <<10, 31, 103, 111, 111, 103, 108, 101, 47, 112, 114, 111, 116, 111, 98, 117, 102, 47, 116, 105, 109, 101, 115, 116, 97, 109, 112, 46, 112, 114, 111, 116, 111, 18, 15, 103, 111, 111, 103, 108, 101, 46, 112, 114, 111, 116, 111, 98, 117, 102, 34, 43, + 10, 9, 84, 105, 109, 101, 115, 116, 97, 109, 112, 18, 15, 10, 7, 115, 101, 99, 111, 110, 100, 115, 24, 1, 32, 1, 40, 3, 18, 13, 10, 5, 110, 97, 110, 111, 115, 24, 2, 32, 1, 40, 5, 98, 6, 112, 114, 111, 116, 111, 51>>; +descriptor(X) -> error({gpb_error, {badname, X}}). + + +gpb_version_as_string() -> + "4.19.5". + +gpb_version_as_list() -> + [4,19,5]. + +gpb_version_source() -> + "file". diff --git a/src/featureflagservice/src/ffs_featureflag_pb.erl b/src/featureflagservice/src/ffs_featureflag_pb.erl deleted file mode 100644 index 4c1b512173..0000000000 --- a/src/featureflagservice/src/ffs_featureflag_pb.erl +++ /dev/null @@ -1,2013 +0,0 @@ -%% -*- coding: utf-8 -*- -%% @private -%% Automatically generated, do not edit -%% Generated by gpb_compile version 4.19.5 -%% Version source: file --module(ffs_featureflag_pb). - --export([encode_msg/2, encode_msg/3]). --export([decode_msg/2, decode_msg/3]). --export([merge_msgs/3, merge_msgs/4]). --export([verify_msg/2, verify_msg/3]). --export([get_msg_defs/0]). --export([get_msg_names/0]). --export([get_group_names/0]). --export([get_msg_or_group_names/0]). --export([get_enum_names/0]). --export([find_msg_def/1, fetch_msg_def/1]). --export([find_enum_def/1, fetch_enum_def/1]). --export([enum_symbol_by_value/2, enum_value_by_symbol/2]). --export([get_service_names/0]). --export([get_service_def/1]). --export([get_rpc_names/1]). --export([find_rpc_def/2, fetch_rpc_def/2]). --export([fqbin_to_service_name/1]). --export([service_name_to_fqbin/1]). --export([fqbins_to_service_and_rpc_name/2]). --export([service_and_rpc_name_to_fqbins/2]). --export([fqbin_to_msg_name/1]). --export([msg_name_to_fqbin/1]). --export([fqbin_to_enum_name/1]). --export([enum_name_to_fqbin/1]). --export([get_package_name/0]). --export([uses_packages/0]). --export([source_basename/0]). --export([get_all_source_basenames/0]). --export([get_all_proto_names/0]). --export([get_msg_containment/1]). --export([get_pkg_containment/1]). --export([get_service_containment/1]). --export([get_rpc_containment/1]). --export([get_enum_containment/1]). --export([get_proto_by_msg_name_as_fqbin/1]). --export([get_proto_by_service_name_as_fqbin/1]). --export([get_proto_by_enum_name_as_fqbin/1]). --export([get_protos_by_pkg_name_as_fqbin/1]). --export([descriptor/0, descriptor/1]). --export([gpb_version_as_string/0, gpb_version_as_list/0]). --export([gpb_version_source/0]). - - -%% enumerated types - --export_type([]). - -%% message types --type flag() :: - #{name => unicode:chardata(), % = 1, optional - description => unicode:chardata(), % = 2, optional - enabled => boolean() | 0 | 1, % = 3, optional - created_at => timestamp(), % = 4, optional - updated_at => timestamp() % = 5, optional - }. - --type get_flag_request() :: - #{name => unicode:chardata() % = 1, optional - }. - --type get_flag_response() :: - #{flag => flag() % = 1, optional - }. - --type create_flag_request() :: - #{name => unicode:chardata(), % = 1, optional - description => unicode:chardata(), % = 2, optional - enabled => boolean() | 0 | 1 % = 3, optional - }. - --type create_flag_response() :: - #{flag => flag() % = 1, optional - }. - --type update_flag_request() :: - #{name => unicode:chardata(), % = 1, optional - enabled => boolean() | 0 | 1 % = 2, optional - }. - --type update_flag_response() :: - #{ - }. - --type list_flags_request() :: - #{ - }. - --type list_flags_response() :: - #{flag => [flag()] % = 1, repeated - }. - --type delete_flag_request() :: - #{name => unicode:chardata() % = 1, optional - }. - --type delete_flag_response() :: - #{ - }. - --type timestamp() :: - #{seconds => integer(), % = 1, optional, 64 bits - nanos => integer() % = 2, optional, 32 bits - }. - --export_type(['flag'/0, 'get_flag_request'/0, 'get_flag_response'/0, 'create_flag_request'/0, 'create_flag_response'/0, 'update_flag_request'/0, 'update_flag_response'/0, 'list_flags_request'/0, 'list_flags_response'/0, 'delete_flag_request'/0, 'delete_flag_response'/0, 'timestamp'/0]). --type '$msg_name'() :: flag | get_flag_request | get_flag_response | create_flag_request | create_flag_response | update_flag_request | update_flag_response | list_flags_request | list_flags_response | delete_flag_request | delete_flag_response | timestamp. --type '$msg'() :: flag() | get_flag_request() | get_flag_response() | create_flag_request() | create_flag_response() | update_flag_request() | update_flag_response() | list_flags_request() | list_flags_response() | delete_flag_request() | delete_flag_response() | timestamp(). --export_type(['$msg_name'/0, '$msg'/0]). - --if(?OTP_RELEASE >= 24). --dialyzer({no_underspecs, encode_msg/2}). --endif. --spec encode_msg('$msg'(), '$msg_name'()) -> binary(). -encode_msg(Msg, MsgName) when is_atom(MsgName) -> encode_msg(Msg, MsgName, []). - --if(?OTP_RELEASE >= 24). --dialyzer({no_underspecs, encode_msg/3}). --endif. --spec encode_msg('$msg'(), '$msg_name'(), list()) -> binary(). -encode_msg(Msg, MsgName, Opts) -> - case proplists:get_bool(verify, Opts) of - true -> verify_msg(Msg, MsgName, Opts); - false -> ok - end, - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - flag -> encode_msg_flag(id(Msg, TrUserData), TrUserData); - get_flag_request -> encode_msg_get_flag_request(id(Msg, TrUserData), TrUserData); - get_flag_response -> encode_msg_get_flag_response(id(Msg, TrUserData), TrUserData); - create_flag_request -> encode_msg_create_flag_request(id(Msg, TrUserData), TrUserData); - create_flag_response -> encode_msg_create_flag_response(id(Msg, TrUserData), TrUserData); - update_flag_request -> encode_msg_update_flag_request(id(Msg, TrUserData), TrUserData); - update_flag_response -> encode_msg_update_flag_response(id(Msg, TrUserData), TrUserData); - list_flags_request -> encode_msg_list_flags_request(id(Msg, TrUserData), TrUserData); - list_flags_response -> encode_msg_list_flags_response(id(Msg, TrUserData), TrUserData); - delete_flag_request -> encode_msg_delete_flag_request(id(Msg, TrUserData), TrUserData); - delete_flag_response -> encode_msg_delete_flag_response(id(Msg, TrUserData), TrUserData); - timestamp -> encode_msg_timestamp(id(Msg, TrUserData), TrUserData) - end. - - -encode_msg_flag(Msg, TrUserData) -> encode_msg_flag(Msg, <<>>, TrUserData). - - -encode_msg_flag(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{name := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{description := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - B3 = case M of - #{enabled := F3} -> - begin - TrF3 = id(F3, TrUserData), - if TrF3 =:= false -> B2; - true -> e_type_bool(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end, - B4 = case M of - #{created_at := F4} -> - begin - TrF4 = id(F4, TrUserData), - if TrF4 =:= undefined -> B3; - true -> e_mfield_flag_created_at(TrF4, <>, TrUserData) - end - end; - _ -> B3 - end, - case M of - #{updated_at := F5} -> - begin - TrF5 = id(F5, TrUserData), - if TrF5 =:= undefined -> B4; - true -> e_mfield_flag_updated_at(TrF5, <>, TrUserData) - end - end; - _ -> B4 - end. - -encode_msg_get_flag_request(Msg, TrUserData) -> encode_msg_get_flag_request(Msg, <<>>, TrUserData). - - -encode_msg_get_flag_request(#{} = M, Bin, TrUserData) -> - case M of - #{name := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_get_flag_response(Msg, TrUserData) -> encode_msg_get_flag_response(Msg, <<>>, TrUserData). - - -encode_msg_get_flag_response(#{} = M, Bin, TrUserData) -> - case M of - #{flag := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= undefined -> Bin; - true -> e_mfield_get_flag_response_flag(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_create_flag_request(Msg, TrUserData) -> encode_msg_create_flag_request(Msg, <<>>, TrUserData). - - -encode_msg_create_flag_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{name := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - B2 = case M of - #{description := F2} -> - begin - TrF2 = id(F2, TrUserData), - case is_empty_string(TrF2) of - true -> B1; - false -> e_type_string(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end, - case M of - #{enabled := F3} -> - begin - TrF3 = id(F3, TrUserData), - if TrF3 =:= false -> B2; - true -> e_type_bool(TrF3, <>, TrUserData) - end - end; - _ -> B2 - end. - -encode_msg_create_flag_response(Msg, TrUserData) -> encode_msg_create_flag_response(Msg, <<>>, TrUserData). - - -encode_msg_create_flag_response(#{} = M, Bin, TrUserData) -> - case M of - #{flag := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= undefined -> Bin; - true -> e_mfield_create_flag_response_flag(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_update_flag_request(Msg, TrUserData) -> encode_msg_update_flag_request(Msg, <<>>, TrUserData). - - -encode_msg_update_flag_request(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{name := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{enabled := F2} -> - begin - TrF2 = id(F2, TrUserData), - if TrF2 =:= false -> B1; - true -> e_type_bool(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -encode_msg_update_flag_response(_Msg, _TrUserData) -> <<>>. - -encode_msg_list_flags_request(_Msg, _TrUserData) -> <<>>. - -encode_msg_list_flags_response(Msg, TrUserData) -> encode_msg_list_flags_response(Msg, <<>>, TrUserData). - - -encode_msg_list_flags_response(#{} = M, Bin, TrUserData) -> - case M of - #{flag := F1} -> - TrF1 = id(F1, TrUserData), - if TrF1 == [] -> Bin; - true -> e_field_list_flags_response_flag(TrF1, Bin, TrUserData) - end; - _ -> Bin - end. - -encode_msg_delete_flag_request(Msg, TrUserData) -> encode_msg_delete_flag_request(Msg, <<>>, TrUserData). - - -encode_msg_delete_flag_request(#{} = M, Bin, TrUserData) -> - case M of - #{name := F1} -> - begin - TrF1 = id(F1, TrUserData), - case is_empty_string(TrF1) of - true -> Bin; - false -> e_type_string(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end. - -encode_msg_delete_flag_response(_Msg, _TrUserData) -> <<>>. - -encode_msg_timestamp(Msg, TrUserData) -> encode_msg_timestamp(Msg, <<>>, TrUserData). - - -encode_msg_timestamp(#{} = M, Bin, TrUserData) -> - B1 = case M of - #{seconds := F1} -> - begin - TrF1 = id(F1, TrUserData), - if TrF1 =:= 0 -> Bin; - true -> e_type_int64(TrF1, <>, TrUserData) - end - end; - _ -> Bin - end, - case M of - #{nanos := F2} -> - begin - TrF2 = id(F2, TrUserData), - if TrF2 =:= 0 -> B1; - true -> e_type_int32(TrF2, <>, TrUserData) - end - end; - _ -> B1 - end. - -e_mfield_flag_created_at(Msg, Bin, TrUserData) -> - SubBin = encode_msg_timestamp(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_mfield_flag_updated_at(Msg, Bin, TrUserData) -> - SubBin = encode_msg_timestamp(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_mfield_get_flag_response_flag(Msg, Bin, TrUserData) -> - SubBin = encode_msg_flag(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_mfield_create_flag_response_flag(Msg, Bin, TrUserData) -> - SubBin = encode_msg_flag(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_mfield_list_flags_response_flag(Msg, Bin, TrUserData) -> - SubBin = encode_msg_flag(Msg, <<>>, TrUserData), - Bin2 = e_varint(byte_size(SubBin), Bin), - <>. - -e_field_list_flags_response_flag([Elem | Rest], Bin, TrUserData) -> - Bin2 = <>, - Bin3 = e_mfield_list_flags_response_flag(id(Elem, TrUserData), Bin2, TrUserData), - e_field_list_flags_response_flag(Rest, Bin3, TrUserData); -e_field_list_flags_response_flag([], Bin, _TrUserData) -> Bin. - --compile({nowarn_unused_function,e_type_sint/3}). -e_type_sint(Value, Bin, _TrUserData) when Value >= 0 -> e_varint(Value * 2, Bin); -e_type_sint(Value, Bin, _TrUserData) -> e_varint(Value * -2 - 1, Bin). - --compile({nowarn_unused_function,e_type_int32/3}). -e_type_int32(Value, Bin, _TrUserData) when 0 =< Value, Value =< 127 -> <>; -e_type_int32(Value, Bin, _TrUserData) -> - <> = <>, - e_varint(N, Bin). - --compile({nowarn_unused_function,e_type_int64/3}). -e_type_int64(Value, Bin, _TrUserData) when 0 =< Value, Value =< 127 -> <>; -e_type_int64(Value, Bin, _TrUserData) -> - <> = <>, - e_varint(N, Bin). - --compile({nowarn_unused_function,e_type_bool/3}). -e_type_bool(true, Bin, _TrUserData) -> <>; -e_type_bool(false, Bin, _TrUserData) -> <>; -e_type_bool(1, Bin, _TrUserData) -> <>; -e_type_bool(0, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_string/3}). -e_type_string(S, Bin, _TrUserData) -> - Utf8 = unicode:characters_to_binary(S), - Bin2 = e_varint(byte_size(Utf8), Bin), - <>. - --compile({nowarn_unused_function,e_type_bytes/3}). -e_type_bytes(Bytes, Bin, _TrUserData) when is_binary(Bytes) -> - Bin2 = e_varint(byte_size(Bytes), Bin), - <>; -e_type_bytes(Bytes, Bin, _TrUserData) when is_list(Bytes) -> - BytesBin = iolist_to_binary(Bytes), - Bin2 = e_varint(byte_size(BytesBin), Bin), - <>. - --compile({nowarn_unused_function,e_type_fixed32/3}). -e_type_fixed32(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_sfixed32/3}). -e_type_sfixed32(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_fixed64/3}). -e_type_fixed64(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_sfixed64/3}). -e_type_sfixed64(Value, Bin, _TrUserData) -> <>. - --compile({nowarn_unused_function,e_type_float/3}). -e_type_float(V, Bin, _) when is_number(V) -> <>; -e_type_float(infinity, Bin, _) -> <>; -e_type_float('-infinity', Bin, _) -> <>; -e_type_float(nan, Bin, _) -> <>. - --compile({nowarn_unused_function,e_type_double/3}). -e_type_double(V, Bin, _) when is_number(V) -> <>; -e_type_double(infinity, Bin, _) -> <>; -e_type_double('-infinity', Bin, _) -> <>; -e_type_double(nan, Bin, _) -> <>. - --compile({nowarn_unused_function,e_unknown_elems/2}). -e_unknown_elems([Elem | Rest], Bin) -> - BinR = case Elem of - {varint, FNum, N} -> - BinF = e_varint(FNum bsl 3, Bin), - e_varint(N, BinF); - {length_delimited, FNum, Data} -> - BinF = e_varint(FNum bsl 3 bor 2, Bin), - BinL = e_varint(byte_size(Data), BinF), - <>; - {group, FNum, GroupFields} -> - Bin1 = e_varint(FNum bsl 3 bor 3, Bin), - Bin2 = e_unknown_elems(GroupFields, Bin1), - e_varint(FNum bsl 3 bor 4, Bin2); - {fixed32, FNum, V} -> - BinF = e_varint(FNum bsl 3 bor 5, Bin), - <>; - {fixed64, FNum, V} -> - BinF = e_varint(FNum bsl 3 bor 1, Bin), - <> - end, - e_unknown_elems(Rest, BinR); -e_unknown_elems([], Bin) -> Bin. - --compile({nowarn_unused_function,e_varint/3}). -e_varint(N, Bin, _TrUserData) -> e_varint(N, Bin). - --compile({nowarn_unused_function,e_varint/2}). -e_varint(N, Bin) when N =< 127 -> <>; -e_varint(N, Bin) -> - Bin2 = <>, - e_varint(N bsr 7, Bin2). - -is_empty_string("") -> true; -is_empty_string(<<>>) -> true; -is_empty_string(L) when is_list(L) -> not string_has_chars(L); -is_empty_string(B) when is_binary(B) -> false. - -string_has_chars([C | _]) when is_integer(C) -> true; -string_has_chars([H | T]) -> - case string_has_chars(H) of - true -> true; - false -> string_has_chars(T) - end; -string_has_chars(B) when is_binary(B), byte_size(B) =/= 0 -> true; -string_has_chars(C) when is_integer(C) -> true; -string_has_chars(<<>>) -> false; -string_has_chars([]) -> false. - - -decode_msg(Bin, MsgName) when is_binary(Bin) -> decode_msg(Bin, MsgName, []). - -decode_msg(Bin, MsgName, Opts) when is_binary(Bin) -> - TrUserData = proplists:get_value(user_data, Opts), - decode_msg_1_catch(Bin, MsgName, TrUserData). - --ifdef('OTP_RELEASE'). -decode_msg_1_catch(Bin, MsgName, TrUserData) -> - try decode_msg_2_doit(MsgName, Bin, TrUserData) - catch - error:{gpb_error,_}=Reason:StackTrace -> - erlang:raise(error, Reason, StackTrace); - Class:Reason:StackTrace -> error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}}) - end. --else. -decode_msg_1_catch(Bin, MsgName, TrUserData) -> - try decode_msg_2_doit(MsgName, Bin, TrUserData) - catch - error:{gpb_error,_}=Reason -> - erlang:raise(error, Reason, - erlang:get_stacktrace()); - Class:Reason -> - StackTrace = erlang:get_stacktrace(), - error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}}) - end. --endif. - -decode_msg_2_doit(flag, Bin, TrUserData) -> id(decode_msg_flag(Bin, TrUserData), TrUserData); -decode_msg_2_doit(get_flag_request, Bin, TrUserData) -> id(decode_msg_get_flag_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(get_flag_response, Bin, TrUserData) -> id(decode_msg_get_flag_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(create_flag_request, Bin, TrUserData) -> id(decode_msg_create_flag_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(create_flag_response, Bin, TrUserData) -> id(decode_msg_create_flag_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(update_flag_request, Bin, TrUserData) -> id(decode_msg_update_flag_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(update_flag_response, Bin, TrUserData) -> id(decode_msg_update_flag_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_flags_request, Bin, TrUserData) -> id(decode_msg_list_flags_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(list_flags_response, Bin, TrUserData) -> id(decode_msg_list_flags_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(delete_flag_request, Bin, TrUserData) -> id(decode_msg_delete_flag_request(Bin, TrUserData), TrUserData); -decode_msg_2_doit(delete_flag_response, Bin, TrUserData) -> id(decode_msg_delete_flag_response(Bin, TrUserData), TrUserData); -decode_msg_2_doit(timestamp, Bin, TrUserData) -> id(decode_msg_timestamp(Bin, TrUserData), TrUserData). - - - -decode_msg_flag(Bin, TrUserData) -> dfp_read_field_def_flag(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(false, TrUserData), id('$undef', TrUserData), id('$undef', TrUserData), TrUserData). - -dfp_read_field_def_flag(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_flag_name(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -dfp_read_field_def_flag(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_flag_description(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -dfp_read_field_def_flag(<<24, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_flag_enabled(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -dfp_read_field_def_flag(<<34, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_flag_created_at(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -dfp_read_field_def_flag(<<42, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_flag_updated_at(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -dfp_read_field_def_flag(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, F@_5, _) -> - S1 = #{name => F@_1, description => F@_2, enabled => F@_3}, - S2 = if F@_4 == '$undef' -> S1; - true -> S1#{created_at => F@_4} - end, - if F@_5 == '$undef' -> S2; - true -> S2#{updated_at => F@_5} - end; -dfp_read_field_def_flag(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dg_read_field_def_flag(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). - -dg_read_field_def_flag(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 32 - 7 -> dg_read_field_def_flag(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -dg_read_field_def_flag(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_flag_name(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); - 18 -> d_field_flag_description(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); - 24 -> d_field_flag_enabled(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); - 34 -> d_field_flag_created_at(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); - 42 -> d_field_flag_updated_at(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_flag(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); - 1 -> skip_64_flag(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); - 2 -> skip_length_delimited_flag(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); - 3 -> skip_group_flag(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); - 5 -> skip_32_flag(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) - end - end; -dg_read_field_def_flag(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, F@_5, _) -> - S1 = #{name => F@_1, description => F@_2, enabled => F@_3}, - S2 = if F@_4 == '$undef' -> S1; - true -> S1#{created_at => F@_4} - end, - if F@_5 == '$undef' -> S2; - true -> S2#{updated_at => F@_5} - end. - -d_field_flag_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_flag_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -d_field_flag_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, F@_4, F@_5, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_flag(RestF, 0, 0, F, NewFValue, F@_2, F@_3, F@_4, F@_5, TrUserData). - -d_field_flag_description(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_flag_description(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -d_field_flag_description(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, F@_4, F@_5, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_flag(RestF, 0, 0, F, F@_1, NewFValue, F@_3, F@_4, F@_5, TrUserData). - -d_field_flag_enabled(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_flag_enabled(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -d_field_flag_enabled(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, F@_4, F@_5, TrUserData) -> - {NewFValue, RestF} = {id(X bsl N + Acc =/= 0, TrUserData), Rest}, - dfp_read_field_def_flag(RestF, 0, 0, F, F@_1, F@_2, NewFValue, F@_4, F@_5, TrUserData). - -d_field_flag_created_at(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_flag_created_at(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -d_field_flag_created_at(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, Prev, F@_5, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_timestamp(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_flag(RestF, - 0, - 0, - F, - F@_1, - F@_2, - F@_3, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_timestamp(Prev, NewFValue, TrUserData) - end, - F@_5, - TrUserData). - -d_field_flag_updated_at(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_flag_updated_at(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -d_field_flag_updated_at(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_timestamp(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_flag(RestF, - 0, - 0, - F, - F@_1, - F@_2, - F@_3, - F@_4, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_timestamp(Prev, NewFValue, TrUserData) - end, - TrUserData). - -skip_varint_flag(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> skip_varint_flag(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -skip_varint_flag(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dfp_read_field_def_flag(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). - -skip_length_delimited_flag(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> skip_length_delimited_flag(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); -skip_length_delimited_flag(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_flag(Rest2, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). - -skip_group_flag(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_flag(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). - -skip_32_flag(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dfp_read_field_def_flag(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). - -skip_64_flag(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dfp_read_field_def_flag(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). - -decode_msg_get_flag_request(Bin, TrUserData) -> dfp_read_field_def_get_flag_request(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_get_flag_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_get_flag_request_name(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_get_flag_request(<<>>, 0, 0, _, F@_1, _) -> #{name => F@_1}; -dfp_read_field_def_get_flag_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_get_flag_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_get_flag_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_get_flag_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_get_flag_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_get_flag_request_name(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_get_flag_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_get_flag_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_get_flag_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_get_flag_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_get_flag_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_get_flag_request(<<>>, 0, 0, _, F@_1, _) -> #{name => F@_1}. - -d_field_get_flag_request_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_get_flag_request_name(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_get_flag_request_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_get_flag_request(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_get_flag_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_get_flag_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_get_flag_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_flag_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_get_flag_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_get_flag_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_get_flag_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_get_flag_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_get_flag_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_get_flag_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_get_flag_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_flag_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_get_flag_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_flag_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_get_flag_response(Bin, TrUserData) -> dfp_read_field_def_get_flag_response(Bin, 0, 0, 0, id('$undef', TrUserData), TrUserData). - -dfp_read_field_def_get_flag_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_get_flag_response_flag(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_get_flag_response(<<>>, 0, 0, _, F@_1, _) -> - S1 = #{}, - if F@_1 == '$undef' -> S1; - true -> S1#{flag => F@_1} - end; -dfp_read_field_def_get_flag_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_get_flag_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_get_flag_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_get_flag_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_get_flag_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_get_flag_response_flag(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_get_flag_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_get_flag_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_get_flag_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_get_flag_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_get_flag_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_get_flag_response(<<>>, 0, 0, _, F@_1, _) -> - S1 = #{}, - if F@_1 == '$undef' -> S1; - true -> S1#{flag => F@_1} - end. - -d_field_get_flag_response_flag(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_get_flag_response_flag(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_get_flag_response_flag(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_flag(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_get_flag_response(RestF, - 0, - 0, - F, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_flag(Prev, NewFValue, TrUserData) - end, - TrUserData). - -skip_varint_get_flag_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_get_flag_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_get_flag_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_flag_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_get_flag_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_get_flag_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_get_flag_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_get_flag_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_get_flag_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_get_flag_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_get_flag_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_flag_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_get_flag_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_get_flag_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_create_flag_request(Bin, TrUserData) -> dfp_read_field_def_create_flag_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(false, TrUserData), TrUserData). - -dfp_read_field_def_create_flag_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_create_flag_request_name(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_create_flag_request(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_create_flag_request_description(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_create_flag_request(<<24, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_create_flag_request_enabled(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -dfp_read_field_def_create_flag_request(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{name => F@_1, description => F@_2, enabled => F@_3}; -dfp_read_field_def_create_flag_request(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_create_flag_request(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -dg_read_field_def_create_flag_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_create_flag_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -dg_read_field_def_create_flag_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_create_flag_request_name(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 18 -> d_field_create_flag_request_description(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - 24 -> d_field_create_flag_request_enabled(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_create_flag_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 1 -> skip_64_create_flag_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 2 -> skip_length_delimited_create_flag_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 3 -> skip_group_create_flag_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData); - 5 -> skip_32_create_flag_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData) - end - end; -dg_read_field_def_create_flag_request(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{name => F@_1, description => F@_2, enabled => F@_3}. - -d_field_create_flag_request_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_create_flag_request_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_create_flag_request_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_create_flag_request(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData). - -d_field_create_flag_request_description(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_create_flag_request_description(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_create_flag_request_description(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_create_flag_request(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData). - -d_field_create_flag_request_enabled(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_create_flag_request_enabled(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -d_field_create_flag_request_enabled(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, TrUserData) -> - {NewFValue, RestF} = {id(X bsl N + Acc =/= 0, TrUserData), Rest}, - dfp_read_field_def_create_flag_request(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData). - -skip_varint_create_flag_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_create_flag_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData); -skip_varint_create_flag_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_create_flag_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_length_delimited_create_flag_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_create_flag_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData); -skip_length_delimited_create_flag_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_create_flag_request(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData). - -skip_group_create_flag_request(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_create_flag_request(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData). - -skip_32_create_flag_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_create_flag_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -skip_64_create_flag_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_create_flag_request(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). - -decode_msg_create_flag_response(Bin, TrUserData) -> dfp_read_field_def_create_flag_response(Bin, 0, 0, 0, id('$undef', TrUserData), TrUserData). - -dfp_read_field_def_create_flag_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_create_flag_response_flag(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_create_flag_response(<<>>, 0, 0, _, F@_1, _) -> - S1 = #{}, - if F@_1 == '$undef' -> S1; - true -> S1#{flag => F@_1} - end; -dfp_read_field_def_create_flag_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_create_flag_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_create_flag_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_create_flag_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_create_flag_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_create_flag_response_flag(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_create_flag_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_create_flag_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_create_flag_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_create_flag_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_create_flag_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_create_flag_response(<<>>, 0, 0, _, F@_1, _) -> - S1 = #{}, - if F@_1 == '$undef' -> S1; - true -> S1#{flag => F@_1} - end. - -d_field_create_flag_response_flag(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_create_flag_response_flag(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_create_flag_response_flag(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_flag(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_create_flag_response(RestF, - 0, - 0, - F, - if Prev == '$undef' -> NewFValue; - true -> merge_msg_flag(Prev, NewFValue, TrUserData) - end, - TrUserData). - -skip_varint_create_flag_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_create_flag_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_create_flag_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_create_flag_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_create_flag_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_create_flag_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_create_flag_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_create_flag_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_create_flag_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_create_flag_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_create_flag_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_create_flag_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_create_flag_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_create_flag_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_update_flag_request(Bin, TrUserData) -> dfp_read_field_def_update_flag_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(false, TrUserData), TrUserData). - -dfp_read_field_def_update_flag_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_update_flag_request_name(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_update_flag_request(<<16, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_update_flag_request_enabled(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_update_flag_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{name => F@_1, enabled => F@_2}; -dfp_read_field_def_update_flag_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_update_flag_request(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_update_flag_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_update_flag_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_update_flag_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_update_flag_request_name(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 16 -> d_field_update_flag_request_enabled(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_update_flag_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_update_flag_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_update_flag_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_update_flag_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_update_flag_request(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_update_flag_request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{name => F@_1, enabled => F@_2}. - -d_field_update_flag_request_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_update_flag_request_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_update_flag_request_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_update_flag_request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_update_flag_request_enabled(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_update_flag_request_enabled(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_update_flag_request_enabled(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = {id(X bsl N + Acc =/= 0, TrUserData), Rest}, - dfp_read_field_def_update_flag_request(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_update_flag_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_update_flag_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_update_flag_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_update_flag_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_update_flag_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_update_flag_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_update_flag_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_update_flag_request(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_update_flag_request(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_update_flag_request(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_update_flag_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_update_flag_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_update_flag_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_update_flag_request(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -decode_msg_update_flag_response(Bin, TrUserData) -> dfp_read_field_def_update_flag_response(Bin, 0, 0, 0, TrUserData). - -dfp_read_field_def_update_flag_response(<<>>, 0, 0, _, _) -> #{}; -dfp_read_field_def_update_flag_response(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_update_flag_response(Other, Z1, Z2, F, TrUserData). - -dg_read_field_def_update_flag_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_update_flag_response(Rest, N + 7, X bsl N + Acc, F, TrUserData); -dg_read_field_def_update_flag_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) -> - Key = X bsl N + Acc, - case Key band 7 of - 0 -> skip_varint_update_flag_response(Rest, 0, 0, Key bsr 3, TrUserData); - 1 -> skip_64_update_flag_response(Rest, 0, 0, Key bsr 3, TrUserData); - 2 -> skip_length_delimited_update_flag_response(Rest, 0, 0, Key bsr 3, TrUserData); - 3 -> skip_group_update_flag_response(Rest, 0, 0, Key bsr 3, TrUserData); - 5 -> skip_32_update_flag_response(Rest, 0, 0, Key bsr 3, TrUserData) - end; -dg_read_field_def_update_flag_response(<<>>, 0, 0, _, _) -> #{}. - -skip_varint_update_flag_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_update_flag_response(Rest, Z1, Z2, F, TrUserData); -skip_varint_update_flag_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_update_flag_response(Rest, Z1, Z2, F, TrUserData). - -skip_length_delimited_update_flag_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_update_flag_response(Rest, N + 7, X bsl N + Acc, F, TrUserData); -skip_length_delimited_update_flag_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_update_flag_response(Rest2, 0, 0, F, TrUserData). - -skip_group_update_flag_response(Bin, _, Z2, FNum, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_update_flag_response(Rest, 0, Z2, FNum, TrUserData). - -skip_32_update_flag_response(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_update_flag_response(Rest, Z1, Z2, F, TrUserData). - -skip_64_update_flag_response(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_update_flag_response(Rest, Z1, Z2, F, TrUserData). - -decode_msg_list_flags_request(Bin, TrUserData) -> dfp_read_field_def_list_flags_request(Bin, 0, 0, 0, TrUserData). - -dfp_read_field_def_list_flags_request(<<>>, 0, 0, _, _) -> #{}; -dfp_read_field_def_list_flags_request(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_list_flags_request(Other, Z1, Z2, F, TrUserData). - -dg_read_field_def_list_flags_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_flags_request(Rest, N + 7, X bsl N + Acc, F, TrUserData); -dg_read_field_def_list_flags_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) -> - Key = X bsl N + Acc, - case Key band 7 of - 0 -> skip_varint_list_flags_request(Rest, 0, 0, Key bsr 3, TrUserData); - 1 -> skip_64_list_flags_request(Rest, 0, 0, Key bsr 3, TrUserData); - 2 -> skip_length_delimited_list_flags_request(Rest, 0, 0, Key bsr 3, TrUserData); - 3 -> skip_group_list_flags_request(Rest, 0, 0, Key bsr 3, TrUserData); - 5 -> skip_32_list_flags_request(Rest, 0, 0, Key bsr 3, TrUserData) - end; -dg_read_field_def_list_flags_request(<<>>, 0, 0, _, _) -> #{}. - -skip_varint_list_flags_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_list_flags_request(Rest, Z1, Z2, F, TrUserData); -skip_varint_list_flags_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_list_flags_request(Rest, Z1, Z2, F, TrUserData). - -skip_length_delimited_list_flags_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_list_flags_request(Rest, N + 7, X bsl N + Acc, F, TrUserData); -skip_length_delimited_list_flags_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_flags_request(Rest2, 0, 0, F, TrUserData). - -skip_group_list_flags_request(Bin, _, Z2, FNum, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_flags_request(Rest, 0, Z2, FNum, TrUserData). - -skip_32_list_flags_request(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_list_flags_request(Rest, Z1, Z2, F, TrUserData). - -skip_64_list_flags_request(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_list_flags_request(Rest, Z1, Z2, F, TrUserData). - -decode_msg_list_flags_response(Bin, TrUserData) -> dfp_read_field_def_list_flags_response(Bin, 0, 0, 0, id([], TrUserData), TrUserData). - -dfp_read_field_def_list_flags_response(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_list_flags_response_flag(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_list_flags_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{flag => lists_reverse(R1, TrUserData)} - end; -dfp_read_field_def_list_flags_response(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_list_flags_response(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_list_flags_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_list_flags_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_list_flags_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_list_flags_response_flag(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_list_flags_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_list_flags_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_list_flags_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_list_flags_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_list_flags_response(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_list_flags_response(<<>>, 0, 0, _, R1, TrUserData) -> - S1 = #{}, - if R1 == '$undef' -> S1; - true -> S1#{flag => lists_reverse(R1, TrUserData)} - end. - -d_field_list_flags_response_flag(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_list_flags_response_flag(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_list_flags_response_flag(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, {id(decode_msg_flag(Bs, TrUserData), TrUserData), Rest2} end, - dfp_read_field_def_list_flags_response(RestF, 0, 0, F, cons(NewFValue, Prev, TrUserData), TrUserData). - -skip_varint_list_flags_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_list_flags_response(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_list_flags_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_flags_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_list_flags_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_list_flags_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_list_flags_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_list_flags_response(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_list_flags_response(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_list_flags_response(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_list_flags_response(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_flags_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_list_flags_response(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_list_flags_response(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_delete_flag_request(Bin, TrUserData) -> dfp_read_field_def_delete_flag_request(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData). - -dfp_read_field_def_delete_flag_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_delete_flag_request_name(Rest, Z1, Z2, F, F@_1, TrUserData); -dfp_read_field_def_delete_flag_request(<<>>, 0, 0, _, F@_1, _) -> #{name => F@_1}; -dfp_read_field_def_delete_flag_request(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_delete_flag_request(Other, Z1, Z2, F, F@_1, TrUserData). - -dg_read_field_def_delete_flag_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_delete_flag_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -dg_read_field_def_delete_flag_request(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 10 -> d_field_delete_flag_request_name(Rest, 0, 0, 0, F@_1, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_delete_flag_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 1 -> skip_64_delete_flag_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 2 -> skip_length_delimited_delete_flag_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 3 -> skip_group_delete_flag_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData); - 5 -> skip_32_delete_flag_request(Rest, 0, 0, Key bsr 3, F@_1, TrUserData) - end - end; -dg_read_field_def_delete_flag_request(<<>>, 0, 0, _, F@_1, _) -> #{name => F@_1}. - -d_field_delete_flag_request_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_delete_flag_request_name(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -d_field_delete_flag_request_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, TrUserData) -> - {NewFValue, RestF} = begin Len = X bsl N + Acc, <> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, - dfp_read_field_def_delete_flag_request(RestF, 0, 0, F, NewFValue, TrUserData). - -skip_varint_delete_flag_request(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_delete_flag_request(Rest, Z1, Z2, F, F@_1, TrUserData); -skip_varint_delete_flag_request(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_delete_flag_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_length_delimited_delete_flag_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_delete_flag_request(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData); -skip_length_delimited_delete_flag_request(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_delete_flag_request(Rest2, 0, 0, F, F@_1, TrUserData). - -skip_group_delete_flag_request(Bin, _, Z2, FNum, F@_1, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_delete_flag_request(Rest, 0, Z2, FNum, F@_1, TrUserData). - -skip_32_delete_flag_request(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_delete_flag_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -skip_64_delete_flag_request(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_delete_flag_request(Rest, Z1, Z2, F, F@_1, TrUserData). - -decode_msg_delete_flag_response(Bin, TrUserData) -> dfp_read_field_def_delete_flag_response(Bin, 0, 0, 0, TrUserData). - -dfp_read_field_def_delete_flag_response(<<>>, 0, 0, _, _) -> #{}; -dfp_read_field_def_delete_flag_response(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_delete_flag_response(Other, Z1, Z2, F, TrUserData). - -dg_read_field_def_delete_flag_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_delete_flag_response(Rest, N + 7, X bsl N + Acc, F, TrUserData); -dg_read_field_def_delete_flag_response(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) -> - Key = X bsl N + Acc, - case Key band 7 of - 0 -> skip_varint_delete_flag_response(Rest, 0, 0, Key bsr 3, TrUserData); - 1 -> skip_64_delete_flag_response(Rest, 0, 0, Key bsr 3, TrUserData); - 2 -> skip_length_delimited_delete_flag_response(Rest, 0, 0, Key bsr 3, TrUserData); - 3 -> skip_group_delete_flag_response(Rest, 0, 0, Key bsr 3, TrUserData); - 5 -> skip_32_delete_flag_response(Rest, 0, 0, Key bsr 3, TrUserData) - end; -dg_read_field_def_delete_flag_response(<<>>, 0, 0, _, _) -> #{}. - -skip_varint_delete_flag_response(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_delete_flag_response(Rest, Z1, Z2, F, TrUserData); -skip_varint_delete_flag_response(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_delete_flag_response(Rest, Z1, Z2, F, TrUserData). - -skip_length_delimited_delete_flag_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_delete_flag_response(Rest, N + 7, X bsl N + Acc, F, TrUserData); -skip_length_delimited_delete_flag_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_delete_flag_response(Rest2, 0, 0, F, TrUserData). - -skip_group_delete_flag_response(Bin, _, Z2, FNum, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_delete_flag_response(Rest, 0, Z2, FNum, TrUserData). - -skip_32_delete_flag_response(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_delete_flag_response(Rest, Z1, Z2, F, TrUserData). - -skip_64_delete_flag_response(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_delete_flag_response(Rest, Z1, Z2, F, TrUserData). - -decode_msg_timestamp(Bin, TrUserData) -> dfp_read_field_def_timestamp(Bin, 0, 0, 0, id(0, TrUserData), id(0, TrUserData), TrUserData). - -dfp_read_field_def_timestamp(<<8, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_timestamp_seconds(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_timestamp(<<16, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_timestamp_nanos(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -dfp_read_field_def_timestamp(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{seconds => F@_1, nanos => F@_2}; -dfp_read_field_def_timestamp(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_timestamp(Other, Z1, Z2, F, F@_1, F@_2, TrUserData). - -dg_read_field_def_timestamp(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_timestamp(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -dg_read_field_def_timestamp(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) -> - Key = X bsl N + Acc, - case Key of - 8 -> d_field_timestamp_seconds(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - 16 -> d_field_timestamp_nanos(Rest, 0, 0, 0, F@_1, F@_2, TrUserData); - _ -> - case Key band 7 of - 0 -> skip_varint_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 1 -> skip_64_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 2 -> skip_length_delimited_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 3 -> skip_group_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData); - 5 -> skip_32_timestamp(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData) - end - end; -dg_read_field_def_timestamp(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{seconds => F@_1, nanos => F@_2}. - -d_field_timestamp_seconds(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_timestamp_seconds(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_timestamp_seconds(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) -> - {NewFValue, RestF} = {begin <> = <<(X bsl N + Acc):64/unsigned-native>>, id(Res, TrUserData) end, Rest}, - dfp_read_field_def_timestamp(RestF, 0, 0, F, NewFValue, F@_2, TrUserData). - -d_field_timestamp_nanos(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_timestamp_nanos(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -d_field_timestamp_nanos(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) -> - {NewFValue, RestF} = {begin <> = <<(X bsl N + Acc):32/unsigned-native>>, id(Res, TrUserData) end, Rest}, - dfp_read_field_def_timestamp(RestF, 0, 0, F, F@_1, NewFValue, TrUserData). - -skip_varint_timestamp(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_timestamp(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData); -skip_varint_timestamp(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_timestamp(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_length_delimited_timestamp(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_timestamp(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData); -skip_length_delimited_timestamp(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) -> - Length = X bsl N + Acc, - <<_:Length/binary, Rest2/binary>> = Rest, - dfp_read_field_def_timestamp(Rest2, 0, 0, F, F@_1, F@_2, TrUserData). - -skip_group_timestamp(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) -> - {_, Rest} = read_group(Bin, FNum), - dfp_read_field_def_timestamp(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData). - -skip_32_timestamp(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_timestamp(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -skip_64_timestamp(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_timestamp(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData). - -read_group(Bin, FieldNum) -> - {NumBytes, EndTagLen} = read_gr_b(Bin, 0, 0, 0, 0, FieldNum), - <> = Bin, - {Group, Rest}. - -%% Like skipping over fields, but record the total length, -%% Each field is <(FieldNum bsl 3) bor FieldType> ++ -%% Record the length because varints may be non-optimally encoded. -%% -%% Groups can be nested, but assume the same FieldNum cannot be nested -%% because group field numbers are shared with the rest of the fields -%% numbers. Thus we can search just for an group-end with the same -%% field number. -%% -%% (The only time the same group field number could occur would -%% be in a nested sub message, but then it would be inside a -%% length-delimited entry, which we skip-read by length.) -read_gr_b(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, FieldNum) - when N < (32-7) -> - read_gr_b(Tl, N+7, X bsl N + Acc, NumBytes, TagLen+1, FieldNum); -read_gr_b(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, - FieldNum) -> - Key = X bsl N + Acc, - TagLen1 = TagLen + 1, - case {Key bsr 3, Key band 7} of - {FieldNum, 4} -> % 4 = group_end - {NumBytes, TagLen1}; - {_, 0} -> % 0 = varint - read_gr_vi(Tl, 0, NumBytes + TagLen1, FieldNum); - {_, 1} -> % 1 = bits64 - <<_:64, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 8, 0, FieldNum); - {_, 2} -> % 2 = length_delimited - read_gr_ld(Tl, 0, 0, NumBytes + TagLen1, FieldNum); - {_, 3} -> % 3 = group_start - read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum); - {_, 4} -> % 4 = group_end - read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum); - {_, 5} -> % 5 = bits32 - <<_:32, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 4, 0, FieldNum) - end. - -read_gr_vi(<<1:1, _:7, Tl/binary>>, N, NumBytes, FieldNum) - when N < (64-7) -> - read_gr_vi(Tl, N+7, NumBytes+1, FieldNum); -read_gr_vi(<<0:1, _:7, Tl/binary>>, _, NumBytes, FieldNum) -> - read_gr_b(Tl, 0, 0, NumBytes+1, 0, FieldNum). - -read_gr_ld(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) - when N < (64-7) -> - read_gr_ld(Tl, N+7, X bsl N + Acc, NumBytes+1, FieldNum); -read_gr_ld(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) -> - Len = X bsl N + Acc, - NumBytes1 = NumBytes + 1, - <<_:Len/binary, Tl2/binary>> = Tl, - read_gr_b(Tl2, 0, 0, NumBytes1 + Len, 0, FieldNum). - -merge_msgs(Prev, New, MsgName) when is_atom(MsgName) -> merge_msgs(Prev, New, MsgName, []). - -merge_msgs(Prev, New, MsgName, Opts) -> - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - flag -> merge_msg_flag(Prev, New, TrUserData); - get_flag_request -> merge_msg_get_flag_request(Prev, New, TrUserData); - get_flag_response -> merge_msg_get_flag_response(Prev, New, TrUserData); - create_flag_request -> merge_msg_create_flag_request(Prev, New, TrUserData); - create_flag_response -> merge_msg_create_flag_response(Prev, New, TrUserData); - update_flag_request -> merge_msg_update_flag_request(Prev, New, TrUserData); - update_flag_response -> merge_msg_update_flag_response(Prev, New, TrUserData); - list_flags_request -> merge_msg_list_flags_request(Prev, New, TrUserData); - list_flags_response -> merge_msg_list_flags_response(Prev, New, TrUserData); - delete_flag_request -> merge_msg_delete_flag_request(Prev, New, TrUserData); - delete_flag_response -> merge_msg_delete_flag_response(Prev, New, TrUserData); - timestamp -> merge_msg_timestamp(Prev, New, TrUserData) - end. - --compile({nowarn_unused_function,merge_msg_flag/3}). -merge_msg_flag(PMsg, NMsg, TrUserData) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{name := NFname}} -> S1#{name => NFname}; - {#{name := PFname}, _} -> S1#{name => PFname}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{description := NFdescription}} -> S2#{description => NFdescription}; - {#{description := PFdescription}, _} -> S2#{description => PFdescription}; - _ -> S2 - end, - S4 = case {PMsg, NMsg} of - {_, #{enabled := NFenabled}} -> S3#{enabled => NFenabled}; - {#{enabled := PFenabled}, _} -> S3#{enabled => PFenabled}; - _ -> S3 - end, - S5 = case {PMsg, NMsg} of - {#{created_at := PFcreated_at}, #{created_at := NFcreated_at}} -> S4#{created_at => merge_msg_timestamp(PFcreated_at, NFcreated_at, TrUserData)}; - {_, #{created_at := NFcreated_at}} -> S4#{created_at => NFcreated_at}; - {#{created_at := PFcreated_at}, _} -> S4#{created_at => PFcreated_at}; - {_, _} -> S4 - end, - case {PMsg, NMsg} of - {#{updated_at := PFupdated_at}, #{updated_at := NFupdated_at}} -> S5#{updated_at => merge_msg_timestamp(PFupdated_at, NFupdated_at, TrUserData)}; - {_, #{updated_at := NFupdated_at}} -> S5#{updated_at => NFupdated_at}; - {#{updated_at := PFupdated_at}, _} -> S5#{updated_at => PFupdated_at}; - {_, _} -> S5 - end. - --compile({nowarn_unused_function,merge_msg_get_flag_request/3}). -merge_msg_get_flag_request(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{name := NFname}} -> S1#{name => NFname}; - {#{name := PFname}, _} -> S1#{name => PFname}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_get_flag_response/3}). -merge_msg_get_flag_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{flag := PFflag}, #{flag := NFflag}} -> S1#{flag => merge_msg_flag(PFflag, NFflag, TrUserData)}; - {_, #{flag := NFflag}} -> S1#{flag => NFflag}; - {#{flag := PFflag}, _} -> S1#{flag => PFflag}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_create_flag_request/3}). -merge_msg_create_flag_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{name := NFname}} -> S1#{name => NFname}; - {#{name := PFname}, _} -> S1#{name => PFname}; - _ -> S1 - end, - S3 = case {PMsg, NMsg} of - {_, #{description := NFdescription}} -> S2#{description => NFdescription}; - {#{description := PFdescription}, _} -> S2#{description => PFdescription}; - _ -> S2 - end, - case {PMsg, NMsg} of - {_, #{enabled := NFenabled}} -> S3#{enabled => NFenabled}; - {#{enabled := PFenabled}, _} -> S3#{enabled => PFenabled}; - _ -> S3 - end. - --compile({nowarn_unused_function,merge_msg_create_flag_response/3}). -merge_msg_create_flag_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{flag := PFflag}, #{flag := NFflag}} -> S1#{flag => merge_msg_flag(PFflag, NFflag, TrUserData)}; - {_, #{flag := NFflag}} -> S1#{flag => NFflag}; - {#{flag := PFflag}, _} -> S1#{flag => PFflag}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_update_flag_request/3}). -merge_msg_update_flag_request(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{name := NFname}} -> S1#{name => NFname}; - {#{name := PFname}, _} -> S1#{name => PFname}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{enabled := NFenabled}} -> S2#{enabled => NFenabled}; - {#{enabled := PFenabled}, _} -> S2#{enabled => PFenabled}; - _ -> S2 - end. - --compile({nowarn_unused_function,merge_msg_update_flag_response/3}). -merge_msg_update_flag_response(_Prev, New, _TrUserData) -> New. - --compile({nowarn_unused_function,merge_msg_list_flags_request/3}). -merge_msg_list_flags_request(_Prev, New, _TrUserData) -> New. - --compile({nowarn_unused_function,merge_msg_list_flags_response/3}). -merge_msg_list_flags_response(PMsg, NMsg, TrUserData) -> - S1 = #{}, - case {PMsg, NMsg} of - {#{flag := PFflag}, #{flag := NFflag}} -> S1#{flag => 'erlang_++'(PFflag, NFflag, TrUserData)}; - {_, #{flag := NFflag}} -> S1#{flag => NFflag}; - {#{flag := PFflag}, _} -> S1#{flag => PFflag}; - {_, _} -> S1 - end. - --compile({nowarn_unused_function,merge_msg_delete_flag_request/3}). -merge_msg_delete_flag_request(PMsg, NMsg, _) -> - S1 = #{}, - case {PMsg, NMsg} of - {_, #{name := NFname}} -> S1#{name => NFname}; - {#{name := PFname}, _} -> S1#{name => PFname}; - _ -> S1 - end. - --compile({nowarn_unused_function,merge_msg_delete_flag_response/3}). -merge_msg_delete_flag_response(_Prev, New, _TrUserData) -> New. - --compile({nowarn_unused_function,merge_msg_timestamp/3}). -merge_msg_timestamp(PMsg, NMsg, _) -> - S1 = #{}, - S2 = case {PMsg, NMsg} of - {_, #{seconds := NFseconds}} -> S1#{seconds => NFseconds}; - {#{seconds := PFseconds}, _} -> S1#{seconds => PFseconds}; - _ -> S1 - end, - case {PMsg, NMsg} of - {_, #{nanos := NFnanos}} -> S2#{nanos => NFnanos}; - {#{nanos := PFnanos}, _} -> S2#{nanos => PFnanos}; - _ -> S2 - end. - - -verify_msg(Msg, MsgName) when is_atom(MsgName) -> verify_msg(Msg, MsgName, []). - -verify_msg(Msg, MsgName, Opts) -> - TrUserData = proplists:get_value(user_data, Opts), - case MsgName of - flag -> v_msg_flag(Msg, [MsgName], TrUserData); - get_flag_request -> v_msg_get_flag_request(Msg, [MsgName], TrUserData); - get_flag_response -> v_msg_get_flag_response(Msg, [MsgName], TrUserData); - create_flag_request -> v_msg_create_flag_request(Msg, [MsgName], TrUserData); - create_flag_response -> v_msg_create_flag_response(Msg, [MsgName], TrUserData); - update_flag_request -> v_msg_update_flag_request(Msg, [MsgName], TrUserData); - update_flag_response -> v_msg_update_flag_response(Msg, [MsgName], TrUserData); - list_flags_request -> v_msg_list_flags_request(Msg, [MsgName], TrUserData); - list_flags_response -> v_msg_list_flags_response(Msg, [MsgName], TrUserData); - delete_flag_request -> v_msg_delete_flag_request(Msg, [MsgName], TrUserData); - delete_flag_response -> v_msg_delete_flag_response(Msg, [MsgName], TrUserData); - timestamp -> v_msg_timestamp(Msg, [MsgName], TrUserData); - _ -> mk_type_error(not_a_known_message, Msg, []) - end. - - --compile({nowarn_unused_function,v_msg_flag/3}). --dialyzer({nowarn_function,v_msg_flag/3}). -v_msg_flag(#{} = M, Path, TrUserData) -> - case M of - #{name := F1} -> v_type_string(F1, [name | Path], TrUserData); - _ -> ok - end, - case M of - #{description := F2} -> v_type_string(F2, [description | Path], TrUserData); - _ -> ok - end, - case M of - #{enabled := F3} -> v_type_bool(F3, [enabled | Path], TrUserData); - _ -> ok - end, - case M of - #{created_at := F4} -> v_msg_timestamp(F4, [created_at | Path], TrUserData); - _ -> ok - end, - case M of - #{updated_at := F5} -> v_msg_timestamp(F5, [updated_at | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (name) -> ok; - (description) -> ok; - (enabled) -> ok; - (created_at) -> ok; - (updated_at) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_flag(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), flag}, M, Path); -v_msg_flag(X, Path, _TrUserData) -> mk_type_error({expected_msg, flag}, X, Path). - --compile({nowarn_unused_function,v_msg_get_flag_request/3}). --dialyzer({nowarn_function,v_msg_get_flag_request/3}). -v_msg_get_flag_request(#{} = M, Path, TrUserData) -> - case M of - #{name := F1} -> v_type_string(F1, [name | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (name) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_get_flag_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), get_flag_request}, M, Path); -v_msg_get_flag_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, get_flag_request}, X, Path). - --compile({nowarn_unused_function,v_msg_get_flag_response/3}). --dialyzer({nowarn_function,v_msg_get_flag_response/3}). -v_msg_get_flag_response(#{} = M, Path, TrUserData) -> - case M of - #{flag := F1} -> v_msg_flag(F1, [flag | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (flag) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_get_flag_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), get_flag_response}, M, Path); -v_msg_get_flag_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, get_flag_response}, X, Path). - --compile({nowarn_unused_function,v_msg_create_flag_request/3}). --dialyzer({nowarn_function,v_msg_create_flag_request/3}). -v_msg_create_flag_request(#{} = M, Path, TrUserData) -> - case M of - #{name := F1} -> v_type_string(F1, [name | Path], TrUserData); - _ -> ok - end, - case M of - #{description := F2} -> v_type_string(F2, [description | Path], TrUserData); - _ -> ok - end, - case M of - #{enabled := F3} -> v_type_bool(F3, [enabled | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (name) -> ok; - (description) -> ok; - (enabled) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_create_flag_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), create_flag_request}, M, Path); -v_msg_create_flag_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, create_flag_request}, X, Path). - --compile({nowarn_unused_function,v_msg_create_flag_response/3}). --dialyzer({nowarn_function,v_msg_create_flag_response/3}). -v_msg_create_flag_response(#{} = M, Path, TrUserData) -> - case M of - #{flag := F1} -> v_msg_flag(F1, [flag | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (flag) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_create_flag_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), create_flag_response}, M, Path); -v_msg_create_flag_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, create_flag_response}, X, Path). - --compile({nowarn_unused_function,v_msg_update_flag_request/3}). --dialyzer({nowarn_function,v_msg_update_flag_request/3}). -v_msg_update_flag_request(#{} = M, Path, TrUserData) -> - case M of - #{name := F1} -> v_type_string(F1, [name | Path], TrUserData); - _ -> ok - end, - case M of - #{enabled := F2} -> v_type_bool(F2, [enabled | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (name) -> ok; - (enabled) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_update_flag_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), update_flag_request}, M, Path); -v_msg_update_flag_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, update_flag_request}, X, Path). - --compile({nowarn_unused_function,v_msg_update_flag_response/3}). --dialyzer({nowarn_function,v_msg_update_flag_response/3}). -v_msg_update_flag_response(#{} = M, Path, _) -> - lists:foreach(fun (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) end, maps:keys(M)), - ok; -v_msg_update_flag_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), update_flag_response}, M, Path); -v_msg_update_flag_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, update_flag_response}, X, Path). - --compile({nowarn_unused_function,v_msg_list_flags_request/3}). --dialyzer({nowarn_function,v_msg_list_flags_request/3}). -v_msg_list_flags_request(#{} = M, Path, _) -> - lists:foreach(fun (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) end, maps:keys(M)), - ok; -v_msg_list_flags_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_flags_request}, M, Path); -v_msg_list_flags_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_flags_request}, X, Path). - --compile({nowarn_unused_function,v_msg_list_flags_response/3}). --dialyzer({nowarn_function,v_msg_list_flags_response/3}). -v_msg_list_flags_response(#{} = M, Path, TrUserData) -> - case M of - #{flag := F1} -> - if is_list(F1) -> - _ = [v_msg_flag(Elem, [flag | Path], TrUserData) || Elem <- F1], - ok; - true -> mk_type_error({invalid_list_of, {msg, flag}}, F1, [flag | Path]) - end; - _ -> ok - end, - lists:foreach(fun (flag) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_list_flags_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), list_flags_response}, M, Path); -v_msg_list_flags_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, list_flags_response}, X, Path). - --compile({nowarn_unused_function,v_msg_delete_flag_request/3}). --dialyzer({nowarn_function,v_msg_delete_flag_request/3}). -v_msg_delete_flag_request(#{} = M, Path, TrUserData) -> - case M of - #{name := F1} -> v_type_string(F1, [name | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (name) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_delete_flag_request(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), delete_flag_request}, M, Path); -v_msg_delete_flag_request(X, Path, _TrUserData) -> mk_type_error({expected_msg, delete_flag_request}, X, Path). - --compile({nowarn_unused_function,v_msg_delete_flag_response/3}). --dialyzer({nowarn_function,v_msg_delete_flag_response/3}). -v_msg_delete_flag_response(#{} = M, Path, _) -> - lists:foreach(fun (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) end, maps:keys(M)), - ok; -v_msg_delete_flag_response(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), delete_flag_response}, M, Path); -v_msg_delete_flag_response(X, Path, _TrUserData) -> mk_type_error({expected_msg, delete_flag_response}, X, Path). - --compile({nowarn_unused_function,v_msg_timestamp/3}). --dialyzer({nowarn_function,v_msg_timestamp/3}). -v_msg_timestamp(#{} = M, Path, TrUserData) -> - case M of - #{seconds := F1} -> v_type_int64(F1, [seconds | Path], TrUserData); - _ -> ok - end, - case M of - #{nanos := F2} -> v_type_int32(F2, [nanos | Path], TrUserData); - _ -> ok - end, - lists:foreach(fun (seconds) -> ok; - (nanos) -> ok; - (OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path) - end, - maps:keys(M)), - ok; -v_msg_timestamp(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), timestamp}, M, Path); -v_msg_timestamp(X, Path, _TrUserData) -> mk_type_error({expected_msg, timestamp}, X, Path). - --compile({nowarn_unused_function,v_type_int32/3}). --dialyzer({nowarn_function,v_type_int32/3}). -v_type_int32(N, _Path, _TrUserData) when -2147483648 =< N, N =< 2147483647 -> ok; -v_type_int32(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, int32, signed, 32}, N, Path); -v_type_int32(X, Path, _TrUserData) -> mk_type_error({bad_integer, int32, signed, 32}, X, Path). - --compile({nowarn_unused_function,v_type_int64/3}). --dialyzer({nowarn_function,v_type_int64/3}). -v_type_int64(N, _Path, _TrUserData) when -9223372036854775808 =< N, N =< 9223372036854775807 -> ok; -v_type_int64(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, int64, signed, 64}, N, Path); -v_type_int64(X, Path, _TrUserData) -> mk_type_error({bad_integer, int64, signed, 64}, X, Path). - --compile({nowarn_unused_function,v_type_bool/3}). --dialyzer({nowarn_function,v_type_bool/3}). -v_type_bool(false, _Path, _TrUserData) -> ok; -v_type_bool(true, _Path, _TrUserData) -> ok; -v_type_bool(0, _Path, _TrUserData) -> ok; -v_type_bool(1, _Path, _TrUserData) -> ok; -v_type_bool(X, Path, _TrUserData) -> mk_type_error(bad_boolean_value, X, Path). - --compile({nowarn_unused_function,v_type_string/3}). --dialyzer({nowarn_function,v_type_string/3}). -v_type_string(S, Path, _TrUserData) when is_list(S); is_binary(S) -> - try unicode:characters_to_binary(S) of - B when is_binary(B) -> ok; - {error, _, _} -> mk_type_error(bad_unicode_string, S, Path) - catch - error:badarg -> mk_type_error(bad_unicode_string, S, Path) - end; -v_type_string(X, Path, _TrUserData) -> mk_type_error(bad_unicode_string, X, Path). - --compile({nowarn_unused_function,mk_type_error/3}). --spec mk_type_error(_, _, list()) -> no_return(). -mk_type_error(Error, ValueSeen, Path) -> - Path2 = prettify_path(Path), - erlang:error({gpb_type_error, {Error, [{value, ValueSeen}, {path, Path2}]}}). - - --compile({nowarn_unused_function,prettify_path/1}). --dialyzer({nowarn_function,prettify_path/1}). -prettify_path([]) -> top_level; -prettify_path(PathR) -> lists:append(lists:join(".", lists:map(fun atom_to_list/1, lists:reverse(PathR)))). - - --compile({nowarn_unused_function,id/2}). --compile({inline,id/2}). -id(X, _TrUserData) -> X. - --compile({nowarn_unused_function,v_ok/3}). --compile({inline,v_ok/3}). -v_ok(_Value, _Path, _TrUserData) -> ok. - --compile({nowarn_unused_function,m_overwrite/3}). --compile({inline,m_overwrite/3}). -m_overwrite(_Prev, New, _TrUserData) -> New. - --compile({nowarn_unused_function,cons/3}). --compile({inline,cons/3}). -cons(Elem, Acc, _TrUserData) -> [Elem | Acc]. - --compile({nowarn_unused_function,lists_reverse/2}). --compile({inline,lists_reverse/2}). -'lists_reverse'(L, _TrUserData) -> lists:reverse(L). --compile({nowarn_unused_function,'erlang_++'/3}). --compile({inline,'erlang_++'/3}). -'erlang_++'(A, B, _TrUserData) -> A ++ B. - - -get_msg_defs() -> - [{{msg, flag}, - [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => description, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => enabled, fnum => 3, rnum => 4, type => bool, occurrence => optional, opts => []}, - #{name => created_at, fnum => 4, rnum => 5, type => {msg, timestamp}, occurrence => optional, opts => []}, - #{name => updated_at, fnum => 5, rnum => 6, type => {msg, timestamp}, occurrence => optional, opts => []}]}, - {{msg, get_flag_request}, [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, - {{msg, get_flag_response}, [#{name => flag, fnum => 1, rnum => 2, type => {msg, flag}, occurrence => optional, opts => []}]}, - {{msg, create_flag_request}, - [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => description, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => enabled, fnum => 3, rnum => 4, type => bool, occurrence => optional, opts => []}]}, - {{msg, create_flag_response}, [#{name => flag, fnum => 1, rnum => 2, type => {msg, flag}, occurrence => optional, opts => []}]}, - {{msg, update_flag_request}, [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => enabled, fnum => 2, rnum => 3, type => bool, occurrence => optional, opts => []}]}, - {{msg, update_flag_response}, []}, - {{msg, list_flags_request}, []}, - {{msg, list_flags_response}, [#{name => flag, fnum => 1, rnum => 2, type => {msg, flag}, occurrence => repeated, opts => []}]}, - {{msg, delete_flag_request}, [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]}, - {{msg, delete_flag_response}, []}, - {{msg, timestamp}, [#{name => seconds, fnum => 1, rnum => 2, type => int64, occurrence => optional, opts => []}, #{name => nanos, fnum => 2, rnum => 3, type => int32, occurrence => optional, opts => []}]}]. - - -get_msg_names() -> [flag, get_flag_request, get_flag_response, create_flag_request, create_flag_response, update_flag_request, update_flag_response, list_flags_request, list_flags_response, delete_flag_request, delete_flag_response, timestamp]. - - -get_group_names() -> []. - - -get_msg_or_group_names() -> - [flag, get_flag_request, get_flag_response, create_flag_request, create_flag_response, update_flag_request, update_flag_response, list_flags_request, list_flags_response, delete_flag_request, delete_flag_response, timestamp]. - - -get_enum_names() -> []. - - -fetch_msg_def(MsgName) -> - case find_msg_def(MsgName) of - Fs when is_list(Fs) -> Fs; - error -> erlang:error({no_such_msg, MsgName}) - end. - - --spec fetch_enum_def(_) -> no_return(). -fetch_enum_def(EnumName) -> erlang:error({no_such_enum, EnumName}). - - -find_msg_def(flag) -> - [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => description, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => enabled, fnum => 3, rnum => 4, type => bool, occurrence => optional, opts => []}, - #{name => created_at, fnum => 4, rnum => 5, type => {msg, timestamp}, occurrence => optional, opts => []}, - #{name => updated_at, fnum => 5, rnum => 6, type => {msg, timestamp}, occurrence => optional, opts => []}]; -find_msg_def(get_flag_request) -> [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; -find_msg_def(get_flag_response) -> [#{name => flag, fnum => 1, rnum => 2, type => {msg, flag}, occurrence => optional, opts => []}]; -find_msg_def(create_flag_request) -> - [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, - #{name => description, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}, - #{name => enabled, fnum => 3, rnum => 4, type => bool, occurrence => optional, opts => []}]; -find_msg_def(create_flag_response) -> [#{name => flag, fnum => 1, rnum => 2, type => {msg, flag}, occurrence => optional, opts => []}]; -find_msg_def(update_flag_request) -> [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => enabled, fnum => 2, rnum => 3, type => bool, occurrence => optional, opts => []}]; -find_msg_def(update_flag_response) -> []; -find_msg_def(list_flags_request) -> []; -find_msg_def(list_flags_response) -> [#{name => flag, fnum => 1, rnum => 2, type => {msg, flag}, occurrence => repeated, opts => []}]; -find_msg_def(delete_flag_request) -> [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}]; -find_msg_def(delete_flag_response) -> []; -find_msg_def(timestamp) -> [#{name => seconds, fnum => 1, rnum => 2, type => int64, occurrence => optional, opts => []}, #{name => nanos, fnum => 2, rnum => 3, type => int32, occurrence => optional, opts => []}]; -find_msg_def(_) -> error. - - -find_enum_def(_) -> error. - - --spec enum_symbol_by_value(_, _) -> no_return(). -enum_symbol_by_value(E, V) -> erlang:error({no_enum_defs, E, V}). - - --spec enum_value_by_symbol(_, _) -> no_return(). -enum_value_by_symbol(E, V) -> erlang:error({no_enum_defs, E, V}). - - - -get_service_names() -> ['FeatureFlagService']. - - -get_service_def('FeatureFlagService') -> - {{service, 'FeatureFlagService'}, - [#{name => 'GetFlag', input => get_flag_request, output => get_flag_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'CreateFlag', input => create_flag_request, output => create_flag_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'UpdateFlag', input => update_flag_request, output => update_flag_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'ListFlags', input => list_flags_request, output => list_flags_response, input_stream => false, output_stream => false, opts => []}, - #{name => 'DeleteFlag', input => delete_flag_request, output => delete_flag_response, input_stream => false, output_stream => false, opts => []}]}; -get_service_def(_) -> error. - - -get_rpc_names('FeatureFlagService') -> ['GetFlag', 'CreateFlag', 'UpdateFlag', 'ListFlags', 'DeleteFlag']; -get_rpc_names(_) -> error. - - -find_rpc_def('FeatureFlagService', RpcName) -> find_rpc_def_FeatureFlagService(RpcName); -find_rpc_def(_, _) -> error. - - -find_rpc_def_FeatureFlagService('GetFlag') -> #{name => 'GetFlag', input => get_flag_request, output => get_flag_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_FeatureFlagService('CreateFlag') -> #{name => 'CreateFlag', input => create_flag_request, output => create_flag_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_FeatureFlagService('UpdateFlag') -> #{name => 'UpdateFlag', input => update_flag_request, output => update_flag_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_FeatureFlagService('ListFlags') -> #{name => 'ListFlags', input => list_flags_request, output => list_flags_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_FeatureFlagService('DeleteFlag') -> #{name => 'DeleteFlag', input => delete_flag_request, output => delete_flag_response, input_stream => false, output_stream => false, opts => []}; -find_rpc_def_FeatureFlagService(_) -> error. - - -fetch_rpc_def(ServiceName, RpcName) -> - case find_rpc_def(ServiceName, RpcName) of - Def when is_map(Def) -> Def; - error -> erlang:error({no_such_rpc, ServiceName, RpcName}) - end. - - -%% Convert a a fully qualified (ie with package name) service name -%% as a binary to a service name as an atom. -fqbin_to_service_name(<<"FeatureFlagService">>) -> 'FeatureFlagService'; -fqbin_to_service_name(X) -> error({gpb_error, {badservice, X}}). - - -%% Convert a service name as an atom to a fully qualified -%% (ie with package name) name as a binary. -service_name_to_fqbin('FeatureFlagService') -> <<"FeatureFlagService">>; -service_name_to_fqbin(X) -> error({gpb_error, {badservice, X}}). - - -%% Convert a a fully qualified (ie with package name) service name -%% and an rpc name, both as binaries to a service name and an rpc -%% name, as atoms. -fqbins_to_service_and_rpc_name(<<"FeatureFlagService">>, <<"GetFlag">>) -> {'FeatureFlagService', 'GetFlag'}; -fqbins_to_service_and_rpc_name(<<"FeatureFlagService">>, <<"CreateFlag">>) -> {'FeatureFlagService', 'CreateFlag'}; -fqbins_to_service_and_rpc_name(<<"FeatureFlagService">>, <<"UpdateFlag">>) -> {'FeatureFlagService', 'UpdateFlag'}; -fqbins_to_service_and_rpc_name(<<"FeatureFlagService">>, <<"ListFlags">>) -> {'FeatureFlagService', 'ListFlags'}; -fqbins_to_service_and_rpc_name(<<"FeatureFlagService">>, <<"DeleteFlag">>) -> {'FeatureFlagService', 'DeleteFlag'}; -fqbins_to_service_and_rpc_name(S, R) -> error({gpb_error, {badservice_or_rpc, {S, R}}}). - - -%% Convert a service name and an rpc name, both as atoms, -%% to a fully qualified (ie with package name) service name and -%% an rpc name as binaries. -service_and_rpc_name_to_fqbins('FeatureFlagService', 'GetFlag') -> {<<"FeatureFlagService">>, <<"GetFlag">>}; -service_and_rpc_name_to_fqbins('FeatureFlagService', 'CreateFlag') -> {<<"FeatureFlagService">>, <<"CreateFlag">>}; -service_and_rpc_name_to_fqbins('FeatureFlagService', 'UpdateFlag') -> {<<"FeatureFlagService">>, <<"UpdateFlag">>}; -service_and_rpc_name_to_fqbins('FeatureFlagService', 'ListFlags') -> {<<"FeatureFlagService">>, <<"ListFlags">>}; -service_and_rpc_name_to_fqbins('FeatureFlagService', 'DeleteFlag') -> {<<"FeatureFlagService">>, <<"DeleteFlag">>}; -service_and_rpc_name_to_fqbins(S, R) -> error({gpb_error, {badservice_or_rpc, {S, R}}}). - - -fqbin_to_msg_name(<<"Flag">>) -> flag; -fqbin_to_msg_name(<<"GetFlagRequest">>) -> get_flag_request; -fqbin_to_msg_name(<<"GetFlagResponse">>) -> get_flag_response; -fqbin_to_msg_name(<<"CreateFlagRequest">>) -> create_flag_request; -fqbin_to_msg_name(<<"CreateFlagResponse">>) -> create_flag_response; -fqbin_to_msg_name(<<"UpdateFlagRequest">>) -> update_flag_request; -fqbin_to_msg_name(<<"UpdateFlagResponse">>) -> update_flag_response; -fqbin_to_msg_name(<<"ListFlagsRequest">>) -> list_flags_request; -fqbin_to_msg_name(<<"ListFlagsResponse">>) -> list_flags_response; -fqbin_to_msg_name(<<"DeleteFlagRequest">>) -> delete_flag_request; -fqbin_to_msg_name(<<"DeleteFlagResponse">>) -> delete_flag_response; -fqbin_to_msg_name(<<"google.protobuf.Timestamp">>) -> timestamp; -fqbin_to_msg_name(E) -> error({gpb_error, {badmsg, E}}). - - -msg_name_to_fqbin(flag) -> <<"Flag">>; -msg_name_to_fqbin(get_flag_request) -> <<"GetFlagRequest">>; -msg_name_to_fqbin(get_flag_response) -> <<"GetFlagResponse">>; -msg_name_to_fqbin(create_flag_request) -> <<"CreateFlagRequest">>; -msg_name_to_fqbin(create_flag_response) -> <<"CreateFlagResponse">>; -msg_name_to_fqbin(update_flag_request) -> <<"UpdateFlagRequest">>; -msg_name_to_fqbin(update_flag_response) -> <<"UpdateFlagResponse">>; -msg_name_to_fqbin(list_flags_request) -> <<"ListFlagsRequest">>; -msg_name_to_fqbin(list_flags_response) -> <<"ListFlagsResponse">>; -msg_name_to_fqbin(delete_flag_request) -> <<"DeleteFlagRequest">>; -msg_name_to_fqbin(delete_flag_response) -> <<"DeleteFlagResponse">>; -msg_name_to_fqbin(timestamp) -> <<"google.protobuf.Timestamp">>; -msg_name_to_fqbin(E) -> error({gpb_error, {badmsg, E}}). - - --spec fqbin_to_enum_name(_) -> no_return(). -fqbin_to_enum_name(E) -> error({gpb_error, {badenum, E}}). - - --spec enum_name_to_fqbin(_) -> no_return(). -enum_name_to_fqbin(E) -> error({gpb_error, {badenum, E}}). - - -get_package_name() -> 'google.protobuf'. - - -%% Whether or not the message names -%% are prepended with package name or not. -uses_packages() -> true. - - -source_basename() -> "featureflag.proto". - - -%% Retrieve all proto file names, also imported ones. -%% The order is top-down. The first element is always the main -%% source file. The files are returned with extension, -%% see get_all_proto_names/0 for a version that returns -%% the basenames sans extension -get_all_source_basenames() -> ["featureflag.proto", "timestamp.proto"]. - - -%% Retrieve all proto file names, also imported ones. -%% The order is top-down. The first element is always the main -%% source file. The files are returned sans .proto extension, -%% to make it easier to use them with the various get_xyz_containment -%% functions. -get_all_proto_names() -> ["featureflag", "timestamp"]. - - -get_msg_containment("featureflag") -> - [create_flag_request, create_flag_response, delete_flag_request, delete_flag_response, flag, get_flag_request, get_flag_response, list_flags_request, list_flags_response, update_flag_request, update_flag_response]; -get_msg_containment("timestamp") -> [timestamp]; -get_msg_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_pkg_containment("featureflag") -> undefined; -get_pkg_containment("timestamp") -> 'google.protobuf'; -get_pkg_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_service_containment("featureflag") -> ['FeatureFlagService']; -get_service_containment("timestamp") -> []; -get_service_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_rpc_containment("featureflag") -> [{'FeatureFlagService', 'GetFlag'}, {'FeatureFlagService', 'CreateFlag'}, {'FeatureFlagService', 'UpdateFlag'}, {'FeatureFlagService', 'ListFlags'}, {'FeatureFlagService', 'DeleteFlag'}]; -get_rpc_containment("timestamp") -> []; -get_rpc_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_enum_containment("featureflag") -> []; -get_enum_containment("timestamp") -> []; -get_enum_containment(P) -> error({gpb_error, {badproto, P}}). - - -get_proto_by_msg_name_as_fqbin(<<"google.protobuf.Timestamp">>) -> "timestamp"; -get_proto_by_msg_name_as_fqbin(<<"UpdateFlagRequest">>) -> "featureflag"; -get_proto_by_msg_name_as_fqbin(<<"ListFlagsRequest">>) -> "featureflag"; -get_proto_by_msg_name_as_fqbin(<<"GetFlagRequest">>) -> "featureflag"; -get_proto_by_msg_name_as_fqbin(<<"DeleteFlagRequest">>) -> "featureflag"; -get_proto_by_msg_name_as_fqbin(<<"CreateFlagRequest">>) -> "featureflag"; -get_proto_by_msg_name_as_fqbin(<<"UpdateFlagResponse">>) -> "featureflag"; -get_proto_by_msg_name_as_fqbin(<<"ListFlagsResponse">>) -> "featureflag"; -get_proto_by_msg_name_as_fqbin(<<"GetFlagResponse">>) -> "featureflag"; -get_proto_by_msg_name_as_fqbin(<<"DeleteFlagResponse">>) -> "featureflag"; -get_proto_by_msg_name_as_fqbin(<<"CreateFlagResponse">>) -> "featureflag"; -get_proto_by_msg_name_as_fqbin(<<"Flag">>) -> "featureflag"; -get_proto_by_msg_name_as_fqbin(E) -> error({gpb_error, {badmsg, E}}). - - -get_proto_by_service_name_as_fqbin(<<"FeatureFlagService">>) -> "featureflag"; -get_proto_by_service_name_as_fqbin(E) -> error({gpb_error, {badservice, E}}). - - --spec get_proto_by_enum_name_as_fqbin(_) -> no_return(). -get_proto_by_enum_name_as_fqbin(E) -> error({gpb_error, {badenum, E}}). - - -get_protos_by_pkg_name_as_fqbin(<<"google.protobuf">>) -> ["timestamp"]; -get_protos_by_pkg_name_as_fqbin(E) -> error({gpb_error, {badpkg, E}}). - - -descriptor() -> - <<10, 231, 6, 10, 17, 102, 101, 97, 116, 117, 114, 101, 102, 108, 97, 103, 46, 112, 114, 111, 116, 111, 34, 71, 10, 17, 67, 114, 101, 97, 116, 101, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 18, 12, 10, 4, 110, 97, 109, 101, 24, 1, 32, 1, - 40, 9, 18, 19, 10, 11, 100, 101, 115, 99, 114, 105, 112, 116, 105, 111, 110, 24, 2, 32, 1, 40, 9, 18, 15, 10, 7, 101, 110, 97, 98, 108, 101, 100, 24, 3, 32, 1, 40, 8, 34, 41, 10, 18, 67, 114, 101, 97, 116, 101, 70, 108, 97, 103, 82, 101, 115, 112, - 111, 110, 115, 101, 18, 19, 10, 4, 102, 108, 97, 103, 24, 1, 32, 1, 40, 11, 50, 5, 46, 70, 108, 97, 103, 34, 33, 10, 17, 68, 101, 108, 101, 116, 101, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 18, 12, 10, 4, 110, 97, 109, 101, 24, 1, 32, 1, - 40, 9, 34, 20, 10, 18, 68, 101, 108, 101, 116, 101, 70, 108, 97, 103, 82, 101, 115, 112, 111, 110, 115, 101, 34, 154, 1, 10, 4, 70, 108, 97, 103, 18, 12, 10, 4, 110, 97, 109, 101, 24, 1, 32, 1, 40, 9, 18, 19, 10, 11, 100, 101, 115, 99, 114, 105, 112, - 116, 105, 111, 110, 24, 2, 32, 1, 40, 9, 18, 15, 10, 7, 101, 110, 97, 98, 108, 101, 100, 24, 3, 32, 1, 40, 8, 18, 46, 10, 10, 99, 114, 101, 97, 116, 101, 100, 95, 97, 116, 24, 4, 32, 1, 40, 11, 50, 26, 46, 103, 111, 111, 103, 108, 101, 46, 112, 114, - 111, 116, 111, 98, 117, 102, 46, 84, 105, 109, 101, 115, 116, 97, 109, 112, 18, 46, 10, 10, 117, 112, 100, 97, 116, 101, 100, 95, 97, 116, 24, 5, 32, 1, 40, 11, 50, 26, 46, 103, 111, 111, 103, 108, 101, 46, 112, 114, 111, 116, 111, 98, 117, 102, 46, - 84, 105, 109, 101, 115, 116, 97, 109, 112, 34, 30, 10, 14, 71, 101, 116, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 18, 12, 10, 4, 110, 97, 109, 101, 24, 1, 32, 1, 40, 9, 34, 38, 10, 15, 71, 101, 116, 70, 108, 97, 103, 82, 101, 115, 112, - 111, 110, 115, 101, 18, 19, 10, 4, 102, 108, 97, 103, 24, 1, 32, 1, 40, 11, 50, 5, 46, 70, 108, 97, 103, 34, 18, 10, 16, 76, 105, 115, 116, 70, 108, 97, 103, 115, 82, 101, 113, 117, 101, 115, 116, 34, 40, 10, 17, 76, 105, 115, 116, 70, 108, 97, 103, - 115, 82, 101, 115, 112, 111, 110, 115, 101, 18, 19, 10, 4, 102, 108, 97, 103, 24, 1, 32, 3, 40, 11, 50, 5, 46, 70, 108, 97, 103, 34, 50, 10, 17, 85, 112, 100, 97, 116, 101, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 18, 12, 10, 4, 110, 97, - 109, 101, 24, 1, 32, 1, 40, 9, 18, 15, 10, 7, 101, 110, 97, 98, 108, 101, 100, 24, 2, 32, 1, 40, 8, 34, 20, 10, 18, 85, 112, 100, 97, 116, 101, 70, 108, 97, 103, 82, 101, 115, 112, 111, 110, 115, 101, 50, 175, 2, 10, 18, 70, 101, 97, 116, 117, 114, - 101, 70, 108, 97, 103, 83, 101, 114, 118, 105, 99, 101, 18, 48, 10, 7, 71, 101, 116, 70, 108, 97, 103, 18, 15, 46, 71, 101, 116, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 26, 16, 46, 71, 101, 116, 70, 108, 97, 103, 82, 101, 115, 112, 111, - 110, 115, 101, 40, 0, 48, 0, 18, 57, 10, 10, 67, 114, 101, 97, 116, 101, 70, 108, 97, 103, 18, 18, 46, 67, 114, 101, 97, 116, 101, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 26, 19, 46, 67, 114, 101, 97, 116, 101, 70, 108, 97, 103, 82, 101, - 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 18, 57, 10, 10, 85, 112, 100, 97, 116, 101, 70, 108, 97, 103, 18, 18, 46, 85, 112, 100, 97, 116, 101, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 26, 19, 46, 85, 112, 100, 97, 116, 101, 70, 108, 97, - 103, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 18, 54, 10, 9, 76, 105, 115, 116, 70, 108, 97, 103, 115, 18, 17, 46, 76, 105, 115, 116, 70, 108, 97, 103, 115, 82, 101, 113, 117, 101, 115, 116, 26, 18, 46, 76, 105, 115, 116, 70, 108, 97, - 103, 115, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 18, 57, 10, 10, 68, 101, 108, 101, 116, 101, 70, 108, 97, 103, 18, 18, 46, 68, 101, 108, 101, 116, 101, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 26, 19, 46, 68, 101, 108, 101, - 116, 101, 70, 108, 97, 103, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 98, 6, 112, 114, 111, 116, 111, 51, 10, 103, 10, 31, 103, 111, 111, 103, 108, 101, 47, 112, 114, 111, 116, 111, 98, 117, 102, 47, 116, 105, 109, 101, 115, 116, 97, 109, - 112, 46, 112, 114, 111, 116, 111, 18, 15, 103, 111, 111, 103, 108, 101, 46, 112, 114, 111, 116, 111, 98, 117, 102, 34, 43, 10, 9, 84, 105, 109, 101, 115, 116, 97, 109, 112, 18, 15, 10, 7, 115, 101, 99, 111, 110, 100, 115, 24, 1, 32, 1, 40, 3, 18, 13, - 10, 5, 110, 97, 110, 111, 115, 24, 2, 32, 1, 40, 5, 98, 6, 112, 114, 111, 116, 111, 51>>. - -descriptor("featureflag") -> - <<10, 17, 102, 101, 97, 116, 117, 114, 101, 102, 108, 97, 103, 46, 112, 114, 111, 116, 111, 34, 71, 10, 17, 67, 114, 101, 97, 116, 101, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 18, 12, 10, 4, 110, 97, 109, 101, 24, 1, 32, 1, 40, 9, 18, 19, - 10, 11, 100, 101, 115, 99, 114, 105, 112, 116, 105, 111, 110, 24, 2, 32, 1, 40, 9, 18, 15, 10, 7, 101, 110, 97, 98, 108, 101, 100, 24, 3, 32, 1, 40, 8, 34, 41, 10, 18, 67, 114, 101, 97, 116, 101, 70, 108, 97, 103, 82, 101, 115, 112, 111, 110, 115, - 101, 18, 19, 10, 4, 102, 108, 97, 103, 24, 1, 32, 1, 40, 11, 50, 5, 46, 70, 108, 97, 103, 34, 33, 10, 17, 68, 101, 108, 101, 116, 101, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 18, 12, 10, 4, 110, 97, 109, 101, 24, 1, 32, 1, 40, 9, 34, 20, - 10, 18, 68, 101, 108, 101, 116, 101, 70, 108, 97, 103, 82, 101, 115, 112, 111, 110, 115, 101, 34, 154, 1, 10, 4, 70, 108, 97, 103, 18, 12, 10, 4, 110, 97, 109, 101, 24, 1, 32, 1, 40, 9, 18, 19, 10, 11, 100, 101, 115, 99, 114, 105, 112, 116, 105, 111, - 110, 24, 2, 32, 1, 40, 9, 18, 15, 10, 7, 101, 110, 97, 98, 108, 101, 100, 24, 3, 32, 1, 40, 8, 18, 46, 10, 10, 99, 114, 101, 97, 116, 101, 100, 95, 97, 116, 24, 4, 32, 1, 40, 11, 50, 26, 46, 103, 111, 111, 103, 108, 101, 46, 112, 114, 111, 116, 111, - 98, 117, 102, 46, 84, 105, 109, 101, 115, 116, 97, 109, 112, 18, 46, 10, 10, 117, 112, 100, 97, 116, 101, 100, 95, 97, 116, 24, 5, 32, 1, 40, 11, 50, 26, 46, 103, 111, 111, 103, 108, 101, 46, 112, 114, 111, 116, 111, 98, 117, 102, 46, 84, 105, 109, - 101, 115, 116, 97, 109, 112, 34, 30, 10, 14, 71, 101, 116, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 18, 12, 10, 4, 110, 97, 109, 101, 24, 1, 32, 1, 40, 9, 34, 38, 10, 15, 71, 101, 116, 70, 108, 97, 103, 82, 101, 115, 112, 111, 110, 115, - 101, 18, 19, 10, 4, 102, 108, 97, 103, 24, 1, 32, 1, 40, 11, 50, 5, 46, 70, 108, 97, 103, 34, 18, 10, 16, 76, 105, 115, 116, 70, 108, 97, 103, 115, 82, 101, 113, 117, 101, 115, 116, 34, 40, 10, 17, 76, 105, 115, 116, 70, 108, 97, 103, 115, 82, 101, - 115, 112, 111, 110, 115, 101, 18, 19, 10, 4, 102, 108, 97, 103, 24, 1, 32, 3, 40, 11, 50, 5, 46, 70, 108, 97, 103, 34, 50, 10, 17, 85, 112, 100, 97, 116, 101, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 18, 12, 10, 4, 110, 97, 109, 101, 24, - 1, 32, 1, 40, 9, 18, 15, 10, 7, 101, 110, 97, 98, 108, 101, 100, 24, 2, 32, 1, 40, 8, 34, 20, 10, 18, 85, 112, 100, 97, 116, 101, 70, 108, 97, 103, 82, 101, 115, 112, 111, 110, 115, 101, 50, 175, 2, 10, 18, 70, 101, 97, 116, 117, 114, 101, 70, 108, - 97, 103, 83, 101, 114, 118, 105, 99, 101, 18, 48, 10, 7, 71, 101, 116, 70, 108, 97, 103, 18, 15, 46, 71, 101, 116, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 26, 16, 46, 71, 101, 116, 70, 108, 97, 103, 82, 101, 115, 112, 111, 110, 115, 101, - 40, 0, 48, 0, 18, 57, 10, 10, 67, 114, 101, 97, 116, 101, 70, 108, 97, 103, 18, 18, 46, 67, 114, 101, 97, 116, 101, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 26, 19, 46, 67, 114, 101, 97, 116, 101, 70, 108, 97, 103, 82, 101, 115, 112, 111, - 110, 115, 101, 40, 0, 48, 0, 18, 57, 10, 10, 85, 112, 100, 97, 116, 101, 70, 108, 97, 103, 18, 18, 46, 85, 112, 100, 97, 116, 101, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 26, 19, 46, 85, 112, 100, 97, 116, 101, 70, 108, 97, 103, 82, 101, - 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 18, 54, 10, 9, 76, 105, 115, 116, 70, 108, 97, 103, 115, 18, 17, 46, 76, 105, 115, 116, 70, 108, 97, 103, 115, 82, 101, 113, 117, 101, 115, 116, 26, 18, 46, 76, 105, 115, 116, 70, 108, 97, 103, 115, 82, - 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 18, 57, 10, 10, 68, 101, 108, 101, 116, 101, 70, 108, 97, 103, 18, 18, 46, 68, 101, 108, 101, 116, 101, 70, 108, 97, 103, 82, 101, 113, 117, 101, 115, 116, 26, 19, 46, 68, 101, 108, 101, 116, 101, 70, - 108, 97, 103, 82, 101, 115, 112, 111, 110, 115, 101, 40, 0, 48, 0, 98, 6, 112, 114, 111, 116, 111, 51>>; -descriptor("timestamp") -> - <<10, 31, 103, 111, 111, 103, 108, 101, 47, 112, 114, 111, 116, 111, 98, 117, 102, 47, 116, 105, 109, 101, 115, 116, 97, 109, 112, 46, 112, 114, 111, 116, 111, 18, 15, 103, 111, 111, 103, 108, 101, 46, 112, 114, 111, 116, 111, 98, 117, 102, 34, 43, - 10, 9, 84, 105, 109, 101, 115, 116, 97, 109, 112, 18, 15, 10, 7, 115, 101, 99, 111, 110, 100, 115, 24, 1, 32, 1, 40, 3, 18, 13, 10, 5, 110, 97, 110, 111, 115, 24, 2, 32, 1, 40, 5, 98, 6, 112, 114, 111, 116, 111, 51>>; -descriptor(X) -> error({gpb_error, {badname, X}}). - - -gpb_version_as_string() -> - "4.19.5". - -gpb_version_as_list() -> - [4,19,5]. - -gpb_version_source() -> - "file". diff --git a/src/featureflagservice/src/ffs_service.erl b/src/featureflagservice/src/ffs_service.erl index 939101b6f8..a2e5680f40 100644 --- a/src/featureflagservice/src/ffs_service.erl +++ b/src/featureflagservice/src/ffs_service.erl @@ -10,8 +10,8 @@ -include_lib("grpcbox/include/grpcbox.hrl"). --spec get_flag(ctx:t(), ffs_featureflag_pb:get_flag_request()) -> - {ok, ffs_featureflag_pb:get_flag_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). +-spec get_flag(ctx:t(), ffs_demo_pb:get_flag_request()) -> + {ok, ffs_demo_pb:get_flag_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). get_flag(Ctx, #{name := Name}) -> case 'Elixir.Featureflagservice.FeatureFlags':get_feature_flag_by_name(Name) of nil -> @@ -33,22 +33,22 @@ get_flag(Ctx, #{name := Name}) -> {ok, #{flag => Flag}, Ctx} end. --spec create_flag(ctx:t(), ffs_featureflag_pb:create_flag_request()) -> - {ok, ffs_featureflag_pb:create_flag_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). +-spec create_flag(ctx:t(), ffs_demo_pb:create_flag_request()) -> + {ok, ffs_demo_pb:create_flag_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). create_flag(_Ctx, _) -> {grpc_error, {?GRPC_STATUS_UNIMPLEMENTED, <<"use the web interface to create flags.">>}}. --spec update_flag(ctx:t(), ffs_featureflag_pb:update_flag_request()) -> - {ok, ffs_featureflag_pb:update_flag_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). +-spec update_flag(ctx:t(), ffs_demo_pb:update_flag_request()) -> + {ok, ffs_demo_pb:update_flag_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). update_flag(_Ctx, _) -> {grpc_error, {?GRPC_STATUS_UNIMPLEMENTED, <<"use the web interface to update flags.">>}}. --spec list_flags(ctx:t(), ffs_featureflag_pb:list_flags_request()) -> - {ok, ffs_featureflag_pb:list_flags_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). +-spec list_flags(ctx:t(), ffs_demo_pb:list_flags_request()) -> + {ok, ffs_demo_pb:list_flags_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). list_flags(_Ctx, _) -> {grpc_error, {?GRPC_STATUS_UNIMPLEMENTED, <<"use the web interface to view all flags.">>}}. --spec delete_flag(ctx:t(), ffs_featureflag_pb:delete_flag_request()) -> - {ok, ffs_featureflag_pb:delete_flag_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). +-spec delete_flag(ctx:t(), ffs_demo_pb:delete_flag_request()) -> + {ok, ffs_demo_pb:delete_flag_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). delete_flag(_Ctx, _) -> {grpc_error, {?GRPC_STATUS_UNIMPLEMENTED, <<"use the web interface to delete flags.">>}}. diff --git a/src/featureflagservice/src/ffs_service_bhvr.erl b/src/featureflagservice/src/ffs_service_bhvr.erl index c15f7487c2..c43123c6bb 100644 --- a/src/featureflagservice/src/ffs_service_bhvr.erl +++ b/src/featureflagservice/src/ffs_service_bhvr.erl @@ -1,5 +1,5 @@ %%%------------------------------------------------------------------- -%% @doc Behaviour to implement for grpc service FeatureFlagService. +%% @doc Behaviour to implement for grpc service hipstershop.FeatureFlagService. %% @end %%%------------------------------------------------------------------- @@ -8,22 +8,22 @@ -module(ffs_service_bhvr). %% Unary RPC --callback get_flag(ctx:t(), ffs_featureflag_pb:get_flag_request()) -> - {ok, ffs_featureflag_pb:get_flag_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). +-callback get_flag(ctx:t(), ffs_demo_pb:get_flag_request()) -> + {ok, ffs_demo_pb:get_flag_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). %% Unary RPC --callback create_flag(ctx:t(), ffs_featureflag_pb:create_flag_request()) -> - {ok, ffs_featureflag_pb:create_flag_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). +-callback create_flag(ctx:t(), ffs_demo_pb:create_flag_request()) -> + {ok, ffs_demo_pb:create_flag_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). %% Unary RPC --callback update_flag(ctx:t(), ffs_featureflag_pb:update_flag_request()) -> - {ok, ffs_featureflag_pb:update_flag_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). +-callback update_flag(ctx:t(), ffs_demo_pb:update_flag_request()) -> + {ok, ffs_demo_pb:update_flag_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). %% Unary RPC --callback list_flags(ctx:t(), ffs_featureflag_pb:list_flags_request()) -> - {ok, ffs_featureflag_pb:list_flags_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). +-callback list_flags(ctx:t(), ffs_demo_pb:list_flags_request()) -> + {ok, ffs_demo_pb:list_flags_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). %% Unary RPC --callback delete_flag(ctx:t(), ffs_featureflag_pb:delete_flag_request()) -> - {ok, ffs_featureflag_pb:delete_flag_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). +-callback delete_flag(ctx:t(), ffs_demo_pb:delete_flag_request()) -> + {ok, ffs_demo_pb:delete_flag_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). diff --git a/src/featureflagservice/src/ffs_service_client.erl b/src/featureflagservice/src/ffs_service_client.erl index 85c8087c2a..b4df8abb58 100644 --- a/src/featureflagservice/src/ffs_service_client.erl +++ b/src/featureflagservice/src/ffs_service_client.erl @@ -1,5 +1,5 @@ %%%------------------------------------------------------------------- -%% @doc Client module for grpc service FeatureFlagService. +%% @doc Client module for grpc service hipstershop.FeatureFlagService. %% @end %%%------------------------------------------------------------------- @@ -14,8 +14,8 @@ -define(is_ctx(Ctx), is_tuple(Ctx) andalso element(1, Ctx) =:= ctx). --define(SERVICE, 'FeatureFlagService'). --define(PROTO_MODULE, 'ffs_featureflag_pb'). +-define(SERVICE, 'hipstershop.FeatureFlagService'). +-define(PROTO_MODULE, 'ffs_demo_pb'). -define(MARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:encode_msg(I, T) end). -define(UNMARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:decode_msg(I, T) end). -define(DEF(Input, Output, MessageType), #grpcbox_def{service=?SERVICE, @@ -24,92 +24,92 @@ unmarshal_fun=?UNMARSHAL_FUN(Output)}). %% @doc Unary RPC --spec get_flag(ffs_featureflag_pb:get_flag_request()) -> - {ok, ffs_featureflag_pb:get_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +-spec get_flag(ffs_demo_pb:get_flag_request()) -> + {ok, ffs_demo_pb:get_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. get_flag(Input) -> get_flag(ctx:new(), Input, #{}). --spec get_flag(ctx:t() | ffs_featureflag_pb:get_flag_request(), ffs_featureflag_pb:get_flag_request() | grpcbox_client:options()) -> - {ok, ffs_featureflag_pb:get_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +-spec get_flag(ctx:t() | ffs_demo_pb:get_flag_request(), ffs_demo_pb:get_flag_request() | grpcbox_client:options()) -> + {ok, ffs_demo_pb:get_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. get_flag(Ctx, Input) when ?is_ctx(Ctx) -> get_flag(Ctx, Input, #{}); get_flag(Input, Options) -> get_flag(ctx:new(), Input, Options). --spec get_flag(ctx:t(), ffs_featureflag_pb:get_flag_request(), grpcbox_client:options()) -> - {ok, ffs_featureflag_pb:get_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +-spec get_flag(ctx:t(), ffs_demo_pb:get_flag_request(), grpcbox_client:options()) -> + {ok, ffs_demo_pb:get_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. get_flag(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/FeatureFlagService/GetFlag">>, Input, ?DEF(get_flag_request, get_flag_response, <<"GetFlagRequest">>), Options). + grpcbox_client:unary(Ctx, <<"/hipstershop.FeatureFlagService/GetFlag">>, Input, ?DEF(get_flag_request, get_flag_response, <<"hipstershop.GetFlagRequest">>), Options). %% @doc Unary RPC --spec create_flag(ffs_featureflag_pb:create_flag_request()) -> - {ok, ffs_featureflag_pb:create_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +-spec create_flag(ffs_demo_pb:create_flag_request()) -> + {ok, ffs_demo_pb:create_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. create_flag(Input) -> create_flag(ctx:new(), Input, #{}). --spec create_flag(ctx:t() | ffs_featureflag_pb:create_flag_request(), ffs_featureflag_pb:create_flag_request() | grpcbox_client:options()) -> - {ok, ffs_featureflag_pb:create_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +-spec create_flag(ctx:t() | ffs_demo_pb:create_flag_request(), ffs_demo_pb:create_flag_request() | grpcbox_client:options()) -> + {ok, ffs_demo_pb:create_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. create_flag(Ctx, Input) when ?is_ctx(Ctx) -> create_flag(Ctx, Input, #{}); create_flag(Input, Options) -> create_flag(ctx:new(), Input, Options). --spec create_flag(ctx:t(), ffs_featureflag_pb:create_flag_request(), grpcbox_client:options()) -> - {ok, ffs_featureflag_pb:create_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +-spec create_flag(ctx:t(), ffs_demo_pb:create_flag_request(), grpcbox_client:options()) -> + {ok, ffs_demo_pb:create_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. create_flag(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/FeatureFlagService/CreateFlag">>, Input, ?DEF(create_flag_request, create_flag_response, <<"CreateFlagRequest">>), Options). + grpcbox_client:unary(Ctx, <<"/hipstershop.FeatureFlagService/CreateFlag">>, Input, ?DEF(create_flag_request, create_flag_response, <<"hipstershop.CreateFlagRequest">>), Options). %% @doc Unary RPC --spec update_flag(ffs_featureflag_pb:update_flag_request()) -> - {ok, ffs_featureflag_pb:update_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +-spec update_flag(ffs_demo_pb:update_flag_request()) -> + {ok, ffs_demo_pb:update_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. update_flag(Input) -> update_flag(ctx:new(), Input, #{}). --spec update_flag(ctx:t() | ffs_featureflag_pb:update_flag_request(), ffs_featureflag_pb:update_flag_request() | grpcbox_client:options()) -> - {ok, ffs_featureflag_pb:update_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +-spec update_flag(ctx:t() | ffs_demo_pb:update_flag_request(), ffs_demo_pb:update_flag_request() | grpcbox_client:options()) -> + {ok, ffs_demo_pb:update_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. update_flag(Ctx, Input) when ?is_ctx(Ctx) -> update_flag(Ctx, Input, #{}); update_flag(Input, Options) -> update_flag(ctx:new(), Input, Options). --spec update_flag(ctx:t(), ffs_featureflag_pb:update_flag_request(), grpcbox_client:options()) -> - {ok, ffs_featureflag_pb:update_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +-spec update_flag(ctx:t(), ffs_demo_pb:update_flag_request(), grpcbox_client:options()) -> + {ok, ffs_demo_pb:update_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. update_flag(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/FeatureFlagService/UpdateFlag">>, Input, ?DEF(update_flag_request, update_flag_response, <<"UpdateFlagRequest">>), Options). + grpcbox_client:unary(Ctx, <<"/hipstershop.FeatureFlagService/UpdateFlag">>, Input, ?DEF(update_flag_request, update_flag_response, <<"hipstershop.UpdateFlagRequest">>), Options). %% @doc Unary RPC --spec list_flags(ffs_featureflag_pb:list_flags_request()) -> - {ok, ffs_featureflag_pb:list_flags_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +-spec list_flags(ffs_demo_pb:list_flags_request()) -> + {ok, ffs_demo_pb:list_flags_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. list_flags(Input) -> list_flags(ctx:new(), Input, #{}). --spec list_flags(ctx:t() | ffs_featureflag_pb:list_flags_request(), ffs_featureflag_pb:list_flags_request() | grpcbox_client:options()) -> - {ok, ffs_featureflag_pb:list_flags_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +-spec list_flags(ctx:t() | ffs_demo_pb:list_flags_request(), ffs_demo_pb:list_flags_request() | grpcbox_client:options()) -> + {ok, ffs_demo_pb:list_flags_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. list_flags(Ctx, Input) when ?is_ctx(Ctx) -> list_flags(Ctx, Input, #{}); list_flags(Input, Options) -> list_flags(ctx:new(), Input, Options). --spec list_flags(ctx:t(), ffs_featureflag_pb:list_flags_request(), grpcbox_client:options()) -> - {ok, ffs_featureflag_pb:list_flags_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +-spec list_flags(ctx:t(), ffs_demo_pb:list_flags_request(), grpcbox_client:options()) -> + {ok, ffs_demo_pb:list_flags_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. list_flags(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/FeatureFlagService/ListFlags">>, Input, ?DEF(list_flags_request, list_flags_response, <<"ListFlagsRequest">>), Options). + grpcbox_client:unary(Ctx, <<"/hipstershop.FeatureFlagService/ListFlags">>, Input, ?DEF(list_flags_request, list_flags_response, <<"hipstershop.ListFlagsRequest">>), Options). %% @doc Unary RPC --spec delete_flag(ffs_featureflag_pb:delete_flag_request()) -> - {ok, ffs_featureflag_pb:delete_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +-spec delete_flag(ffs_demo_pb:delete_flag_request()) -> + {ok, ffs_demo_pb:delete_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. delete_flag(Input) -> delete_flag(ctx:new(), Input, #{}). --spec delete_flag(ctx:t() | ffs_featureflag_pb:delete_flag_request(), ffs_featureflag_pb:delete_flag_request() | grpcbox_client:options()) -> - {ok, ffs_featureflag_pb:delete_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +-spec delete_flag(ctx:t() | ffs_demo_pb:delete_flag_request(), ffs_demo_pb:delete_flag_request() | grpcbox_client:options()) -> + {ok, ffs_demo_pb:delete_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. delete_flag(Ctx, Input) when ?is_ctx(Ctx) -> delete_flag(Ctx, Input, #{}); delete_flag(Input, Options) -> delete_flag(ctx:new(), Input, Options). --spec delete_flag(ctx:t(), ffs_featureflag_pb:delete_flag_request(), grpcbox_client:options()) -> - {ok, ffs_featureflag_pb:delete_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +-spec delete_flag(ctx:t(), ffs_demo_pb:delete_flag_request(), grpcbox_client:options()) -> + {ok, ffs_demo_pb:delete_flag_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. delete_flag(Ctx, Input, Options) -> - grpcbox_client:unary(Ctx, <<"/FeatureFlagService/DeleteFlag">>, Input, ?DEF(delete_flag_request, delete_flag_response, <<"DeleteFlagRequest">>), Options). + grpcbox_client:unary(Ctx, <<"/hipstershop.FeatureFlagService/DeleteFlag">>, Input, ?DEF(delete_flag_request, delete_flag_response, <<"hipstershop.DeleteFlagRequest">>), Options). diff --git a/src/featureflagservice/src/hipstershop_ad_service_bhvr.erl b/src/featureflagservice/src/hipstershop_ad_service_bhvr.erl new file mode 100644 index 0000000000..420ce58bf0 --- /dev/null +++ b/src/featureflagservice/src/hipstershop_ad_service_bhvr.erl @@ -0,0 +1,13 @@ +%%%------------------------------------------------------------------- +%% @doc Behaviour to implement for grpc service hipstershop.AdService. +%% @end +%%%------------------------------------------------------------------- + +%% this module was generated and should not be modified manually + +-module(hipstershop_ad_service_bhvr). + +%% Unary RPC +-callback get_ads(ctx:t(), ffs_demo_pb:ad_request()) -> + {ok, ffs_demo_pb:ad_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). + diff --git a/src/featureflagservice/src/hipstershop_ad_service_client.erl b/src/featureflagservice/src/hipstershop_ad_service_client.erl new file mode 100644 index 0000000000..c1ebaa7db2 --- /dev/null +++ b/src/featureflagservice/src/hipstershop_ad_service_client.erl @@ -0,0 +1,43 @@ +%%%------------------------------------------------------------------- +%% @doc Client module for grpc service hipstershop.AdService. +%% @end +%%%------------------------------------------------------------------- + +%% this module was generated and should not be modified manually + +-module(hipstershop_ad_service_client). + +-compile(export_all). +-compile(nowarn_export_all). + +-include_lib("grpcbox/include/grpcbox.hrl"). + +-define(is_ctx(Ctx), is_tuple(Ctx) andalso element(1, Ctx) =:= ctx). + +-define(SERVICE, 'hipstershop.AdService'). +-define(PROTO_MODULE, 'ffs_demo_pb'). +-define(MARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:encode_msg(I, T) end). +-define(UNMARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:decode_msg(I, T) end). +-define(DEF(Input, Output, MessageType), #grpcbox_def{service=?SERVICE, + message_type=MessageType, + marshal_fun=?MARSHAL_FUN(Input), + unmarshal_fun=?UNMARSHAL_FUN(Output)}). + +%% @doc Unary RPC +-spec get_ads(ffs_demo_pb:ad_request()) -> + {ok, ffs_demo_pb:ad_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +get_ads(Input) -> + get_ads(ctx:new(), Input, #{}). + +-spec get_ads(ctx:t() | ffs_demo_pb:ad_request(), ffs_demo_pb:ad_request() | grpcbox_client:options()) -> + {ok, ffs_demo_pb:ad_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +get_ads(Ctx, Input) when ?is_ctx(Ctx) -> + get_ads(Ctx, Input, #{}); +get_ads(Input, Options) -> + get_ads(ctx:new(), Input, Options). + +-spec get_ads(ctx:t(), ffs_demo_pb:ad_request(), grpcbox_client:options()) -> + {ok, ffs_demo_pb:ad_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +get_ads(Ctx, Input, Options) -> + grpcbox_client:unary(Ctx, <<"/hipstershop.AdService/GetAds">>, Input, ?DEF(ad_request, ad_response, <<"hipstershop.AdRequest">>), Options). + diff --git a/src/featureflagservice/src/hipstershop_cart_service_bhvr.erl b/src/featureflagservice/src/hipstershop_cart_service_bhvr.erl new file mode 100644 index 0000000000..bcfd8e7ffb --- /dev/null +++ b/src/featureflagservice/src/hipstershop_cart_service_bhvr.erl @@ -0,0 +1,21 @@ +%%%------------------------------------------------------------------- +%% @doc Behaviour to implement for grpc service hipstershop.CartService. +%% @end +%%%------------------------------------------------------------------- + +%% this module was generated and should not be modified manually + +-module(hipstershop_cart_service_bhvr). + +%% Unary RPC +-callback add_item(ctx:t(), ffs_demo_pb:add_item_request()) -> + {ok, ffs_demo_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). + +%% Unary RPC +-callback get_cart(ctx:t(), ffs_demo_pb:get_cart_request()) -> + {ok, ffs_demo_pb:cart(), ctx:t()} | grpcbox_stream:grpc_error_response(). + +%% Unary RPC +-callback empty_cart(ctx:t(), ffs_demo_pb:empty_cart_request()) -> + {ok, ffs_demo_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). + diff --git a/src/featureflagservice/src/hipstershop_cart_service_client.erl b/src/featureflagservice/src/hipstershop_cart_service_client.erl new file mode 100644 index 0000000000..9324a90b29 --- /dev/null +++ b/src/featureflagservice/src/hipstershop_cart_service_client.erl @@ -0,0 +1,79 @@ +%%%------------------------------------------------------------------- +%% @doc Client module for grpc service hipstershop.CartService. +%% @end +%%%------------------------------------------------------------------- + +%% this module was generated and should not be modified manually + +-module(hipstershop_cart_service_client). + +-compile(export_all). +-compile(nowarn_export_all). + +-include_lib("grpcbox/include/grpcbox.hrl"). + +-define(is_ctx(Ctx), is_tuple(Ctx) andalso element(1, Ctx) =:= ctx). + +-define(SERVICE, 'hipstershop.CartService'). +-define(PROTO_MODULE, 'ffs_demo_pb'). +-define(MARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:encode_msg(I, T) end). +-define(UNMARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:decode_msg(I, T) end). +-define(DEF(Input, Output, MessageType), #grpcbox_def{service=?SERVICE, + message_type=MessageType, + marshal_fun=?MARSHAL_FUN(Input), + unmarshal_fun=?UNMARSHAL_FUN(Output)}). + +%% @doc Unary RPC +-spec add_item(ffs_demo_pb:add_item_request()) -> + {ok, ffs_demo_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +add_item(Input) -> + add_item(ctx:new(), Input, #{}). + +-spec add_item(ctx:t() | ffs_demo_pb:add_item_request(), ffs_demo_pb:add_item_request() | grpcbox_client:options()) -> + {ok, ffs_demo_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +add_item(Ctx, Input) when ?is_ctx(Ctx) -> + add_item(Ctx, Input, #{}); +add_item(Input, Options) -> + add_item(ctx:new(), Input, Options). + +-spec add_item(ctx:t(), ffs_demo_pb:add_item_request(), grpcbox_client:options()) -> + {ok, ffs_demo_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +add_item(Ctx, Input, Options) -> + grpcbox_client:unary(Ctx, <<"/hipstershop.CartService/AddItem">>, Input, ?DEF(add_item_request, empty, <<"hipstershop.AddItemRequest">>), Options). + +%% @doc Unary RPC +-spec get_cart(ffs_demo_pb:get_cart_request()) -> + {ok, ffs_demo_pb:cart(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +get_cart(Input) -> + get_cart(ctx:new(), Input, #{}). + +-spec get_cart(ctx:t() | ffs_demo_pb:get_cart_request(), ffs_demo_pb:get_cart_request() | grpcbox_client:options()) -> + {ok, ffs_demo_pb:cart(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +get_cart(Ctx, Input) when ?is_ctx(Ctx) -> + get_cart(Ctx, Input, #{}); +get_cart(Input, Options) -> + get_cart(ctx:new(), Input, Options). + +-spec get_cart(ctx:t(), ffs_demo_pb:get_cart_request(), grpcbox_client:options()) -> + {ok, ffs_demo_pb:cart(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +get_cart(Ctx, Input, Options) -> + grpcbox_client:unary(Ctx, <<"/hipstershop.CartService/GetCart">>, Input, ?DEF(get_cart_request, cart, <<"hipstershop.GetCartRequest">>), Options). + +%% @doc Unary RPC +-spec empty_cart(ffs_demo_pb:empty_cart_request()) -> + {ok, ffs_demo_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +empty_cart(Input) -> + empty_cart(ctx:new(), Input, #{}). + +-spec empty_cart(ctx:t() | ffs_demo_pb:empty_cart_request(), ffs_demo_pb:empty_cart_request() | grpcbox_client:options()) -> + {ok, ffs_demo_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +empty_cart(Ctx, Input) when ?is_ctx(Ctx) -> + empty_cart(Ctx, Input, #{}); +empty_cart(Input, Options) -> + empty_cart(ctx:new(), Input, Options). + +-spec empty_cart(ctx:t(), ffs_demo_pb:empty_cart_request(), grpcbox_client:options()) -> + {ok, ffs_demo_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +empty_cart(Ctx, Input, Options) -> + grpcbox_client:unary(Ctx, <<"/hipstershop.CartService/EmptyCart">>, Input, ?DEF(empty_cart_request, empty, <<"hipstershop.EmptyCartRequest">>), Options). + diff --git a/src/featureflagservice/src/hipstershop_checkout_service_bhvr.erl b/src/featureflagservice/src/hipstershop_checkout_service_bhvr.erl new file mode 100644 index 0000000000..8e2ffdc139 --- /dev/null +++ b/src/featureflagservice/src/hipstershop_checkout_service_bhvr.erl @@ -0,0 +1,13 @@ +%%%------------------------------------------------------------------- +%% @doc Behaviour to implement for grpc service hipstershop.CheckoutService. +%% @end +%%%------------------------------------------------------------------- + +%% this module was generated and should not be modified manually + +-module(hipstershop_checkout_service_bhvr). + +%% Unary RPC +-callback place_order(ctx:t(), ffs_demo_pb:place_order_request()) -> + {ok, ffs_demo_pb:place_order_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). + diff --git a/src/featureflagservice/src/hipstershop_checkout_service_client.erl b/src/featureflagservice/src/hipstershop_checkout_service_client.erl new file mode 100644 index 0000000000..fa71ec8d5a --- /dev/null +++ b/src/featureflagservice/src/hipstershop_checkout_service_client.erl @@ -0,0 +1,43 @@ +%%%------------------------------------------------------------------- +%% @doc Client module for grpc service hipstershop.CheckoutService. +%% @end +%%%------------------------------------------------------------------- + +%% this module was generated and should not be modified manually + +-module(hipstershop_checkout_service_client). + +-compile(export_all). +-compile(nowarn_export_all). + +-include_lib("grpcbox/include/grpcbox.hrl"). + +-define(is_ctx(Ctx), is_tuple(Ctx) andalso element(1, Ctx) =:= ctx). + +-define(SERVICE, 'hipstershop.CheckoutService'). +-define(PROTO_MODULE, 'ffs_demo_pb'). +-define(MARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:encode_msg(I, T) end). +-define(UNMARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:decode_msg(I, T) end). +-define(DEF(Input, Output, MessageType), #grpcbox_def{service=?SERVICE, + message_type=MessageType, + marshal_fun=?MARSHAL_FUN(Input), + unmarshal_fun=?UNMARSHAL_FUN(Output)}). + +%% @doc Unary RPC +-spec place_order(ffs_demo_pb:place_order_request()) -> + {ok, ffs_demo_pb:place_order_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +place_order(Input) -> + place_order(ctx:new(), Input, #{}). + +-spec place_order(ctx:t() | ffs_demo_pb:place_order_request(), ffs_demo_pb:place_order_request() | grpcbox_client:options()) -> + {ok, ffs_demo_pb:place_order_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +place_order(Ctx, Input) when ?is_ctx(Ctx) -> + place_order(Ctx, Input, #{}); +place_order(Input, Options) -> + place_order(ctx:new(), Input, Options). + +-spec place_order(ctx:t(), ffs_demo_pb:place_order_request(), grpcbox_client:options()) -> + {ok, ffs_demo_pb:place_order_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +place_order(Ctx, Input, Options) -> + grpcbox_client:unary(Ctx, <<"/hipstershop.CheckoutService/PlaceOrder">>, Input, ?DEF(place_order_request, place_order_response, <<"hipstershop.PlaceOrderRequest">>), Options). + diff --git a/src/featureflagservice/src/hipstershop_currency_service_bhvr.erl b/src/featureflagservice/src/hipstershop_currency_service_bhvr.erl new file mode 100644 index 0000000000..3d5d99683a --- /dev/null +++ b/src/featureflagservice/src/hipstershop_currency_service_bhvr.erl @@ -0,0 +1,17 @@ +%%%------------------------------------------------------------------- +%% @doc Behaviour to implement for grpc service hipstershop.CurrencyService. +%% @end +%%%------------------------------------------------------------------- + +%% this module was generated and should not be modified manually + +-module(hipstershop_currency_service_bhvr). + +%% Unary RPC +-callback get_supported_currencies(ctx:t(), ffs_demo_pb:empty()) -> + {ok, ffs_demo_pb:get_supported_currencies_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). + +%% Unary RPC +-callback convert(ctx:t(), ffs_demo_pb:currency_conversion_request()) -> + {ok, ffs_demo_pb:money(), ctx:t()} | grpcbox_stream:grpc_error_response(). + diff --git a/src/featureflagservice/src/hipstershop_currency_service_client.erl b/src/featureflagservice/src/hipstershop_currency_service_client.erl new file mode 100644 index 0000000000..280e6aa394 --- /dev/null +++ b/src/featureflagservice/src/hipstershop_currency_service_client.erl @@ -0,0 +1,61 @@ +%%%------------------------------------------------------------------- +%% @doc Client module for grpc service hipstershop.CurrencyService. +%% @end +%%%------------------------------------------------------------------- + +%% this module was generated and should not be modified manually + +-module(hipstershop_currency_service_client). + +-compile(export_all). +-compile(nowarn_export_all). + +-include_lib("grpcbox/include/grpcbox.hrl"). + +-define(is_ctx(Ctx), is_tuple(Ctx) andalso element(1, Ctx) =:= ctx). + +-define(SERVICE, 'hipstershop.CurrencyService'). +-define(PROTO_MODULE, 'ffs_demo_pb'). +-define(MARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:encode_msg(I, T) end). +-define(UNMARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:decode_msg(I, T) end). +-define(DEF(Input, Output, MessageType), #grpcbox_def{service=?SERVICE, + message_type=MessageType, + marshal_fun=?MARSHAL_FUN(Input), + unmarshal_fun=?UNMARSHAL_FUN(Output)}). + +%% @doc Unary RPC +-spec get_supported_currencies(ffs_demo_pb:empty()) -> + {ok, ffs_demo_pb:get_supported_currencies_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +get_supported_currencies(Input) -> + get_supported_currencies(ctx:new(), Input, #{}). + +-spec get_supported_currencies(ctx:t() | ffs_demo_pb:empty(), ffs_demo_pb:empty() | grpcbox_client:options()) -> + {ok, ffs_demo_pb:get_supported_currencies_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +get_supported_currencies(Ctx, Input) when ?is_ctx(Ctx) -> + get_supported_currencies(Ctx, Input, #{}); +get_supported_currencies(Input, Options) -> + get_supported_currencies(ctx:new(), Input, Options). + +-spec get_supported_currencies(ctx:t(), ffs_demo_pb:empty(), grpcbox_client:options()) -> + {ok, ffs_demo_pb:get_supported_currencies_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +get_supported_currencies(Ctx, Input, Options) -> + grpcbox_client:unary(Ctx, <<"/hipstershop.CurrencyService/GetSupportedCurrencies">>, Input, ?DEF(empty, get_supported_currencies_response, <<"hipstershop.Empty">>), Options). + +%% @doc Unary RPC +-spec convert(ffs_demo_pb:currency_conversion_request()) -> + {ok, ffs_demo_pb:money(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +convert(Input) -> + convert(ctx:new(), Input, #{}). + +-spec convert(ctx:t() | ffs_demo_pb:currency_conversion_request(), ffs_demo_pb:currency_conversion_request() | grpcbox_client:options()) -> + {ok, ffs_demo_pb:money(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +convert(Ctx, Input) when ?is_ctx(Ctx) -> + convert(Ctx, Input, #{}); +convert(Input, Options) -> + convert(ctx:new(), Input, Options). + +-spec convert(ctx:t(), ffs_demo_pb:currency_conversion_request(), grpcbox_client:options()) -> + {ok, ffs_demo_pb:money(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +convert(Ctx, Input, Options) -> + grpcbox_client:unary(Ctx, <<"/hipstershop.CurrencyService/Convert">>, Input, ?DEF(currency_conversion_request, money, <<"hipstershop.CurrencyConversionRequest">>), Options). + diff --git a/src/featureflagservice/src/hipstershop_email_service_bhvr.erl b/src/featureflagservice/src/hipstershop_email_service_bhvr.erl new file mode 100644 index 0000000000..4250ec1d5b --- /dev/null +++ b/src/featureflagservice/src/hipstershop_email_service_bhvr.erl @@ -0,0 +1,13 @@ +%%%------------------------------------------------------------------- +%% @doc Behaviour to implement for grpc service hipstershop.EmailService. +%% @end +%%%------------------------------------------------------------------- + +%% this module was generated and should not be modified manually + +-module(hipstershop_email_service_bhvr). + +%% Unary RPC +-callback send_order_confirmation(ctx:t(), ffs_demo_pb:send_order_confirmation_request()) -> + {ok, ffs_demo_pb:empty(), ctx:t()} | grpcbox_stream:grpc_error_response(). + diff --git a/src/featureflagservice/src/hipstershop_email_service_client.erl b/src/featureflagservice/src/hipstershop_email_service_client.erl new file mode 100644 index 0000000000..2105c0cb67 --- /dev/null +++ b/src/featureflagservice/src/hipstershop_email_service_client.erl @@ -0,0 +1,43 @@ +%%%------------------------------------------------------------------- +%% @doc Client module for grpc service hipstershop.EmailService. +%% @end +%%%------------------------------------------------------------------- + +%% this module was generated and should not be modified manually + +-module(hipstershop_email_service_client). + +-compile(export_all). +-compile(nowarn_export_all). + +-include_lib("grpcbox/include/grpcbox.hrl"). + +-define(is_ctx(Ctx), is_tuple(Ctx) andalso element(1, Ctx) =:= ctx). + +-define(SERVICE, 'hipstershop.EmailService'). +-define(PROTO_MODULE, 'ffs_demo_pb'). +-define(MARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:encode_msg(I, T) end). +-define(UNMARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:decode_msg(I, T) end). +-define(DEF(Input, Output, MessageType), #grpcbox_def{service=?SERVICE, + message_type=MessageType, + marshal_fun=?MARSHAL_FUN(Input), + unmarshal_fun=?UNMARSHAL_FUN(Output)}). + +%% @doc Unary RPC +-spec send_order_confirmation(ffs_demo_pb:send_order_confirmation_request()) -> + {ok, ffs_demo_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +send_order_confirmation(Input) -> + send_order_confirmation(ctx:new(), Input, #{}). + +-spec send_order_confirmation(ctx:t() | ffs_demo_pb:send_order_confirmation_request(), ffs_demo_pb:send_order_confirmation_request() | grpcbox_client:options()) -> + {ok, ffs_demo_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +send_order_confirmation(Ctx, Input) when ?is_ctx(Ctx) -> + send_order_confirmation(Ctx, Input, #{}); +send_order_confirmation(Input, Options) -> + send_order_confirmation(ctx:new(), Input, Options). + +-spec send_order_confirmation(ctx:t(), ffs_demo_pb:send_order_confirmation_request(), grpcbox_client:options()) -> + {ok, ffs_demo_pb:empty(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +send_order_confirmation(Ctx, Input, Options) -> + grpcbox_client:unary(Ctx, <<"/hipstershop.EmailService/SendOrderConfirmation">>, Input, ?DEF(send_order_confirmation_request, empty, <<"hipstershop.SendOrderConfirmationRequest">>), Options). + diff --git a/src/featureflagservice/src/hipstershop_payment_service_bhvr.erl b/src/featureflagservice/src/hipstershop_payment_service_bhvr.erl new file mode 100644 index 0000000000..fca88e3960 --- /dev/null +++ b/src/featureflagservice/src/hipstershop_payment_service_bhvr.erl @@ -0,0 +1,13 @@ +%%%------------------------------------------------------------------- +%% @doc Behaviour to implement for grpc service hipstershop.PaymentService. +%% @end +%%%------------------------------------------------------------------- + +%% this module was generated and should not be modified manually + +-module(hipstershop_payment_service_bhvr). + +%% Unary RPC +-callback charge(ctx:t(), ffs_demo_pb:charge_request()) -> + {ok, ffs_demo_pb:charge_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). + diff --git a/src/featureflagservice/src/hipstershop_payment_service_client.erl b/src/featureflagservice/src/hipstershop_payment_service_client.erl new file mode 100644 index 0000000000..77e0a048f9 --- /dev/null +++ b/src/featureflagservice/src/hipstershop_payment_service_client.erl @@ -0,0 +1,43 @@ +%%%------------------------------------------------------------------- +%% @doc Client module for grpc service hipstershop.PaymentService. +%% @end +%%%------------------------------------------------------------------- + +%% this module was generated and should not be modified manually + +-module(hipstershop_payment_service_client). + +-compile(export_all). +-compile(nowarn_export_all). + +-include_lib("grpcbox/include/grpcbox.hrl"). + +-define(is_ctx(Ctx), is_tuple(Ctx) andalso element(1, Ctx) =:= ctx). + +-define(SERVICE, 'hipstershop.PaymentService'). +-define(PROTO_MODULE, 'ffs_demo_pb'). +-define(MARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:encode_msg(I, T) end). +-define(UNMARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:decode_msg(I, T) end). +-define(DEF(Input, Output, MessageType), #grpcbox_def{service=?SERVICE, + message_type=MessageType, + marshal_fun=?MARSHAL_FUN(Input), + unmarshal_fun=?UNMARSHAL_FUN(Output)}). + +%% @doc Unary RPC +-spec charge(ffs_demo_pb:charge_request()) -> + {ok, ffs_demo_pb:charge_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +charge(Input) -> + charge(ctx:new(), Input, #{}). + +-spec charge(ctx:t() | ffs_demo_pb:charge_request(), ffs_demo_pb:charge_request() | grpcbox_client:options()) -> + {ok, ffs_demo_pb:charge_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +charge(Ctx, Input) when ?is_ctx(Ctx) -> + charge(Ctx, Input, #{}); +charge(Input, Options) -> + charge(ctx:new(), Input, Options). + +-spec charge(ctx:t(), ffs_demo_pb:charge_request(), grpcbox_client:options()) -> + {ok, ffs_demo_pb:charge_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +charge(Ctx, Input, Options) -> + grpcbox_client:unary(Ctx, <<"/hipstershop.PaymentService/Charge">>, Input, ?DEF(charge_request, charge_response, <<"hipstershop.ChargeRequest">>), Options). + diff --git a/src/featureflagservice/src/hipstershop_product_catalog_service_bhvr.erl b/src/featureflagservice/src/hipstershop_product_catalog_service_bhvr.erl new file mode 100644 index 0000000000..b73a380174 --- /dev/null +++ b/src/featureflagservice/src/hipstershop_product_catalog_service_bhvr.erl @@ -0,0 +1,21 @@ +%%%------------------------------------------------------------------- +%% @doc Behaviour to implement for grpc service hipstershop.ProductCatalogService. +%% @end +%%%------------------------------------------------------------------- + +%% this module was generated and should not be modified manually + +-module(hipstershop_product_catalog_service_bhvr). + +%% Unary RPC +-callback list_products(ctx:t(), ffs_demo_pb:empty()) -> + {ok, ffs_demo_pb:list_products_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). + +%% Unary RPC +-callback get_product(ctx:t(), ffs_demo_pb:get_product_request()) -> + {ok, ffs_demo_pb:product(), ctx:t()} | grpcbox_stream:grpc_error_response(). + +%% Unary RPC +-callback search_products(ctx:t(), ffs_demo_pb:search_products_request()) -> + {ok, ffs_demo_pb:search_products_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). + diff --git a/src/featureflagservice/src/hipstershop_product_catalog_service_client.erl b/src/featureflagservice/src/hipstershop_product_catalog_service_client.erl new file mode 100644 index 0000000000..0f0224ee91 --- /dev/null +++ b/src/featureflagservice/src/hipstershop_product_catalog_service_client.erl @@ -0,0 +1,79 @@ +%%%------------------------------------------------------------------- +%% @doc Client module for grpc service hipstershop.ProductCatalogService. +%% @end +%%%------------------------------------------------------------------- + +%% this module was generated and should not be modified manually + +-module(hipstershop_product_catalog_service_client). + +-compile(export_all). +-compile(nowarn_export_all). + +-include_lib("grpcbox/include/grpcbox.hrl"). + +-define(is_ctx(Ctx), is_tuple(Ctx) andalso element(1, Ctx) =:= ctx). + +-define(SERVICE, 'hipstershop.ProductCatalogService'). +-define(PROTO_MODULE, 'ffs_demo_pb'). +-define(MARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:encode_msg(I, T) end). +-define(UNMARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:decode_msg(I, T) end). +-define(DEF(Input, Output, MessageType), #grpcbox_def{service=?SERVICE, + message_type=MessageType, + marshal_fun=?MARSHAL_FUN(Input), + unmarshal_fun=?UNMARSHAL_FUN(Output)}). + +%% @doc Unary RPC +-spec list_products(ffs_demo_pb:empty()) -> + {ok, ffs_demo_pb:list_products_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +list_products(Input) -> + list_products(ctx:new(), Input, #{}). + +-spec list_products(ctx:t() | ffs_demo_pb:empty(), ffs_demo_pb:empty() | grpcbox_client:options()) -> + {ok, ffs_demo_pb:list_products_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +list_products(Ctx, Input) when ?is_ctx(Ctx) -> + list_products(Ctx, Input, #{}); +list_products(Input, Options) -> + list_products(ctx:new(), Input, Options). + +-spec list_products(ctx:t(), ffs_demo_pb:empty(), grpcbox_client:options()) -> + {ok, ffs_demo_pb:list_products_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +list_products(Ctx, Input, Options) -> + grpcbox_client:unary(Ctx, <<"/hipstershop.ProductCatalogService/ListProducts">>, Input, ?DEF(empty, list_products_response, <<"hipstershop.Empty">>), Options). + +%% @doc Unary RPC +-spec get_product(ffs_demo_pb:get_product_request()) -> + {ok, ffs_demo_pb:product(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +get_product(Input) -> + get_product(ctx:new(), Input, #{}). + +-spec get_product(ctx:t() | ffs_demo_pb:get_product_request(), ffs_demo_pb:get_product_request() | grpcbox_client:options()) -> + {ok, ffs_demo_pb:product(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +get_product(Ctx, Input) when ?is_ctx(Ctx) -> + get_product(Ctx, Input, #{}); +get_product(Input, Options) -> + get_product(ctx:new(), Input, Options). + +-spec get_product(ctx:t(), ffs_demo_pb:get_product_request(), grpcbox_client:options()) -> + {ok, ffs_demo_pb:product(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +get_product(Ctx, Input, Options) -> + grpcbox_client:unary(Ctx, <<"/hipstershop.ProductCatalogService/GetProduct">>, Input, ?DEF(get_product_request, product, <<"hipstershop.GetProductRequest">>), Options). + +%% @doc Unary RPC +-spec search_products(ffs_demo_pb:search_products_request()) -> + {ok, ffs_demo_pb:search_products_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +search_products(Input) -> + search_products(ctx:new(), Input, #{}). + +-spec search_products(ctx:t() | ffs_demo_pb:search_products_request(), ffs_demo_pb:search_products_request() | grpcbox_client:options()) -> + {ok, ffs_demo_pb:search_products_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +search_products(Ctx, Input) when ?is_ctx(Ctx) -> + search_products(Ctx, Input, #{}); +search_products(Input, Options) -> + search_products(ctx:new(), Input, Options). + +-spec search_products(ctx:t(), ffs_demo_pb:search_products_request(), grpcbox_client:options()) -> + {ok, ffs_demo_pb:search_products_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +search_products(Ctx, Input, Options) -> + grpcbox_client:unary(Ctx, <<"/hipstershop.ProductCatalogService/SearchProducts">>, Input, ?DEF(search_products_request, search_products_response, <<"hipstershop.SearchProductsRequest">>), Options). + diff --git a/src/featureflagservice/src/hipstershop_recommendation_service_bhvr.erl b/src/featureflagservice/src/hipstershop_recommendation_service_bhvr.erl new file mode 100644 index 0000000000..9dd19766c0 --- /dev/null +++ b/src/featureflagservice/src/hipstershop_recommendation_service_bhvr.erl @@ -0,0 +1,13 @@ +%%%------------------------------------------------------------------- +%% @doc Behaviour to implement for grpc service hipstershop.RecommendationService. +%% @end +%%%------------------------------------------------------------------- + +%% this module was generated and should not be modified manually + +-module(hipstershop_recommendation_service_bhvr). + +%% Unary RPC +-callback list_recommendations(ctx:t(), ffs_demo_pb:list_recommendations_request()) -> + {ok, ffs_demo_pb:list_recommendations_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). + diff --git a/src/featureflagservice/src/hipstershop_recommendation_service_client.erl b/src/featureflagservice/src/hipstershop_recommendation_service_client.erl new file mode 100644 index 0000000000..50942df90d --- /dev/null +++ b/src/featureflagservice/src/hipstershop_recommendation_service_client.erl @@ -0,0 +1,43 @@ +%%%------------------------------------------------------------------- +%% @doc Client module for grpc service hipstershop.RecommendationService. +%% @end +%%%------------------------------------------------------------------- + +%% this module was generated and should not be modified manually + +-module(hipstershop_recommendation_service_client). + +-compile(export_all). +-compile(nowarn_export_all). + +-include_lib("grpcbox/include/grpcbox.hrl"). + +-define(is_ctx(Ctx), is_tuple(Ctx) andalso element(1, Ctx) =:= ctx). + +-define(SERVICE, 'hipstershop.RecommendationService'). +-define(PROTO_MODULE, 'ffs_demo_pb'). +-define(MARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:encode_msg(I, T) end). +-define(UNMARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:decode_msg(I, T) end). +-define(DEF(Input, Output, MessageType), #grpcbox_def{service=?SERVICE, + message_type=MessageType, + marshal_fun=?MARSHAL_FUN(Input), + unmarshal_fun=?UNMARSHAL_FUN(Output)}). + +%% @doc Unary RPC +-spec list_recommendations(ffs_demo_pb:list_recommendations_request()) -> + {ok, ffs_demo_pb:list_recommendations_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +list_recommendations(Input) -> + list_recommendations(ctx:new(), Input, #{}). + +-spec list_recommendations(ctx:t() | ffs_demo_pb:list_recommendations_request(), ffs_demo_pb:list_recommendations_request() | grpcbox_client:options()) -> + {ok, ffs_demo_pb:list_recommendations_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +list_recommendations(Ctx, Input) when ?is_ctx(Ctx) -> + list_recommendations(Ctx, Input, #{}); +list_recommendations(Input, Options) -> + list_recommendations(ctx:new(), Input, Options). + +-spec list_recommendations(ctx:t(), ffs_demo_pb:list_recommendations_request(), grpcbox_client:options()) -> + {ok, ffs_demo_pb:list_recommendations_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +list_recommendations(Ctx, Input, Options) -> + grpcbox_client:unary(Ctx, <<"/hipstershop.RecommendationService/ListRecommendations">>, Input, ?DEF(list_recommendations_request, list_recommendations_response, <<"hipstershop.ListRecommendationsRequest">>), Options). + diff --git a/src/featureflagservice/src/hipstershop_shipping_service_bhvr.erl b/src/featureflagservice/src/hipstershop_shipping_service_bhvr.erl new file mode 100644 index 0000000000..9b67654154 --- /dev/null +++ b/src/featureflagservice/src/hipstershop_shipping_service_bhvr.erl @@ -0,0 +1,17 @@ +%%%------------------------------------------------------------------- +%% @doc Behaviour to implement for grpc service hipstershop.ShippingService. +%% @end +%%%------------------------------------------------------------------- + +%% this module was generated and should not be modified manually + +-module(hipstershop_shipping_service_bhvr). + +%% Unary RPC +-callback get_quote(ctx:t(), ffs_demo_pb:get_quote_request()) -> + {ok, ffs_demo_pb:get_quote_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). + +%% Unary RPC +-callback ship_order(ctx:t(), ffs_demo_pb:ship_order_request()) -> + {ok, ffs_demo_pb:ship_order_response(), ctx:t()} | grpcbox_stream:grpc_error_response(). + diff --git a/src/featureflagservice/src/hipstershop_shipping_service_client.erl b/src/featureflagservice/src/hipstershop_shipping_service_client.erl new file mode 100644 index 0000000000..913cde7d88 --- /dev/null +++ b/src/featureflagservice/src/hipstershop_shipping_service_client.erl @@ -0,0 +1,61 @@ +%%%------------------------------------------------------------------- +%% @doc Client module for grpc service hipstershop.ShippingService. +%% @end +%%%------------------------------------------------------------------- + +%% this module was generated and should not be modified manually + +-module(hipstershop_shipping_service_client). + +-compile(export_all). +-compile(nowarn_export_all). + +-include_lib("grpcbox/include/grpcbox.hrl"). + +-define(is_ctx(Ctx), is_tuple(Ctx) andalso element(1, Ctx) =:= ctx). + +-define(SERVICE, 'hipstershop.ShippingService'). +-define(PROTO_MODULE, 'ffs_demo_pb'). +-define(MARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:encode_msg(I, T) end). +-define(UNMARSHAL_FUN(T), fun(I) -> ?PROTO_MODULE:decode_msg(I, T) end). +-define(DEF(Input, Output, MessageType), #grpcbox_def{service=?SERVICE, + message_type=MessageType, + marshal_fun=?MARSHAL_FUN(Input), + unmarshal_fun=?UNMARSHAL_FUN(Output)}). + +%% @doc Unary RPC +-spec get_quote(ffs_demo_pb:get_quote_request()) -> + {ok, ffs_demo_pb:get_quote_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +get_quote(Input) -> + get_quote(ctx:new(), Input, #{}). + +-spec get_quote(ctx:t() | ffs_demo_pb:get_quote_request(), ffs_demo_pb:get_quote_request() | grpcbox_client:options()) -> + {ok, ffs_demo_pb:get_quote_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +get_quote(Ctx, Input) when ?is_ctx(Ctx) -> + get_quote(Ctx, Input, #{}); +get_quote(Input, Options) -> + get_quote(ctx:new(), Input, Options). + +-spec get_quote(ctx:t(), ffs_demo_pb:get_quote_request(), grpcbox_client:options()) -> + {ok, ffs_demo_pb:get_quote_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +get_quote(Ctx, Input, Options) -> + grpcbox_client:unary(Ctx, <<"/hipstershop.ShippingService/GetQuote">>, Input, ?DEF(get_quote_request, get_quote_response, <<"hipstershop.GetQuoteRequest">>), Options). + +%% @doc Unary RPC +-spec ship_order(ffs_demo_pb:ship_order_request()) -> + {ok, ffs_demo_pb:ship_order_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +ship_order(Input) -> + ship_order(ctx:new(), Input, #{}). + +-spec ship_order(ctx:t() | ffs_demo_pb:ship_order_request(), ffs_demo_pb:ship_order_request() | grpcbox_client:options()) -> + {ok, ffs_demo_pb:ship_order_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +ship_order(Ctx, Input) when ?is_ctx(Ctx) -> + ship_order(Ctx, Input, #{}); +ship_order(Input, Options) -> + ship_order(ctx:new(), Input, Options). + +-spec ship_order(ctx:t(), ffs_demo_pb:ship_order_request(), grpcbox_client:options()) -> + {ok, ffs_demo_pb:ship_order_response(), grpcbox:metadata()} | grpcbox_stream:grpc_error_response() | {error, any()}. +ship_order(Ctx, Input, Options) -> + grpcbox_client:unary(Ctx, <<"/hipstershop.ShippingService/ShipOrder">>, Input, ?DEF(ship_order_request, ship_order_response, <<"hipstershop.ShipOrderRequest">>), Options). +