{"action":"created","comment":{"url":"https://api.github.com/repos/advancedtelematic/campaign-manager/pulls/comments/194988247","pull_request_review_id":128264671,"id":194988247,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NDk4ODI0Nw==","diff_hunk":"@@ -0,0 +1,109 @@\n+use reqwest::header::{Authorization, Bearer, Header};\n+use reqwest::Client;\n+use serde_json::{self, Value};\n+use std::io::{self, Write};\n+use uuid::Uuid;\n+\n+use datatype::{Token, Url};\n+use error::Error;\n+\n+const API_VERSION: &'static str = \"api/v2\";\n+\n+pub trait Campaign {\n+    fn create(&self, campaign_id: Uuid, name: &str, groups: Vec<Uuid>) -> Result<(), Error>;\n+    fn get(&self, campaign_id: Uuid) -> Result<(), Error>;\n+    fn launch(&self, campaign_id: Uuid) -> Result<(), Error>;\n+    fn stats(&self, campaign_id: Uuid) -> Result<(), Error>;\n+    fn cancel(&self, campaign_id: Uuid) -> Result<(), Error>;\n+}\n+\n+pub struct Manager<'c> {\n+    client: &'c Client,\n+    campaigner: Url,\n+    token: Token,\n+}\n+\n+impl<'c> Manager<'c> {\n+    pub fn new(client: &'c Client, campaigner: Url, token: Token) -> Self {\n+        Manager {\n+            client,\n+            campaigner,\n+            token,\n+        }\n+    }\n+\n+    fn bearer(&self) -> Result<impl Header, Error> {\n+        Ok(Authorization(Bearer {\n+            token: (self.token)()?.access_token,\n+        }))\n+    }\n+}\n+\n+impl<'c> Campaign for Manager<'c> {\n+    fn create(&self, campaign_id: Uuid, name: &str, groups: Vec<Uuid>) -> Result<(), Error> {","path":"src/campaign.rs","position":43,"original_position":43,"commit_id":"12fbb36df71549c5910a434cc0bf2fde9cb0a59b","original_commit_id":"2727b0d3e80bae5336a4f886bc8948a4690151a0","user":{"login":"taheris","id":298102,"node_id":"MDQ6VXNlcjI5ODEwMg==","avatar_url":"https://avatars0.githubusercontent.com/u/298102?v=4","gravatar_id":"","url":"https://api.github.com/users/taheris","html_url":"https://github.com/taheris","followers_url":"https://api.github.com/users/taheris/followers","following_url":"https://api.github.com/users/taheris/following{/other_user}","gists_url":"https://api.github.com/users/taheris/gists{/gist_id}","starred_url":"https://api.github.com/users/taheris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taheris/subscriptions","organizations_url":"https://api.github.com/users/taheris/orgs","repos_url":"https://api.github.com/users/taheris/repos","events_url":"https://api.github.com/users/taheris/events{/privacy}","received_events_url":"https://api.github.com/users/taheris/received_events","type":"User","site_admin":false},"body":"As discussed, I'll add the prior Director API call in another commit.","created_at":"2018-06-13T08:02:34Z","updated_at":"2018-06-13T08:02:34Z","html_url":"https://github.com/advancedtelematic/campaign-manager/pull/1#discussion_r194988247","pull_request_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/pulls/1","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/advancedtelematic/campaign-manager/pulls/comments/194988247"},"html":{"href":"https://github.com/advancedtelematic/campaign-manager/pull/1#discussion_r194988247"},"pull_request":{"href":"https://api.github.com/repos/advancedtelematic/campaign-manager/pulls/1"}},"in_reply_to_id":194980553},"pull_request":{"url":"https://api.github.com/repos/advancedtelematic/campaign-manager/pulls/1","id":194313450,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk0MzEzNDUw","html_url":"https://github.com/advancedtelematic/campaign-manager/pull/1","diff_url":"https://github.com/advancedtelematic/campaign-manager/pull/1.diff","patch_url":"https://github.com/advancedtelematic/campaign-manager/pull/1.patch","issue_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/issues/1","number":1,"state":"open","locked":false,"title":"Build the CLI","user":{"login":"taheris","id":298102,"node_id":"MDQ6VXNlcjI5ODEwMg==","avatar_url":"https://avatars0.githubusercontent.com/u/298102?v=4","gravatar_id":"","url":"https://api.github.com/users/taheris","html_url":"https://github.com/taheris","followers_url":"https://api.github.com/users/taheris/followers","following_url":"https://api.github.com/users/taheris/following{/other_user}","gists_url":"https://api.github.com/users/taheris/gists{/gist_id}","starred_url":"https://api.github.com/users/taheris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taheris/subscriptions","organizations_url":"https://api.github.com/users/taheris/orgs","repos_url":"https://api.github.com/users/taheris/repos","events_url":"https://api.github.com/users/taheris/events{/privacy}","received_events_url":"https://api.github.com/users/taheris/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-06-12T15:07:55Z","updated_at":"2018-06-13T08:02:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"37bbec5b56bdce3f7ad9dcb3ab9c55e8b75af9b9","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/pulls/1/commits","review_comments_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/pulls/1/comments","review_comment_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/pulls/comments{/number}","comments_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/issues/1/comments","statuses_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/statuses/12fbb36df71549c5910a434cc0bf2fde9cb0a59b","head":{"label":"advancedtelematic:feat/cli-parsing","ref":"feat/cli-parsing","sha":"12fbb36df71549c5910a434cc0bf2fde9cb0a59b","user":{"login":"advancedtelematic","id":7944633,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc5NDQ2MzM=","avatar_url":"https://avatars0.githubusercontent.com/u/7944633?v=4","gravatar_id":"","url":"https://api.github.com/users/advancedtelematic","html_url":"https://github.com/advancedtelematic","followers_url":"https://api.github.com/users/advancedtelematic/followers","following_url":"https://api.github.com/users/advancedtelematic/following{/other_user}","gists_url":"https://api.github.com/users/advancedtelematic/gists{/gist_id}","starred_url":"https://api.github.com/users/advancedtelematic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/advancedtelematic/subscriptions","organizations_url":"https://api.github.com/users/advancedtelematic/orgs","repos_url":"https://api.github.com/users/advancedtelematic/repos","events_url":"https://api.github.com/users/advancedtelematic/events{/privacy}","received_events_url":"https://api.github.com/users/advancedtelematic/received_events","type":"Organization","site_admin":false},"repo":{"id":136297636,"node_id":"MDEwOlJlcG9zaXRvcnkxMzYyOTc2MzY=","name":"campaign-manager","full_name":"advancedtelematic/campaign-manager","owner":{"login":"advancedtelematic","id":7944633,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc5NDQ2MzM=","avatar_url":"https://avatars0.githubusercontent.com/u/7944633?v=4","gravatar_id":"","url":"https://api.github.com/users/advancedtelematic","html_url":"https://github.com/advancedtelematic","followers_url":"https://api.github.com/users/advancedtelematic/followers","following_url":"https://api.github.com/users/advancedtelematic/following{/other_user}","gists_url":"https://api.github.com/users/advancedtelematic/gists{/gist_id}","starred_url":"https://api.github.com/users/advancedtelematic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/advancedtelematic/subscriptions","organizations_url":"https://api.github.com/users/advancedtelematic/orgs","repos_url":"https://api.github.com/users/advancedtelematic/repos","events_url":"https://api.github.com/users/advancedtelematic/events{/privacy}","received_events_url":"https://api.github.com/users/advancedtelematic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/advancedtelematic/campaign-manager","description":"CLI to manage campaigns","fork":false,"url":"https://api.github.com/repos/advancedtelematic/campaign-manager","forks_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/forks","keys_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/teams","hooks_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/hooks","issue_events_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/issues/events{/number}","events_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/events","assignees_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/assignees{/user}","branches_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/branches{/branch}","tags_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/tags","blobs_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/git/refs{/sha}","trees_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/statuses/{sha}","languages_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/languages","stargazers_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/stargazers","contributors_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/contributors","subscribers_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/subscribers","subscription_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/subscription","commits_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/commits{/sha}","git_commits_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/git/commits{/sha}","comments_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/comments{/number}","issue_comment_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/issues/comments{/number}","contents_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/contents/{+path}","compare_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/merges","archive_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/downloads","issues_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/issues{/number}","pulls_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/pulls{/number}","milestones_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/milestones{/number}","notifications_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/labels{/name}","releases_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/releases{/id}","deployments_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/deployments","created_at":"2018-06-06T08:29:03Z","updated_at":"2018-06-06T08:29:06Z","pushed_at":"2018-06-12T20:18:17Z","git_url":"git://github.com/advancedtelematic/campaign-manager.git","ssh_url":"git@github.com:advancedtelematic/campaign-manager.git","clone_url":"https://github.com/advancedtelematic/campaign-manager.git","svn_url":"https://github.com/advancedtelematic/campaign-manager","homepage":null,"size":31,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"advancedtelematic:master","ref":"master","sha":"cdb8e92ea1ad8843d5c1e2ad41dff4479e9ec875","user":{"login":"advancedtelematic","id":7944633,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc5NDQ2MzM=","avatar_url":"https://avatars0.githubusercontent.com/u/7944633?v=4","gravatar_id":"","url":"https://api.github.com/users/advancedtelematic","html_url":"https://github.com/advancedtelematic","followers_url":"https://api.github.com/users/advancedtelematic/followers","following_url":"https://api.github.com/users/advancedtelematic/following{/other_user}","gists_url":"https://api.github.com/users/advancedtelematic/gists{/gist_id}","starred_url":"https://api.github.com/users/advancedtelematic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/advancedtelematic/subscriptions","organizations_url":"https://api.github.com/users/advancedtelematic/orgs","repos_url":"https://api.github.com/users/advancedtelematic/repos","events_url":"https://api.github.com/users/advancedtelematic/events{/privacy}","received_events_url":"https://api.github.com/users/advancedtelematic/received_events","type":"Organization","site_admin":false},"repo":{"id":136297636,"node_id":"MDEwOlJlcG9zaXRvcnkxMzYyOTc2MzY=","name":"campaign-manager","full_name":"advancedtelematic/campaign-manager","owner":{"login":"advancedtelematic","id":7944633,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc5NDQ2MzM=","avatar_url":"https://avatars0.githubusercontent.com/u/7944633?v=4","gravatar_id":"","url":"https://api.github.com/users/advancedtelematic","html_url":"https://github.com/advancedtelematic","followers_url":"https://api.github.com/users/advancedtelematic/followers","following_url":"https://api.github.com/users/advancedtelematic/following{/other_user}","gists_url":"https://api.github.com/users/advancedtelematic/gists{/gist_id}","starred_url":"https://api.github.com/users/advancedtelematic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/advancedtelematic/subscriptions","organizations_url":"https://api.github.com/users/advancedtelematic/orgs","repos_url":"https://api.github.com/users/advancedtelematic/repos","events_url":"https://api.github.com/users/advancedtelematic/events{/privacy}","received_events_url":"https://api.github.com/users/advancedtelematic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/advancedtelematic/campaign-manager","description":"CLI to manage campaigns","fork":false,"url":"https://api.github.com/repos/advancedtelematic/campaign-manager","forks_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/forks","keys_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/teams","hooks_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/hooks","issue_events_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/issues/events{/number}","events_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/events","assignees_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/assignees{/user}","branches_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/branches{/branch}","tags_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/tags","blobs_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/git/refs{/sha}","trees_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/statuses/{sha}","languages_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/languages","stargazers_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/stargazers","contributors_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/contributors","subscribers_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/subscribers","subscription_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/subscription","commits_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/commits{/sha}","git_commits_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/git/commits{/sha}","comments_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/comments{/number}","issue_comment_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/issues/comments{/number}","contents_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/contents/{+path}","compare_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/merges","archive_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/downloads","issues_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/issues{/number}","pulls_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/pulls{/number}","milestones_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/milestones{/number}","notifications_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/labels{/name}","releases_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/releases{/id}","deployments_url":"https://api.github.com/repos/advancedtelematic/campaign-manager/deployments","created_at":"2018-06-06T08:29:03Z","updated_at":"2018-06-06T08:29:06Z","pushed_at":"2018-06-12T20:18:17Z","git_url":"git://github.com/advancedtelematic/campaign-manager.git","ssh_url":"git@github.com:advancedtelematic/campaign-manager.git","clone_url":"https://github.com/advancedtelematic/campaign-manager.git","svn_url":"https://github.com/advancedtelematic/campaign-manager","homepage":null,"size":31,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/advancedtelematic/campaign-manager/pulls/1"},"html":{"href":"https://github.com/advancedtelematic/campaign-manager/pull/1"},"issue":{"href":"https://api.github.com/repos/advancedtelematic/campaign-manager/issues/1"},"comments":{"href":"https://api.github.com/repos/advancedtelematic/campaign-manager/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/advancedtelematic/campaign-manager/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/advancedtelematic/campaign-manager/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/advancedtelematic/campaign-manager/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/advancedtelematic/campaign-manager/statuses/12fbb36df71549c5910a434cc0bf2fde9cb0a59b"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"taheris"}}