@@ -772,4 +772,319 @@ public LootLockerInlinedCatalogEntry[] GetLootLockerInlinedCatalogEntries()
772772 return inlinedEntries . ToArray ( ) ;
773773 }
774774 }
775+
776+ /// <summary>
777+ /// </summary>
778+ public class LootLockerListCatalogPricesV2Response : LootLockerResponse
779+ {
780+ /// <summary>
781+ /// Details about the catalog that the prices is in
782+ /// </summary>
783+ public LootLockerCatalog catalog { get ; set ; }
784+
785+ /// <summary>
786+ /// A list of entries available in this catalog
787+ /// </summary>
788+ public LootLockerCatalogEntry [ ] entries { get ; set ; }
789+
790+ /// <summary>
791+ /// Lookup map for details about entities of entity type assets
792+ /// </summary>
793+ public Dictionary < LootLockerItemDetailsKey , LootLockerAssetDetails > asset_details { get ; set ; }
794+
795+ /// <summary>
796+ /// Lookup map for details about entities of entity type progression_points
797+ /// </summary>
798+ public Dictionary < LootLockerItemDetailsKey , LootLockerProgressionPointDetails > progression_points_details
799+ {
800+ get ;
801+ set ;
802+ }
803+
804+ /// <summary>
805+ /// Lookup map for details about entities of entity type progression_reset
806+ /// </summary>
807+ public Dictionary < LootLockerItemDetailsKey , LootLockerProgressionResetDetails > progression_resets_details
808+ {
809+ get ;
810+ set ;
811+ }
812+
813+ /// <summary>
814+ /// Lookup map for details about entities of entity type currency
815+ /// </summary>
816+ public Dictionary < LootLockerItemDetailsKey , LootLockerCurrencyDetails > currency_details { get ; set ; }
817+
818+ /// <summary>
819+ /// Lookup map for details about entities of entity type group
820+ /// </summary>
821+ public Dictionary < LootLockerItemDetailsKey , LootLockerGroupDetails > group_details { get ; set ; }
822+
823+ /// <summary>
824+ /// Pagination data to use for subsequent requests
825+ /// </summary>
826+ public LootLockerExtendedPagination pagination { get ; set ; }
827+
828+ public void AppendCatalogItems ( LootLockerListCatalogPricesV2Response catalogPrices )
829+ {
830+ var concatenatedArray = new LootLockerCatalogEntry [ entries . Length + catalogPrices . entries . Length ] ;
831+ entries . CopyTo ( concatenatedArray , 0 ) ;
832+ catalogPrices . entries . CopyTo ( concatenatedArray , entries . Length ) ;
833+ pagination . total = catalogPrices . pagination . total ;
834+ pagination . offset = catalogPrices . pagination . offset ;
835+ pagination . per_page = catalogPrices . pagination . per_page ;
836+ pagination . last_page = catalogPrices . pagination . last_page ;
837+ pagination . current_page = catalogPrices . pagination . current_page ;
838+ pagination . next_page = catalogPrices . pagination . next_page ;
839+ pagination . prev_page = catalogPrices . pagination . prev_page ;
840+ pagination . errors = catalogPrices . pagination . errors ;
841+
842+ foreach ( var assetDetail in catalogPrices . asset_details )
843+ {
844+ asset_details . Add ( assetDetail . Key , assetDetail . Value ) ;
845+ }
846+
847+ foreach ( var progressionPointDetail in catalogPrices . progression_points_details )
848+ {
849+ progression_points_details . Add ( progressionPointDetail . Key , progressionPointDetail . Value ) ;
850+ }
851+
852+ foreach ( var progressionResetDetail in catalogPrices . progression_resets_details )
853+ {
854+ progression_resets_details . Add ( progressionResetDetail . Key , progressionResetDetail . Value ) ;
855+ }
856+
857+ foreach ( var currencyDetail in catalogPrices . currency_details )
858+ {
859+ currency_details . Add ( currencyDetail . Key , currencyDetail . Value ) ;
860+ }
861+
862+ foreach ( var groupDetail in catalogPrices . group_details )
863+ {
864+ group_details . Add ( groupDetail . Key , groupDetail . Value ) ;
865+ }
866+
867+ }
868+
869+ public LootLockerListCatalogPricesV2Response ( ) { }
870+
871+ /// This is the way that the response actually looks, but we don't want to expose it, hence the conversion
872+ private class LootLockerListCatalogItemsWithArraysResponse : LootLockerResponse
873+ {
874+ public LootLockerCatalog catalog { get ; set ; }
875+ public LootLockerCatalogEntry [ ] entries { get ; set ; }
876+ public LootLockerAssetDetails [ ] assets_details { get ; set ; }
877+ public LootLockerProgressionPointDetails [ ] progression_points_details { get ; set ; }
878+ public LootLockerProgressionResetDetails [ ] progression_resets_details { get ; set ; }
879+ public LootLockerCurrencyDetails [ ] currency_details { get ; set ; }
880+ public LootLockerGroupDetails [ ] group_details { get ; set ; }
881+ public LootLockerExtendedPagination pagination { get ; set ; }
882+ }
883+
884+ public LootLockerListCatalogPricesV2Response ( LootLockerResponse serverResponse )
885+ {
886+ LootLockerListCatalogItemsWithArraysResponse parsedResponse =
887+ Deserialize < LootLockerListCatalogItemsWithArraysResponse > ( serverResponse ) ;
888+ success = parsedResponse . success ;
889+ statusCode = parsedResponse . statusCode ;
890+ text = parsedResponse . text ;
891+ errorData = parsedResponse . errorData ;
892+ if ( ! success )
893+ {
894+ return ;
895+ }
896+
897+ catalog = parsedResponse . catalog ;
898+ entries = parsedResponse . entries ;
899+ pagination = parsedResponse . pagination ;
900+
901+ if ( parsedResponse . assets_details != null && parsedResponse . assets_details . Length > 0 )
902+ {
903+ asset_details = new Dictionary < LootLockerItemDetailsKey , LootLockerAssetDetails > ( ) ;
904+ foreach ( var detail in parsedResponse . assets_details )
905+ {
906+ asset_details [ detail . GetItemDetailsKey ( ) ] = detail ;
907+ }
908+ }
909+
910+ if ( parsedResponse . progression_points_details != null &&
911+ parsedResponse . progression_points_details . Length > 0 )
912+ {
913+ progression_points_details = new Dictionary < LootLockerItemDetailsKey , LootLockerProgressionPointDetails > ( ) ;
914+ foreach ( var detail in parsedResponse . progression_points_details )
915+ {
916+ progression_points_details [ detail . GetItemDetailsKey ( ) ] = detail ;
917+ }
918+ }
919+
920+ if ( parsedResponse . progression_resets_details != null &&
921+ parsedResponse . progression_resets_details . Length > 0 )
922+ {
923+ progression_resets_details = new Dictionary < LootLockerItemDetailsKey , LootLockerProgressionResetDetails > ( ) ;
924+ foreach ( var detail in parsedResponse . progression_resets_details )
925+ {
926+ progression_resets_details [ detail . GetItemDetailsKey ( ) ] = detail ;
927+ }
928+ }
929+
930+ if ( parsedResponse . currency_details != null && parsedResponse . currency_details . Length > 0 )
931+ {
932+ currency_details = new Dictionary < LootLockerItemDetailsKey , LootLockerCurrencyDetails > ( ) ;
933+ foreach ( var detail in parsedResponse . currency_details )
934+ {
935+ currency_details [ detail . GetItemDetailsKey ( ) ] = detail ;
936+ }
937+ }
938+
939+ if ( parsedResponse . group_details != null && parsedResponse . group_details . Length > 0 )
940+ {
941+ group_details = new Dictionary < LootLockerItemDetailsKey , LootLockerGroupDetails > ( ) ;
942+ foreach ( var detail in parsedResponse . group_details )
943+ {
944+ group_details [ detail . GetItemDetailsKey ( ) ] = detail ;
945+ }
946+ }
947+ }
948+
949+ /// <summary>
950+ /// </summary>
951+ public class LootLockerInlinedCatalogEntry : LootLockerCatalogEntry
952+ {
953+
954+ /// <summary>
955+ /// Asset details inlined for this catalog entry, will be null if the entity_kind is not asset
956+ /// </summary>
957+ public LootLockerAssetDetails asset_details { get ; set ; }
958+
959+ /// <summary>
960+ /// Progression point details inlined for this catalog entry, will be null if the entity_kind is not progression_points
961+ /// </summary>
962+ public LootLockerProgressionPointDetails progression_point_details { get ; set ; }
963+
964+ /// <summary>
965+ /// Progression reset details inlined for this catalog entry, will be null if the entity_kind is not progression_reset
966+ /// </summary>
967+ public LootLockerProgressionResetDetails progression_reset_details { get ; set ; }
968+
969+ /// <summary>
970+ /// Currency details inlined for this catalog entry, will be null if the entity_kind is not currency
971+ /// </summary>
972+ public LootLockerCurrencyDetails currency_details { get ; set ; }
973+
974+ /// <summary>
975+ /// Group details inlined for this catalog entry, will be null if the entity_kind is not group
976+ /// </summary>
977+ public LootLockerInlinedGroupDetails group_details { get ; set ; }
978+
979+ public LootLockerInlinedCatalogEntry ( LootLockerCatalogEntry entry , LootLockerListCatalogPricesV2Response catalogListing )
980+ {
981+ created_at = entry . created_at ;
982+ entity_kind = entry . entity_kind ;
983+ entity_name = entry . entity_name ;
984+ entity_id = entry . entity_id ;
985+ listings = entry . listings ;
986+ prices = entry . prices ;
987+ catalog_listing_id = entry . catalog_listing_id ;
988+ purchasable = entry . purchasable ;
989+
990+ switch ( entity_kind )
991+ {
992+ case LootLockerCatalogEntryEntityKind . asset :
993+ if ( catalogListing . asset_details . ContainsKey ( entry . GetItemDetailsKey ( ) ) )
994+ {
995+ asset_details = catalogListing . asset_details [ entry . GetItemDetailsKey ( ) ] ;
996+ }
997+ break ;
998+ case LootLockerCatalogEntryEntityKind . currency :
999+ if ( catalogListing . currency_details . ContainsKey ( entry . GetItemDetailsKey ( ) ) )
1000+ {
1001+ currency_details = catalogListing . currency_details [ entry . GetItemDetailsKey ( ) ] ;
1002+ }
1003+ break ;
1004+ case LootLockerCatalogEntryEntityKind . progression_points :
1005+ if ( catalogListing . progression_points_details . ContainsKey ( entry . GetItemDetailsKey ( ) ) )
1006+ {
1007+ progression_point_details = catalogListing . progression_points_details [ entry . GetItemDetailsKey ( ) ] ;
1008+ }
1009+ break ;
1010+ case LootLockerCatalogEntryEntityKind . progression_reset :
1011+ if ( catalogListing . progression_resets_details . ContainsKey ( entry . GetItemDetailsKey ( ) ) )
1012+ {
1013+ progression_reset_details = catalogListing . progression_resets_details [ entry . GetItemDetailsKey ( ) ] ;
1014+ }
1015+ break ;
1016+ case LootLockerCatalogEntryEntityKind . group :
1017+ if ( ! catalogListing . group_details . ContainsKey ( entry . GetItemDetailsKey ( ) ) )
1018+ break ;
1019+
1020+ var catalogLevelGroup = catalogListing . group_details [ entry . GetItemDetailsKey ( ) ] ;
1021+
1022+ LootLockerInlinedGroupDetails inlinedGroupDetails = new LootLockerInlinedGroupDetails ( ) ;
1023+
1024+ inlinedGroupDetails . name = catalogLevelGroup . name ;
1025+ inlinedGroupDetails . description = catalogLevelGroup . description ;
1026+ inlinedGroupDetails . metadata = catalogLevelGroup . metadata ;
1027+ inlinedGroupDetails . id = catalogLevelGroup . id ;
1028+ inlinedGroupDetails . associations = catalogLevelGroup . associations ;
1029+
1030+ foreach ( var association in catalogLevelGroup . associations )
1031+ {
1032+ switch ( association . kind )
1033+ {
1034+ case LootLockerCatalogEntryEntityKind . asset :
1035+ if ( catalogListing . asset_details . ContainsKey ( association . GetItemDetailsKey ( ) ) )
1036+ {
1037+ inlinedGroupDetails . assetDetails . Add ( catalogListing . asset_details [ association . GetItemDetailsKey ( ) ] ) ;
1038+ }
1039+ break ;
1040+ case LootLockerCatalogEntryEntityKind . progression_points :
1041+ if ( catalogListing . progression_points_details . ContainsKey ( association . GetItemDetailsKey ( ) ) )
1042+ {
1043+ inlinedGroupDetails . progressionPointDetails . Add ( catalogListing . progression_points_details [ association . GetItemDetailsKey ( ) ] ) ;
1044+ }
1045+ break ;
1046+ case LootLockerCatalogEntryEntityKind . progression_reset :
1047+ if ( catalogListing . progression_resets_details . ContainsKey ( association . GetItemDetailsKey ( ) ) )
1048+ {
1049+ inlinedGroupDetails . progressionResetDetails . Add ( catalogListing . progression_resets_details [ association . GetItemDetailsKey ( ) ] ) ;
1050+ }
1051+ break ;
1052+ case LootLockerCatalogEntryEntityKind . currency :
1053+ if ( catalogListing . currency_details . ContainsKey ( association . GetItemDetailsKey ( ) ) )
1054+ {
1055+ inlinedGroupDetails . currencyDetails . Add ( catalogListing . currency_details [ association . GetItemDetailsKey ( ) ] ) ;
1056+ }
1057+ break ;
1058+ case LootLockerCatalogEntryEntityKind . group :
1059+ default :
1060+ break ;
1061+ }
1062+ }
1063+
1064+ group_details = inlinedGroupDetails ;
1065+
1066+ break ;
1067+ default :
1068+ break ;
1069+ }
1070+
1071+ }
1072+ }
1073+
1074+ /// <summary>
1075+ /// Get all the entries with details inlined into the entries themselves
1076+ /// </summary>
1077+ public LootLockerInlinedCatalogEntry [ ] GetLootLockerInlinedCatalogEntries ( )
1078+ {
1079+ List < LootLockerInlinedCatalogEntry > inlinedEntries = new List < LootLockerInlinedCatalogEntry > ( ) ;
1080+ foreach ( var lootLockerCatalogEntry in entries )
1081+ {
1082+ inlinedEntries . Add ( new LootLockerInlinedCatalogEntry (
1083+ lootLockerCatalogEntry ,
1084+ this
1085+ ) ) ;
1086+ }
1087+ return inlinedEntries . ToArray ( ) ;
1088+ }
1089+ }
7751090}
0 commit comments