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
Version 1.0.1 of the OneSignalApi throws an exception when sending a notification because it can't find a constructor in the RestSharp package.
Message:Method not found: 'Void RestSharp.RestRequest..ctor(RestSharp.Method)'.
StackTrace: System.MissingMethodException: Method not found: 'Void RestSharp.RestRequest..ctor(RestSharp.Method)'.\r\n at OneSignalApi.Client.ApiClient.NewRequest(HttpMethod method, String path, RequestOptions options, IReadableConfiguration configuration)\r\n at OneSignalApi.Client.ApiClient.Post[T](String path, RequestOptions options, IReadableConfiguration configuration)\r\n at OneSignalApi.Api.DefaultApi.CreateNotificationWithHttpInfo(Notification notification, Int32 operationIndex)\r\n at OneSignalApi.Api.DefaultApi.CreateNotification(Notification notification, Int32 operationIndex)\r\n
Using RestSharp 108.0.1, I don't see a constructor in their code that matches the pattern of just taking in a Method.
I'm mixing a .NET Framework API with a .NET Standard Class Library, and the required packages are installed in both projects.
Code Snippet (inside the .NET Standard Class Library, called from the .NET Framework API):
var restApiKey = "......";
var Configuration = new OneSignalApi.Client.Configuration();
Configuration.BasePath = "https://onesignal.com/api/v1";
Configuration.AccessToken = restApiKey;
Configuration.ApiKey.Add("default", restApiKey);
var model = new OneSignalApi.Model.Notification(appId: AppId)
{
IncludeExternalUserIds = new List<string> { "..." },
Name = "Test Message",
ChannelForExternalUserIds = "push"
};
model.Contents = new OneSignalApi.Model.StringMap { En = "message contents" };
var api = new DefaultApi(Configuration);
var result = api.CreateNotification(model);
return !String.IsNullOrWhiteSpace(result.Id);
Steps to reproduce?
1. Create .NET Framework 4.8.1 API
2. Create .NET Standard 2.0 Class Library
3. Install packages: OneSignalApi 1.0.1, RestSharp 108.0.1, Newtonsoft.Json 13.0.1, JsonSubTypes 1.9.0, System.ComponentModel.Annotations 5.0.0 in both projects
4. Call the class library from the api
5. Get error
What did you expect to happen?
I expected the API to send a push notification message.
Relevant log output
No response
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Are there plans to update this library to use the latest RestSharp (108+)?
RestSharp v107 was a large update and I have other code that also uses RestSharp v107+ features.
Much appreciated any roadmap or plans to use the "modern" RestSharp! Thanks,
Ryan
Yes I would also like to know if you will be supporting the latest version of RestSharp, the latest version of Xero nuget package needs RestSharp 108.0.1 or greater but I cannot install it because OneSignal needs RestSharp below version 107.
What happened?
Version 1.0.1 of the OneSignalApi throws an exception when sending a notification because it can't find a constructor in the RestSharp package.
Message:
Method not found: 'Void RestSharp.RestRequest..ctor(RestSharp.Method)'.
StackTrace:
System.MissingMethodException: Method not found: 'Void RestSharp.RestRequest..ctor(RestSharp.Method)'.\r\n at OneSignalApi.Client.ApiClient.NewRequest(HttpMethod method, String path, RequestOptions options, IReadableConfiguration configuration)\r\n at OneSignalApi.Client.ApiClient.Post[T](String path, RequestOptions options, IReadableConfiguration configuration)\r\n at OneSignalApi.Api.DefaultApi.CreateNotificationWithHttpInfo(Notification notification, Int32 operationIndex)\r\n at OneSignalApi.Api.DefaultApi.CreateNotification(Notification notification, Int32 operationIndex)\r\n
Using RestSharp 108.0.1, I don't see a constructor in their code that matches the pattern of just taking in a Method.
I'm mixing a .NET Framework API with a .NET Standard Class Library, and the required packages are installed in both projects.
Code Snippet (inside the .NET Standard Class Library, called from the .NET Framework API):
Steps to reproduce?
What did you expect to happen?
I expected the API to send a push notification message.
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: