Exemplo n.º 1
0
        public async Task <TraktList> Create(TraktList model)
        {
            await PrepareForApiRequest(model.Owner);

            var response = await _traktClient.Users.CreateCustomListAsync(
                "me",
                model.Name,
                $"{Constants.LIST_Description}\r\n\r\n{model.GetDescriptionText()}",
                TraktAccessScope.Public,
                false,
                false
                );

            if (!response.IsSuccess)
            {
                throw response.Exception;
            }

            model.Id            = response.Value.Ids.Trakt;
            model.Slug          = response.Value.Ids.Slug;
            model.LastProcessed = DateTime.Now;
            model.Process       = true;

            return(model);
        }
Exemplo n.º 2
0
        public async Task <TraktList> Update(TraktList model)
        {
            await PrepareForApiRequest(model.Owner);

            await _traktClient.Users.UpdateCustomListAsync(
                "me",
                model.Id.ToString(),
                model.Name,
                $"{Constants.LIST_Description}\r\n\r\n{model.GetDescriptionText()}",
                TraktAccessScope.Public,
                false,
                false
                );

            return(model);
        }