diff --git a/Cargo.toml b/Cargo.toml index 33a44e7..25a0b70 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "amp-client" description = "The Amphitheatre API client for Rust" -version = "0.7.0" +version = "0.7.1" edition = "2021" license = "Apache-2.0" homepage = "https://amphitheatre.app" @@ -11,7 +11,7 @@ readme = "README.md" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -amp-common = { git = "https://github.com/amphitheatre-app/common", tag = "v0.7.0" } +amp-common = { git = "https://github.com/amphitheatre-app/common", tag = "v0.7.1" } futures = "0.3" reqwest-eventsource = "0.5.0" serde = { version = "1.0", features = ["derive"] } diff --git a/tests/fixtures/v1/api/playbooks/create-playbook-created.http b/tests/fixtures/v1/api/playbooks/create-playbook-created.http index 82eddf3..3efcd38 100644 --- a/tests/fixtures/v1/api/playbooks/create-playbook-created.http +++ b/tests/fixtures/v1/api/playbooks/create-playbook-created.http @@ -3,4 +3,4 @@ content-type: application/json content-length: 1012 date: Sun, 14 Jan 2024 10:20:36 GMT -{"title":"Untitled","description":"","namespace":"amp-a82abba3-df2f-4608-b1a5-9e058ff80468","preface":{"name":"amp-example-go","manifest":{"meta":{"name":"amp-example-go","version":"0.0.3","authors":["Eguo Wang "],"description":"A simple Golang example app","readme":"README.md","homepage":"https://github.com/amphitheatre-app/amp-example-go","repository":"https://github.com/amphitheatre-app/amp-example-go","license":"Apache-2.0","keywords":["example","golang","getting-started"],"categories":["example"]},"partners":{},"live":true,"once":true}},"characters":[{"meta":{"name":"amp-example-go","version":"0.0.3","authors":["Eguo Wang "],"description":"A simple Golang example app","readme":"README.md","homepage":"https://github.com/amphitheatre-app/amp-example-go","repository":"https://github.com/amphitheatre-app/amp-example-go","license":"Apache-2.0","keywords":["example","golang","getting-started"],"categories":["example"]},"partners":{},"live":true,"once":true}]} \ No newline at end of file +{"title":"Untitled","description":"","id":"a82abba3-df2f-4608-b1a5-9e058ff80468","preface":{"name":"amp-example-go","manifest":{"meta":{"name":"amp-example-go","version":"0.0.3","authors":["Eguo Wang "],"description":"A simple Golang example app","readme":"README.md","homepage":"https://github.com/amphitheatre-app/amp-example-go","repository":"https://github.com/amphitheatre-app/amp-example-go","license":"Apache-2.0","keywords":["example","golang","getting-started"],"categories":["example"]},"partners":{},"live":true,"once":true}},"characters":[{"meta":{"name":"amp-example-go","version":"0.0.3","authors":["Eguo Wang "],"description":"A simple Golang example app","readme":"README.md","homepage":"https://github.com/amphitheatre-app/amp-example-go","repository":"https://github.com/amphitheatre-app/amp-example-go","license":"Apache-2.0","keywords":["example","golang","getting-started"],"categories":["example"]},"partners":{},"live":true,"once":true}]} diff --git a/tests/fixtures/v1/api/playbooks/get-playbook-success.http b/tests/fixtures/v1/api/playbooks/get-playbook-success.http index 82eddf3..3efcd38 100644 --- a/tests/fixtures/v1/api/playbooks/get-playbook-success.http +++ b/tests/fixtures/v1/api/playbooks/get-playbook-success.http @@ -3,4 +3,4 @@ content-type: application/json content-length: 1012 date: Sun, 14 Jan 2024 10:20:36 GMT -{"title":"Untitled","description":"","namespace":"amp-a82abba3-df2f-4608-b1a5-9e058ff80468","preface":{"name":"amp-example-go","manifest":{"meta":{"name":"amp-example-go","version":"0.0.3","authors":["Eguo Wang "],"description":"A simple Golang example app","readme":"README.md","homepage":"https://github.com/amphitheatre-app/amp-example-go","repository":"https://github.com/amphitheatre-app/amp-example-go","license":"Apache-2.0","keywords":["example","golang","getting-started"],"categories":["example"]},"partners":{},"live":true,"once":true}},"characters":[{"meta":{"name":"amp-example-go","version":"0.0.3","authors":["Eguo Wang "],"description":"A simple Golang example app","readme":"README.md","homepage":"https://github.com/amphitheatre-app/amp-example-go","repository":"https://github.com/amphitheatre-app/amp-example-go","license":"Apache-2.0","keywords":["example","golang","getting-started"],"categories":["example"]},"partners":{},"live":true,"once":true}]} \ No newline at end of file +{"title":"Untitled","description":"","id":"a82abba3-df2f-4608-b1a5-9e058ff80468","preface":{"name":"amp-example-go","manifest":{"meta":{"name":"amp-example-go","version":"0.0.3","authors":["Eguo Wang "],"description":"A simple Golang example app","readme":"README.md","homepage":"https://github.com/amphitheatre-app/amp-example-go","repository":"https://github.com/amphitheatre-app/amp-example-go","license":"Apache-2.0","keywords":["example","golang","getting-started"],"categories":["example"]},"partners":{},"live":true,"once":true}},"characters":[{"meta":{"name":"amp-example-go","version":"0.0.3","authors":["Eguo Wang "],"description":"A simple Golang example app","readme":"README.md","homepage":"https://github.com/amphitheatre-app/amp-example-go","repository":"https://github.com/amphitheatre-app/amp-example-go","license":"Apache-2.0","keywords":["example","golang","getting-started"],"categories":["example"]},"partners":{},"live":true,"once":true}]} diff --git a/tests/fixtures/v1/api/playbooks/list-playbooks-success.http b/tests/fixtures/v1/api/playbooks/list-playbooks-success.http index 4f0100f..fe81107 100644 --- a/tests/fixtures/v1/api/playbooks/list-playbooks-success.http +++ b/tests/fixtures/v1/api/playbooks/list-playbooks-success.http @@ -3,4 +3,4 @@ content-type: application/json content-length: 1014 date: Sun, 14 Jan 2024 10:19:55 GMT -[{"title":"Untitled","description":"","namespace":"amp-a82abba3-df2f-4608-b1a5-9e058ff80468","preface":{"name":"amp-example-go","manifest":{"meta":{"name":"amp-example-go","version":"0.0.3","authors":["Eguo Wang "],"description":"A simple Golang example app","readme":"README.md","homepage":"https://github.com/amphitheatre-app/amp-example-go","repository":"https://github.com/amphitheatre-app/amp-example-go","license":"Apache-2.0","keywords":["example","golang","getting-started"],"categories":["example"]},"partners":{},"live":true,"once":true}},"characters":[{"meta":{"name":"amp-example-go","version":"0.0.3","authors":["Eguo Wang "],"description":"A simple Golang example app","readme":"README.md","homepage":"https://github.com/amphitheatre-app/amp-example-go","repository":"https://github.com/amphitheatre-app/amp-example-go","license":"Apache-2.0","keywords":["example","golang","getting-started"],"categories":["example"]},"partners":{},"live":true,"once":true}]}] \ No newline at end of file +[{"title":"Untitled","description":"","id":"a82abba3-df2f-4608-b1a5-9e058ff80468","preface":{"name":"amp-example-go","manifest":{"meta":{"name":"amp-example-go","version":"0.0.3","authors":["Eguo Wang "],"description":"A simple Golang example app","readme":"README.md","homepage":"https://github.com/amphitheatre-app/amp-example-go","repository":"https://github.com/amphitheatre-app/amp-example-go","license":"Apache-2.0","keywords":["example","golang","getting-started"],"categories":["example"]},"partners":{},"live":true,"once":true}},"characters":[{"meta":{"name":"amp-example-go","version":"0.0.3","authors":["Eguo Wang "],"description":"A simple Golang example app","readme":"README.md","homepage":"https://github.com/amphitheatre-app/amp-example-go","repository":"https://github.com/amphitheatre-app/amp-example-go","license":"Apache-2.0","keywords":["example","golang","getting-started"],"categories":["example"]},"partners":{},"live":true,"once":true}]}] diff --git a/tests/fixtures/v1/api/playbooks/update-playbook-success.http b/tests/fixtures/v1/api/playbooks/update-playbook-success.http index 82eddf3..3efcd38 100644 --- a/tests/fixtures/v1/api/playbooks/update-playbook-success.http +++ b/tests/fixtures/v1/api/playbooks/update-playbook-success.http @@ -3,4 +3,4 @@ content-type: application/json content-length: 1012 date: Sun, 14 Jan 2024 10:20:36 GMT -{"title":"Untitled","description":"","namespace":"amp-a82abba3-df2f-4608-b1a5-9e058ff80468","preface":{"name":"amp-example-go","manifest":{"meta":{"name":"amp-example-go","version":"0.0.3","authors":["Eguo Wang "],"description":"A simple Golang example app","readme":"README.md","homepage":"https://github.com/amphitheatre-app/amp-example-go","repository":"https://github.com/amphitheatre-app/amp-example-go","license":"Apache-2.0","keywords":["example","golang","getting-started"],"categories":["example"]},"partners":{},"live":true,"once":true}},"characters":[{"meta":{"name":"amp-example-go","version":"0.0.3","authors":["Eguo Wang "],"description":"A simple Golang example app","readme":"README.md","homepage":"https://github.com/amphitheatre-app/amp-example-go","repository":"https://github.com/amphitheatre-app/amp-example-go","license":"Apache-2.0","keywords":["example","golang","getting-started"],"categories":["example"]},"partners":{},"live":true,"once":true}]} \ No newline at end of file +{"title":"Untitled","description":"","id":"a82abba3-df2f-4608-b1a5-9e058ff80468","preface":{"name":"amp-example-go","manifest":{"meta":{"name":"amp-example-go","version":"0.0.3","authors":["Eguo Wang "],"description":"A simple Golang example app","readme":"README.md","homepage":"https://github.com/amphitheatre-app/amp-example-go","repository":"https://github.com/amphitheatre-app/amp-example-go","license":"Apache-2.0","keywords":["example","golang","getting-started"],"categories":["example"]},"partners":{},"live":true,"once":true}},"characters":[{"meta":{"name":"amp-example-go","version":"0.0.3","authors":["Eguo Wang "],"description":"A simple Golang example app","readme":"README.md","homepage":"https://github.com/amphitheatre-app/amp-example-go","repository":"https://github.com/amphitheatre-app/amp-example-go","license":"Apache-2.0","keywords":["example","golang","getting-started"],"categories":["example"]},"partners":{},"live":true,"once":true}]} diff --git a/tests/playbooks_test.rs b/tests/playbooks_test.rs index 1e15055..61a41b8 100644 --- a/tests/playbooks_test.rs +++ b/tests/playbooks_test.rs @@ -28,7 +28,7 @@ fn list_playbooks_test() { let playbook = playbooks.first().unwrap(); - assert_eq!("amp-a82abba3-df2f-4608-b1a5-9e058ff80468", playbook.id()); + assert_eq!("a82abba3-df2f-4608-b1a5-9e058ff80468", playbook.id); assert_eq!("Untitled", playbook.title); assert_eq!(Some("".into()), playbook.description); // assert_eq!("2016-01-19T20:50:26Z", playbook.created_at); @@ -48,7 +48,7 @@ fn create_playbook_test() { let playbook = client.playbooks().create(payload).unwrap(); - assert_eq!("amp-a82abba3-df2f-4608-b1a5-9e058ff80468", playbook.id()); + assert_eq!("a82abba3-df2f-4608-b1a5-9e058ff80468", playbook.id); assert_eq!("Untitled", playbook.title); assert_eq!(Some("".into()), playbook.description); // assert_eq!("2016-01-19T20:50:26Z", playbook.created_at); @@ -58,16 +58,16 @@ fn create_playbook_test() { #[test] fn get_playbook_test() { let setup = setup_mock_for( - "/playbooks/amp-a82abba3-df2f-4608-b1a5-9e058ff80468", + "/playbooks/a82abba3-df2f-4608-b1a5-9e058ff80468", "playbooks/get-playbook-success", "GET", ); let client = setup.0; - let playbook_id = "amp-a82abba3-df2f-4608-b1a5-9e058ff80468"; + let playbook_id = "a82abba3-df2f-4608-b1a5-9e058ff80468"; let playbook = client.playbooks().get(playbook_id).unwrap(); - assert_eq!("amp-a82abba3-df2f-4608-b1a5-9e058ff80468", playbook.id()); + assert_eq!("a82abba3-df2f-4608-b1a5-9e058ff80468", playbook.id); assert_eq!("Untitled", playbook.title); assert_eq!(Some("".into()), playbook.description); // assert_eq!("2016-01-19T20:50:26Z", playbook.created_at); @@ -77,12 +77,12 @@ fn get_playbook_test() { #[test] fn update_playbook_test() { let setup = setup_mock_for( - "/playbooks/amp-a82abba3-df2f-4608-b1a5-9e058ff80468", + "/playbooks/a82abba3-df2f-4608-b1a5-9e058ff80468", "playbooks/update-playbook-success", "PATCH", ); let client = setup.0; - let playbook_id = "amp-a82abba3-df2f-4608-b1a5-9e058ff80468"; + let playbook_id = "a82abba3-df2f-4608-b1a5-9e058ff80468"; let payload = PlaybookPayload { title: String::from("Untitled"), @@ -92,7 +92,7 @@ fn update_playbook_test() { let playbook = client.playbooks().update(playbook_id, payload).unwrap(); - assert_eq!("amp-a82abba3-df2f-4608-b1a5-9e058ff80468", playbook.id()); + assert_eq!("a82abba3-df2f-4608-b1a5-9e058ff80468", playbook.id); assert_eq!("Untitled", playbook.title); assert_eq!(Some("".into()), playbook.description); // assert_eq!("2016-01-19T20:50:26Z", playbook.created_at); @@ -102,12 +102,12 @@ fn update_playbook_test() { #[test] fn delete_playbook_test() { let setup = setup_mock_for( - "/playbooks/amp-a82abba3-df2f-4608-b1a5-9e058ff80468", + "/playbooks/a82abba3-df2f-4608-b1a5-9e058ff80468", "playbooks/delete-playbook-success", "DELETE", ); let client = setup.0; - let playbook_id = "amp-a82abba3-df2f-4608-b1a5-9e058ff80468"; + let playbook_id = "a82abba3-df2f-4608-b1a5-9e058ff80468"; let response = client.playbooks().delete(playbook_id); @@ -118,12 +118,12 @@ fn delete_playbook_test() { #[test] fn get_playbook_events() { let setup = setup_mock_for( - "/playbooks/amp-a82abba3-df2f-4608-b1a5-9e058ff80468/events", + "/playbooks/a82abba3-df2f-4608-b1a5-9e058ff80468/events", "playbooks/get-playbook-events-success", "GET", ); let client = setup.0; - let playbook_id = "amp-a82abba3-df2f-4608-b1a5-9e058ff80468"; + let playbook_id = "a82abba3-df2f-4608-b1a5-9e058ff80468"; let response = client.playbooks().events(playbook_id); @@ -133,12 +133,12 @@ fn get_playbook_events() { #[test] fn start_playbook_test() { let setup = setup_mock_for( - "/playbooks/amp-a82abba3-df2f-4608-b1a5-9e058ff80468/actions/start", + "/playbooks/a82abba3-df2f-4608-b1a5-9e058ff80468/actions/start", "playbooks/start-playbook-success", "POST", ); let client = setup.0; - let playbook_id = "amp-a82abba3-df2f-4608-b1a5-9e058ff80468"; + let playbook_id = "a82abba3-df2f-4608-b1a5-9e058ff80468"; let response = client.playbooks().start(playbook_id); @@ -149,12 +149,12 @@ fn start_playbook_test() { #[test] fn stop_playbook_test() { let setup = setup_mock_for( - "/playbooks/amp-a82abba3-df2f-4608-b1a5-9e058ff80468/actions/stop", + "/playbooks/a82abba3-df2f-4608-b1a5-9e058ff80468/actions/stop", "playbooks/stop-playbook-success", "POST", ); let client = setup.0; - let playbook_id = "amp-a82abba3-df2f-4608-b1a5-9e058ff80468"; + let playbook_id = "a82abba3-df2f-4608-b1a5-9e058ff80468"; let response = client.playbooks().stop(playbook_id);