{"id":18973339,"url":"https://github.com/cyangle/google_drive","last_synced_at":"2025-04-19T16:37:40.331Z","repository":{"id":39662013,"uuid":"430239868","full_name":"cyangle/google_drive","owner":"cyangle","description":"Google drive v3 crystal lang client generated by OpenAPI Generator","archived":false,"fork":false,"pushed_at":"2024-09-07T20:29:47.000Z","size":569,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T10:12:13.745Z","etag":null,"topics":["crystal","crystal-lang","google-drive","google-drive-api","openapi-generator"],"latest_commit_sha":null,"homepage":"","language":"Crystal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cyangle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-21T00:30:30.000Z","updated_at":"2024-09-07T20:29:51.000Z","dependencies_parsed_at":"2024-11-08T15:11:52.478Z","dependency_job_id":null,"html_url":"https://github.com/cyangle/google_drive","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyangle%2Fgoogle_drive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyangle%2Fgoogle_drive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyangle%2Fgoogle_drive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyangle%2Fgoogle_drive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cyangle","download_url":"https://codeload.github.com/cyangle/google_drive/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249223935,"owners_count":21232833,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crystal","crystal-lang","google-drive","google-drive-api","openapi-generator"],"created_at":"2024-11-08T15:11:46.602Z","updated_at":"2025-04-16T09:33:31.749Z","avatar_url":"https://github.com/cyangle.png","language":"Crystal","readme":"# google_drive\n\nThe Crystal module for the Drive API\n\nManages files in Drive including uploading, downloading, searching, detecting changes, and updating sharing permissions.\n\nThis SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project with CUSTOM templates:\n\n- API version: v3\n- Package version: 3.4.1\n- Build package: org.openapitools.codegen.languages.CrystalClientCodegen\n- Custom templates: [crystal_client_generator](https://github.com/cyangle/crystal_client_generator)\n\nFor more information, please visit [https://google.com](https://google.com)\n\n## Installation\n\n### Install from Git\n\nAdd the following to shard.yaml\n\n```yaml\ndependencies:\n  google_drive:\n    github: cyangle/google_drive\n    version: ~\u003e 3.4.1\n```\n\n## Usage\n\nCheck [here](https://developers.google.com/drive/api/v3/reference) for more information about how to use google drive v3 APIs.\n\nBelow lists only a few examples of the most interesting APIs, the client should support all APIs provided by google drive as it's generated from the OpenAPI v3 specification `./google-drive-api-v3-oas3.json`.\n\n### Require this shard in your project\n\nFirst you need to require it.\n\n```crystal\nrequire \"google_drive\"\n```\n\nOr require a specific api only.\n\n```crystal\nrequire \"google_drive/api/files_api\"\n```\n\n### Configure client with google OAuth2 access token\n\n```crystal\nGoogleDrive.configure do |config|\n  config.access_token = \"Google OAuth2 Access Token\"\nend\n```\n\n### FilesApi\n\n```crystal\nfiles_api = GoogleDrive::FilesApi.new\n```\n\n#### List files\n\n```crystal\nfiles_api.list(page_size: 10, spaces: \"appDataFolder\")\n```\n\n#### Get file meta data by id\n\n```crystal\nfile_meta : GoogleDrive::File = files_api.get(file_id: \"unique_file_id\")\n```\n\n#### Download file by id\n\n```crystal\nfiles_api.get(file_id: \"unique_file_id\", alt: \"media\") do |response|\n  File.open(\"my_file.txt\", \"w\") do |file|\n    IO.copy(response.body_io, file)\n  end\nend\n```\n\n#### Upload file\n\n##### Simple upload\n\n```crystal\nnew_file_meta : GoogleDrive::File = files_api.upload(\n  upload_type: \"media\",\n  media: File.open(\"./test.json\")\n)\n```\n\n##### Multipart upload\n\n```crystal\nfile_meta = GoogleDrive::File.new(\n  name: \"test.json\",\n  mime_type: \"application/json\",\n  parents: [\"appDataFolder\"]\n)\n\nnew_file_meta : GoogleDrive::File = files_api.upload(\n  upload_type: \"multipart\",\n  metadata: IO::Memory.new(file_meta.to_json),\n  media: File.open(\"./test.json\")\n)\n```\n\n#### Create folder\n\n```crystal\nfolder = GoogleDrive::File.new(\n  name: \"my_app\",\n  mime_type: \"application/vnd.google-apps.folder\",\n  parents: [\"appDataFolder\"]\n)\n\nfiles_api.create(file: folder)\n```\n\n\n#### Update file metadata by id\n\nUpdate file name.\n\n```crystal\nfile_meta = GoogleDrive::File.new(name: \"new_name.json\")\nfiles_api.update(file_id: \"unique_file_id\", file: file_meta)\n```\n\n#### Update file content by id\n\n```crystal\nfiles_api.update_content(file_id: \"unique_file_id\", media: File.open(\"./test2.json\"))\n```\n\n#### Delete file by id\n\n```crystal\nfiles_api.delete(file_id: \"unique_file_id\")\n```\n\n## Development\n\nInstall dependencies\n\n```shell\nshards\n```\n\nRun the tests:\n\n```shell\ncrystal spec\n```\n\nRun lints\n\n```shell\n./bin/ameba\ncrystal tool format --check\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyangle%2Fgoogle_drive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyangle%2Fgoogle_drive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyangle%2Fgoogle_drive/lists"}