Files
speckle-unity/Packages/systems.speckle.speckle-unity/Streams.cs
T
2022-04-07 01:42:59 +01:00

42 lines
962 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Speckle.Core.Api;
using Speckle.Core.Credentials;
using Speckle.Core.Logging;
namespace Speckle.ConnectorUnity
{
public static class Streams
{
public static async Task<List<Stream>> List(int limit = 10)
{
var account = AccountManager.GetDefaultAccount();
if (account == null)
return new List<Stream>();
var client = new Client(account);
var res = await client.StreamsGet(limit);
return res;
}
public static async Task<Stream> Get(string streamId, int limit = 10)
{
var account = AccountManager.GetDefaultAccount();
if (account == null)
return null;
var client = new Client(account);
var res = await client.StreamGet(streamId, limit);
if (res.branches.items != null)
{
res.branches.items.Reverse();
}
return res;
}
}
}