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 }); }
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 }); }
public static Task <ApiResponse <CountSchema> > AddDislike(string token, int id) { var requestData = new { post_id = id }; return(ApiRequestEngine.ExecuteAnonymRequestJson <CountSchema>("posts/dislikeAdd", requestData, token)); }
public static Task <ApiResponse> AddRepost(string token, int id) { var requestData = new { post_id = id }; return(ApiRequestEngine.ExecuteAnonymRequestJson("posts/repost", requestData, token)); }
public static Task <ApiResponse> AddView(int id) { var requestData = new { post_id = id }; return(ApiRequestEngine.ExecuteAnonymRequestJson("posts/viewAdd", requestData)); }
public static Task <ApiResponse <List <PostCategorySchema> > > GetPostCategories() { var requestData = new { count = uint.MaxValue }; return(ApiRequestEngine.ExecuteAnonymRequestJson <List <PostCategorySchema> >("posts/getCategories", requestData)); }
public static Task <ApiResponse <CountSchema> > RemoveDislikeComment(string token, int id) { var requestData = new { comment_id = id }; return(ApiRequestEngine.ExecuteAnonymRequestJson <CountSchema>("posts/dislikeCommentDelete", requestData, token)); }
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)); }
public static Task <ApiResponse <List <UserSchema> > > GetUserById(int[] ids) { var requestData = new { user_id = ids }; return(ApiRequestEngine.ExecuteAnonymRequestJson <List <UserSchema> >("users/getById", requestData)); }
public static Task <ApiResponse> RemoveComment(string token, int id) { var requestData = new { comment_id = id }; return(ApiRequestEngine.ExecuteAnonymRequestJson("posts/removeComment", requestData, token)); }
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)); }
public static Task <ApiResponse> ChangePassword(string token, string oldPassword, string newPassword) { var requestData = new { oldPassword, newPassword }; return(ApiRequestEngine.ExecuteAnonymRequestJson("users/changePassword", requestData, token)); }
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)); }
public static Task <ApiResponse <AuthSchema> > Login(string login, string password) { var requestData = new { login, password }; return(ApiRequestEngine.ExecuteAnonymRequestJson <AuthSchema>("users/login2", requestData)); }
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)); }
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)); }
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)); }
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)); }
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 }); }
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)); }
public static Task <ApiResponse <IdSchema> > Add(string token, PostSchema post) { return(ApiRequestEngine.ExecuteAnonymRequestJson <IdSchema>("posts/add", post, token)); }
public static Task <ApiResponse> Edit(string token, PostEditSchema schema) { return(ApiRequestEngine.ExecuteAnonymRequestJson("posts/edit", schema, token)); }
public static Task <ApiResponse> EditProfile(string token, ProfileSchema profileData) { return(ApiRequestEngine.ExecuteAnonymRequestJson("users/profile/set", profileData, token)); }
public static Task <ApiResponse <List <LibraryPhotoSchema> > > GetLibraryPhotos() { return(ApiRequestEngine.ExecuteAnonymRequestJson <List <LibraryPhotoSchema> >( "getLibrary", null, null, RequestType.Get)); }
public static Task <ApiResponse <RocketPasswordSchema> > GetRocketPassword(string token) { return(ApiRequestEngine.ExecuteAnonymRequestJson <RocketPasswordSchema>("users/getRocketPassword", null, token)); }