Skip to content

Commit f1a92af

Browse files
committed
Issue 81 and remove RestSharp ref
1 parent 3851483 commit f1a92af

33 files changed

+1353
-673
lines changed
-187 KB
Binary file not shown.

Assets/MoralisWeb3ApiSdk/Moralis/Moralis.SolanaApi/Api/AccountApi.cs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using Moralis.SolanaApi.Client;
22
using Moralis.SolanaApi.Interfaces;
33
using Moralis.SolanaApi.Models;
4-
using RestSharp;
54
using System;
65
using System.Collections.Generic;
6+
using System.Net.Http;
77
using System.Threading.Tasks;
88

99
namespace Moralis.SolanaApi.Api
@@ -72,14 +72,15 @@ public async Task<NativeBalance> Balance(NetworkTypes network, string address)
7272
// Authentication setting, if any
7373
String[] authSettings = new String[] { "ApiKeyAuth" };
7474

75-
IRestResponse response = (IRestResponse)(await ApiClient.CallApi(path, Method.GET, null, null, headerParams, null, null, authSettings));
75+
//IRestResponse response = (IRestResponse)(await ApiClient.CallApi(path, Method.GET, null, null, headerParams, null, null, authSettings));
76+
HttpResponseMessage response = await ApiClient.CallApi(path, HttpMethod.Get, null, headerParams, null, authSettings);
7677

7778
if (((int)response.StatusCode) >= 400)
7879
throw new ApiException((int)response.StatusCode, "Error calling Balance: " + response.Content, response.Content);
7980
else if (((int)response.StatusCode) == 0)
80-
throw new ApiException((int)response.StatusCode, "Error calling Balance: " + response.ErrorMessage, response.ErrorMessage);
81+
throw new ApiException((int)response.StatusCode, "Error calling Balance: " + response.ReasonPhrase, response.ReasonPhrase);
8182

82-
return (NativeBalance)ApiClient.Deserialize(response.Content, typeof(NativeBalance), response.Headers);
83+
return (NativeBalance)(await ApiClient.Deserialize(response.Content, typeof(NativeBalance), response.Headers));
8384

8485
}
8586

@@ -97,14 +98,15 @@ public async Task<List<SplTokenBalanace>> GetSplTokens(NetworkTypes network, str
9798
// Authentication setting, if any
9899
String[] authSettings = new String[] { "ApiKeyAuth" };
99100

100-
IRestResponse response = (IRestResponse)(await ApiClient.CallApi(path, Method.GET, null, null, headerParams, null, null, authSettings));
101+
//IRestResponse response = (IRestResponse)(await ApiClient.CallApi(path, Method.GET, null, null, headerParams, null, null, authSettings));
102+
HttpResponseMessage response = await ApiClient.CallApi(path, HttpMethod.Get, null, headerParams, null, authSettings);
101103

102104
if (((int)response.StatusCode) >= 400)
103105
throw new ApiException((int)response.StatusCode, "Error calling GetSplTokens: " + response.Content, response.Content);
104106
else if (((int)response.StatusCode) == 0)
105-
throw new ApiException((int)response.StatusCode, "Error calling GetSplTokens: " + response.ErrorMessage, response.ErrorMessage);
107+
throw new ApiException((int)response.StatusCode, "Error calling GetSplTokens: " + response.ReasonPhrase, response.ReasonPhrase);
106108

107-
return (List<SplTokenBalanace>)ApiClient.Deserialize(response.Content, typeof(List<SplTokenBalanace>), response.Headers);
109+
return (List<SplTokenBalanace>)(await ApiClient.Deserialize(response.Content, typeof(List<SplTokenBalanace>), response.Headers));
108110
}
109111

110112
public async Task<List<SplNft>> GetNFTs(NetworkTypes network, string address)
@@ -121,14 +123,15 @@ public async Task<List<SplNft>> GetNFTs(NetworkTypes network, string address)
121123
// Authentication setting, if any
122124
String[] authSettings = new String[] { "ApiKeyAuth" };
123125

124-
IRestResponse response = (IRestResponse)(await ApiClient.CallApi(path, Method.GET, null, null, headerParams, null, null, authSettings));
126+
//IRestResponse response = (IRestResponse)(await ApiClient.CallApi(path, Method.GET, null, null, headerParams, null, null, authSettings));
127+
HttpResponseMessage response = await ApiClient.CallApi(path, HttpMethod.Get, null, headerParams, null, authSettings);
125128

126129
if (((int)response.StatusCode) >= 400)
127130
throw new ApiException((int)response.StatusCode, "Error calling GetNFTs: " + response.Content, response.Content);
128131
else if (((int)response.StatusCode) == 0)
129-
throw new ApiException((int)response.StatusCode, "Error calling GetNFTs: " + response.ErrorMessage, response.ErrorMessage);
132+
throw new ApiException((int)response.StatusCode, "Error calling GetNFTs: " + response.ReasonPhrase, response.ReasonPhrase);
130133

131-
return (List<SplNft>)ApiClient.Deserialize(response.Content, typeof(List<SplNft>), response.Headers);
134+
return (List<SplNft>)(await ApiClient .Deserialize(response.Content, typeof(List<SplNft>), response.Headers));
132135
}
133136

134137
public async Task<Portfolio> GetPortfolio(NetworkTypes network, string address)
@@ -145,14 +148,15 @@ public async Task<Portfolio> GetPortfolio(NetworkTypes network, string address)
145148
// Authentication setting, if any
146149
String[] authSettings = new String[] { "ApiKeyAuth" };
147150

148-
IRestResponse response = (IRestResponse)(await ApiClient.CallApi(path, Method.GET, null, null, headerParams, null, null, authSettings));
151+
//IRestResponse response = (IRestResponse)(await ApiClient.CallApi(path, Method.GET, null, null, headerParams, null, null, authSettings));
152+
HttpResponseMessage response = await ApiClient.CallApi(path, HttpMethod.Get, null, headerParams, null, authSettings);
149153

150154
if (((int)response.StatusCode) >= 400)
151155
throw new ApiException((int)response.StatusCode, "Error calling GetPortfolio: " + response.Content, response.Content);
152156
else if (((int)response.StatusCode) == 0)
153-
throw new ApiException((int)response.StatusCode, "Error calling GetPortfolio: " + response.ErrorMessage, response.ErrorMessage);
157+
throw new ApiException((int)response.StatusCode, "Error calling GetPortfolio: " + response.ReasonPhrase, response.ReasonPhrase);
154158

155-
return (Portfolio)ApiClient.Deserialize(response.Content, typeof(Portfolio), response.Headers);
159+
return (Portfolio)(await ApiClient.Deserialize(response.Content, typeof(Portfolio), response.Headers));
156160
}
157161
}
158162
}

Assets/MoralisWeb3ApiSdk/Moralis/Moralis.SolanaApi/Api/NftApi.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using Moralis.SolanaApi.Client;
22
using Moralis.SolanaApi.Interfaces;
33
using Moralis.SolanaApi.Models;
4-
using RestSharp;
54
using System;
65
using System.Collections.Generic;
6+
using System.Net.Http;
77
using System.Threading.Tasks;
88

99
namespace Moralis.SolanaApi.Api
@@ -73,14 +73,15 @@ public async Task<NftMetadata> GetNFTMetadata(NetworkTypes network, string addre
7373
// Authentication setting, if any
7474
String[] authSettings = new String[] { "ApiKeyAuth" };
7575

76-
IRestResponse response = (IRestResponse)(await ApiClient.CallApi(path, Method.GET, null, null, headerParams, null, null, authSettings));
76+
//IRestResponse response = (IRestResponse)(await ApiClient.CallApi(path, Method.GET, null, null, headerParams, null, null, authSettings));
77+
HttpResponseMessage response = await ApiClient.CallApi(path, HttpMethod.Get, null, headerParams, null, authSettings);
7778

7879
if (((int)response.StatusCode) >= 400)
7980
throw new ApiException((int)response.StatusCode, "Error calling GetNFTMetadata: " + response.Content, response.Content);
8081
else if (((int)response.StatusCode) == 0)
81-
throw new ApiException((int)response.StatusCode, "Error calling GetNFTMetadata: " + response.ErrorMessage, response.ErrorMessage);
82+
throw new ApiException((int)response.StatusCode, "Error calling GetNFTMetadata: " + response.ReasonPhrase, response.ReasonPhrase);
8283

83-
return (NftMetadata)ApiClient.Deserialize(response.Content, typeof(NftMetadata), response.Headers);
84+
return (NftMetadata)(await ApiClient.Deserialize(response.Content, typeof(NftMetadata), response.Headers)) ;
8485
}
8586
}
8687
}

0 commit comments

Comments
 (0)