|
| 1 | +/** |
| 2 | + * Copyright 2023 SourceLab.org https://github.com/SourceLabOrg/Buildkite-Api-Client |
| 3 | + * |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated |
| 5 | + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the |
| 6 | + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit |
| 7 | + * persons to whom the Software is furnished to do so, subject to the following conditions: |
| 8 | + * |
| 9 | + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the |
| 10 | + * Software. |
| 11 | + * |
| 12 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE |
| 13 | + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
| 14 | + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 15 | + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 16 | + */ |
| 17 | + |
| 18 | +package org.sourcelab.buildkite.api.client.request; |
| 19 | + |
| 20 | +public class StateChooser { |
| 21 | + private final BuildFiltersBuilder builder; |
| 22 | + |
| 23 | + public StateChooser(final BuildFiltersBuilder builder) { |
| 24 | + this.builder = builder; |
| 25 | + } |
| 26 | + |
| 27 | + public BuildFiltersBuilder blocked() { |
| 28 | + return builder.withState("blocked"); |
| 29 | + } |
| 30 | + |
| 31 | + public StateChooser blockedAnd() { |
| 32 | + blocked(); |
| 33 | + return this; |
| 34 | + } |
| 35 | + |
| 36 | + public BuildFiltersBuilder canceled() { |
| 37 | + return builder.withState("canceled"); |
| 38 | + } |
| 39 | + |
| 40 | + public StateChooser canceledAnd() { |
| 41 | + canceled(); |
| 42 | + return this; |
| 43 | + } |
| 44 | + |
| 45 | + public BuildFiltersBuilder canceling() { |
| 46 | + return builder.withState("canceling"); |
| 47 | + } |
| 48 | + |
| 49 | + public StateChooser cancelingAnd() { |
| 50 | + canceling(); |
| 51 | + return this; |
| 52 | + } |
| 53 | + |
| 54 | + public BuildFiltersBuilder failed() { |
| 55 | + return builder.withState("failed"); |
| 56 | + } |
| 57 | + |
| 58 | + public StateChooser failedAnd() { |
| 59 | + builder.withState("failed"); |
| 60 | + return this; |
| 61 | + } |
| 62 | + |
| 63 | + public BuildFiltersBuilder failing() { |
| 64 | + return builder.withState("failing"); |
| 65 | + } |
| 66 | + |
| 67 | + public StateChooser failingAnd() { |
| 68 | + failing(); |
| 69 | + return this; |
| 70 | + } |
| 71 | + |
| 72 | + public BuildFiltersBuilder finished() { |
| 73 | + return builder.withState("finished"); |
| 74 | + } |
| 75 | + |
| 76 | + public StateChooser finishedAnd() { |
| 77 | + finished(); |
| 78 | + return this; |
| 79 | + } |
| 80 | + |
| 81 | + public BuildFiltersBuilder notRun() { |
| 82 | + return builder.withState("not_run"); |
| 83 | + } |
| 84 | + |
| 85 | + public StateChooser notRunAnd() { |
| 86 | + notRun(); |
| 87 | + return this; |
| 88 | + } |
| 89 | + |
| 90 | + public BuildFiltersBuilder passed() { |
| 91 | + return builder.withState("passed"); |
| 92 | + } |
| 93 | + |
| 94 | + public StateChooser passedAnd() { |
| 95 | + passed(); |
| 96 | + return this; |
| 97 | + } |
| 98 | + |
| 99 | + public BuildFiltersBuilder running() { |
| 100 | + return builder.withState("running"); |
| 101 | + } |
| 102 | + |
| 103 | + public StateChooser runningAnd() { |
| 104 | + running(); |
| 105 | + return this; |
| 106 | + } |
| 107 | + |
| 108 | + public BuildFiltersBuilder scheduled() { |
| 109 | + return builder.withState("scheduled"); |
| 110 | + } |
| 111 | + |
| 112 | + public StateChooser scheduledAnd() { |
| 113 | + scheduled(); |
| 114 | + return this; |
| 115 | + } |
| 116 | + |
| 117 | + public BuildFiltersBuilder skipped() { |
| 118 | + return builder.withState("skipped"); |
| 119 | + } |
| 120 | + |
| 121 | + public StateChooser skippedAnd() { |
| 122 | + skipped(); |
| 123 | + return this; |
| 124 | + } |
| 125 | +} |
0 commit comments