Skip to content

Commit

Permalink
Fixed an issue on GetPayloadType method
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad Noman Musleh committed Jan 17, 2022
1 parent ea057a7 commit 0da7fda
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/Console.Sample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private static async Task Main()
ClientSecret = _app.Secret,
};

await _client.SendMessage(applicationAuthReq, ProtoOAPayloadType.ProtoOaApplicationAuthReq);
await _client.SendMessage(applicationAuthReq);

await Task.Delay(5000);

Expand Down Expand Up @@ -278,7 +278,7 @@ private static async void RefreshToken()
RefreshToken = _token.RefreshToken
};

await _client.SendMessage(refreshTokenReq, ProtoOAPayloadType.ProtoOaRefreshTokenReq);
await _client.SendMessage(refreshTokenReq);
}

private static async void SubscribeToSymbolTrendBar(string[] commandSplit)
Expand All @@ -292,7 +292,7 @@ private static async void SubscribeToSymbolTrendBar(string[] commandSplit)
SymbolId = long.Parse(commandSplit[4]),
};

await _client.SendMessage(subscribeLiveTrendbarReq, ProtoOAPayloadType.ProtoOaSubscribeLiveTrendbarReq);
await _client.SendMessage(subscribeLiveTrendbarReq);
}

private static async void SubscribeToSymbolSpot(string[] commandSplit)
Expand All @@ -306,7 +306,7 @@ private static async void SubscribeToSymbolSpot(string[] commandSplit)

subscribeSpotsReq.SymbolId.AddRange(commandSplit.Skip(3).Select(iSymbolId => long.Parse(iSymbolId)));

await _client.SendMessage(subscribeSpotsReq, ProtoOAPayloadType.ProtoOaSubscribeSpotsReq);
await _client.SendMessage(subscribeSpotsReq);
}

private static async void SymbolListRequest(string[] commandSplit)
Expand All @@ -320,7 +320,7 @@ private static async void SymbolListRequest(string[] commandSplit)
CtidTraderAccountId = accountId,
};

await _client.SendMessage(symbolsListReq, ProtoOAPayloadType.ProtoOaSymbolsListReq);
await _client.SendMessage(symbolsListReq);
}

private static async void ReconcileRequest(string[] commandSplit)
Expand All @@ -334,7 +334,7 @@ private static async void ReconcileRequest(string[] commandSplit)
CtidTraderAccountId = accountId,
};

await _client.SendMessage(reconcileReq, ProtoOAPayloadType.ProtoOaReconcileReq);
await _client.SendMessage(reconcileReq);
}

private static async void AccountListRequest()
Expand All @@ -346,7 +346,7 @@ private static async void AccountListRequest()
AccessToken = _token.AccessToken,
};

await _client.SendMessage(accountListByAccessTokenReq, ProtoOAPayloadType.ProtoOaGetAccountsByAccessTokenReq);
await _client.SendMessage(accountListByAccessTokenReq);
}

private static async void AccountAuthRequest(string[] commandSplit)
Expand All @@ -361,7 +361,7 @@ private static async void AccountAuthRequest(string[] commandSplit)
AccessToken = _token.AccessToken
};

await _client.SendMessage(accountAuthReq, ProtoOAPayloadType.ProtoOaAccountAuthReq);
await _client.SendMessage(accountAuthReq);
}

private static void GetCommand()
Expand Down
2 changes: 1 addition & 1 deletion src/OpenAPI.Net/Helpers/MessagePayloadTypeExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static uint GetPayloadType<T>(this T message) where T : IMessage
throw new InvalidOperationException($"Couldn't get the PayloadType of the message {message}", ex);
}

return (uint)property.GetValue(message);
return Convert.ToUInt32(property.GetValue(message));
}
}
}
2 changes: 1 addition & 1 deletion src/OpenAPI.Net/OpenAPI.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PackageTags>cTrader, Open API, Spotware</PackageTags>
<Description>A .NET RX library for Spotware Open API</Description>
<PackageId>Spotware.OpenAPI.Net</PackageId>
<Version>1.3.6-rc1</Version>
<Version>1.3.6-rc2</Version>
<Platforms>AnyCPU</Platforms>
<Company>Spotware</Company>
<Authors>Spotware</Authors>
Expand Down

0 comments on commit 0da7fda

Please sign in to comment.