Example #1
0
// Example of searching a flowdock flow for a string and tags
func main() {
	client := flowdock.NewClient(auth.AuthenticationRequest())

	search := "production to production"
	tags := []string{"deployment", "deploy_end", "production", "icis"}
	event := "mail"
	messageSearch(&tags, &event, &search, client)
}
Example #2
0
func main() {
	httpClient := auth.AuthenticationRequest()
	token, _ := oauth.CacheFile("cache.json").Token()

	client := flowdock.NewClient(httpClient)

	messageList(client)
	messageStream(client, token.AccessToken)

	fmt.Println("Waiting for event")
}
Example #3
0
func main() {
	client := flowdock.NewClient(auth.AuthenticationRequest())

	// Careful
	// flowsCreate("iora", "wm-test-api", client)
	// flowsUpdate("iora", "wm-test-api", client)

	flowsGet("iora", "culinary-extra", client)
	flowsGetById("iora:culinary-extra", client)
	flowsList(client)

	message := messagesCreate(client)
	messagesComment(client, *message.ID)
	messageList(client)
	// inboxMessage(client)
}
Example #4
0
// example of counting number of deploys per month for specidied applications.
//
// This is utilizing the fact that a deploy command messages the flow inbox and is tagged appropriately.
func main() {
	app := cli.NewApp()

	app.Flags = []cli.Flag{
		cli.StringFlag{"id", "", "Client ID"},
		cli.StringFlag{"secret", "", "Client Secret"},
		cli.StringFlag{"redirect_url", "urn:ietf:wg:oauth:2.0:oob", "Redirect URL"},
		cli.StringFlag{"auth_url", "https://api.flowdock.com/oauth/authorize", "Authentication URL"},
		cli.StringFlag{"token_url", "https://api.flowdock.com/oauth/token", "Token URL"},
		cli.StringFlag{"code", "", "Authorization Code"},
		cli.StringFlag{"cache", "cache.json", "Token cache file"},
		cli.StringFlag{"environment, e", "production", "the deploy target"},
		cli.StringFlag{"organization, o", "iora", "the organization of the flow"},
		cli.StringFlag{"flow, f", "tech-stuff", "the name of the flow to query"},
	}

	app.Name = "deploys"
	app.Usage = "Counts the deploys for the listed applications by month"

	app.Action = func(c *cli.Context) {
		client := flowdock.NewClient(AuthenticationRequest(c))
		// args := []string{"bouncah", "icis", "cronos", "snowflake"} //c.Args()
		args := c.Args()

		if len(args) == 0 {
			cli.ShowAppHelp(c)
			os.Exit(1)
		}

		channel := make(chan AppDeployCount, len([]string(args)))

		for _, app := range []string(args) {
			tags := []string{
				"deployment",
				"deploy_end",
				c.String("environment"),
				app,
			}
			q := Query{tags, c.String("organization"), c.String("flow")}
			getAppDeployCount(q, client, channel)
		}

		displayAppDeployCount(channel)
	}

	app.Run(os.Args)
}