Esempio n. 1
0
        public static async Task <ApiResponse <PostSchema> > GetById(string token, int id)
        {
            var requestData = new
            {
                post_ids = new[]
                {
                    id
                }
            };

            var response = await ApiRequestEngine.ExecuteAnonymRequestJson <List <PostSchema> >("posts/getById", requestData, token)
                           .ConfigureAwait(false);

            var data = response.Data != null && response.Data.Count != 0
                ? response.Data[0]
                : null;

            return(new ApiResponse <PostSchema>
            {
                Code = response.Code,
                Data = data,
                IsError = response.IsError,
                Message = response.Message
            });
        }
Esempio n. 2
0
        public static async Task <ApiResponse <UserSchema> > GetUserById(int id)
        {
            var requestData = new
            {
                user_id = new[]
                {
                    id
                }
            };

            var response = await ApiRequestEngine.ExecuteAnonymRequestJson <List <UserSchema> >("users/getById", requestData)
                           .ConfigureAwait(false);

            var data = response.Data != null && response.Data.Count != 0
                ? response.Data[0]
                : null;

            return(new ApiResponse <UserSchema>
            {
                Code = response.Code,
                Data = data,
                IsError = response.IsError,
                Message = response.Message
            });
        }
Esempio n. 3
0
        public static Task <ApiResponse <CountSchema> > AddDislike(string token, int id)
        {
            var requestData = new
            {
                post_id = id
            };

            return(ApiRequestEngine.ExecuteAnonymRequestJson <CountSchema>("posts/dislikeAdd", requestData, token));
        }
Esempio n. 4
0
        public static Task <ApiResponse> AddRepost(string token, int id)
        {
            var requestData = new
            {
                post_id = id
            };

            return(ApiRequestEngine.ExecuteAnonymRequestJson("posts/repost", requestData, token));
        }
Esempio n. 5
0
        public static Task <ApiResponse> AddView(int id)
        {
            var requestData = new
            {
                post_id = id
            };

            return(ApiRequestEngine.ExecuteAnonymRequestJson("posts/viewAdd", requestData));
        }
Esempio n. 6
0
        public static Task <ApiResponse <List <PostCategorySchema> > > GetPostCategories()
        {
            var requestData = new
            {
                count = uint.MaxValue
            };

            return(ApiRequestEngine.ExecuteAnonymRequestJson <List <PostCategorySchema> >("posts/getCategories", requestData));
        }
Esempio n. 7
0
        public static Task <ApiResponse <CountSchema> > RemoveDislikeComment(string token, int id)
        {
            var requestData = new
            {
                comment_id = id
            };

            return(ApiRequestEngine.ExecuteAnonymRequestJson <CountSchema>("posts/dislikeCommentDelete", requestData, token));
        }
Esempio n. 8
0
        public static Task <ApiResponse <List <PostSchema> > > GetById(string token, int[] ids)
        {
            var requestData = new
            {
                post_ids = ids
            };

            return(ApiRequestEngine.ExecuteAnonymRequestJson <List <PostSchema> >("posts/getById", requestData, token));
        }
Esempio n. 9
0
        public static Task <ApiResponse <List <UserSchema> > > GetUserById(int[] ids)
        {
            var requestData = new
            {
                user_id = ids
            };

            return(ApiRequestEngine.ExecuteAnonymRequestJson <List <UserSchema> >("users/getById", requestData));
        }
Esempio n. 10
0
        public static Task <ApiResponse> RemoveComment(string token, int id)
        {
            var requestData = new
            {
                comment_id = id
            };

            return(ApiRequestEngine.ExecuteAnonymRequestJson("posts/removeComment", requestData, token));
        }
Esempio n. 11
0
        public static Task <ApiResponse> EditComment(string token, int id, string text)
        {
            var requestData = new
            {
                comment_id = id,
                text
            };

            return(ApiRequestEngine.ExecuteAnonymRequestJson("posts/editComment", requestData, token));
        }
Esempio n. 12
0
        public static Task <ApiResponse> ChangePassword(string token,
                                                        string oldPassword, string newPassword)
        {
            var requestData = new
            {
                oldPassword,
                newPassword
            };

            return(ApiRequestEngine.ExecuteAnonymRequestJson("users/changePassword", requestData, token));
        }
Esempio n. 13
0
        public static Task <ApiResponse <IdSchema> > AddComment(string token, int postId, string text, bool?anonymous = false)
        {
            var requestData = new
            {
                post_id = postId,
                text,
                anonim = Convert.ToInt32(anonymous)
            };

            return(ApiRequestEngine.ExecuteAnonymRequestJson <IdSchema>("posts/commentAdd", requestData, token));
        }
Esempio n. 14
0
        public static Task <ApiResponse <AuthSchema> > Login(string login,
                                                             string password)
        {
            var requestData = new
            {
                login,
                password
            };

            return(ApiRequestEngine.ExecuteAnonymRequestJson <AuthSchema>("users/login2", requestData));
        }
Esempio n. 15
0
        public static Task <ApiResponse <List <CommentSchema> > > GetComments(string token, int postId, int count = 20, int offset = 0)
        {
            var requestData = new
            {
                post_id = postId,
                count,
                offset
            };

            return(ApiRequestEngine.ExecuteAnonymRequestJson <List <CommentSchema> >("posts/getComments", requestData, token));
        }
Esempio n. 16
0
        public static Task <ApiResponse <List <SearchedUserSchema> > > GetUsers(int count  = 20,
                                                                                int offset = 0, int type = 0)
        {
            var requestData = new
            {
                type,
                count,
                offset
            };

            return(ApiRequestEngine.ExecuteAnonymRequestJson <List <SearchedUserSchema> >("users/get", requestData));
        }
Esempio n. 17
0
        public static Task <ApiResponse <List <PostSchema> > > Get(string token,
                                                                   PostType type = PostType.Popular, int count = 20, int offset = 0)
        {
            var requestData = new
            {
                type,
                count,
                offset
            };

            return(ApiRequestEngine.ExecuteAnonymRequestJson <List <PostSchema> >("posts/get", requestData, token));
        }
Esempio n. 18
0
        public static Task <ApiResponse <List <PostSchema> > > GetByUserId(string token,
                                                                           int userId, int count = 20, int offset = 0)
        {
            var requestData = new
            {
                user_id = userId,
                count,
                offset
            };

            return(ApiRequestEngine.ExecuteAnonymRequestJson <List <PostSchema> >("posts/getByUserId", requestData, token));
        }
Esempio n. 19
0
        public static async Task <ApiResponse <int?> > GetId(string token)
        {
            var response = await ApiRequestEngine.ExecuteAnonymRequestJson <IdSchema>("users/profile/get", null, token)
                           .ConfigureAwait(false);

            return(new ApiResponse <int?>
            {
                Code = response.Code,
                Data = response.Data?.Id,
                IsError = response.IsError,
                Message = response.Message
            });
        }
Esempio n. 20
0
        public static Task <ApiResponse <AuthSchema> > Register(string login,
                                                                string password, string nickname = null)
        {
            if (nickname == null)
            {
                nickname = login;
            }

            var requestData = new
            {
                login,
                password,
                name = nickname
            };

            return(ApiRequestEngine.ExecuteAnonymRequestJson <AuthSchema>("users/add", requestData));
        }
Esempio n. 21
0
 public static Task <ApiResponse <IdSchema> > Add(string token, PostSchema post)
 {
     return(ApiRequestEngine.ExecuteAnonymRequestJson <IdSchema>("posts/add", post, token));
 }
Esempio n. 22
0
 public static Task <ApiResponse> Edit(string token, PostEditSchema schema)
 {
     return(ApiRequestEngine.ExecuteAnonymRequestJson("posts/edit", schema, token));
 }
Esempio n. 23
0
 public static Task <ApiResponse> EditProfile(string token, ProfileSchema profileData)
 {
     return(ApiRequestEngine.ExecuteAnonymRequestJson("users/profile/set", profileData, token));
 }
Esempio n. 24
0
 public static Task <ApiResponse <List <LibraryPhotoSchema> > > GetLibraryPhotos()
 {
     return(ApiRequestEngine.ExecuteAnonymRequestJson <List <LibraryPhotoSchema> >(
                "getLibrary", null, null, RequestType.Get));
 }
Esempio n. 25
0
 public static Task <ApiResponse <RocketPasswordSchema> > GetRocketPassword(string token)
 {
     return(ApiRequestEngine.ExecuteAnonymRequestJson <RocketPasswordSchema>("users/getRocketPassword", null, token));
 }