public bool ContainsItem(int itemId) { return(OriginalInput.ContainsItem(itemId)); }
/// <summary> /// Gets a valid account for this stream wrapper. /// <para>Note: this method ensures that the stream exists and/or that the user has an account which has access to that stream. If used in a sync manner, make sure it's not blocking.</para> /// </summary> /// <exception cref="Exception">Throws exception if account fetching failed. This could be due to non-existent account or stream.</exception> /// <returns>The valid account object for this stream.</returns> public async Task <Account> GetAccount() { Exception err = null; if (_Account != null) { return(_Account); } // Step 1: check if direct account id (?u=) if (OriginalInput.Contains("?u=")) { var userId = OriginalInput.Split(new string[] { "?u=" }, StringSplitOptions.None)[1]; var acc = AccountManager.GetAccounts().FirstOrDefault(acc => acc.userInfo.id == userId); if (acc != null) { try { await ValidateWithAccount(acc); _Account = acc; return(acc); } catch (Exception e) { // If user specified account and fails, we should stop trying. throw e; } } } // Step 2: check the default var defAcc = AccountManager.GetDefaultAccount(); try { await ValidateWithAccount(defAcc); _Account = defAcc; return(defAcc); } catch (Exception e) { err = e; } // Step 3: all the rest var accs = AccountManager.GetAccounts(ServerUrl); if (accs.Count() == 0) { throw new SpeckleException($"You don't have any accounts for {ServerUrl}."); } foreach (var acc in accs) { try { await ValidateWithAccount(acc); _Account = acc; return(acc); } catch (Exception e) { err = e; } } throw err; }
public bool ItemIsOkToRecommend(int itemId) { return(OriginalInput.ItemIsOkToRecommend(itemId)); }