Giter VIP home page Giter VIP logo

pivotaltrack-fluent-api's Introduction

What is it ?

Pivotal Tracker FluentAPI is C# API that uses the Fluent pattern to connect to the PivotalTracker REST API.

How to use it ?

First create the Pivotal Tracker Facade

	var token = new Token("APIKEY"); //get a pivotal API key from your Profile
	var Pivotal = new PivotalTrackerFacade(token);

List all stories

	Pivotal.Projects().Get(123456).Stories().All().Each(s=>Console.WriteLine("{0} : {1}", s.Name, s.Description));

List some stories

	var stories = Pivotal.Projects().Get(123456).Stories().Filter("label:ui state:delivered");

Create a story

	Pivotal.Projects().Get(123456).Stories()
		.Create()
			  .SetName("Hello World")
			  .SetType(StoryTypeEnum.Bug)
		.Save();

Complete sample

  1. create a project
  2. create a story
  3. add a note
  4. add an attachment
  5. start a story
  6. then retrieves all stories in started state
	byte[] someBytes = System.Text.Encoding.ASCII.GetBytes("Hello World"); //Some bytes
	Pivotal
		.Projects()
			.Create()
				.SetName("My first project")
				.SetIterationLength(3)
			.Save()
				.Stories()
					.Create()
						.SetName("This is my first story")
						.SetType(StoryTypeEnum.Feature)
						.SetDescription("i'am happy it's so easy !")
						.Save() 
							.AddNote("this is really amazing")
							.UploadAttachment(someBytes, "attachment.txt", "text/plain")
							.Update(story =>
							{
								story.Estimate = 3;
								story.OwnedBy = story.RequestedBy;
								story.CurrentState = StoryStateEnum.Started;
							})
				.Done()
				.Filter("state:started") //search for stories
					.Do(stories =>
					{
						//do some display
						foreach (var s in stories)
						{
							Console.WriteLine("{0}: {1} ({2})", s.Id, s.Name, s.Type);
							foreach (var n in s.Notes)
								Console.WriteLine("\tNote {0} ({1}): {2}", n.Id, n.Description, n.NoteDate);
						}
					})
				.Done() //not mandatory, just for the symmetry :)
			.Done()
		.Done()
	.Done();

There is many other methods. Just download the code and let's follow the Fluent API :)

pivotaltrack-fluent-api's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

muojp

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.