pub struct GraphClient { /* private fields */ }
Implementations§
Source§impl GraphClient
impl GraphClient
pub fn new<AT: ToString>(access_token: AT) -> GraphClient
pub fn from_client_app<CA: ClientApplication + 'static>( client_app: CA, ) -> GraphClient
Sourcepub fn v1(&mut self) -> &mut GraphClient
pub fn v1(&mut self) -> &mut GraphClient
Sourcepub fn use_v1(&mut self)
pub fn use_v1(&mut self)
Use the v1 endpoint for the Microsoft Graph API. Same as calling
v1()
but takes a mutable reference to self and does not return
self.
§Example
use graph_rs_sdk::Graph;
let mut client = Graph::new("ACCESS_TOKEN");
client.use_v1();
assert_eq!(client.url().to_string(), GRAPH_URL.to_string())
Sourcepub fn beta(&mut self) -> &mut GraphClient
pub fn beta(&mut self) -> &mut GraphClient
Sourcepub fn use_beta(&mut self)
pub fn use_beta(&mut self)
Use the beta endpoint for the Microsoft Graph API. Same as calling
beta()
but takes a mutable reference to self and does not return
self.
Example
use graph_rs_sdk::Graph;
let mut client = Graph::new("ACCESS_TOKEN");
client.use_beta();
assert_eq!(client.url().to_string(), GRAPH_URL_BETA.to_string())
pub fn url(&self) -> &Url
pub fn with_force_token_refresh( &mut self, force_token_refresh: ForceTokenRefresh, ) -> &mut Self
pub fn use_force_token_refresh( &mut self, force_token_refresh: ForceTokenRefresh, )
Sourcepub fn custom_endpoint(&mut self, url: &Url) -> &mut GraphClient
pub fn custom_endpoint(&mut self, url: &Url) -> &mut GraphClient
Set a custom endpoint for the Microsoft Graph API. Provide the scheme and host with an optional path. The path is not set by the sdk when using a custom endpoint.
The scheme must be https:// and any other provided scheme will cause a panic. See Microsoft Graph Service Root Endpoints
Attempting to use an invalid host will cause the client to panic. This is done for increased security.
Do not use a government host endpoint without authorization and any necessary clearances. Using any government host endpoint means you should expect every API call will be monitored and recorded.
You should also assume China’s Graph API operated by 21Vianet is being monitored by the Chinese government who is well known for the control it has over Chinese companies and for its surveillance state of Chinese citizens. And, according to Microsoft, These services are subject to Chinese laws. See Microsoft 365 operated by 21Vianet
Valid Hosts:
- graph.microsoft.com (Default public endpoint worldwide)
- graph.microsoft.us (U.S. Government)
- dod-graph.microsoft.us (U.S. Department Of Defense)
- graph.microsoft.de
- microsoftgraph.chinacloudapi.cn (operated by 21Vianet)
- canary.graph.microsoft.com
Example
use graph_rs_sdk::Graph;
let mut client = Graph::new("ACCESS_TOKEN");
client.custom_endpoint("https://graph.microsoft.com/v1.0")
.me()
.get_user()
.send()
.await?;
Sourcepub fn use_endpoint(&mut self, url: &Url)
pub fn use_endpoint(&mut self, url: &Url)
Set a custom endpoint for the Microsoft Graph API. Provide the scheme and host with an optional path. The path is not set by the sdk when using a custom endpoint.
The scheme must be https:// and any other provided scheme will cause a panic. See Microsoft Graph Service Root Endpoints
Attempting to use an invalid host will cause the client to panic. This is done for increased security.
Do not use a government host endpoint without authorization and any necessary clearances. Using any government host endpoint means you should expect every API call will be monitored and recorded.
You should also assume China’s Graph API operated by 21Vianet is being monitored by the Chinese government who is well known for the control it has over Chinese companies and for its surveillance state of Chinese citizens. And, according to Microsoft, These services are subject to Chinese laws. See Microsoft 365 operated by 21Vianet
Valid Hosts:
- graph.microsoft.com (Default public endpoint worldwide)
- graph.microsoft.us (U.S. Government)
- dod-graph.microsoft.us (U.S. Department Of Defense)
- graph.microsoft.de
- microsoftgraph.chinacloudapi.cn (operated by 21Vianet)
- canary.graph.microsoft.com
Example
use url::Url;
use graph_rs_sdk::Graph;
let mut client = Graph::new("ACCESS_TOKEN");
client.use_endpoint(&Url::parse("https://graph.microsoft.com/v1.0").unwrap());
assert_eq!(client.url().to_string(), "https://graph.microsoft.com/v1.0".to_string())
pub fn admin(&self) -> AdminApiClient
pub fn app_catalogs(&self) -> AppCatalogsApiClient
pub fn agreement_acceptances(&self) -> AgreementAcceptancesApiClient
pub fn agreement_acceptance<S: AsRef<str>>( &self, id: S, ) -> AgreementAcceptancesIdApiClient
pub fn agreements(&self) -> AgreementsApiClient
pub fn agreement<S: AsRef<str>>(&self, id: S) -> AgreementsIdApiClient
pub fn applications(&self) -> ApplicationsApiClient
pub fn application<S: AsRef<str>>(&self, id: S) -> ApplicationsIdApiClient
pub fn audit_logs(&self) -> AuditLogsApiClient
pub fn authentication_method_configurations( &self, ) -> AuthenticationMethodConfigurationsApiClient
pub fn authentication_method_configuration<S: AsRef<str>>( &self, id: S, ) -> AuthenticationMethodConfigurationsIdApiClient
pub fn authentication_methods_policy( &self, ) -> AuthenticationMethodsPolicyApiClient
pub fn branding(&self) -> BrandingApiClient
pub fn certificate_based_auth_configurations( &self, ) -> CertificateBasedAuthConfigurationApiClient
pub fn certificate_based_auth_configuration<S: AsRef<str>>( &self, id: S, ) -> CertificateBasedAuthConfigurationIdApiClient
pub fn chats(&self) -> ChatsApiClient
pub fn chat<S: AsRef<str>>(&self, id: S) -> ChatsIdApiClient
pub fn communications(&self) -> CommunicationsApiClient
pub fn contracts(&self) -> ContractsApiClient
pub fn contract<S: AsRef<str>>(&self, id: S) -> ContractsIdApiClient
pub fn data_policy_operations(&self) -> DataPolicyOperationsApiClient
pub fn device_app_management(&self) -> DeviceAppManagementApiClient
pub fn device_management(&self) -> DeviceManagementApiClient
pub fn devices(&self) -> DevicesApiClient
pub fn device<S: AsRef<str>>(&self, id: S) -> DevicesIdApiClient
pub fn directory(&self) -> DirectoryApiClient
pub fn directory_objects(&self) -> DirectoryObjectsApiClient
pub fn directory_object<S: AsRef<str>>( &self, id: S, ) -> DirectoryObjectsIdApiClient
pub fn directory_role_templates(&self) -> DirectoryRoleTemplatesApiClient
pub fn directory_role_template<S: AsRef<str>>( &self, id: S, ) -> DirectoryRoleTemplatesIdApiClient
pub fn directory_roles(&self) -> DirectoryRolesApiClient
pub fn directory_role<S: AsRef<str>>(&self, id: S) -> DirectoryRolesIdApiClient
pub fn domain_dns_records(&self) -> DomainDnsRecordsApiClient
pub fn domain_dns_record<S: AsRef<str>>( &self, id: S, ) -> DomainDnsRecordsIdApiClient
pub fn domains(&self) -> DomainsApiClient
pub fn domain<S: AsRef<str>>(&self, id: S) -> DomainsIdApiClient
pub fn drives(&self) -> DrivesApiClient
pub fn drive<S: AsRef<str>>(&self, id: S) -> DrivesIdApiClient
pub fn default_drive(&self) -> DefaultDriveApiClient
pub fn education(&self) -> EducationApiClient
pub fn groups(&self) -> GroupsApiClient
pub fn group<S: AsRef<str>>(&self, id: S) -> GroupsIdApiClient
pub fn group_lifecycle_policies(&self) -> GroupLifecyclePoliciesApiClient
pub fn group_lifecycle_policy<S: AsRef<str>>( &self, id: S, ) -> GroupLifecyclePoliciesIdApiClient
pub fn identity(&self) -> IdentityApiClient
pub fn identity_governance(&self) -> IdentityGovernanceApiClient
pub fn identity_providers(&self) -> IdentityProvidersApiClient
pub fn identity_provider<S: AsRef<str>>( &self, id: S, ) -> IdentityProvidersIdApiClient
pub fn invitations(&self) -> InvitationsApiClient
pub fn me(&self) -> MeApiClient
pub fn oauth2_permission_grants(&self) -> Oauth2PermissionGrantsApiClient
pub fn oauth2_permission_grant<S: AsRef<str>>( &self, id: S, ) -> Oauth2PermissionGrantsIdApiClient
pub fn organizations(&self) -> OrganizationApiClient
pub fn organization<S: AsRef<str>>(&self, id: S) -> OrganizationIdApiClient
pub fn places(&self) -> PlacesApiClient
pub fn permission_grants(&self) -> PermissionGrantsApiClient
pub fn permission_grant<S: AsRef<str>>( &self, id: S, ) -> PermissionGrantsIdApiClient
pub fn planner(&self) -> PlannerApiClient
pub fn policies(&self) -> PoliciesApiClient
pub fn reports(&self) -> ReportsApiClient
pub fn schema_extensions(&self) -> SchemaExtensionsApiClient
pub fn schema_extension<S: AsRef<str>>( &self, id: S, ) -> SchemaExtensionsIdApiClient
pub fn service_principals(&self) -> ServicePrincipalsApiClient
pub fn service_principal<S: AsRef<str>>( &self, id: S, ) -> ServicePrincipalsIdApiClient
pub fn sites(&self) -> SitesApiClient
pub fn site<S: AsRef<str>>(&self, id: S) -> SitesIdApiClient
pub fn solutions(&self) -> SolutionsApiClient
pub fn subscribed_skus(&self) -> SubscribedSkusApiClient
pub fn subscribed_sku<S: AsRef<str>>(&self, id: S) -> SubscriptionsIdApiClient
pub fn subscriptions(&self) -> SubscriptionsApiClient
pub fn subscription<S: AsRef<str>>(&self, id: S) -> SubscriptionsIdApiClient
pub fn teams(&self) -> TeamsApiClient
pub fn team<S: AsRef<str>>(&self, id: S) -> TeamsIdApiClient
pub fn teams_templates(&self) -> TeamsTemplatesApiClient
pub fn teams_template<S: AsRef<str>>(&self, id: S) -> TeamsTemplatesIdApiClient
pub fn teamwork(&self) -> TeamworkApiClient
pub fn users(&self) -> UsersApiClient
pub fn user<S: AsRef<str>>(&self, id: S) -> UsersIdApiClient
pub fn custom(&self, method: Method, body: Option<BodyRead>) -> RequestHandler
pub fn batch<B: Serialize>(&self, batch: &B) -> RequestHandler
Trait Implementations§
Source§impl Clone for GraphClient
impl Clone for GraphClient
Source§fn clone(&self) -> GraphClient
fn clone(&self) -> GraphClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more