ShareShortcuts

GoogleKit

GoogleKit was designed to simplify the way your Shortcuts connect to the Google API

tdevx
Fazer fork de “GoogleKit”

Criou algo novo a partir deste atalho? Compartilhe como uma derivação: ela se torna um atalho seu, que você gerencia, e as duas páginas têm links entre si para que tdevx receba o crédito.

  1. 1Obtenha o atalho e altere-o no app Atalhos. Dê a ele um nome próprio.
  2. 2Compartilhe pelo app Atalhos e copie o link do iCloud.
  3. 3Volte aqui, cole o link e descreva o que mudou, por exemplo: “Adicionei uma etapa que usa a Apple Intelligence para personalizar o texto.”
Downloads
71K
Salvo
3
Ações
189
Categoria
API
Versão
1.2
Idioma
EN

GoogleKit was designed to simplify the way your Shortcuts connect to the Google API.

Powered by Google

Graphics by MediaKit


Note: Instructions on how to configure this Shortcut are below. If you experience issues or require any assistance, don’t hesitate to contact me via Reddit.



Overview

This shortcut was designed to remove some of the bloat from Shortcuts that utilise the Google API (as well as remove some of the headache). When you implement GoogleKit, you’ll be able to remove over 200 Actions (per Shortcut) and still ensure you’re receiving an active Access Token.

GoogleKit (once setup), will allow access to all of the Google API calls as well are check the Access Token each time your Shortcut is run to make sure it’s still active. If it’s no longer active, it will automatically refresh with the API to make sure everything runs smoothly.

Thanks to GoogleKit, implementing the Google API won’t be as tedious as before. If we wanted to publish a Shortcut that used Google’s API, I found the daily quota to be very low and easily hit. Now thanks to this Shortcut, every user will have their on indicidual quota! This means if one person hits the quota, the service won’t be down for everybody.


Documentation

Setup Instructions

Tip: Follow each step to the letter, this is to minimise the risk of you encountering any issues.

  1. Visit THIS link to the Google Developer Console.
  2. Create a new project and call it ”Shortcuts”.
  3. Visit THIS link to the Google API Credentials page.
  4. Type “Shortcuts” in ”Application Name” and save it.
  5. Visit THIS link to the Google oAuth page.
  6. Select “Web Application” and type “http://localhost/“ (lowercase) into the ”Authorised Redirect URI” box, then create the application.
  7. Download and run the ”GoogleKit”Shortcut, you will be guided through the rest of the setup from there.
  8. Done.

Tip: Follow the instructions below each time you install a GoogleKit compatible Shortcut.

  1. Install a GoogleKit compatible Shortcut such as ”YouTube Manager”.
  2. Run the new Shortcut once before running ”GoogleKit”.
  3. Head into ”Settings” and tap on ”Add API”.
  4. Tap on the new Shortcut and Enable all of the listed API’s.
  5. Head into ”Settings” and tap on ”Grant Scope”.
  6. Tap on the new Shortcut and Enable all of the listed Scopes.
  7. Done.

Implementation

Implementation of GoogleKit couldn’t be easier, all it requires from you is around 7 Actions in total placed near the top of your Shortcut. After you add them, you are good to go.

I do however, highly recommend that you inform people when they run your Shortcut to check GoogleKit for your required Scopes / API’s.

Access Token

GoogleKit can fetch the latest Access Token for you, all this takes is placing 3 Actions near the top of your Shortcut.

  1. Place the Text Action and type “refresh_token” inside.
  2. Place the Run Shortcut Action and select the “GoogleKit” Shortcut.
  3. Place the Set Variable Action and name it “access_token”.
Required API

If you need to set a list of required API’s for your Shortcut, all you need to do is add 2 Actions after Access Token.

  1. Place the Dictionary Action, add the API name in ”Key” and the API URL in ”Value”.
  2. Place the Save File Action and set the destination path as “GoogleKit/API/SHORTCUT NAME.json”, and enable ”Overwrite If File Exists”.
Required Scopes

If you’re using an API that requires sensitive data, the user will need to grant access to the Scopes you’re using. If you need to set a list of required Scopes for your Shortcut, all you need to do is add 2 more Actions after Access Token.

  1. Place the Dictionary Action, add the Scope name in ”Key” and the Scope URL in ”Value”.
  2. Place the Save File Action and set the destination path as “GoogleKit/Scopes/SHORTCUT NAME.json”, and enable ”Overwrite If File Exists”.

Novidades

Versão 1.2

Added support for Scopes and API's (this was an oversight), see documentation for change. Bug fixes.

Histórico de versões
1.2 15 de fev de 2019

Added support for Scopes and API's (this was an oversight), see documentation for change. Bug fixes.

1.1 14 de fev de 2019

Added support for Scopes and API's (this was an oversight), see documentation for changes

1.0 12 de fev de 2019

First release

O que ele faz

189 ações
  1. Comment
    Release Notes: - Added support for Scopes and API's (this was an oversight), see documentation for changes.
  2. Dictionary
  3. Set Variable
    shortcut_details
  4. Comment
    //start_first_run
  5. Create Folder
  6. Create Folder
  7. Create Folder
  8. Get File
  9. Count
  10. If
  11. Dictionary
  12. Save File
  13. Comment
    //end_first_run
  14. Comment
    //start_update
  15. Get File
  16. Count
  17. If
  18. Dictionary
  19. Save File
  20. If
  21. Date
  22. Get Time Between Dates
  23. If
  24. Get My Shortcuts
  25. If
  26. Dictionary
  27. Run Shortcut
    UpdateKit
  28. Get Dictionary Value
  29. If
  30. Stop This Shortcut
  31. If
  32. Show Alert
    Missing Required Shortcut
  33. URL
    http://www.mikebeas.com/updatekit/
  34. Open URLs
  35. Stop This Shortcut
  36. Dictionary
  37. Save File
  38. Comment
    //end_update
  39. Comment
    //start_refresh
  40. Get File
  41. Get Dictionary Value
  42. Set Variable
    access_token
  43. Count
  44. If
  45. If
  46. Get Variable
  47. URL
    https://www.googleapis.com/oauth2/v3/tokeninfo?access_token=…
  48. Get Contents of URL
  49. If
  50. URL
    https://www.googleapis.com/oauth2/v4/token?refresh_token=…&client_id=…&client_secret=…&grant_type=refresh_token
  51. Get Contents of URL
  52. Get Dictionary Value
  53. Set Variable
    access_token
  54. Get File
  55. Set Dictionary Value
  56. Save File
  57. Get Variable
  58. If
  59. Get Variable
  60. Count
  61. If
  62. Get Variable
  63. Stop This Shortcut
  64. If
  65. Show Alert
    oAuth Error
  66. Comment
    //end_refresh
  67. Comment
    //start_header
  68. Text
  69. Set Variable
    shortcut_header
  70. Comment
    //end_header
  71. Text
  72. Choose from Menu
    …
  73. Choose from Menu
    Settings
  74. Choose from Menu
    What would you like to do?
  75. Choose from Menu
    Add API
  76. Comment
    //start_api
  77. Get File
  78. Set Variable
    api_data
  79. Get File
  80. Repeat with Each
  81. Get Name
  82. Choose from List
  83. Get File
  84. Choose from List
  85. Show Alert
    Setup Instructions
  86. URL
    …
  87. Show Web Page
  88. Show Alert
    Setup Instructions
  89. URL
    https://console.developers.google.com/apis/credentials/consent
  90. Show Web Page
  91. Nothing
  92. Show Notification
    Congratulations, you have successfully added a new API.
  93. Comment
    //end_api
  94. Choose from Menu
    Grant Scope
  95. Comment
    //start_scopes
  96. Get File
  97. Set Variable
    api_data
  98. Get File
  99. Repeat with Each
  100. Get Name
  101. Choose from List
  102. Get File
  103. Choose from List
  104. Set Variable
    selected_scope
  105. URL
    https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=…
  106. Get Contents of URL
  107. Get Dictionary Value
  108. If
  109. Nothing
  110. Show Notification
    You have already granted access to that Scope.
  111. If
  112. Show Alert
    Access Required
  113. URL
    https://accounts.google.com/o/oauth2/v2/auth?scope=…&include_granted_scopes=true&state=state_parameter_passthrough_value&redirect_uri=http://localhost/&response_type=code&access_type=offline&prompt=consent&client_id=…
  114. Show Web Page
  115. Get Clipboard
  116. Match Text
  117. Set Variable
    oauth_code
  118. Count
  119. If
  120. Show Notification
    Error, please use the share sheet and copy the webpage before tapping done.
  121. Stop This Shortcut
  122. URL
    https://www.googleapis.com/oauth2/v4/token?code=…&client_id=…&client_secret=…&redirect_uri=http://localhost/&grant_type=authorization_code
  123. Get Contents of URL
  124. Set Variable
    oauth2_temp
  125. Get File
  126. Set Dictionary Value
  127. Save File
  128. Get File
  129. Set Dictionary Value
  130. Save File
  131. Nothing
  132. Show Notification
    Congratulations, you have successfully added a new Scope.
  133. Comment
    //end_scopes
  134. Choose from Menu
    Setup OAuth
  135. Comment
    //start_setup
  136. Get File
  137. Get Dictionary Value
  138. Count
  139. If
  140. Show Alert
    Client ID Required
  141. URL
    https://console.developers.google.com/apis/credentials
  142. Show Web Page
  143. Get Clipboard
  144. Set Variable
    client_id
  145. Get File
  146. Set Dictionary Value
  147. Save File
  148. If
  149. Get File
  150. Get Dictionary Value
  151. Set Variable
    client_id
  152. Get File
  153. Get Dictionary Value
  154. Count
  155. If
  156. Show Alert
    Client Secret Required
  157. URL
    https://console.cloud.google.com/apis/credentials
  158. Show Web Page
  159. Get Clipboard
  160. Set Variable
    client_secret
  161. Get File
  162. Set Dictionary Value
  163. Save File
  164. If
  165. Get Variable
  166. Set Variable
    client_secret
  167. Show Alert
    Access Required
  168. URL
    https://accounts.google.com/o/oauth2/v2/auth?scope=https://www.googleapis.com/auth/userinfo.profile&include_granted_scopes=true&state=state_parameter_passthrough_value&redirect_uri=http://localhost/&response_type=code&access_type=offline&prompt=cons…
  169. Show Web Page
  170. Get Clipboard
  171. Match Text
  172. Set Variable
    oauth_code
  173. Count
  174. If
  175. Show Notification
    Error, please use the share sheet and copy the webpage before tapping done.
  176. Stop This Shortcut
  177. URL
    https://www.googleapis.com/oauth2/v4/token?code=…&client_id=…&client_secret=…&redirect_uri=http://localhost/&grant_type=authorization_code
  178. Get Contents of URL
  179. Set Variable
    oauth2_temp
  180. Get File
  181. Set Dictionary Value
  182. Save File
  183. Get File
  184. Set Dictionary Value
  185. Save File
  186. Show Notification
    Congratulations, you have successfully setup the … Shortcut!
  187. Get Variable
  188. Stop This Shortcut
  189. Comment
    //end_setup

Avaliações e comentários

Escrever uma avaliação
–
de 5
★★★★★
★★★★
★★★
★★
★
0 ratings

Ainda não há avaliações. Seja o primeiro a compartilhar o que você pensa!

Publicidade

Mais de tdevx

Ver tudo

Você também pode gostar

Ver tudo
Publicidade