Skip to content

Commit

Permalink
Added xml comments for all Public facing Members and methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Hariharan Subramanian committed Sep 18, 2019
1 parent f4b2e24 commit 7dc8250
Show file tree
Hide file tree
Showing 18 changed files with 449 additions and 75 deletions.
24 changes: 12 additions & 12 deletions Sample/ConsoleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using StackExchange.NET.Models;

namespace StackExchange.NET_Example
{
{
class Program
{
static void Main(string[] args)
Expand All @@ -17,14 +17,14 @@ static void Main(string[] args)
Page = 1,
Sort = Sort.Votes
};
var res = client.Answers.GetAllAnswers(null);
// var answers = client.Answers.GetAllAnswers(queryString);

// var answers = client.Answers.GetAllAnswers(queryString);
var ids = new List<string>()
{
"44164379","6841479"
};
//var answers = client.Answers.GetAnswerByIds(ids, queryString);
//var answers = client.Answers.GetCommentsByIds(ids, queryString);
//var answers = client.Answers.GetCommentsOnAnswers(ids, queryString);
//var answers = client.Answers.GetQuestionByAnswerIds(ids, queryString);

var badgeFilter = new BadgeFilters()
Expand All @@ -40,8 +40,8 @@ static void Main(string[] args)
//var getBadgesByIds = client.Badges.GetNonTaggedBadges(batchIds, badgeFilter);
//var getBadgesByIds = client.Badges.GetBadgesByIds(batchIds, badgeFilter);
//var getBadgesByIds = client.Badges.GetRecentlyAwardedBadges(badgeFilter);
// var getBadgesByIds = client.Badges.GetRecentlyAwardedBadgesByIds(batchIds, badgeFilter);

// var getBadgesByIds = client.Badges.GetRecentlyAwardedBadgesByIds(batchIds, badgeFilter);

//var getBadgesByIds = client.Badges.GetAllTaggedBadges(badgeFilter);
//Console.WriteLine(JsonConvert.SerializeObject(getBadgesByIds));
Expand All @@ -56,7 +56,7 @@ static void Main(string[] args)
{
"102165885", "102166303"
};
//var comments = client.Comments.GetCommentsByIds(commentIds,commentFilter);
//var comments = client.Comments.GetCommentsOnAnswers(commentIds,commentFilter);
//Console.WriteLine(JsonConvert.SerializeObject(comments));

var postFilter = new PostFilter()
Expand All @@ -75,12 +75,12 @@ static void Main(string[] args)

//var postsByIds = client.Posts.GetCommentsOnPosts(postIds, postFilter);

// var revisionByIds = client.Posts.GetRevisionsByIds(postIds, postFilter);
// var revisionByIds = client.Posts.GetRevisionsByIds(postIds, postFilter);

var suggestedEdits = client.Posts.GetSuggestedEdits(postIds, new SuggestedEditFilter()
{
Sort = PostSort.Creation
});
var suggestedEdits = client.Posts.GetSuggestedEdits(postIds, new SuggestedEditFilter()
{
Sort = PostSort.Creation
});

Console.WriteLine(JsonConvert.SerializeObject(suggestedEdits));
Console.ReadKey();
Expand Down
58 changes: 7 additions & 51 deletions StackExchange.NET/StackExchange.NET/Clients/Answers.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#region Using Directives

using System;
using System.Collections.Generic;
using StackExchange.NET.Helpers;
using StackExchange.NET.Interfaces;
Expand All @@ -10,8 +9,14 @@

namespace StackExchange.NET.Clients
{
/// <summary>
/// StackExchangeClient used to perform operations on APIs.
/// </summary>
public partial class StackExchangeClient : IAnswers
{
/// <summary>
/// The Answers interface which lists all possible operations.
/// </summary>
public IAnswers Answers => this;
BaseResponse<Answer> IAnswers.GetAllAnswers(AnswerFilters filters)
{
Expand All @@ -35,7 +40,7 @@ BaseResponse<Answer> IAnswers.GetAnswerByIds(List<string> ids, AnswerFilters fil
return response;
}

BaseResponse<Answer> IAnswers.GetCommentsByIds(List<string> ids, AnswerFilters filters)
BaseResponse<Answer> IAnswers.GetCommentsOnAnswers(List<string> ids, AnswerFilters filters)
{
var url = ApiUrlBuilder.Initialize(_apiKey)
.ForClient(ClientType.Answers)
Expand All @@ -57,54 +62,5 @@ BaseResponse<Question> IAnswers.GetQuestionByAnswerIds(List<string> ids, AnswerF
return response;
}

void IAnswers.AcceptAnAnswer(string id, AnswerFilters filters)
{
throw new NotImplementedException();
}

void IAnswers.UndoAcceptedAnswer(string id, AnswerFilters filters)
{
throw new NotImplementedException();
}

void IAnswers.DeleteAnswer(string id, AnswerFilters filters)
{
throw new NotImplementedException();
}

void IAnswers.DownVoteAnswer(string id, AnswerFilters filters)
{
throw new NotImplementedException();
}

void IAnswers.UndoDownVotedAnswer(string id, AnswerFilters filters)
{
throw new NotImplementedException();
}

void IAnswers.EditAnswer(string id, AnswerFilters filters)
{
throw new NotImplementedException();
}

void IAnswers.GetOptionsOfAnswer(string id, AnswerFilters filters)
{
throw new NotImplementedException();
}

void IAnswers.FlagAnswer(string id, AnswerFilters filters)
{
throw new NotImplementedException();
}

void IAnswers.UpVoteAnswer(string id, AnswerFilters filters)
{
throw new NotImplementedException();
}

void IAnswers.UndoUpVotedAnswer(string id, AnswerFilters filters)
{
throw new NotImplementedException();
}
}
}
3 changes: 3 additions & 0 deletions StackExchange.NET/StackExchange.NET/Clients/Badges.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ namespace StackExchange.NET.Clients
{
public partial class StackExchangeClient : IBadges
{
/// <summary>
/// The Badges interface which lists all possible operations.
/// </summary>
public IBadges Badges => this;

BaseResponse<Badge> IBadges.GetAllBadges(BadgeFilters filters, string inName)
Expand Down
3 changes: 3 additions & 0 deletions StackExchange.NET/StackExchange.NET/Clients/Comments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ namespace StackExchange.NET.Clients
{
public partial class StackExchangeClient : IComments
{
/// <summary>
/// The Comments interface which lists all possible operations.
/// </summary>
public IComments Comments => this;

BaseResponse<Comment> IComments.GetAllComments(CommentFilter filters)
Expand Down
3 changes: 3 additions & 0 deletions StackExchange.NET/StackExchange.NET/Clients/PostsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ namespace StackExchange.NET.Clients
{
public partial class StackExchangeClient : IPosts
{
/// <summary>
/// The Posts interface which lists all possible operations.
/// </summary>
public IPosts Posts => this;

BaseResponse<Post> IPosts.GetAllPosts(PostFilter filters)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace StackExchange.NET.Exceptions
{
/// <summary>
/// StackExchangeApiException
/// </summary>
public class StackExchangeApiException : Exception
{
/// <summary>
Expand Down
4 changes: 4 additions & 0 deletions StackExchange.NET/StackExchange.NET/Helpers/ApiUrlBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class ApiUrlBuilder : IApiUrlHelper
private string _filter;
private readonly string _apiKey;

/// <summary>
/// Constructor used to Build the api url internally
/// </summary>
/// <param name="apiKey"></param>
public ApiUrlBuilder(string apiKey)
{
_apiKey = apiKey;
Expand Down
3 changes: 3 additions & 0 deletions StackExchange.NET/StackExchange.NET/Helpers/ClientType.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace StackExchange.NET.Helpers
{
/// <summary>
/// The list of Interfaces exposed for consuming the API
/// </summary>
public enum ClientType
{
Answers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace StackExchange.NET.Helpers
{
internal static class ExtensionMethods
{
public static string GetQueryString(this object obj)
internal static string GetQueryString(this object obj)
{
var properties = from p in obj.GetType().GetProperties()
where p.GetValue(obj, null) != null
Expand Down
3 changes: 3 additions & 0 deletions StackExchange.NET/StackExchange.NET/Helpers/MakeSure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace StackExchange.NET.Helpers
{
/// <summary>
/// Used for Validating parameters for Exceptions
/// </summary>
public abstract class MakeSure
{
/// <summary>Checks an argument to make sure it isn't null</summary>
Expand Down
46 changes: 35 additions & 11 deletions StackExchange.NET/StackExchange.NET/Interfaces/IAnswers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,45 @@

namespace StackExchange.NET.Interfaces
{
/// <summary>
/// The Answers interface which lists all possible operations.
/// </summary>
public interface IAnswers
{
/// <summary>Returns all the undeleted answers in the system.</summary>
/// <param name="filters">The Answer filters.</param>
/// <returns>This method returns a list of answers</returns>
BaseResponse<Answer> GetAllAnswers(AnswerFilters filters);
/// <summary>
/// Gets the set of answers identified by ids.
/// </summary>
/// <param name="ids"></param>
/// <param name="filters"></param>
/// <returns></returns>
BaseResponse<Answer> GetAnswerByIds(List<string> ids, AnswerFilters filters);
BaseResponse<Answer> GetCommentsByIds(List<string> ids, AnswerFilters filters);
/// <summary>
/// Gets the comments on a set of answers.
/// </summary>
/// <param name="ids"></param>
/// <param name="filters"></param>
/// <returns></returns>
BaseResponse<Answer> GetCommentsOnAnswers(List<string> ids, AnswerFilters filters);
/// <summary>
/// Returns the questions that answers identified by {ids} are on.
/// </summary>
/// <param name="ids"></param>
/// <param name="filters"></param>
/// <returns></returns>
BaseResponse<Question> GetQuestionByAnswerIds(List<string> ids, AnswerFilters filters);
void AcceptAnAnswer(string id, AnswerFilters filters);
void UndoAcceptedAnswer(string id, AnswerFilters filters);
void DeleteAnswer(string id, AnswerFilters filters);
void DownVoteAnswer(string id, AnswerFilters filters);
void UndoDownVotedAnswer(string id, AnswerFilters filters);
void EditAnswer(string id, AnswerFilters filters);
void GetOptionsOfAnswer(string id, AnswerFilters filters);
void FlagAnswer(string id, AnswerFilters filters);
void UpVoteAnswer(string id, AnswerFilters filters);
void UndoUpVotedAnswer(string id, AnswerFilters filters);
//void AcceptAnAnswer(string id, AnswerFilters filters);
//void UndoAcceptedAnswer(string id, AnswerFilters filters);
//void DeleteAnswer(string id, AnswerFilters filters);
//void DownVoteAnswer(string id, AnswerFilters filters);
//void UndoDownVotedAnswer(string id, AnswerFilters filters);
//void EditAnswer(string id, AnswerFilters filters);
//void GetOptionsOfAnswer(string id, AnswerFilters filters);
//void FlagAnswer(string id, AnswerFilters filters);
//void UpVoteAnswer(string id, AnswerFilters filters);
//void UndoUpVotedAnswer(string id, AnswerFilters filters);
}
}
38 changes: 38 additions & 0 deletions StackExchange.NET/StackExchange.NET/Interfaces/IBadges.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,51 @@

namespace StackExchange.NET.Interfaces
{
/// <summary>
/// The Badges interface which lists all possible operations.
/// </summary>
public interface IBadges
{
/// <summary>
/// Returns all the badges in the system.
/// </summary>
/// <param name="filters"></param>
/// <param name="inName"></param>
/// <returns></returns>
BaseResponse<Badge> GetAllBadges(BadgeFilters filters, string inName = null);
/// <summary>
/// Gets the badges identified in id.
/// </summary>
/// <param name="ids"></param>
/// <param name="filters"></param>
/// <returns></returns>
BaseResponse<Badge> GetBadgesByIds(List<string> ids, BadgeFilters filters);
/// <summary>
/// Gets all explicitly named badges in the system.
/// </summary>
/// <param name="ids"></param>
/// <param name="filters"></param>
/// <returns></returns>
BaseResponse<Badge> GetNonTaggedBadges(List<string> ids, BadgeFilters filters);
/// <summary>
/// Returns recently awarded badges in the system.
/// </summary>
/// <param name="filters"></param>
/// <returns></returns>
BaseResponse<Badge> GetRecentlyAwardedBadges(BadgeFilters filters);
/// <summary>
/// Returns recently awarded badges in the system, constrained to a certain set of badges.
/// </summary>
/// <param name="ids"></param>
/// <param name="filters"></param>
/// <returns></returns>
BaseResponse<Badge> GetRecentlyAwardedBadgesByIds(List<string> ids, BadgeFilters filters);
/// <summary>
/// Returns the badges that are awarded for participation in specific tags.
/// </summary>
/// <param name="filters"></param>
/// <param name="inName"></param>
/// <returns></returns>
BaseResponse<Badge> GetAllTaggedBadges(BadgeFilters filters, string inName = null);
}
}
14 changes: 14 additions & 0 deletions StackExchange.NET/StackExchange.NET/Interfaces/IComments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,23 @@

namespace StackExchange.NET.Interfaces
{
/// <summary>
/// The Comments interface which lists all possible operations.
/// </summary>
public interface IComments
{
/// <summary>
/// Gets all the comments on the site
/// </summary>
/// <param name="commentFilter"></param>
/// <returns></returns>
BaseResponse<Comment> GetAllComments(CommentFilter commentFilter);
/// <summary>
/// Gets the comments identified in id.
/// </summary>
/// <param name="commentIds"></param>
/// <param name="commentFilter"></param>
/// <returns></returns>
BaseResponse<Comment> GetCommentsByIds(List<string> commentIds, CommentFilter commentFilter);
}
}
Loading

0 comments on commit 7dc8250

Please sign in to comment.