You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Moved from Codeplex: https://gw2dotnet.codeplex.com/workitem/1317]
Seeing that most of the time a implementation for a request looks like this:
publicclassContinentRequest:IRequest,ILocalizable{/// <summary>Gets or sets the locale.</summary>publicCultureInfoCulture{get;set;}/// <summary>Gets the resource path.</summary>publicstringResource{get{return"v2/continents";}}/// <summary>Gets the request parameters.</summary>/// <returns>A collection of parameters.</returns>publicIEnumerable<KeyValuePair<string,string>>GetParameters(){// Get the 'lang' parameterif(this.Culture !=null){yieldreturnnewKeyValuePair<string,string>("lang",this.Culture.TwoLetterISOLanguageName);}}/// <summary>The get path segments.</summary>/// <returns>The <see cref="IEnumerable{T}"/>.</returns>publicIEnumerable<string>GetPathSegments(){yieldbreak;}}
Wouldn't it make sense to implement an abstract class which has the following layout:
/// <summary>Represents a request, targeting any the v2/ endpoint.</summary>publicabstractclassLocalizableRequest:IRequest,ILocalizable{/// <summary>Gets or sets the locale.</summary>publicCultureInfoCulture{get;set;}/// <summary>Gets the resource path.</summary>publicabstractstringResource{get;}/// <summary>Gets the request parameters.</summary>/// <returns>A collection of parameters.</returns>publicvirtualIEnumerable<KeyValuePair<string,string>>GetParameters(){// Get the 'lang' parameterif(this.Culture !=null){yieldreturnnewKeyValuePair<string,string>("lang",this.Culture.TwoLetterISOLanguageName);}}/// <summary>The get path segments.</summary>/// <returns>The <see cref="IEnumerable{T}"/>.</returns>publicvirtualIEnumerable<string>GetPathSegments(){yieldbreak;}}
I went ahead and added this to the GW2.NET core library. However the only endpoint that uses this class is the continents endpoint which I am currently adding.
Thoughts?
The text was updated successfully, but these errors were encountered:
I remember trying to use the LocalizableRequest and running into problems with bulk expanded endpoints. A request class can't inherit both BulkRequest and LocalizableRequest.
[Moved from Codeplex: https://gw2dotnet.codeplex.com/workitem/1317]
Seeing that most of the time a implementation for a request looks like this:
Wouldn't it make sense to implement an abstract class which has the following layout:
I went ahead and added this to the GW2.NET core library. However the only endpoint that uses this class is the continents endpoint which I am currently adding.
Thoughts?
The text was updated successfully, but these errors were encountered: