1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
// Copyright (c) 2019 Jason White // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. use std::fmt; /// API previews. /// /// See: https://developer.github.com/v3/previews/ #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] pub enum Preview { /// Allows you to download repositories from your GitHub user or /// organization account to review, backup, and migrate data to GitHub /// Enterprise Server. Wyandotte, /// Import source repositories to GitHub with the API version of the GitHub /// Importer. BarredRock, /// Exercise greater control over deployments with more information and /// finer granularity. AntMan, /// Manage reactions for commits, issues, and comments. SquirrelGirl, /// Get a list of events for an issue or pull request. Mockingbird, /// Get more information about your GitHub Pages site. MisterFantastic, /// Manage integrations through the API. MachineMan, /// Manage projects. Inertia, /// Search commits. Cloak, /// Retrieve community profile metrics (also known as community health) for /// any public repository. BlackPanther, /// Users can block other users. Organizations can block users, too. GiantSentryFist, /// View a list of repository topics in calls that return repository /// results. Mercy, /// View all codes of conduct or get which code of conduct a repository has /// currently. ScarletWitch, /// Include nested team content in team payloads. Hellcat, /// Transfer a repository to an organization or user. Nightshade, /// You can now add a reason when you lock an issue. SailorV, /// You can now use the API to invite new users to an organization by /// creating an organization invitation. Dazzler, /// You can now use the API to manage team discussions and team discussion /// comments. Echo, /// You can now use emoji in label names, add descriptions to labels, and /// search for labels in a repository. Symmetra, /// You can now use the API to manage the setting for requiring signed /// commits on protected branches. Zzzax, /// You can now require multiple approving reviews for a pull request using /// the API. LukeCage, /// Retrieve information from someone's hovercard. Hagar, /// Allows a GitHub App to run external checks on a repository's code. See /// the Check runs and Check suites APIs for more details. Antiope, /// The REST API v3 responses for issue events and issue timeline events /// now return the project_card field for project-related events. Starfox, /// GitHub App Manifests allow people to create preconfigured GitHub Apps. /// See "Creating GitHub Apps from a manifest" for more details. Fury, /// You can now update the `environment` of a deployment status and use the /// `in_progress` and `queued` states. When you create deployment statuses, /// you can now use the `auto_inactive` parameter to mark old `production` /// deployments as `inactive`. Flash, /// You can now configure whether organization members can create /// repositories and which types of repositories they can create. See "Edit /// an organization" for more details. Surtur, /// You can now provide more information in GitHub for URLs that link to /// registered domains by using the Content Attachments API. See "Using /// content attachments" for more details. Corsair, /// Allows you to temporarily restrict interactions, such as commenting, /// opening issues, and creating pull requests, for GitHub repositories or /// organizations. When enabled, only the specified group of GitHub users /// will be able to participate in these interactions. See the Repository /// interactions and Organization interactions APIs for more details. Sombra, /// You can use the Draft Pull Requests API and its pull request endpoints /// to see whether a pull request is in draft state. To learn more about /// draft pull requests, see "About pull requests" in the GitHub Help /// documentation. ShadowCat, /// You can use the new endpoints in the Pages API to enable or disable /// Pages. To learn more about Pages, see "GitHub Pages Basics" in the /// GitHub Help documentation. Switcheroo, /// You can use the new endpoints in the Commits API to list branches or /// pull requests for a commit. Groot, /// Owners of GitHub Apps can now uninstall an app using the Apps API. Gambit, } impl Preview { /// Returns the kebab-case name of the preview. pub fn name(self) -> &'static str { match self { Preview::Wyandotte => "wyandotte", Preview::BarredRock => "barred-rock", Preview::AntMan => "ant-man", Preview::SquirrelGirl => "squirrel-girl", Preview::Mockingbird => "mocking-bird", Preview::MisterFantastic => "mister-fantastic", Preview::MachineMan => "machine-man", Preview::Inertia => "inertia", Preview::Cloak => "clock", Preview::BlackPanther => "black-panther", Preview::GiantSentryFist => "giant-sentry-fist", Preview::Mercy => "mercy", Preview::ScarletWitch => "scarlet-witch", Preview::Hellcat => "hellcat", Preview::Nightshade => "nightshade", Preview::SailorV => "sailor-v", Preview::Dazzler => "dazzler", Preview::Echo => "echo", Preview::Symmetra => "symmetra", Preview::Zzzax => "zzzax", Preview::LukeCage => "luke-cage", Preview::Hagar => "hagar", Preview::Antiope => "antiope", Preview::Starfox => "starfox", Preview::Fury => "fury", Preview::Flash => "flash", Preview::Surtur => "surtur", Preview::Corsair => "corsair", Preview::Sombra => "sombra", Preview::ShadowCat => "shadow-cat", Preview::Switcheroo => "switcheroo", Preview::Groot => "groot", Preview::Gambit => "gambit", } } /// Returns the media type for the preview. This can be used for the /// `Accept` header in requests. pub fn media_type(self) -> String { format!("application/vnd.github.{}-preview+json", self.name()) } } impl fmt::Display for Preview { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str(self.name()) } }