Проверка того, является ли файл Google диска документами Google, листами и слайдами?

#google-drive-api #google-drive-shared-drive

Вопрос:

Как мы узнаем, является ли файл на Google диске документами, таблицами и слайдами Google?

Какие-нибудь закономерности?

 {
                        "kind": "drive#file",
                        "id": "xxxxxxxxxxxxxxxxxxxxxxxx",
                        "etag": ""xxxxxxxxxxxxxxxxxxxxx"",
                        "selfLink": "https://www.googleapis.com/drive/v2/files/xxxxxxxxxxxxxx",
                        "alternateLink": "https://docs.google.com/document/d/xxxxxxxxxxxxx/edit?usp=drivesdk",
                        "embedLink": "https://docs.google.com/document/d/xxxxxxxxxxxxx/preview?ouid=xxxxxxxxxxxxxxx",
                        "iconLink": "https://drive-thirdparty.googleusercontent.com/16/type/application/vnd.google-apps.document",
                        "thumbnailLink": "https://docs.google.com/feeds/vt?gd=trueamp;id=xxxxxxxxxxxxxxxxxamp;v=1amp;s=AMedNxxxxxxxxxxpdmctLve-fDRQL6N9iGoAJ-aEamp;sz=s220",
                        "title": "Title",
                        "mimeType": "application/vnd.google-apps.document",
                        "labels": ⊕{5 items},
                        "copyRequiresWriterPermission": false,
                        "createdDate": "2021-06-02T03:33:25.303Z",
                        "modifiedDate": "2021-06-02T03:34:04.112Z",
                        "markedViewedByMeDate": "1970-01-01T00:00:00.000Z",
                        "version": "17",
                        "parents": ⊕[1 item],
                        "exportLinks": ⊕{8 items},
                        "userPermission": ⊕{7 items},
                        "quotaBytesUsed": "0",
                        "ownerNames": ⊕[1 item],
                        "owners": ⊕[1 item],
                        "lastModifyingUserName": "myname",
                        "lastModifyingUser": ⊕{6 items},
                        "capabilities": ⊕{2 items},
                        "editable": false,
                        "copyable": true,
                        "writersCanShare": true,
                        "shared": true,
                        "explicitlyTrashed": false,
                        "appDataContents": false,
                        "spaces": ⊖[
                            "drive"
                        ]}
 

Кажется, миметип дает некоторые подсказки, но не всегда

приложение/vnd.google-приложения.документ должен быть документом google

Ответ №1:

Стандартный способ определить любой тип файла-по его типу носителя или типу mime.

Если вы проверите ответ, который вы показали, вы увидите

 "mimeType": "application/vnd.google-apps.document",
 

Это скажет вам, что это файл типа Google-приложений. затем вы можете проверить документацию для типов mime google, чтобы узнать, какой это тип

введите описание изображения здесь

Ответ №2:

 "mimeType": "application/vnd.google-apps.spreadsheet"
"mimeType": "application/vnd.google-apps.presentation"
"mimeType": "application/vnd.google-apps.document",
 

являются ответом