SharphConduitProject
ActivePublic

Members (1)

Watchers

  • This project does not have any watchers.

Details

Description

SharphConduit 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.SharphConduit;

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.SharphConduit.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

Tue, Jan 30

stwalkerster changed the edit policy for T833: Detect missing / from URL and fix.
Tue, Jan 30, 11:48 PM · SharphConduit
stwalkerster changed the edit policy for T587: Implement Dashboard application.
Tue, Jan 30, 8:21 PM · SharphConduit
stwalkerster changed the edit policy for T589: Implement Owners application.
Tue, Jan 30, 8:21 PM · SharphConduit
stwalkerster changed the edit policy for T588: Implement Badges application.
Tue, Jan 30, 8:21 PM · SharphConduit
stwalkerster changed the edit policy for T195: Paste.
Tue, Jan 30, 8:20 PM · SharphConduit
stwalkerster changed the edit policy for T568: ApplicationEditor Edit method doesn't update object with relevant transactions.
Tue, Jan 30, 8:20 PM · SharphConduit
stwalkerster changed the edit policy for T571: Member and Watcher lists don't reflect pending transactions.
Tue, Jan 30, 8:20 PM · SharphConduit
stwalkerster changed the edit policy for T570: Workboard column attachment.
Tue, Jan 30, 8:20 PM · SharphConduit
stwalkerster changed the edit policy for T569: ApplicationEditor Search doesn't handle ordering of results.
Tue, Jan 30, 8:20 PM · SharphConduit
stwalkerster changed the edit policy for T572: Edit slugs.
Tue, Jan 30, 8:20 PM · SharphConduit
stwalkerster changed the edit policy for T574: Implement project.column.search.
Tue, Jan 30, 8:20 PM · SharphConduit
stwalkerster changed the edit policy for T573: Create with parent/milestone.
Tue, Jan 30, 8:20 PM · SharphConduit
stwalkerster changed the edit policy for T576: Implement maniphest.gettasktransactions.
Tue, Jan 30, 8:20 PM · SharphConduit
stwalkerster changed the edit policy for T575: Project / Subscribers to reflect pending transactions.
Tue, Jan 30, 8:20 PM · SharphConduit
stwalkerster changed the edit policy for T577: Implement maniphest.querystatuses.
Tue, Jan 30, 8:20 PM · SharphConduit
stwalkerster changed the edit policy for T579: Pad out SearchConstraintFactory.
Tue, Jan 30, 8:20 PM · SharphConduit
stwalkerster changed the edit policy for T580: Implement SearchConstraintFactory.
Tue, Jan 30, 8:20 PM · SharphConduit
stwalkerster changed the edit policy for T578: Pad out SearchContstraintFactory.
Tue, Jan 30, 8:20 PM · SharphConduit
stwalkerster changed the edit policy for T582: Implement generally.
Tue, Jan 30, 8:20 PM · SharphConduit
stwalkerster changed the edit policy for T584: Implement repository search attachments.
Tue, Jan 30, 8:20 PM · SharphConduit
stwalkerster changed the edit policy for T583: Implement lots of dangling Diffusion things.
Tue, Jan 30, 8:20 PM · SharphConduit
stwalkerster changed the edit policy for T581: Create with parent task.
Tue, Jan 30, 8:20 PM · SharphConduit
stwalkerster changed the edit policy for T585: Implement various repository transactions which aren't reflected in search method.
Tue, Jan 30, 8:20 PM · SharphConduit
stwalkerster changed the edit policy for T586: Implement Differential application.
Tue, Jan 30, 8:20 PM · SharphConduit
stwalkerster changed the edit policy for T590: Implement User application.
Tue, Jan 30, 8:20 PM · SharphConduit
stwalkerster changed the edit policy for T629: Investigate whether view policy and edit policy need to be brought up a layer.
Tue, Jan 30, 8:20 PM · SharphConduit
stwalkerster changed the edit policy for T630: Move custom fields to application editor?.
Tue, Jan 30, 8:20 PM · SharphConduit
stwalkerster changed the edit policy for T207: sharphconduit paste doesn't support editingprojects or subscribers.
Tue, Jan 30, 2:10 PM · SharphConduit, Restricted Project
stwalkerster triaged T833: Detect missing / from URL and fix as Normal priority.
Tue, Jan 30, 1:48 PM · SharphConduit

Feb 16 2017

stwalkerster created T630: Move custom fields to application editor?.
Feb 16 2017, 11:51 AM · SharphConduit
stwalkerster created T629: Investigate whether view policy and edit policy need to be brought up a layer.
Feb 16 2017, 11:50 AM · SharphConduit

Feb 6 2017

stwalkerster lowered the priority of T587: Implement Dashboard application from Normal to Wishlist.
Feb 6 2017, 8:25 PM · SharphConduit
stwalkerster lowered the priority of T588: Implement Badges application from Normal to Wishlist.
Feb 6 2017, 8:25 PM · SharphConduit
stwalkerster lowered the priority of T589: Implement Owners application from Normal to Wishlist.
Feb 6 2017, 8:25 PM · SharphConduit
stwalkerster triaged T568: ApplicationEditor Edit method doesn't update object with relevant transactions as Normal priority.
Feb 6 2017, 8:24 PM · SharphConduit
stwalkerster triaged T570: Workboard column attachment as Normal priority.
Feb 6 2017, 8:24 PM · SharphConduit
stwalkerster triaged T569: ApplicationEditor Search doesn't handle ordering of results as Normal priority.
Feb 6 2017, 8:24 PM · SharphConduit
stwalkerster triaged T571: Member and Watcher lists don't reflect pending transactions as Normal priority.
Feb 6 2017, 8:24 PM · SharphConduit
stwalkerster triaged T573: Create with parent/milestone as Normal priority.
Feb 6 2017, 8:24 PM · SharphConduit
stwalkerster triaged T572: Edit slugs as Normal priority.
Feb 6 2017, 8:24 PM · SharphConduit
stwalkerster triaged T574: Implement project.column.search as Normal priority.
Feb 6 2017, 8:24 PM · SharphConduit
stwalkerster triaged T577: Implement maniphest.querystatuses as Normal priority.
Feb 6 2017, 8:24 PM · SharphConduit
stwalkerster triaged T575: Project / Subscribers to reflect pending transactions as Normal priority.
Feb 6 2017, 8:24 PM · SharphConduit
stwalkerster triaged T576: Implement maniphest.gettasktransactions as Normal priority.
Feb 6 2017, 8:24 PM · SharphConduit
stwalkerster triaged T579: Pad out SearchConstraintFactory as Normal priority.
Feb 6 2017, 8:24 PM · SharphConduit
stwalkerster triaged T578: Pad out SearchContstraintFactory as Normal priority.
Feb 6 2017, 8:24 PM · SharphConduit
stwalkerster triaged T582: Implement generally as Normal priority.
Feb 6 2017, 8:24 PM · SharphConduit
stwalkerster triaged T580: Implement SearchConstraintFactory as Normal priority.
Feb 6 2017, 8:24 PM · SharphConduit
stwalkerster triaged T581: Create with parent task as Normal priority.
Feb 6 2017, 8:24 PM · SharphConduit
stwalkerster triaged T585: Implement various repository transactions which aren't reflected in search method as Normal priority.
Feb 6 2017, 8:24 PM · SharphConduit