Skip to content

Commit

Permalink
Add ServiceManagement
Browse files Browse the repository at this point in the history
  • Loading branch information
dongcarl committed Dec 27, 2023
1 parent 19561a8 commit 47b1e44
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 0 deletions.
84 changes: 84 additions & 0 deletions ServiceManagement/SMAppService.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use crate::common::*;
use crate::Foundation::*;
use crate::ServiceManagement::*;

ns_enum!(
#[underlying(NSInteger)]
pub enum SMAppServiceStatus {
SMAppServiceStatusNotRegistered = 0,
SMAppServiceStatusEnabled = 1,
SMAppServiceStatusRequiresApproval = 2,
SMAppServiceStatusNotFound = 3,
}
);

extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "ServiceManagement_SMAppService")]
pub struct SMAppService;

#[cfg(feature = "ServiceManagement_SMAppService")]
unsafe impl ClassType for SMAppService {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);

#[cfg(feature = "ServiceManagement_SMAppService")]
unsafe impl NSObjectProtocol for SMAppService {}

extern_methods!(
#[cfg(feature = "ServiceManagement_SMAppService")]
unsafe impl SMAppService {
#[cfg(feature = "Foundation_NSString")]
#[method_id(@__retain_semantics Other loginItemServiceWithIdentifier:)]
pub unsafe fn loginItemServiceWithIdentifier(identifier: &NSString) -> Id<Self>;

#[method_id(@__retain_semantics Other mainAppService)]
pub unsafe fn mainAppService() -> Id<SMAppService>;

#[cfg(feature = "Foundation_NSString")]
#[method_id(@__retain_semantics Other agentServiceWithPlistName:)]
pub unsafe fn agentServiceWithPlistName(plist_name: &NSString) -> Id<Self>;

#[cfg(feature = "Foundation_NSString")]
#[method_id(@__retain_semantics Other daemonServiceWithPlistName:)]
pub unsafe fn daemonServiceWithPlistName(plist_name: &NSString) -> Id<Self>;

#[cfg(feature = "Foundation_NSError")]
#[method(registerAndReturnError:_)]
pub unsafe fn registerAndReturnError(&self) -> Result<(), Id<NSError>>;

#[cfg(feature = "Foundation_NSError")]
#[method(unregisterAndReturnError:_)]
pub unsafe fn unregisterAndReturnError(&self) -> Result<(), Id<NSError>>;

#[cfg(feature = "Foundation_NSError")]
#[method(unregisterWithCompletionHandler:)]
pub unsafe fn unregisterWithCompletionHandler(&self, handler: &Block<(*mut NSError,), ()>);

#[method(status)]
pub unsafe fn status(&self) -> SMAppServiceStatus;

#[cfg(feature = "Foundation_NSURL")]
#[method(statusForLegacyURL:)]
pub unsafe fn statusForLegacyURL(url: &NSURL) -> SMAppServiceStatus;

#[method(openSystemSettingsLoginItems)]
pub unsafe fn openSystemSettingsLoginItems();
}
);

extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "ServiceManagement_SMAppService")]
unsafe impl SMAppService {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;

#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Id<Self>;
}
);
22 changes: 22 additions & 0 deletions ServiceManagement/SMErrors.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use crate::common::*;
use crate::Foundation::*;
use crate::ServiceManagement::*;

extern_enum!(
#[underlying(c_uint)]
pub enum __anonymous__ {
kSMErrorInternalFailure = 2,
kSMErrorInvalidSignature = 3,
kSMErrorAuthorizationFailure = 4,
kSMErrorToolNotValid = 5,
kSMErrorJobNotFound = 6,
kSMErrorServiceUnavailable = 7,
kSMErrorJobPlistNotFound = 8,
kSMErrorJobMustBeEnabled = 9,
kSMErrorInvalidPlist = 10,
kSMErrorLaunchDeniedByUser = 11,
kSMErrorAlreadyRegistered = 12,
}
);
5 changes: 5 additions & 0 deletions ServiceManagement/SMLoginItem.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use crate::common::*;
use crate::Foundation::*;
use crate::ServiceManagement::*;
31 changes: 31 additions & 0 deletions ServiceManagement/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// This file has been automatically generated by `objc2`'s `header-translator`.
// DO NOT EDIT

//! # Bindings to the `ServiceManagement` framework

#[cfg_attr(
feature = "apple",
link(name = "ServiceManagement", kind = "framework")
)]
extern "C" {}

#[path = "SMAppService.rs"]
mod __SMAppService;
#[path = "SMErrors.rs"]
mod __SMErrors;
#[path = "SMLoginItem.rs"]
mod __SMLoginItem;

#[cfg(feature = "ServiceManagement_SMAppService")]
pub use self::__SMAppService::SMAppService;
pub use self::__SMAppService::SMAppServiceStatus;
pub use self::__SMAppService::{
SMAppServiceStatusEnabled, SMAppServiceStatusNotFound, SMAppServiceStatusNotRegistered,
SMAppServiceStatusRequiresApproval,
};
pub use self::__SMErrors::{
kSMErrorAlreadyRegistered, kSMErrorAuthorizationFailure, kSMErrorInternalFailure,
kSMErrorInvalidPlist, kSMErrorInvalidSignature, kSMErrorJobMustBeEnabled, kSMErrorJobNotFound,
kSMErrorJobPlistNotFound, kSMErrorLaunchDeniedByUser, kSMErrorServiceUnavailable,
kSMErrorToolNotValid,
};
2 changes: 2 additions & 0 deletions mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ pub mod OSAKit;
pub mod Photos;
#[cfg(feature = "QuartzCore")]
pub mod QuartzCore;
#[cfg(feature = "ServiceManagement")]
pub mod ServiceManagement;
#[cfg(feature = "SoundAnalysis")]
pub mod SoundAnalysis;
#[cfg(feature = "Speech")]
Expand Down

0 comments on commit 47b1e44

Please sign in to comment.