VersionCmdParams

Struct VersionCmdParams 

Source
pub struct VersionCmdParams {
Show 14 fields pub project: String, pub project_id: Option<i64>, pub version_name: Option<String>, pub version_id: Option<String>, pub version_description: Option<String>, pub version_start_date: Option<String>, pub version_release_date: Option<String>, pub version_archived: Option<bool>, pub version_released: Option<bool>, pub changelog_file: Option<String>, pub transition_issues: Option<bool>, pub transition_assignee: Option<String>, pub versions_page_size: Option<i32>, pub versions_page_offset: Option<i64>,
}
Expand description

This struct defines the parameters for the Version commands

§Fields

  • project - The project key, always required.
  • project_id - The project ID, optional.
  • version_name - The version name, optional.
  • version_id - The version ID, required for archive, delete, release and update.
  • version_description - The version description, optional.
  • version_start_date - The version start date, optional (default: today on create command).
  • version_release_date - The version release date, optional (default: today on release command).
  • version_archived - The version archived status, optional.
  • version_released - The version released status, optional.
  • changelog_file - The changelog file path, to be used for automatic description generation (changelog-based), optional: if set the script detects automatically the first tagged block in the changelog and use it as description
  • resolve_issues - The flag to resolve issues in the version, optional.
  • versions_page_size - The page size for the version, optional.
  • versions_page_offset - The page offset for the version, optional.

Fields§

§project: String

Jira project key (required for all version operations).

§project_id: Option<i64>

Jira project id when key is not available.

§version_name: Option<String>

Version name to create or update.

§version_id: Option<String>

Version id required for archive, delete, release, and update operations.

§version_description: Option<String>

Human readable version description.

§version_start_date: Option<String>

Version start date in yyyy-mm-dd format.

§version_release_date: Option<String>

Version release date in yyyy-mm-dd format.

§version_archived: Option<bool>

Flag indicating whether the version is archived.

§version_released: Option<bool>

Flag indicating whether the version is released.

§changelog_file: Option<String>

Optional changelog file path used to build the description.

§transition_issues: Option<bool>

Whether to transition issues found in the changelog.

§transition_assignee: Option<String>

Account id used when reassigning transitioned issues.

§versions_page_size: Option<i32>

Page size used when listing versions.

§versions_page_offset: Option<i64>

Page offset used when listing versions.

Implementations§

Source§

impl VersionCmdParams

Implementation of the VersionCmdParams struct

§Methods

  • new - returns a new VersionCmdParams struct
  • merge_args - merges the current version with the optional arguments
  • mark_released - marks the version as released
  • mark_archived - marks the version as archived
Source

pub fn new() -> VersionCmdParams

This method returns a new VersionCmdParams struct

§Returns
  • A VersionCmdParams struct
§Examples
use jirust_cli::runners::jira_cmd_runners::version_cmd_runner::VersionCmdParams;

let params = VersionCmdParams::new();
Source

pub fn merge_args( current_version: Version, opt_args: Option<&VersionArgs>, ) -> VersionCmdParams

This method merges the current version with the optional arguments and returns a VersionCmdParams struct If the optional arguments are not given, it uses the current version values

§Arguments
  • current_version - A Version struct
  • opt_args - An Option<&VersionArgs> struct
§Returns
  • A VersionCmdParams struct
§Examples
use jira_v3_openapi::models::Version;
use jirust_cli::args::commands::{VersionArgs, VersionActionValues, PaginationArgs, OutputArgs};
use jirust_cli::runners::jira_cmd_runners::version_cmd_runner::VersionCmdParams;

let mut current_version: Version = Version::new();
current_version.id = Some("12345".to_string());
current_version.project_id = Some(9876);
current_version.project = Some("TEST_PROJECT".to_string());
current_version.name = Some("v1.0".to_string());
current_version.description = Some("This is the first version".to_string());

let opt_args = VersionArgs {
  version_act: VersionActionValues::List,
  project_key: "project_key".to_string(),
  project_id: None,
  version_id: Some("97531".to_string()),
  version_name: Some("version_name".to_string()),
  version_description: Some("version_description".to_string()),
  version_start_date: None,
  version_release_date: None,
  version_archived: None,
  version_released: Some(true),
  changelog_file: None,
  pagination: PaginationArgs { page_size: None, page_offset: None },
  output: OutputArgs { output_format: None, output_type: None },
  transition_issues: None,
  transition_assignee: None,
};

let params = VersionCmdParams::merge_args(current_version, Some(&opt_args));

assert_eq!(params.project, "TEST_PROJECT".to_string());
assert_eq!(params.project_id, Some(9876));
assert_eq!(params.version_id, Some("12345".to_string()));
assert_eq!(params.version_name, Some("version_name".to_string()));
assert_eq!(params.version_description, Some("version_description".to_string()));
assert_eq!(params.version_released, Some(true));
Source

pub fn mark_released(version: Version) -> VersionCmdParams

This method marks the version as released and returns a VersionCmdParams struct It sets the version_released and version_release_date fields with the current date

§Arguments
  • version - A Version struct
§Returns
  • A VersionCmdParams struct
§Examples
use jira_v3_openapi::models::Version;
use jirust_cli::runners::jira_cmd_runners::version_cmd_runner::VersionCmdParams;

let mut version: Version = Version::new();
version.id = Some("12345".to_string());
version.project_id = Some(9876);
version.project = Some("TEST_PROJECT".to_string());
version.name = Some("v1.0".to_string());
version.description = Some("This is the first version".to_string());

assert_eq!(version.released, None);

let params = VersionCmdParams::mark_released(version);

assert_eq!(params.version_released, Some(true));
Source

pub fn mark_archived(version: Version) -> VersionCmdParams

This method marks the version as archived and returns a VersionCmdParams struct

§Arguments
  • version - A Version struct
§Returns
  • A VersionCmdParams struct
§Examples
use jira_v3_openapi::models::Version;
use jirust_cli::runners::jira_cmd_runners::version_cmd_runner::VersionCmdParams;

let mut version: Version = Version::new();
version.id = Some("12345".to_string());
version.project_id = Some(9876);
version.project = Some("TEST_PROJECT".to_string());
version.name = Some("v1.0".to_string());
version.description = Some("This is the first version".to_string());

assert_eq!(version.archived, None);

let params = VersionCmdParams::mark_archived(version);

assert_eq!(params.version_archived, Some(true));

Trait Implementations§

Source§

impl Default for VersionCmdParams

Implementation of the Default trait for the VersionCmdParams struct

Source§

fn default() -> Self

This method returns a VersionCmdParams struct with default values and returns a VersionCmdParams struct

§Returns
  • A VersionCmdParams struct initialized with default values
§Examples
use jirust_cli::runners::jira_cmd_runners::version_cmd_runner::VersionCmdParams;

let params = VersionCmdParams::default();

assert_eq!(params.project, "".to_string());
assert_eq!(params.project_id, None);
assert_eq!(params.version_name, None);
assert_eq!(params.version_id, None);
assert_eq!(params.version_description, None);
assert_eq!(params.version_start_date, None);
assert_eq!(params.version_release_date, None);
assert_eq!(params.version_archived, None);
assert_eq!(params.version_released, None);
assert_eq!(params.changelog_file, None);
assert_eq!(params.transition_issues, None);
assert_eq!(params.transition_assignee, None);
assert_eq!(params.versions_page_size, None);
assert_eq!(params.versions_page_offset, None);
Source§

impl From<&VersionArgs> for VersionCmdParams

Implementation of the From trait for the VersionArgs struct This implementation allows the conversion of a VersionArgs struct to a VersionCmdParams struct.

Source§

fn from(args: &VersionArgs) -> Self

This method converts the VersionArgs struct to a VersionCmdParams struct and returns a VersionCmdParams struct

§Arguments
  • args - A VersionArgs struct
§Returns
  • A VersionCmdParams struct
§Examples
use jirust_cli::args::commands::{VersionActionValues, VersionArgs, PaginationArgs, OutputArgs};
use jirust_cli::runners::jira_cmd_runners::version_cmd_runner::VersionCmdParams;

let version_args = VersionArgs {
  version_act: VersionActionValues::List,
  project_key: "project_key".to_string(),
  project_id: None,
  version_id: None,
  version_name: Some("version_name".to_string()),
  version_description: Some("version_description".to_string()),
  version_start_date: None,
  version_release_date: None,
  version_archived: None,
  version_released: None,
  changelog_file: None,
  pagination: PaginationArgs { page_size: Some(10), page_offset: Some(0) },
  output: OutputArgs { output_format: None, output_type: None },
  transition_issues: None,
  transition_assignee: None,
};

let params = VersionCmdParams::from(&version_args);

assert_eq!(params.project, "project_key".to_string());
assert_eq!(params.version_name, Some("version_name".to_string()));
assert_eq!(params.version_description, Some("version_description".to_string()));
assert_eq!(params.versions_page_size, Some(10));
assert_eq!(params.versions_page_offset, Some(0));

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more