Page MenuHomePhabricator

Stwalkerster.Bot.PhabricatorLibProject
ArchivedPublic

Members (1)

Watchers

  • This project does not have any watchers.
  • View All

Details

Description

Stwalkerster.Bot.PhabricatorLib is a C# library which implements the Phabricator API.

While still in development, certain areas are mostly complete:

  • Maniphest
  • Projects
  • Paste

Other areas have barely any functionality yet.

Usage

Firstly, grab yourself an API token from https://phabricator.example.com/conduit/token/

Then, create a new instance of ConduitClient:

using Stwalkerster.Bot.PhabricatorLib;

private static void Main()
{
    string phabUrl = "https://phabricator.example.com/";
    string token = "api-xxxxxxxxxxxxxxxxxxxxxxxxxxxx";

    var client = new ConduitClient(phabUrl, token);
}

This client implements the underlying protocol of Conduit, allowing you to do things like this:

dynamic result = client.CallMethod("user.whoami", new Dictionary<string, dynamic>());

Or something more complex:

dynamic response = client.CallMethod(
                       "phid.lookup",
                       new Dictionary<string, dynamic> { { "names", new[] { "T112", "T439" } } });

However, that's boring. For some applications, these API calls have already been wrapped up for you!

ApplicationEditor-capable APIs (including Maniphest)

Take your client from earlier, and use it to create a new instance of Maniphest:

using Stwalkerster.Bot.PhabricatorLib.Applications.Maniphest;
var maniphest = new Maniphest(client);

Application editor APIs provide two methods to call: Edit(...) and Search(...)

Search

Search requests can pass in a base query to start the search with, or a set of constraints to apply.

To add a constraint, construct an instance of ApplicationEditorSearchConstraint like this:

var constraint = ManiphestSearchConstraintFactory.Statuses(new List<string> { "open" });

Or, if that doesn't provide you with the flexibility you need:

var constraint = new ApplicationEditorSearchConstraint {Type = "fulltext", Value = "foo bar"};

You can consult the relevant API documentation to find the constraint types you can use at https://phabricator.example.com/conduit/method/maniphest.search/ .

NOTE: Some constraints expect PHIDs rather than actual names or IDs. You can find these easily by using PHIDLookup.

Once you have your constraints, you can pass the collection of them to the Search method:

var constraint = ManiphestSearchConstraintFactory.Statuses(new List<string> { "open" });
var searchConstraints = new List<ApplicationEditorSearchConstraint> { constraint };
IEnumerable<ManiphestTask> response = maniphest.Search(constraints: searchConstraints);

Edit

Editing is much simpler.

Either get yourself an instance of a ManiphestTask from the client (by search) if you want to edit, or create a new instance of ManiphestTask if you want to create a new task.

var task = new ManiphestTask();

Then, just set the properties you want to set:

task.Title = "Example task";
task.Description = "Example description";

Finally, pass your task to Maniphest:

maniphest.Edit(task);

Recent Activity

Jan 10 2023

stwalkerster archived Stwalkerster.Bot.PhabricatorLib.
Jan 10 2023, 1:06 AM
stwalkerster closed T589: Implement Owners application as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T568: ApplicationEditor Edit method doesn't update object with relevant transactions as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T588: Implement Badges application as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T587: Implement Dashboard application as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T575: Project / Subscribers to reflect pending transactions as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T570: Workboard column attachment as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T569: ApplicationEditor Search doesn't handle ordering of results as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T574: Implement project.column.search as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T572: Edit slugs as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T573: Create with parent/milestone as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T571: Member and Watcher lists don't reflect pending transactions as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T580: Implement SearchConstraintFactory as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T581: Create with parent task as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T578: Pad out SearchContstraintFactory as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T579: Pad out SearchConstraintFactory as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T576: Implement maniphest.gettasktransactions as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T577: Implement maniphest.querystatuses as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T582: Implement generally as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T586: Implement Differential application as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T584: Implement repository search attachments as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T585: Implement various repository transactions which aren't reflected in search method as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T590: Implement User application as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T583: Implement lots of dangling Diffusion things as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T629: Investigate whether view policy and edit policy need to be brought up a layer as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T833: Detect missing / from URL and fix as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib
stwalkerster closed T630: Move custom fields to application editor? as Wontfix.
Jan 10 2023, 12:52 AM · Stwalkerster.Bot.PhabricatorLib

Aug 25 2020

stwalkerster renamed Stwalkerster.Bot.PhabricatorLib from SharphConduit to Stwalkerster.Bot.PhabricatorLib.
Aug 25 2020, 10:58 PM

Feb 13 2019

stwalkerster changed the join policy for Stwalkerster.Bot.PhabricatorLib.
Feb 13 2019, 11:58 AM

Jan 30 2018

stwalkerster changed the edit policy for T833: Detect missing / from URL and fix.
Jan 30 2018, 11:48 PM · Stwalkerster.Bot.PhabricatorLib
stwalkerster changed the edit policy for T587: Implement Dashboard application.
Jan 30 2018, 8:21 PM · Stwalkerster.Bot.PhabricatorLib
stwalkerster changed the edit policy for T589: Implement Owners application.
Jan 30 2018, 8:21 PM · Stwalkerster.Bot.PhabricatorLib
stwalkerster changed the edit policy for T588: Implement Badges application.
Jan 30 2018, 8:21 PM · Stwalkerster.Bot.PhabricatorLib
stwalkerster changed the edit policy for T195: Paste.
Jan 30 2018, 8:20 PM · Stwalkerster.Bot.PhabricatorLib
stwalkerster changed the edit policy for T568: ApplicationEditor Edit method doesn't update object with relevant transactions.
Jan 30 2018, 8:20 PM · Stwalkerster.Bot.PhabricatorLib
stwalkerster changed the edit policy for T571: Member and Watcher lists don't reflect pending transactions.
Jan 30 2018, 8:20 PM · Stwalkerster.Bot.PhabricatorLib
stwalkerster changed the edit policy for T570: Workboard column attachment.
Jan 30 2018, 8:20 PM · Stwalkerster.Bot.PhabricatorLib
stwalkerster changed the edit policy for T569: ApplicationEditor Search doesn't handle ordering of results.
Jan 30 2018, 8:20 PM · Stwalkerster.Bot.PhabricatorLib
stwalkerster changed the edit policy for T572: Edit slugs.
Jan 30 2018, 8:20 PM · Stwalkerster.Bot.PhabricatorLib
stwalkerster changed the edit policy for T574: Implement project.column.search.
Jan 30 2018, 8:20 PM · Stwalkerster.Bot.PhabricatorLib
stwalkerster changed the edit policy for T573: Create with parent/milestone.
Jan 30 2018, 8:20 PM · Stwalkerster.Bot.PhabricatorLib
stwalkerster changed the edit policy for T576: Implement maniphest.gettasktransactions.
Jan 30 2018, 8:20 PM · Stwalkerster.Bot.PhabricatorLib
stwalkerster changed the edit policy for T575: Project / Subscribers to reflect pending transactions.
Jan 30 2018, 8:20 PM · Stwalkerster.Bot.PhabricatorLib
stwalkerster changed the edit policy for T577: Implement maniphest.querystatuses.
Jan 30 2018, 8:20 PM · Stwalkerster.Bot.PhabricatorLib
stwalkerster changed the edit policy for T579: Pad out SearchConstraintFactory.
Jan 30 2018, 8:20 PM · Stwalkerster.Bot.PhabricatorLib
stwalkerster changed the edit policy for T580: Implement SearchConstraintFactory.
Jan 30 2018, 8:20 PM · Stwalkerster.Bot.PhabricatorLib
stwalkerster changed the edit policy for T578: Pad out SearchContstraintFactory.
Jan 30 2018, 8:20 PM · Stwalkerster.Bot.PhabricatorLib
stwalkerster changed the edit policy for T582: Implement generally.
Jan 30 2018, 8:20 PM · Stwalkerster.Bot.PhabricatorLib
stwalkerster changed the edit policy for T584: Implement repository search attachments.
Jan 30 2018, 8:20 PM · Stwalkerster.Bot.PhabricatorLib
stwalkerster changed the edit policy for T583: Implement lots of dangling Diffusion things.
Jan 30 2018, 8:20 PM · Stwalkerster.Bot.PhabricatorLib