public void Demonstrate_Functionality() { // Visit https://trello.com/1/appKey/generate to get your application key ITrello trello = new Trello("[your application key]"); // Optional: Have the user browse to this url to authenticate your application var urlForAuthentication = trello.GetAuthenticationUrl("[a name for your application]"); // The user will receive a token, call Authenticate with it trello.Authenticate("[the token the user got]"); // Get a member Member me = trello.Members.GetMe(); Member memberTrello = trello.Members.GetById("trello"); // Get a board Board theTrelloDevBoard = trello.Boards.GetById("4d5ea62fd76aa1136000000c"); // Get an organization Organization trelloApps = trello.Organizations.GetById("trelloapps"); // Get all members of a board IEnumerable<Member> membersOfTrelloDevBoard = trello.Members.GetByBoard(theTrelloDevBoard); // Get all owners of a board IEnumerable<Member> ownersOfTrelloDevBoard = trello.Members.GetByBoard(theTrelloDevBoard, MemberFilter.Owners); // Get all members of an organization IEnumerable<Member> membersInTrelloAppsOrg = trello.Members.GetByOrganization(trelloApps); // Get all boards of a member IEnumerable<Board> allMyBoards = trello.Boards.GetByMember(me); //Get all boards of an organization IEnumerable<Board> allBoardsOfTrelloAppsOrg = trello.Boards.GetByOrganization(trelloApps); // Get all closed boards of an organization IEnumerable<Board> closedBoardsOfTrelloAppsOrg = trello.Boards.GetByOrganization(trelloApps, BoardFilter.Closed); // Get all lists on a board IEnumerable<List> allListsInTheTrelloDevBoard = trello.Lists.GetByBoard(theTrelloDevBoard); // Get all cards on a board IEnumerable<Card> allCardsOnTheTrelloDevBoard = trello.Cards.GetByBoard(theTrelloDevBoard); // Get all cards assigned to a member IEnumerable<Card> allCardsAssignedToMe = trello.Cards.GetByMember(me); // Get all organizations that a member belongs to IEnumerable<Organization> allMyOrganizations = trello.Organizations.GetByMember(me); }
public void Demonstrate_Functionality() { // Visit https://trello.com/1/appKey/generate to get your application key ITrello trello = new Trello("[your application key]"); // Optional: Have the user browse to this url to authenticate your application var urlForAuthentication = trello.GetAuthorizationUrl("[a name for your application]", Scope.ReadOnly); // The user will receive a token, call Authenticate with it trello.Authorize("[the token the user got]"); // Get a member Member memberTrello = trello.Members.WithId("trello"); // Get the authenticated member Member me = trello.Members.Me(); // Get a board Board theTrelloDevBoard = trello.Boards.WithId("4d5ea62fd76aa1136000000c"); // Get an organization Organization trelloApps = trello.Organizations.WithId("trelloapps"); // Get all members of a board IEnumerable<Member> membersOfTrelloDevBoard = trello.Members.ForBoard(theTrelloDevBoard); // Get all owners of a board IEnumerable<Member> ownersOfTrelloDevBoard = trello.Members.ForBoard(theTrelloDevBoard, MemberFilter.Owners); // Get all members of an organization IEnumerable<Member> membersInTrelloAppsOrg = trello.Members.ForOrganization(trelloApps); // Get all boards of a member IEnumerable<Board> allMyBoards = trello.Boards.ForMember(me); //Get all boards of an organization IEnumerable<Board> allBoardsOfTrelloAppsOrg = trello.Boards.ForOrganization(trelloApps); // Get all closed boards of an organization IEnumerable<Board> closedBoardsOfTrelloAppsOrg = trello.Boards.ForOrganization(trelloApps, BoardFilter.Closed); // Get all lists on a board IEnumerable<List> allListsInTheTrelloDevBoard = trello.Lists.ForBoard(theTrelloDevBoard); // Get all cards on a board IEnumerable<Card> allCardsOnTheTrelloDevBoard = trello.Cards.ForBoard(theTrelloDevBoard); // Get all cards assigned to a member IEnumerable<Card> allCardsAssignedToMe = trello.Cards.ForMember(me); // Get all organizations that a member belongs to IEnumerable<Organization> allMyOrganizations = trello.Organizations.ForMember(me); // Get unread notifications IEnumerable<Notification> notifications = trello.Notifications.ForMe(readFilter: ReadFilter.Unread); // Get a token Token token = trello.Tokens.WithToken("[a token]"); // Create a new board Board aNewBoard = trello.Boards.Add(new NewBoard("A new board")); // Close a board trello.Boards.Close(aNewBoard); // Create a new list List aNewList = trello.Lists.Add(new NewList("A new list", aNewBoard)); // Archive a list trello.Lists.Archive(aNewList); // Create a card Card aNewCard = trello.Cards.Add(new NewCard("A new card", aNewList)); // Label card trello.Cards.AddLabel(aNewCard, Color.Green); // Assign member to card trello.Cards.AddMember(aNewCard, me); // Delete a card trello.Cards.Delete(aNewCard); // Comment on a card trello.Cards.AddComment(aNewCard, "My comment"); // Update entire card (also works for list, board and checklist) aNewCard.Name = "an updated name"; aNewCard.Desc = "an updated description"; trello.Cards.Update(aNewCard); // Create a checklist var aNewChecklist = trello.Checklists.Add("My checklist", aNewBoard); // Add the checklist to a card trello.Cards.AddChecklist(aNewCard, aNewChecklist); // Add check items trello.Checklists.AddCheckItem(aNewChecklist, "My check item"); // Do things asynchronously! Same API as the sync one, except it returns Task. Task<IEnumerable<Card>> cardsTask = trello.Async.Cards.ForMe(); cardsTask.Wait(); }
// public ActionResult GenerateNewCards(string location) { Trello t = new Trello(); var result = t.GenerateCards(location); return(RedirectToAction("Trello")); }
public void GetAuthorizationlUrl_ApplicationNameIsEmpty_Throw() { var trello = new Trello("key"); Assert.That(() => trello.GetAuthorizationUrl("", Scope.ReadOnly), Throws.InstanceOf<ArgumentException>().With.Matches<ArgumentException>(e => e.ParamName == "applicationName")); }
public async void LoadBoardsNoToken() { Trello.Token = ""; await Trello.LoadBoards(); Assert.Empty(Trello.Boards); }
/// <summary> Initializes static members of the TrelloMicroService.TrelloMS class. </summary> static TrelloMS() { trello = new Trello(TrelloIds.AppKey); var url = trello.GetAuthorizationUrl("https://trello.com/b/j4CnV8Vq/work", Scope.ReadWrite); trello.Authorize(TrelloIds.UserToken); }
public IEnumerator Start() { //Checks if we are already connected if (trello != null && trello.IsConnected()) { Debug.Log("Connection with Trello server succesful"); yield break; } // Creates our trello Obj with our key and token trello = new Trello(yourKey, yourToken); // gets the boards of the current user yield return(trello.PopulateBoardsRoutine()); trello.SetCurrentBoard(currentBoard); // gets the lists on the current board yield return(trello.PopulateListsRoutine()); // check if our reportType match the lists in your trello board // otherwise it creates new lists and uploads them for (int i = 0; i < reportTypes.Count; i++) { if (!trello.IsListCached(reportTypes[i].text)) { var optionList = trello.NewList(reportTypes[i].text); yield return(trello.UploadListRoutine(optionList)); } } // caches the new lists created (if any) yield return(trello.PopulateListsRoutine()); }
public void InvalidToken_ShouldThrowUnauthorizedException() { var trello = new Trello(ConfigurationManager.AppSettings["ApplicationKey"]); trello.Authorize("invalid token"); Assert.That(() => trello.Members.Me(), Throws.TypeOf <TrelloUnauthorizedException>()); }
public void GetAuthorizationlUrl_ApplicationNameIsEmpty_Throw() { var trello = new Trello("key"); Assert.That(() => trello.GetAuthorizationUrl("", Scope.ReadOnly), Throws.InstanceOf <ArgumentException>().With.Matches <ArgumentException>(e => e.ParamName == "applicationName")); }
// retrieves all cards public ActionResult GetCardsList(string board) { Trello t = new Trello(); var result = t.GetCards(board); return(View()); }
// retrieves all boards public ActionResult GetBoards() { Trello t = new Trello(); var result = t.GetBoards(); return(RedirectToAction("Trello")); }
/// <summary> /// 認証ボタンが押された時に呼び出されます /// </summary> private void authButton_Click(object sender, EventArgs e) { m_trello = new Trello(m_keyTextBox.Text); m_trello.Authorize(m_tokenTextBox.Text); OnAuthorize(); }
public void GetAuthorizationlUrl_Always_ContainsResponseTypeToken() { var trello = new Trello("dummy"); var url = trello.GetAuthorizationUrl("dummy", Scope.ReadOnly); Assert.That(url.ToString(), Is.StringContaining("response_type=token")); }
public void GetAuthorizationlUrl_ExpirationNever_ContainsNever() { var trello = new Trello("dummy"); var url = trello.GetAuthorizationUrl("dummy", Scope.ReadWrite, Expiration.Never); Assert.That(url.ToString(), Is.StringContaining("expiration=never")); }
public void GetAuthorizationlUrl_DefaultExpiration_Contains30days() { var trello = new Trello("dummy"); var url = trello.GetAuthorizationUrl("dummy", Scope.ReadWrite); Assert.That(url.ToString(), Is.StringContaining("expiration=30days")); }
public void GetAuthorizationlUrl_ScopeReadWriteAccount_ContainsReadWriteAccount() { var trello = new Trello("dummy"); var url = trello.GetAuthorizationUrl("dummy", Scope.ReadWriteAccount); Assert.That(url.ToString(), Is.StringContaining("scope=read,write,account")); }
public void GetAuthorizationlUrl_ExpirationOneHour_Contains1day() { var trello = new Trello("dummy"); var url = trello.GetAuthorizationUrl("dummy", Scope.ReadWrite, Expiration.OneDay); Assert.That(url.ToString(), Is.StringContaining("expiration=1day")); }
public void GetAuthorizationlUrl_Always_ContainsKeyPassedInConstructor() { var trello = new Trello("123"); var url = trello.GetAuthorizationUrl("dummy", Scope.ReadOnly); Assert.That(url.ToString(), Is.StringContaining("key=123")); }
public void GetAuthorizationlUrl_Always_ContainsApplicationName() { var trello = new Trello("dummy"); var url = trello.GetAuthorizationUrl("appname", Scope.ReadOnly); Assert.That(url.ToString(), Is.StringContaining("name=appname")); }
public void GetAuthorizationlUrl_ExpirationOneHour_Contains1hour() { var trello = new Trello("dummy"); var url = trello.GetAuthorizationUrl("dummy", Scope.ReadWrite, Expiration.OneHour); Assert.That(url.ToString(), Is.StringContaining("expiration=1hour")); }
public void Setup() { _trelloReadOnly = new Trello(ConfigurationManager.AppSettings["ApplicationKey"]); _trelloReadOnly.Authorize(ConfigurationManager.AppSettings["MemberReadToken"]); _trelloReadWrite = new Trello(ConfigurationManager.AppSettings["ApplicationKey"]); _trelloReadWrite.Authorize(ConfigurationManager.AppSettings["MemberWriteToken"]); }
private void OnEnable() { if (trello == null) { // init trello API handler EFConfig config = AssetDatabase.LoadAssetAtPath <EFConfig>(ConfigWindow.CONFIG_ASSET_LOCATION); trello = new Trello(config.Token); } }
public void GetAuthorizationlUrl_ScopeReadonly_ContainsRead() { var trello = new Trello("dummy"); var url = trello.GetAuthorizationUrl("dummy", Scope.ReadOnly); Assert.That(url.ToString(), Is.StringContaining("scope=read")); Assert.That(url.ToString(), Is.Not.StringContaining("write")); }
protected override void Configure() { _container = new PhoneContainer(); _container.RegisterPhoneServices(RootFrame); _container.Instance(RootFrame); _container.Singleton <ICache, FileSystemCache>(); // View Models _container.Singleton <SplashViewModel>(); _container.Singleton <AboutViewModel>(); _container.Singleton <ShellViewModel>(); _container.Singleton <MyBoardsViewModel>(); _container.Singleton <MyCardsViewModel>(); _container.Singleton <MyNotificationsViewModel>(); _container.Singleton <ProfileViewModel>(); _container.PerRequest <BoardViewModel>(); _container.PerRequest <BoardListViewModel>(); _container.PerRequest <CardViewModel>(); _container.PerRequest <CardDetailPivotViewModel>(); _container.PerRequest <CardDetailOverviewViewModel>(); _container.PerRequest <CardDetailChecklistViewModel>(); _container.PerRequest <CardDetailAttachmentsViewModel>(); _container.PerRequest <CardDetailMembersViewModel>(); _container.PerRequest <ChecklistViewModel>(); _container.PerRequest <ChecklistItemViewModel>(); _container.PerRequest <AttachmentViewModel>(); _container.AllTransientTypesOf <NotificationViewModel>(); // Event handlers _container.AllSingletonTypesOf <AbstractHandler>(); // Services _container.PerRequest <Services.IApplicationBar, DefaultApplicationBar>(); _container.Singleton <INetworkService, NetworkService>(); _container.Singleton <IProgressService, ProgressService>(); _container.Singleton <ITrelloApiSettings, TrelloSettings>(); #if DISCONNECTED _container.Singleton <IRequestClient, JsonFileRestClient>(); #else _container.Singleton <IRequestClient, TrelloRestClient>(); #endif var network = _container.Get <INetworkService>(); var client = AugmentClient(_container); var trello = new Trello(network, client); _container.Instance <ITrello>(trello); PhoneToolkitConventions.Install(); TelerikConventions.Install(); // Force creation _container.InstantiateInstancesOf <AbstractHandler>(); }
public async Task <IActionResult> LoadCards(string id) { if (String.IsNullOrEmpty(Trello.Token)) { return(RedirectToAction(nameof(Index))); } await Trello.LoadCards(id); return(RedirectToAction(nameof(Cards))); }
public UpdateTemplateBoard(string key, string token, string idTemplateBoard, Estimate estimate, Trello trello) { Key = key; Token = token; IdTemplateBoard = idTemplateBoard .Replace("https://trello.com/b/", ""); Estimate = estimate; Trello = trello; Cards = new List <Card>(); }
static async Task <Trello> GetTrelloAsync(string path) { Trello trello = null; HttpResponseMessage response = await client.GetAsync(path); if (response.IsSuccessStatusCode) { trello = await response.Content.ReadAsAsync <Trello>(); } return(trello); }
public IEnumerable <TrelloNet.Board> GetAll() { ITrello trello = new Trello("84ffe047543614a43b06bb341dc3e25f"); trello.Authorize("81fd4d07eb1a4317a05e4cdfaa6a5e1642ed8ac726bf22a8c21194e805952064"); var me = trello.Members.Me(); Console.WriteLine(me.FullName); var allMyBoards = trello.Boards.ForMember(me); return(allMyBoards); //return _repository.AllItems; }
/// <summary> /// Initializes a new instance of the Trello API handler /// </summary> private void initAPIHandler() { if (Trello.IsValidToken(config.Token)) { trello = new Trello(config.Token); } else { EditorUtility.DisplayDialog("Invalid Token", "Invalid Trello API credentials. Please re-enter your token.", "OK"); // remove bad token to force reauth logOut(); } }
public void AddOrUpdate() { var testModel = new TrelloDataModel("wiOPDS9X"); var trello = new Trello { Name = "Test" }; var result = testModel.AddOrUpdate(trello); Assert.IsTrue(result); }
private void Awake() { if (_instance != null && _instance != this) { Destroy(this.gameObject); } else { _instance = this; } Trello = new Trello(); Google = new Google(); }
/// <summary> /// Checks if the current token is valid, shows a message if invalid /// </summary> /// <returns></returns> private bool tokenIsValid(string token) { bool valid = Trello.IsValidToken(token); if (!valid) { // show message EditorUtility.DisplayDialog("Invalid Token", "The provided token is invalid. Please enter a valid Trello API token.", "OK"); // highlight token field EditorGUI.FocusTextInControl("Token"); } return(valid); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } var objectiveID = id ?? default(int); Objective = await _context.GetObjectiveAsync(objectiveID); if (Objective == null) { return(NotFound()); } return(Page()); }
private void button2_Click(object sender, EventArgs e) { var trello = new Trello(AppKey); trello.Authorize(UserToken); var trelloBoard = trello.Boards.ForMe().FirstOrDefault(b => b.Name == "Gladiators RoadMap"); var trelloCards = trello.Cards.ForBoard(trelloBoard); foreach (var trelloCard in trelloCards) { trello.Cards.Delete(trelloCard); } MessageBox.Show(@"RoadMap cleaned."); }
public void WithId_CopyCardAction_ReturnsRightTypeWithValues() { const string actionId = "5284efa689cce63268004224"; var trello = new Trello("4db5f5e3efbc86a81cf5f3633432fc64"); trello.Authorize("bb03a75e3c7aa28fd3eceed4012f818ba094428458588532cf69e795609e6a4d"); var expected = new CopyCardAction { Id = actionId, IdMemberCreator = "5284ee0726a67481680045bf", Date = new DateTime(2013, 11, 14, 15, 43, 34, 477), Data = new CopyCardAction.ActionData { CardSource = new CardName { Id = "5284ee0726a67481680045c9", Name = "Welcome to Trello!", IdShort = 1, ShortLink = "51YEJguq" }, List = new ListName { Id = "5284ee0726a67481680045c5", Name = "Basics" }, Card = new CardName { IdShort = 20, Id = "5284efa689cce63268004223", Name = "Welcome to Trello 2!", ShortLink = "I5YS0snW" }, Board = new BoardName { Id = "5284ee0726a67481680045c0", Name = "Welcome Board", ShortLink = "YZZ1mDR5" }, }, MemberCreator = new Action.ActionMember { FullName = "Trello ApiGuy", Username = "******", Id = "5284ee0726a67481680045bf", AvatarHash = null, Initials = "TA" } }.ToExpectedObject(); var result = trello.Actions.WithId(actionId); var actual = result as CopyCardAction; expected.ShouldEqual(actual); }
public void Setup() { _trello = new Trello(ConfigurationManager.AppSettings["ApplicationKey"]); _trello.Authenticate(ConfigurationManager.AppSettings["MemberToken"]); }
public void InvalidToken_ShouldThrowUnauthorizedException() { var trello = new Trello(ConfigurationManager.AppSettings["ApplicationKey"]); trello.Authenticate("invalid token"); Assert.That(() => trello.Members.GetMe(), Throws.TypeOf<UnauthorizedException>()); }
public void NoToken_ShouldThrowUnauthorizedException() { var trello = new Trello(ConfigurationManager.AppSettings["ApplicationKey"]); Assert.That(() => trello.Boards.GetById(Constants.WelcomeBoardId), Throws.TypeOf<UnauthorizedException>()); }
public void Explore() { ITrello trello = new Trello("[your application key]"); var url = trello.GetAuthorizationUrl("Name of your app", Scope.ReadWrite); trello.Authorize("[the token the user got]"); var board = trello.Boards.Add("My Board"); var todoList = trello.Lists.Add("To Do", board); trello.Lists.Add("Doing", board); trello.Lists.Add("Done", board); trello.Cards.Add("My card", todoList); }
public void Explore() { ITrello trello = new Trello("[your application key]"); var url = trello.GetAuthorizationUrl("Name of your app", Scope.ReadWrite); trello.Authorize("[the token the user got]"); var myBoard = trello.Boards.Add("My Board"); var todoList = trello.Lists.Add("To Do", myBoard); trello.Lists.Add("Doing", myBoard); trello.Lists.Add("Done", myBoard); trello.Cards.Add("My card", todoList); foreach(var list in trello.Lists.ForBoard(myBoard)) Console.WriteLine(list.Name); }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { Trello = new Trello("1ed8d91b5af35305a60e169a321ac248"); MessageBus = new MessageBus(); var exportCardsControl = new ExportCardsControl(); var importCardsControl = new ImportCardsControl(); var authorizeForm = new AuthorizationDialog(); ExportCardsTaskPane = CustomTaskPanes.Add(exportCardsControl, "Export cards to Trello"); ExportCardsTaskPane.Width = 300; ExportCardsTaskPane.DockPositionRestrict = MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoHorizontal; ImportCardsTaskPane = CustomTaskPanes.Add(importCardsControl, "Import cards from Trello"); ImportCardsTaskPane.Width = 300; ImportCardsTaskPane.DockPositionRestrict = MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoHorizontal; TaskScheduler = TaskScheduler.FromCurrentSynchronizationContext(); ExportCardsPresenter = new ExportCardsPresenter(exportCardsControl, Trello, new GridToNewCardTransformer(), TaskScheduler, MessageBus); ImportCardsPresenter = new ImportCardsPresenter(importCardsControl, MessageBus, Trello, TaskScheduler); AuthorizePresenter = new AuthorizePresenter(authorizeForm, Trello, MessageBus); Globals.Ribbons.TrelloRibbon.SetMessageBus(MessageBus); TryToAuthorizeTrello(); }