Example #1
0
        public async Task <PlayerUrlResponseModel> CreatePlayerUrlAsync(string playerID, PlayerUrlModel playerUrlModel)
        {
            if (string.IsNullOrWhiteSpace(playerID))
            {
                throw new NullReferenceException($"You need a player id to update this player");
            }

            if (playerUrlModel == null)
            {
                throw new ArgumentNullException(nameof(playerUrlModel), "PlayerUrlModel Object cannot be null");
            }

            var urlData = new UrlDataModel
            {
                Url = playerUrlModel
            };
            var result = await CreateActionAsync <UrlDataModel, PlayerUrlReadModel>($"/{playerID}/urls", urlData, null).ConfigureAwait(false);

            return(result?.Url ?? null);
        }
Example #2
0
        public async Task <PlayerUrlResponseModel> UpdatePlayerUrlAsync(string playerID, string id, PlayerUrlModel playerUrlModel)
        {
            if (string.IsNullOrWhiteSpace(playerID))
            {
                throw new NullReferenceException($"You need a player id to fetch this data");
            }
            if (string.IsNullOrWhiteSpace(id))
            {
                throw new NullReferenceException($"You need a url id to fetch this data");
            }
            if (playerUrlModel == null)
            {
                throw new ArgumentNullException(nameof(playerUrlModel), "PlayerUrlModel Object cannot be null");
            }

            var playerCreateModel = new PlayerUrlCreateModel
            {
                Url = playerUrlModel
            };

            var result = await PatchActionAsync <PlayerUrlCreateModel, PlayerUrlReadModel>($"/{playerID}/urls/{id}", playerCreateModel, null).ConfigureAwait(false);

            return(result?.Url ?? null);
        }