11using Moralis . SolanaApi . Client ;
22using Moralis . SolanaApi . Interfaces ;
33using Moralis . SolanaApi . Models ;
4- using RestSharp ;
54using System ;
65using System . Collections . Generic ;
6+ using System . Net . Http ;
77using System . Threading . Tasks ;
88
99namespace 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}
0 commit comments