public YRequest Create(string id, YLibrarySection section, YLibrarySectionType type = YLibrarySectionType.Likes)
        {
            Dictionary <string, string> body = new Dictionary <string, string> {
                { $"{section.ToString().ToLower().TrimEnd('s')}-ids", id }
            };

            List <KeyValuePair <string, string> > headers = new List <KeyValuePair <string, string> > {
                YRequestHeaders.Get(YHeader.ContentType, "application/x-www-form-urlencoded")
            };

            FormRequest($"{YEndpoints.API}/users/{storage.User.Uid}/{type.ToString().ToLower()}/{section.ToString().ToLower()}/remove",
                        WebRequestMethods.Http.Post, body: GetQueryString(body), headers: headers);

            return(this);
        }
        public YRequest Create(YLibrarySection section, YLibrarySectionType type = YLibrarySectionType.Likes)
        {
            FormRequest($"{YEndpoints.API}/users/{storage.User.Uid}/{type.ToString().ToLower()}/{section.ToString().ToLower()}");

            return(this);
        }
 /// <summary>
 /// Получение секции библиотеки
 /// </summary>
 /// <typeparam name="T">Тип объекта библиотеки</typeparam>
 /// <param name="storage">Хранилище</param>
 /// <param name="section">Секция</param>
 /// <param name="type">Тип</param>
 /// <returns>Список объектов из секции</returns>
 private async Task <YResponse <T> > GetLibrarySection <T>(AuthStorage storage, YLibrarySection section, YLibrarySectionType type = YLibrarySectionType.Likes)
 {
     return(await new YGetLibrarySectionRequest(api, storage)
            .Create(section, type)
            .GetResponseAsync <YResponse <T> >());
 }
Exemple #4
0
 /// <summary>
 /// Получение секции библиотеки
 /// </summary>
 /// <typeparam name="T">Тип объекта библиотеки</typeparam>
 /// <param name="storage">Хранилище</param>
 /// <param name="section">Секция</param>
 /// <param name="type">Тип</param>
 /// <returns>Список объектов из секции</returns>
 private async Task <List <T> > GetLibrarySection <T>(YAuthStorage storage, YLibrarySection section, YLibrarySectionType type = YLibrarySectionType.Likes, string jsonPath = "")
 {
     return(await new YGetLibrarySectionRequest(storage)
            .Create(section, type)
            .GetResponseAsyncList <T>(jsonPath));
 }