Archomeda / Gw2Sharp

A cross-platform .NET wrapper library for the Guild Wars 2 API written in C#
https://archomeda.github.io/Gw2Sharp
MIT License
37 stars 8 forks source link

Raids endpoint returns `Not Found` error #122

Closed a727891 closed 2 years ago

a727891 commented 2 years ago

I am trying to use the base Raids endpoint to enumerate all wings and encounters. The account specific endpoint that displays weekly clears is working correctly.

GW2Sharp is installed with version 1.7.2 via NuGet inside a BlishHud module.

            try
            {
                Logger.Debug("Getting wings from the API.");
                var apiData = await Gw2ApiManager.Gw2ApiClient.V2.Raids.AllAsync()
                //... process raid wings
            }
            catch (Exception ex)
            {
                Logger.Debug(ex, "Failed to load ");
            }

Returned Exception

Gw2Sharp.WebApi.Exceptions.NotFoundException: not found
   at Gw2Sharp.WebApi.Middleware.ExceptionMiddleware.<>c__DisplayClass1_0.<<OnRequestAsync>g__ExecAsync|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Gw2Sharp.WebApi.Middleware.RequestSplitterMiddleware.<>c__DisplayClass4_0.<<OnRequestAsync>g__ExecAsync|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Gw2Sharp.WebApi.Middleware.CacheMiddleware.<RequestGetAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Gw2Sharp.WebApi.Caching.BaseCacheMethod.<>c__DisplayClass4_0.<<GetOrUpdateAsync>g__ExecAsync|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Gw2Sharp.WebApi.Middleware.CacheMiddleware.<OnAllRequestAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Gw2Sharp.WebApi.Http.WebApiRequest.<ExecuteAsync>d__10`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Gw2Sharp.WebApi.V2.Clients.BaseEndpointBulkAllClient`2.<AllAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Soeed.RaidClears.RaidClearsModule.<QueryRaidWings>d__25.MoveNext() in Module.cs:line 139

Potential Fix I think the issue is the endpoint path for this client is missing the pluralization. https://github.com/Archomeda/Gw2Sharp/blob/f8338e05ead17d3cdb5de55d308f060afe2134d4/Gw2Sharp/WebApi/V2/Clients/Raids/RaidsClient.cs#L9 [EndpointPath("raid")] instead of being [EndpointPath("raids")] to render the api url https://api.guildwars2.com/v2/raids