/// Promote a package to the specified channel.
///
/// # Failures
///
/// * Fails if it cannot find the specified package in Builder
Promote a package to the specified channel.
Promote a package to the specified channel .
pub fn start(ui: &mut UI,
             bldr_url: &str,
             ident: &PackageIdent,
             channel: &ChannelIdent,
             token: &str)
             -> Result<()> {
    let api_client = Client::new(bldr_url, PRODUCT, VERSION, None)?;
    ui.begin(format!("Promoting {} to channel '{}'", ident, channel))?;
    if channel != &ChannelIdent::stable() && channel != &ChannelIdent::unstable() {
        match api_client.create_channel(&ident.origin, channel, token) {
            Ok(_) => (),
            Err(api_client::Error::APIError(StatusCode::Conflict, _)) => (),
            Err(e) => {
                println!("Failed to create '{}' channel: {:?}", channel, e);
                return Err(Error::from(e));
            }
        };
    }
    match api_client.promote_package(ident, channel, token) {
        Ok(_) => (),
        Err(e) => {
            println!("Failed to promote '{}': {:?}", ident, e);
            return Err(Error::from(e));
        }
    }
    ui.status(Status::Promoted, ident)?;
    Ok(())
}
pub fn start ( ui : & mut UI , bldr_url : & str , ident : & PackageIdent , channel : & ChannelIdent , token : & str ) -> Result < ( ) > { let api_client = Client :: new ( bldr_url , PRODUCT , VERSION , None ) ? ; ui . begin ( format ! ( " " ident channel ) ) ? ; if channel != & ChannelIdent :: stable ( ) && channel != & ChannelIdent :: unstable ( ) { match api_client . create_channel ( & ident . origin , channel , token ) { Ok ( _ ) => ( ) , Err ( api_client :: Error :: APIError ( StatusCode :: Conflict , _ ) ) => ( ) , Err ( e ) => { println ! ( " " channel e ) ; return Err ( Error :: from ( e ) ) ; } } ; } match api_client . promote_package ( ident , channel , token ) { Ok ( _ ) => ( ) , Err ( e ) => { println ! ( " " ident e ) ; return Err ( Error :: from ( e ) ) ; } } ui . status ( Status :: Promoted , ident ) ? ; Ok ( ( ) ) }
Promote a package to the specified channel.
Promote a package to the specified channel .
ui
&mut UI
bldr_url
&str
ident
&PackageIdent
channel
&ChannelIdent
token
&str
failures
Fails if it cannot find the specified package in Builder
Fails if it cannot find the specified package in Builder