GithubHelp home page GithubHelp logo

productplanapi-go's Introduction

productplanapi-go

https://app.productplan.com/docs

Example client

package main

import (
	"fmt"
	"os"

	"github.com/jpparsons/productplanapi-go/productplan"
)

func main() {
  oauthToken := os.Getenv("TOKEN")
  url := "https://app.productplan.com"

  client := productplan.NewClient(url, productplan.NewOauthTokenCredentials(oauthToken))
  statusResponse, err := client.Status.GetStatus()
  if err != nil {
    fmt.Printf("Status() returned error: %v\n", err)
    os.Exit(1)
  }
  // List Roadmaps
  roadmapList, err := client.Roadmaps.ListRoadmaps(&productplan.ListOptions{Filters: "name=Planning Roadmap*"})
  if err != nil {
    fmt.Printf("ListRoadmaps() returned error: %v\n", err)
    os.Exit(1)
  }

  for _, roadmap := range *roadmapList {
    fmt.Println(roadmap.Name)
    fmt.Println(roadmap.ID) 
  }
  
  // Get bars for a roadmap
  roadmap := (*roadmapList)[0]
  bars, err := client.Roadmaps.GetBars(roadmap.Roadmap)
  if err != nil {
    fmt.Printf("GetBars() returned error: %v\n", err)
    os.Exit(1)
  }

  for _, bar := range *bars {
    fmt.Println(bar.ID)
    fmt.Println(bar.Name)
  }
  
  // Import an idea (parkinglot bar)
  idea := productplan.Ideas{
    Name:           "Docker",
    Description:    "Setup Docker",
    StrategicValue: "High",
    Notes:          "isolated",
    PercentDone:    15,
    Effort:         5,
    Tags:           []string{"devops", "security"},
    Fields:         map[string]string{"pp_lanes": "Lane 2", "pp_legend": "Goal 4"}, 
  }

  ideas := productplan.IdeasImportAttributes{
    IdeaImportRoadmap: productplan.IdeaImportRoadmap{ID: roadmap.ID},
    Ideas:             []productplan.Ideas{idea},
  }

  // import returns no response data (resp will contain the code as resp.HTTPResponse.StatusCode)
  _, err = client.Ideas.Import(ideas)
  if err != nil {
    fmt.Printf("Ideas.Import() returned error: %v\n", err)
  }
}

productplanapi-go's People

Contributors

jpparsons avatar

Watchers

James Cloos avatar  avatar

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.