Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Méthode introuvable : 'Void RestSharp.RestRequest..ctor(RestSharp.Method)'. #45

Open
1 task done
tobus2012 opened this issue Dec 26, 2023 · 1 comment
Open
1 task done
Labels
bug Something isn't working

Comments

@tobus2012
Copy link

What happened?

Good morning ,
I'm trying OneSignal's server-side API to send push notifications.

When I execute the method CreateNotificationSuccessResponse result = appInstance.CreateNotification(notification);

var appConfig = new Configuration();
appConfig.BasePath = "https://onesignal.com/api/v1";
appConfig.AccessToken = "ApiKey";

var appInstance = new DefaultApi(appConfig);

var notification = new Notification(appId: "app id");

StringMap stringMap = new StringMap();
stringMap.En = message;
notification.Contents = stringMap;
notification.ExternalId = Guid.NewGuid().ToString();
if (!string.IsNullOrWhiteSpace(link))
{
notification.Url = link;
}
if (Subcription.Count > 0)
{
notification.IncludedSegments = Subcription;
}
if (ExternalID.Count > 0)
{
PlayerNotificationTargetIncludeAliases playerNotificationTargetIncludeAliases = new PlayerNotificationTargetIncludeAliases(ExternalID);
notification.IncludeAliases = playerNotificationTargetIncludeAliases;
}
try
{
// Create notification
CreateNotificationSuccessResponse result = appInstance.CreateNotification(notification);
return result.Id + " --- "+result.Recipients.ToString();
}
catch (ApiException e)
{
Debug.Print("Exception when calling DefaultApi.CreateNotification: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
return "Exception when calling DefaultApi.CreateNotification: " + e.Message;
}

I have this error Method not found: 'Void RestSharp.RestRequest..ctor(RestSharp.Method)'.

Steps to reproduce?

OneSignalApi 2.0.2
RestSharp 110.2.0

What did you expect to happen?

à OneSignalApi.Client.ApiClient.NewRequest(HttpMethod method, String path, RequestOptions options, IReadableConfiguration configuration)
à OneSignalApi.Client.ApiClient.Post[T](String path, RequestOptions options, IReadableConfiguration configuration)
à OneSignalApi.Api.DefaultApi.CreateNotificationWithHttpInfo(Notification notification, Int32 operationIndex)
à OneSignalApi.Api.DefaultApi.CreateNotification(Notification notification, Int32 operationIndex)
à WebAPI.Helper.Utils.SendNotification(String message, List1 Subcription, List1 ExternalID, String link) dans D:\WORK\APPLICATION\CNPS\MA CNPS A MOI\AppMobile\WEP API\WebAPI\Helper\Utils.cs :ligne 967
à WebAPI.Controllers.CallBackAPIController.testsss() dans D:\WORK\APPLICATION\CNPS\MA CNPS A MOI\AppMobile\WEP API\WebAPI\Controllers\CallBackAPIController.cs :ligne 3079

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@tobus2012 tobus2012 added the bug Something isn't working label Dec 26, 2023
@RoryMcCrossan
Copy link

RoryMcCrossan commented Oct 21, 2024

I am also receiving this exact same error. Any news on fixing this since the bug was raised nearly 11 months ago?

System.MissingMethodException
  HResult=0x80131513
  Message=Method not found: 'Void RestSharp.RestRequest..ctor(RestSharp.Method)'.
  Source=OneSignalApi
  StackTrace:
   at OneSignalApi.Client.ApiClient.NewRequest(HttpMethod method, String path, RequestOptions options, IReadableConfiguration configuration)
   at OneSignalApi.Client.ApiClient.PostAsync[T](String path, RequestOptions options, IReadableConfiguration configuration, CancellationToken cancellationToken)
   at OneSignalApi.Api.DefaultApi.<CreateNotificationWithHttpInfoAsync>d__36.MoveNext()
   at OneSignalApi.Api.DefaultApi.<CreateNotificationAsync>d__35.MoveNext()
   at FooApplication.Funcs.Background.PushNotifications.PushNotificationQueueHandler.<Run>d__3.MoveNext() in D:\FooApplication\FooApplication.Funcs.Background\PushNotifications\PushNotificationQueueHandler.cs:line 56

  This exception was originally thrown at this call stack:
    OneSignalApi.Client.ApiClient.PostAsync<T>(string, OneSignalApi.Client.RequestOptions, OneSignalApi.Client.IReadableConfiguration, System.Threading.CancellationToken)
    OneSignalApi.Api.DefaultApi.CreateNotificationWithHttpInfoAsync(OneSignalApi.Model.Notification, int, System.Threading.CancellationToken)
    OneSignalApi.Api.DefaultApi.CreateNotificationAsync(OneSignalApi.Model.Notification, int, System.Threading.CancellationToken)
    FooApplication.Funcs.Background.PushNotifications.PushNotificationQueueHandler.Run(string) in PushNotificationQueueHandler.cs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants