/// <summary> /// Gets a stream and its objects, in bulk. This is NOT recommended for large streams. /// </summary> /// <param name="_streamId"></param> static void GetStream(string _streamId = null) { Console.WriteLine("Hello Speckle! We will now try and get a stream."); var account = LocalContext.GetAccountByEmailAndRestApi("*****@*****.**", "https://hestia.speckle.works/api"); var streamId = ""; if (_streamId == null) { Console.WriteLine("What stream id should we get?"); streamId = Console.ReadLine(); } else { streamId = _streamId; } var client = new SpeckleApiClient(account.RestApi, false, "console_app"); client.AuthToken = account.Token; var stream = client.StreamGetAsync(streamId, "").Result.Resource; var objects = client.StreamGetObjectsAsync(streamId, "fields=hash,type").Result; // restricting to just a few things Console.WriteLine("This is the stream:"); Console.WriteLine(stream.ToJson()); Console.WriteLine(); Console.WriteLine("Press any key to continue."); Console.ReadLine(); Console.WriteLine("These are the objects:"); Console.WriteLine(objects.ToJson()); Console.WriteLine(); Console.WriteLine("Press any key to continue."); Console.ReadLine(); }
public override bool Read(GH_IReader reader) { string restApi = "", email = ""; reader.TryGetString("restapi", ref restApi); reader.TryGetString("email", ref email); try { var acc = LocalContext.GetAccountByEmailAndRestApi(email, restApi); Selected = acc; } catch (Exception e) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Account not found."); } return(base.Read(reader)); }