pub struct Permissions {
    pub client: Client,
}

Fields§

§client: Client

Implementations§

source§

impl Permissions

source

pub async fn list( &self, file_id: &str, include_permissions_for_view: &str, page_size: i64, page_token: &str, supports_all_drives: bool, supports_team_drives: bool, use_domain_admin_access: bool ) -> Result<Response<Vec<Permission>>, ClientError>

This function performs a GET to the /files/{fileId}/permissions endpoint.

Lists a file’s or shared drive’s permissions.

Parameters:

  • file_id: &str – A link to this theme’s background image.
  • include_permissions_for_view: &str – Specifies which additional view’s permissions to include in the response. Only ‘published’ is supported.
  • page_size: i64 – The maximum number of permissions to return per page. When not set for files in a shared drive, at most 100 results will be returned. When not set for files that are not in a shared drive, the entire list will be returned.
  • page_token: &str – The token for continuing a previous list request on the next page. This should be set to the value of ‘nextPageToken’ from the previous response.
  • supports_all_drives: bool – Whether the requesting application supports both My Drives and shared drives.
  • supports_team_drives: bool – Whether the user has installed the requesting app.
  • use_domain_admin_access: bool – Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
source

pub async fn list_all( &self, file_id: &str, include_permissions_for_view: &str, supports_all_drives: bool, supports_team_drives: bool, use_domain_admin_access: bool ) -> Result<Response<Vec<Permission>>, ClientError>

This function performs a GET to the /files/{fileId}/permissions endpoint.

As opposed to list, this function returns all the pages of the request at once.

Lists a file’s or shared drive’s permissions.

source

pub async fn create( &self, file_id: &str, email_message: &str, move_to_new_owners_root: bool, send_notification_email: bool, supports_all_drives: bool, supports_team_drives: bool, transfer_ownership: bool, use_domain_admin_access: bool, body: &Permission ) -> Result<Response<Permission>, ClientError>

This function performs a POST to the /files/{fileId}/permissions endpoint.

Creates a permission for a file or shared drive.

Parameters:

  • file_id: &str – A link to this theme’s background image.
  • email_message: &str – A plain text custom message to include in the notification email.
  • enforce_single_parent: bool – Whether the user has installed the requesting app.
  • move_to_new_owners_root: bool – This parameter will only take effect if the item is not in a shared drive and the request is attempting to transfer the ownership of the item. If set to true, the item will be moved to the new owner’s My Drive root folder and all prior parents removed. If set to false, parents are not changed.
  • send_notification_email: bool – Whether to send a notification email when sharing to users or groups. This defaults to true for users and groups, and is not allowed for other requests. It must not be disabled for ownership transfers.
  • supports_all_drives: bool – Whether the requesting application supports both My Drives and shared drives.
  • supports_team_drives: bool – Whether the user has installed the requesting app.
  • transfer_ownership: bool – Whether to transfer ownership to the specified user and downgrade the current owner to a writer. This parameter is required as an acknowledgement of the side effect. File owners can only transfer ownership of files existing on My Drive. Files existing in a shared drive are owned by the organization that owns that shared drive. Ownership transfers are not supported for files and folders in shared drives. Organizers of a shared drive can move items from that shared drive into their My Drive which transfers the ownership to them.
  • use_domain_admin_access: bool – Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
source

pub async fn get( &self, file_id: &str, permission_id: &str, supports_all_drives: bool, supports_team_drives: bool, use_domain_admin_access: bool ) -> Result<Response<Permission>, ClientError>

This function performs a GET to the /files/{fileId}/permissions/{permissionId} endpoint.

Gets a permission by ID.

Parameters:

  • file_id: &str – A link to this theme’s background image.
  • permission_id: &str – A link to this theme’s background image.
  • supports_all_drives: bool – Whether the requesting application supports both My Drives and shared drives.
  • supports_team_drives: bool – Whether the user has installed the requesting app.
  • use_domain_admin_access: bool – Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
source

pub async fn delete( &self, file_id: &str, permission_id: &str, supports_all_drives: bool, supports_team_drives: bool, use_domain_admin_access: bool ) -> Result<Response<()>, ClientError>

This function performs a DELETE to the /files/{fileId}/permissions/{permissionId} endpoint.

Deletes a permission.

Parameters:

  • file_id: &str – A link to this theme’s background image.
  • permission_id: &str – A link to this theme’s background image.
  • supports_all_drives: bool – Whether the requesting application supports both My Drives and shared drives.
  • supports_team_drives: bool – Whether the user has installed the requesting app.
  • use_domain_admin_access: bool – Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
source

pub async fn update( &self, file_id: &str, permission_id: &str, remove_expiration: bool, supports_all_drives: bool, supports_team_drives: bool, transfer_ownership: bool, use_domain_admin_access: bool, body: &Permission ) -> Result<Response<Permission>, ClientError>

This function performs a PATCH to the /files/{fileId}/permissions/{permissionId} endpoint.

Updates a permission with patch semantics.

Parameters:

  • file_id: &str – A link to this theme’s background image.
  • permission_id: &str – A link to this theme’s background image.
  • remove_expiration: bool – Whether the user has installed the requesting app.
  • supports_all_drives: bool – Whether the requesting application supports both My Drives and shared drives.
  • supports_team_drives: bool – Whether the user has installed the requesting app.
  • transfer_ownership: bool – Whether to transfer ownership to the specified user and downgrade the current owner to a writer. This parameter is required as an acknowledgement of the side effect. File owners can only transfer ownership of files existing on My Drive. Files existing in a shared drive are owned by the organization that owns that shared drive. Ownership transfers are not supported for files and folders in shared drives. Organizers of a shared drive can move items from that shared drive into their My Drive which transfers the ownership to them.
  • use_domain_admin_access: bool – Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.

Trait Implementations§

source§

impl PermissionOps for Permissions

source§

fn add_if_not_exists<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, file_id: &'life1 str, email_address: &'life2 str, email_message: &'life3 str, role: &'life4 str, type_: &'life5 str, use_domain_admin_access: bool, send_notification_email: bool ) -> Pin<Box<dyn Future<Output = Result<Response<Permission>, ClientError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait,

Add a permission if it does not already exist.

role: The role granted by this permission. While new values may be supported in the future, the following are currently allowed:

  • owner
  • organizer
  • fileOrganizer
  • writer
  • commenter
  • reader

type_: The type of the grantee. Valid values are:

  • user
  • group
  • domain
  • anyone When creating a permission, if type is user or group, you must provide an emailAddress for the user or group. When type is domain, you must provide a domain. There isn’t extra information required for a anyone type.

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

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