#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct ResourceSubscription {
pub subject_id: String,
pub resource_ids: Vec<String>,
pub attach: Option<String>,
}
impl ResourceSubscription {
pub fn new(subject_id: impl Into<String>, resource_ids: impl Into<Vec<String>>) -> Self {
Self {
subject_id: subject_id.into(),
resource_ids: resource_ids.into(),
attach: None,
}
}
pub fn with_attach(mut self, attach: impl Into<String>) -> Self {
self.attach = Some(attach.into());
self
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct SubscribeResourceParams {
pub resources: Vec<ResourceSubscription>,
}
impl SubscribeResourceParams {
pub fn new(resources: impl Into<Vec<ResourceSubscription>>) -> Self {
Self {
resources: resources.into(),
}
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct UnsubscribeResourceParams {
pub resources: Vec<ResourceSubscription>,
}
impl UnsubscribeResourceParams {
pub fn new(resources: impl Into<Vec<ResourceSubscription>>) -> Self {
Self {
resources: resources.into(),
}
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct QueryPushErrorMsgParams {
pub app_id: String,
pub open_id: Option<String>,
pub msg_type: Option<String>,
pub start_time: Option<i64>,
pub end_time: Option<i64>,
pub size: Option<u32>,
pub scan_id: Option<String>,
}
impl QueryPushErrorMsgParams {
pub fn new(app_id: impl Into<String>) -> Self {
Self {
app_id: app_id.into(),
open_id: None,
msg_type: None,
start_time: None,
end_time: None,
size: None,
scan_id: None,
}
}
pub fn with_open_id(mut self, open_id: impl Into<String>) -> Self {
self.open_id = Some(open_id.into());
self
}
pub fn with_msg_type(mut self, msg_type: impl Into<String>) -> Self {
self.msg_type = Some(msg_type.into());
self
}
pub fn with_start_time(mut self, start_time: i64) -> Self {
self.start_time = Some(start_time);
self
}
pub fn with_end_time(mut self, end_time: i64) -> Self {
self.end_time = Some(end_time);
self
}
pub fn with_size(mut self, size: u32) -> Self {
self.size = Some(size);
self
}
pub fn with_scan_id(mut self, scan_id: impl Into<String>) -> Self {
self.scan_id = Some(scan_id.into());
self
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct TraitSubscription {
pub subject_id: String,
pub code_paths: Vec<String>,
pub attach: Option<String>,
}
impl TraitSubscription {
pub fn new(subject_id: impl Into<String>, code_paths: impl Into<Vec<String>>) -> Self {
Self {
subject_id: subject_id.into(),
code_paths: code_paths.into(),
attach: None,
}
}
pub fn with_attach(mut self, attach: impl Into<String>) -> Self {
self.attach = Some(attach.into());
self
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct TraitSubscribeParams {
pub traits: Vec<TraitSubscription>,
}
impl TraitSubscribeParams {
pub fn new(traits: impl Into<Vec<TraitSubscription>>) -> Self {
Self {
traits: traits.into(),
}
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct TraitUnsubscribeParams {
pub traits: Vec<TraitSubscription>,
}
impl TraitUnsubscribeParams {
pub fn new(traits: impl Into<Vec<TraitSubscription>>) -> Self {
Self {
traits: traits.into(),
}
}
}