pub struct DingTalk {
pub appid: String,
pub app_secret: String,
pub client: Client,
pub rdb: Arc<Pool>,
}
Fields§
§appid: String
§app_secret: String
§client: Client
§rdb: Arc<Pool>
Implementations§
Source§impl DingTalk
impl DingTalk
Sourcepub async fn set_app_access_token(
&self,
code: String,
) -> Result<String, Box<dyn Error>>
pub async fn set_app_access_token( &self, code: String, ) -> Result<String, Box<dyn Error>>
Obtain the access token for the application.
This asynchronous function sends a POST request to the DingTalk API to obtain the access token for the application. The request includes the authorization code in the query parameters for authentication.
§Arguments
code
- The authorization code to obtain the access token.
§Returns
Returns a Result
containing the access token as a string if the request is successful,
or an error if the request fails or if the response status is not successful.
§Errors
Returns an error if the response status is not successful, or if the request fails.
Sourcepub async fn get_app_access_token(&self) -> Result<String, Box<dyn Error>>
pub async fn get_app_access_token(&self) -> Result<String, Box<dyn Error>>
Get the access token for the application.
The access token is stored in Redis by calling [set_app_access_token].
§Returns
A Result containing the access token as a string if the access token exists, otherwise an error string.
Source§impl DingTalk
impl DingTalk
Sourcepub fn set_corp_id(&self, corp_id: String) -> OrgApp
pub fn set_corp_id(&self, corp_id: String) -> OrgApp
Creates a new OrgApp
instance with the given corporate ID and configuration.
This method creates a new instance of OrgApp
with the given corporate ID and the same
configuration as the current DingTalk
instance. This is useful for accessing the DingTalk
API of a specific organization.
§Arguments
corp_id
- The corporate ID of the organization to create theOrgApp
for.
§Returns
A new OrgApp
instance with the given corporate ID and configuration.
Auto Trait Implementations§
impl Freeze for DingTalk
impl !RefUnwindSafe for DingTalk
impl Send for DingTalk
impl Sync for DingTalk
impl Unpin for DingTalk
impl !UnwindSafe for DingTalk
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more