Fix API communication issues
This commit is contained in:
parent
25c320bf6b
commit
0923b55430
2 changed files with 14 additions and 10 deletions
|
@ -9,14 +9,14 @@ namespace Website.Data
|
|||
public BlogApi(HttpClient client) : base(client) {
|
||||
}
|
||||
|
||||
public async Task<BlogPost> GetPostByUrlAsync(string url) => await Get<BlogPost>("/get/" + url);
|
||||
public async Task<IEnumerable<BlogPost>> GetLatestPostsAsync(int count = 0, int offset = 0) => await Get<IEnumerable<BlogPost>>("/getlatestposts", new{count, offset});
|
||||
public async Task<BlogPost> GetLatestPostAsync() => await Get<BlogPost>("/getlatestpost");
|
||||
public async Task<int> GetCountAsync() => await Get<int>("/getcount");
|
||||
public async Task<BlogPost> GetPostByIdAsync(int id) => await Get<BlogPost>("/get/" + id);
|
||||
public async Task<BlogPost> SavePost(BlogPostSubmission post) => await Post<BlogPost>("/savepost", post);
|
||||
public async Task<IEnumerable<BlogPost>> GetAllPostsAsync() => await Get<IEnumerable<BlogPost>>("/getallposts");
|
||||
public async Task DeletePostAsync(int id) => await Post<object>("/deletepost", id);
|
||||
public async Task PublishPostAsync(int id) => await Post<object>("/publishpost", id);
|
||||
public async Task<BlogPost> GetPostByUrlAsync(string url) => await Get<BlogPost>("get/" + url);
|
||||
public async Task<IEnumerable<BlogPost>> GetLatestPostsAsync(int count = 0, int offset = 0) => await Get<IEnumerable<BlogPost>>("getlatestposts", new{count, offset});
|
||||
public async Task<BlogPost> GetLatestPostAsync() => await Get<BlogPost>("getlatestpost");
|
||||
public async Task<int> GetCountAsync() => await Get<int>("getcount");
|
||||
public async Task<BlogPost> GetPostByIdAsync(int id) => await Get<BlogPost>("get/" + id);
|
||||
public async Task<BlogPost> SavePost(BlogPostSubmission post) => await Post<BlogPost>("savepost", post);
|
||||
public async Task<IEnumerable<BlogPost>> GetAllPostsAsync() => await Get<IEnumerable<BlogPost>>("getallposts");
|
||||
public async Task DeletePostAsync(int id) => await Post<object>("deletepost", id);
|
||||
public async Task PublishPostAsync(int id) => await Post<object>("publishpost", id);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue