### Install dependencies Source: https://github.com/leankit/api-samples/blob/master/node-search/README.md Installs the required Node.js dependencies for the project. ```bash npm install ``` -------------------------------- ### LeanKitCmdQuery .NET Command-Line Tool Examples Source: https://context7.com/leankit/api-samples/llms.txt Demonstrates using the LeanKitClient library for .NET to make direct API calls via a command-line interface. Supports querying and exporting boards, lanes, and cards in CSV, JSON, or console format. ```bash # List all boards available to the account LeanKitCmdQuery -h accountname -u email@address.com -p p@ssw0rd -Boards -csv ``` ```bash # Get details for a specific board LeanKitCmdQuery -h accountname -u email@address.com -p p@ssw0rd -b 101 ``` ```bash # List all lanes for a board LeanKitCmdQuery -h accountname -u email@address.com -p p@ssw0rd -b 101 -Lanes -json ``` ```bash # Export all cards from a board including backlog and archive to CSV LeanKitCmdQuery -h accountname -u email@address.com -p p@ssw0rd -b 101 -Cards -backlog -archive -csv > cards.csv ``` ```bash # Get cards from a specific lane only LeanKitCmdQuery -h accountname -u email@address.com -p p@ssw0rd -b 101 -l 5001 -Cards -json ``` -------------------------------- ### Subscribe to LeanKit Board Events (.NET) Source: https://context7.com/leankit/api-samples/llms.txt Configure LeanKit integration to receive real-time notifications for board changes like card additions, updates, moves, and blocks. Ensure LeanKit.API.Client.Library is installed. ```csharp using LeanKit.API.Client.Library; using LeanKit.API.Client.Library.EventArguments; // Configure authentication var leanKitAuth = new LeanKitBasicAuth { Hostname = "accountname", Username = "user@company.com", Password = "your-password" }; var boardId = 101; // Create integration instance for event-based monitoring var integration = new LeanKitIntegrationFactory().Create(boardId, leanKitAuth); // Subscribe to board change events integration.BoardChanged += (sender, args) => { if (args.BoardStructureChanged) Console.WriteLine("Board structure changed."); if (args.AddedCards.Any()) Console.WriteLine($"{args.AddedCards.Count} card(s) were added."); if (args.UpdatedCards.Any()) Console.WriteLine($"{args.UpdatedCards.Count} card(s) were updated."); if (args.MovedCards.Any()) Console.WriteLine($"{args.MovedCards.Count} card(s) were moved."); if (args.BlockedCards.Any()) Console.WriteLine($"{args.BlockedCards.Count} card(s) were blocked."); }; // Start watching for changes integration.StartWatching(); // ... application runs ... // Stop watching when done integration.ShouldContinue = false; ``` -------------------------------- ### Search LeanKit Cards with Node.js Source: https://context7.com/leankit/api-samples/llms.txt Utilize the LeanKit Client for Node.js to search for cards on a board. Options include searching specific areas like backlog or comments, and exporting results in CSV or JSON format. Install dependencies using 'npm install'. ```bash # Install dependencies npm install # Basic search on a board (outputs CSV by default) node search.js -h "mycompany" -u "me@mycompany.com" -p "mypassword" -b "My Board Name" # Search with specific terms node search.js -h "mycompany" -u "me@mycompany.com" -p "mypassword" -b 12345 -s "bug fix" # Search in backlog only and save to file node search.js -h "mycompany" -u "me@mycompany.com" -p "mypassword" -b "My Board" --backlog > backlog.csv # Search including comments and tags, output as JSON node search.js -h "mycompany" -u "me@mycompany.com" -p "mypassword" -b 12345 --comments --tags --json # Search all areas (board, backlog, archive, old archive) node search.js -h "mycompany" -u "me@mycompany.com" -p "mypassword" -b "My Board" \ --board --backlog --archive --old --comments --tags # Command-line options: # -h, --host LeanKit hostname (e.g., "mycompany") # -u, --user Account email # -p, --password Account password # -b, --board-id Board name or numeric ID # -s, --search Search terms # --board Search active board lanes # --backlog Search backlog # --archive Search recent archive (< 14 days) # --old Search old archive (> 14 days) # --comments Include card comments in search # --tags Include card tags in search # --csv Output as CSV (default) # --json Output as JSON ``` -------------------------------- ### Export LeanKit Cards to CSV Source: https://github.com/leankit/api-samples/blob/master/LeanKitCmdQuery/README.md This example demonstrates how to export all cards from a specific board, including backlog and archive lanes, into a CSV file. Ensure you replace placeholder values with your actual account details and board ID. ```bash LeanKitCmdQuery -h accountname -u email@address.com -p p@ssw0rd -b 101 -cards -backlog -archive -csv > cards.csv ``` -------------------------------- ### Retrieving Board Lanes and Cards (.NET) Source: https://context7.com/leankit/api-samples/llms.txt Demonstrates retrieving all lanes from a board, including backlog and archive sections, and iterating through their cards. Archived cards can also be fetched separately. ```csharp using LeanKit.API.Client.Library; using LeanKit.API.Client.Library.TransferObjects; using System.Collections.Generic; using System.Linq; var api = new LeanKitClientFactory().Create(leanKitAuth); var boardId = 101; // Get the board var board = api.GetBoard(boardId); // Collect lanes from different sections var allLanes = new List(); allLanes.AddRange(board.Backlog); // Backlog lanes allLanes.AddRange(board.Lanes); // Active lanes allLanes.AddRange(board.Archive); // Archive lanes // Or use the built-in helper var allLanes = board.AllLanes(); // Iterate through all cards in all lanes foreach (var lane in allLanes) { Console.WriteLine($"Lane: {lane.Title} (ID: {lane.Id})"); foreach (var card in lane.Cards) { Console.WriteLine($" Card: {card.Title}"); Console.WriteLine($" ID: {card.Id}"); Console.WriteLine($" Type: {card.TypeName}"); Console.WriteLine($" Priority: {card.Priority}"); Console.WriteLine($" Size: {card.Size}"); } } // Get archived cards separately (cards older than 14 days) var archivedCards = api.GetArchiveCards(boardId); foreach (var card in archivedCards) { var lane = allLanes.FirstOrDefault(x => x.Id == card.LaneId); Console.WriteLine($"Archived Card: {card.Title} in {lane?.Title}"); } ``` -------------------------------- ### LeanKit search CLI usage Source: https://github.com/leankit/api-samples/blob/master/node-search/README.md Displays the available command-line arguments and options for the search script. ```text Usage: node search.js -h "accountname" -u "email" -p "password" -b ["name" or 1234] [options] Options: -h, --host Host name (e.g. mycompany) [string] [required] -u, --user Account email (e.g. me@company.com) [string] [required] -p, --password Account password [string] [required] -b, --board-id Board name or ID [required] -s, --search Search terms [string] --board Search board [boolean] --backlog Search backlog [boolean] --archive Search recent archive [boolean] --old Search old archive (> 14 days) [boolean] --comments Search comments [boolean] --tags Search tags [boolean] -?, --help Show help ``` -------------------------------- ### Node.js LeanKit Client Operations Source: https://context7.com/leankit/api-samples/llms.txt Demonstrates authentication, board retrieval, card searching with pagination, and finding board IDs by name using the leankit-client library. ```javascript var LeanKitClient = require("leankit-client"); var when = require("when"); // Create authenticated client var client = new LeanKitClient("accountname", "user@company.com", "password"); // Get all boards client.getBoards(function(err, boards) { if (err) { console.error("Error getting boards:", err); return; } boards.forEach(function(board) { console.log("Board:", board.Title, "ID:", board.Id); }); }); // Search cards with pagination var searchOptions = { SearchTerm: "bug", SearchInBacklog: true, SearchInBoard: true, SearchInRecentArchive: false, SearchInOldArchive: false, IncludeComments: true, IncludeTags: true, Page: 1, MaxResults: 20 }; var boardId = 12345; client.searchCards(boardId, searchOptions, function(err, results) { if (err) { console.error("Search error:", err); return; } console.log("Total results:", results.TotalResults); results.Results.forEach(function(card) { console.log("Card:", card.Title); }); }); // Find board by name function getBoardIdByName(boardName) { return when.promise(function(resolve, reject) { client.getBoards(function(err, boards) { if (err) return reject(err); var board = boards.find(function(b) { return b.Title === boardName; }); if (board) { resolve(board.Id); } else { reject("Board not found: " + boardName); } }); }); } ``` -------------------------------- ### Configure Windows Notifier (App.config) Source: https://context7.com/leankit/api-samples/llms.txt Set up LeanKitNotifier application credentials and board ID in the App.config file for Windows tray notifications. Ensure your account subdomain, email, password, and board ID are correctly entered. ```xml ``` -------------------------------- ### LeanKitCmdQuery Command-Line Usage Source: https://github.com/leankit/api-samples/blob/master/LeanKitCmdQuery/README.md This displays the available command-line options for the LeanKitCmdQuery application. Use these options to specify account details, target boards/lanes, and desired output format. ```bash Usage: LeanKitCmdQuery options OPTION TYPE DESCRIPTION -Host(-h) string* LeanKit host name (e.g. CompanyName) -User(-u) string* Account email address -Password(-p) string* Account password -Board(-b) integer Specify a board with the given identifier (ID) -Boards(-Bo) switch List all boards available to account -Lanes(-La) switch List all lanes for the given board -Lane(-l) integer Specify a lane with the given identifier (ID) -IncludeBacklog(-backlog) switch Include backlog lane(s) -IncludeArchive(-archive) switch Include archive lane(s) -Cards(-C) switch List all cards for the given board or lane -Csv(-Cs) switch Output results in comma-delimited format (CSV) -Json(-J) switch Output results in JSON format EXAMPLE: LeanKitCmdQuery -h [account name] -u [email] -p [password] [-b [board id]] Query LeanKit and output results to console. ``` -------------------------------- ### LeanKit API Authentication (.NET) Source: https://context7.com/leankit/api-samples/llms.txt Configures authentication credentials using LeanKitBasicAuth and creates an authenticated client instance with LeanKitClientFactory. Use this to access the LeanKit API for operations like retrieving boards. ```csharp using LeanKit.API.Client.Library; using LeanKit.API.Client.Library.TransferObjects; // Configure authentication var leanKitAuth = new LeanKitBasicAuth { Hostname = "accountname", // Your LeanKit subdomain Username = "user@company.com", // Account email Password = "your-password" // Account password }; // Create API client instance var api = new LeanKitClientFactory().Create(leanKitAuth); // Get all boards accessible to the account var boards = api.GetBoards(); foreach (var board in boards) { Console.WriteLine($"Board: {board.Title} (ID: {board.Id})"); } // Get a specific board with all details var boardId = 101; var board = api.GetBoard(boardId); Console.WriteLine($"Board: {board.Title}"); Console.WriteLine($"Total Lanes: {board.Lanes.Count}"); ``` -------------------------------- ### Execute search script Source: https://github.com/leankit/api-samples/blob/master/node-search/README.md Runs the search script with specific credentials and board parameters, outputting to a CSV file. ```bash node search.js -h "mycompany" -u "me@mycompany.com" -p "mypassword" -b "my board name" --backlog > backlog.csv ``` -------------------------------- ### Configure LeanKit Connection Settings Source: https://github.com/leankit/api-samples/blob/master/LeanKitNotifier/README.md Update these settings in the app.config file to connect to your LeanKit account. Ensure you replace the placeholder values with your actual account details. ```xml ``` -------------------------------- ### Execute ExportCards.csx via Command Prompt Source: https://github.com/leankit/api-samples/blob/master/LeanKitScriptCS/README.md Run the script using the scriptcs command and redirect the output to a local CSV file. ```bash scriptcs ExportCards.csx > cards.csv ``` -------------------------------- ### ScriptCS Card Export Source: https://context7.com/leankit/api-samples/llms.txt Exports all cards from a LeanKit board to CSV format using C# scripting. Requires the LeanKit.API.Client.Library and a custom CardModel. ```csharp // ExportCards.csx - Run with: scriptcs ExportCards.csx > cards.csv #r "LeanKit.API.Client.Library.dll" #load "CardModel.csx" using LeanKit.API.Client.Library; using LeanKit.API.Client.Library.TransferObjects; using System.Collections.Generic; using System.Linq; // Configure your LeanKit connection var host = "accountname"; // Your LeanKit subdomain var userName = "user@email.com"; // Your email var password = "p@ssword"; // Your password var boardId = 101; // Your board ID // Authenticate and create API client var leanKitAuth = new LeanKitBasicAuth { Hostname = host, Username = userName, Password = password }; var api = new LeanKitClientFactory().Create(leanKitAuth); // Get board and collect all cards var board = api.GetBoard(boardId); var cards = new List(); // Get cards from all lanes var allLanes = board.AllLanes(); foreach (var lane in allLanes) { foreach (var card in lane.Cards) { cards.Add(new CardModel { CardId = card.Id, LaneId = card.LaneId, LaneTitle = lane.Title.Replace("\"", "\"\""), Title = card.Title.Replace("\"", "\"\""), Description = card.Description.Replace("\"", "\"\""), Type = card.TypeName, Priority = card.Priority.ToString(), Size = card.Size }); } } // Include archived cards var archivedCards = api.GetArchiveCards(boardId); foreach (var card in archivedCards) { var lane = allLanes.FirstOrDefault(x => x.Id == card.LaneId); cards.Add(new CardModel { CardId = card.Id, LaneId = card.LaneId, LaneTitle = lane?.Title.Replace("\"", "\"\"") ?? "", Title = card.Title.Replace("\"", "\"\""), Description = card.Description.Replace("\"", "\"\""), Type = card.TypeName, Priority = card.Priority.ToString(), Size = card.Size }); } // Output CSV format Console.WriteLine("LaneId,LaneTitle,CardId,Title,Description,Type,Priority,Size"); foreach (var card in cards) { Console.WriteLine("{0},\"{1}\",{2},\"{3}\",\"{4}\",{5},{6},{7}", card.LaneId, card.LaneTitle, card.CardId, card.Title, card.Description, card.Type, card.Priority, card.Size); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.