Example #1
0
 public async Task<GetPlayerSteamInventoryResponse> GetPlayerSteamInventoryAsync(string steamId, int appId, string contextId)
 {
     var request = new GetPlayerSteamInventoryRequest
     {
         SteamId = steamId,
         InventoryToFetch = new Inventory
         {
             AppId = appId,
             ContextId = contextId
         }
     };
     return await _steamServiceClient.GetPlayerSteamInventoryAsync(request);
 }
Example #2
0
        private async Task<GetPlayerSteamInventoryResponse> GetPlayerSteamInventory(string steamId, int appId, string contextId)
        {
            var req = new GetPlayerSteamInventoryRequest
            {
                SteamId = steamId,
                InventoryToFetch = new Inventory
                {
                    AppId = appId,
                    ContextId = contextId
                }
            };
            var playerSteamInvenotry = await _steamServiceClient.GetPlayerSteamInventoryAsync(req);

            if (playerSteamInvenotry.DataCase == GetPlayerSteamInventoryResponse.DataOneofCase.Error)
                throw new System.Exception(playerSteamInvenotry.Error.Message);
            return playerSteamInvenotry;
        }
Example #3
0
        public async Task <GetPlayerSteamInventoryResponse> GetPlayerSteamInventoryAsync(GetPlayerSteamInventoryRequest request)
        {
            var steamId = request.SteamId;

            if (_cacheManager.HasCache($"{steamId}:{request.InventoryToFetch.AppId}"))
            {
                return(_cacheManager.LookupCache($"{steamId}:{request.InventoryToFetch.AppId}"));
            }

            var inventoryResponse = await SendGrpcAction(async() =>
                                                         await _steamServiceClient.GetPlayerSteamInventoryAsync(request, DefaultSettings.GetDefaultSettings(30)));

            _cacheManager.AddToCache($"{steamId}:{request.InventoryToFetch.AppId}", inventoryResponse);
            return(inventoryResponse);
        }