You are viewing a single comment's thread from:

RE: Steem Data Services (SDS) / Upcoming Update Info / Version 0.1.7a

in #sds2 years ago (edited)

I am having difficulty reading multiple rows as it creates arrays in my model:
https://sds.steemworld.org/transfers_api/getTransfersByTypeFrom/transfer/ngoenyi

What I currently doing is to transfer the result.rows into a list and then reading every field I need.

Is there might an easier way. Here is the model class created by copying JSON as a class

public class SDSTransferReturnModel
{
public int code { get; set; }
public ResultTr result { get; set; }
}

public class ResultTr
{
public Cols cols { get; set; }
public object[][] rows { get; set; }
}

public class Cols
{
public int time { get; set; }
public int from { get; set; }
public int to { get; set; }
public int amount { get; set; }
public int unit { get; set; }
public int memo { get; set; }
}

Sort:  

For the rows I use Generics to get the added benefit of type safety.
So, my rows property is defined like this instead

image.png

Then I can use the respective column index to get the field that I want.

Thanks. Yes also ran into type safety issues. Still battling with getting the index and fields aligned. If it was only one table you can just hard code it but there is to many differences

I have another problem. For one or other reason my Blazor editor is totally screwed. I have no formatting capability at all. Like if you type
If and tab twice it formats the if statement.
Do you perhaps know of any know issues

7428A9B1-EF74-4AC9-AE35-0F45182AA603.jpeg

Don’t warry. Sorted when i closed it and reopened

Hi
Sorry to bother but I am pulling my hair out of my head.
I thought I will start a new project from scratch and rebuild all.
Standard Blazor WebAsembly.
In Data folder, FetchAccountDetails.cs
var responseFromSDS = client.GetAsync($"https://sds.steemworld.org/accounts_api/getAccount/{accountName}");
string jsonResponseFromSDS = await responseFromSDS.Result.Content.ReadAsStringAsync();
I get the error: cannot wait on monitors on this runtime
I have checked everything possible in your demo and everything is exactly the same.

Do you perhaps have any idea what I am doing wrong.

Ok used an interface and httpclient factory to solve

Ahh... Sorry... Saw this now.... Yea.... my go to implementation is usually the client factory cause of a plethora of advantages that it offers with maintaining the connection pool without causing a resource utilization spike... But the other comment that I shared should also work if you do decide to go with it. Plus, on the client side, a normal httpclien should work just fine and in most cases the client factory is an overkill😅

Ok, so the one project is basically completed. Also not to good on UI but does not look to bad on a computer browser or when mobile turned landscape. https://steemtools.azurewebsites.net/

My problem now is with analysing the data. In order for that I need to bring in all the data rows. Been trying now for 2 days to map data into classes, tried Automapper but then realised the source is an different object. The tried using reflection .
Tried looking for similar JSon data examples but could not found.

There are to many tables to write each one individually .

Do you perhaps know of any place I can look for an example?

Unfortunately nope. Not aware of it yet.

var responseFromSDS = await client.GetAsync($"https://sds.steemworld.org/accounts_api/getAccount/{accountName}");
string jsonResponseFromSDS = responseFromSDS.Content.ReadAsStringAsync().Result;

Do this instead.... What youv'e done should technically work on a server side code but on a client side system like WASM, you cannot wait on monitors cause it's not native to the browser.

Coin Marketplace

STEEM 0.19
TRX 0.15
JST 0.029
BTC 62629.89
ETH 2572.37
USDT 1.00
SBD 2.74