semvec/pypi-packages huggingface dataset:
GDAsync 1.0.0
Asynchronous client library for Google Drive.

# GDAsync
A tiny asynchronous client library for Google Drive, built for use in [gdrove](github.com/spazzlo/gdrove).

# API

## constructor
```py
gda = GDAsync(credentials)
```

## get file
`gda.get_file(fileid, fields=['name', 'id'])`  
#### args:
**fileid** - id of the file to get  
**fields** - list of fields of the file to get
#### returns:
the file you requested

## copy file
`gda.copy_file(fileid, target)`  
#### args:
**fileid** - id of the file to get  
**target** - id of the target folder (use 'root' to reference the root of the drive)
#### returns:
the new file (you can use `file['id']` to get the id of this new object)

## get drives
`gda.get_drives()`  
#### args:
**none**
#### returns:
a list of drives

## list elements in directory
`gda.ls(parentid, q='', fields=['id', 'name'])`  
#### args:
**parent** - id of the folder to look in  
**q** - optional [query](https://developers.google.com/drive/api/v3/search-files) to add to search  
**fields** - list of fields of the files to get
#### returns:
a list of files

## list files in directory
`gda.lsfiles(parentid, fields=['id', 'name'])`  
#### args:
**parent** - id of the folder to look in  
**fields** - list of fields of the files to get
#### returns:
a list of files

## list folders in directory
`gda.lsfolders(parentid, fields=['id', 'name'])`  
#### args:
**parent** - id of the folder to look in  
**fields** - list of fields of the files to get
#### returns:
a list of folders

# Example
```py
from gdasync import GDAsync
import pygauth
import asyncio

async def main():

  # authenticate
  creds = pygauth.get_user_creds_file('credentials.json', ['drive'])

  # create gdasync instance
  gda = GDAsync(creds)

  # get all files in root directory
  files = await gda.ls('root', fields=['name', 'size'])

  # print sizes of all the files
  for i in files:
    if 'size' in i: # some files don't have sizes
      print(f'{i["name"]} is {i["size"]} bytes big!')

asyncio.run(main())
```