├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE.md ├── linters │ ├── .htmlhintrc │ ├── .yaml-lint.yml │ └── sun_checks.xml ├── sync-repo-settings.yaml └── workflows │ ├── automation.yml │ ├── lint.yml │ └── test.yml ├── .gitignore ├── LICENSE ├── README.md ├── SECURITY.md ├── admin_sdk ├── directory │ ├── README.md │ └── quickstart.go ├── reports │ ├── README.md │ └── quickstart.go └── reseller │ ├── README.md │ └── quickstart.go ├── apps_script ├── execute │ └── execute.go └── quickstart │ ├── README.md │ └── quickstart.go ├── calendar └── quickstart │ ├── README.md │ └── quickstart.go ├── classroom ├── quickstart │ ├── README.md │ └── quickstart.go └── snippets │ ├── createCourse.go │ ├── getCourse.go │ └── oauth.go ├── docs └── quickstart │ ├── README.md │ └── quickstart.go ├── drive ├── activity-v2 │ └── quickstart │ │ └── quickstart.go ├── activity │ └── quickstart │ │ └── quickstart.go └── quickstart │ ├── README.md │ └── quickstart.go ├── gmail └── quickstart │ ├── README.md │ └── quickstart.go ├── go.mod ├── go.sum ├── people └── quickstart │ ├── README.md │ └── quickstart.go ├── renovate.json ├── sheets └── quickstart │ ├── README.md │ └── quickstart.go ├── slides ├── quickstart │ ├── README.md │ └── quickstart.go └── snippets │ ├── install.sh │ ├── oauth.go │ ├── presentations.go │ ├── presentations_test.go │ ├── test.sh │ └── test_utils.go └── tasks └── quickstart ├── README.md └── quickstart.go /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners 16 | 17 | .github/ @googleworkspace/workspace-devrel-dpe 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Expected Behavior 2 | 3 | 4 | ## Actual Behavior 5 | 6 | 7 | ## Steps to Reproduce the Problem 8 | 9 | 1. 10 | 1. 11 | 1. 12 | 13 | ## Specifications 14 | 15 | - Go version (`go version`) 16 | - OS (Mac/Linux/Windows) 17 | -------------------------------------------------------------------------------- /.github/linters/.htmlhintrc: -------------------------------------------------------------------------------- 1 | { 2 | "tagname-lowercase": true, 3 | "attr-lowercase": true, 4 | "attr-value-double-quotes": true, 5 | "attr-value-not-empty": false, 6 | "attr-no-duplication": true, 7 | "doctype-first": false, 8 | "tag-pair": true, 9 | "tag-self-close": false, 10 | "spec-char-escape": false, 11 | "id-unique": true, 12 | "src-not-empty": true, 13 | "title-require": false, 14 | "alt-require": true, 15 | "doctype-html5": true, 16 | "id-class-value": false, 17 | "style-disabled": false, 18 | "inline-style-disabled": false, 19 | "inline-script-disabled": false, 20 | "space-tab-mixed-disabled": "space", 21 | "id-class-ad-disabled": false, 22 | "href-abs-or-rel": false, 23 | "attr-unsafe-chars": true, 24 | "head-script-disabled": false 25 | } 26 | -------------------------------------------------------------------------------- /.github/linters/.yaml-lint.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ########################################### 3 | # These are the rules used for # 4 | # linting all the yaml files in the stack # 5 | # NOTE: # 6 | # You can disable line with: # 7 | # # yamllint disable-line # 8 | ########################################### 9 | rules: 10 | braces: 11 | level: warning 12 | min-spaces-inside: 0 13 | max-spaces-inside: 0 14 | min-spaces-inside-empty: 1 15 | max-spaces-inside-empty: 5 16 | brackets: 17 | level: warning 18 | min-spaces-inside: 0 19 | max-spaces-inside: 0 20 | min-spaces-inside-empty: 1 21 | max-spaces-inside-empty: 5 22 | colons: 23 | level: warning 24 | max-spaces-before: 0 25 | max-spaces-after: 1 26 | commas: 27 | level: warning 28 | max-spaces-before: 0 29 | min-spaces-after: 1 30 | max-spaces-after: 1 31 | comments: disable 32 | comments-indentation: disable 33 | document-end: disable 34 | document-start: 35 | level: warning 36 | present: true 37 | empty-lines: 38 | level: warning 39 | max: 2 40 | max-start: 0 41 | max-end: 0 42 | hyphens: 43 | level: warning 44 | max-spaces-after: 1 45 | indentation: 46 | level: warning 47 | spaces: consistent 48 | indent-sequences: true 49 | check-multi-line-strings: false 50 | key-duplicates: enable 51 | line-length: 52 | level: warning 53 | max: 120 54 | allow-non-breakable-words: true 55 | allow-non-breakable-inline-mappings: true 56 | new-line-at-end-of-file: disable 57 | new-lines: 58 | type: unix 59 | trailing-spaces: disable -------------------------------------------------------------------------------- /.github/linters/sun_checks.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 18 | 19 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 65 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 82 | 83 | 84 | 86 | 87 | 88 | 94 | 95 | 96 | 97 | 100 | 101 | 102 | 103 | 104 | 108 | 109 | 110 | 111 | 112 | 114 | 115 | 116 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 135 | 137 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 185 | 186 | 187 | 189 | 191 | 192 | 193 | 194 | 196 | 197 | 198 | 199 | 201 | 202 | 203 | 204 | 206 | 207 | 208 | 209 | 211 | 212 | 213 | 214 | 216 | 217 | 218 | 219 | 221 | 222 | 223 | 224 | 226 | 227 | 228 | 229 | 231 | 232 | 233 | 234 | 236 | 237 | 238 | 239 | 241 | 242 | 243 | 244 | 246 | 247 | 248 | 249 | 251 | 253 | 255 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 287 | 288 | 289 | 292 | 293 | 294 | 295 | 301 | 302 | 303 | 304 | 308 | 309 | 310 | 311 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 326 | 327 | 328 | 329 | 330 | 331 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 347 | 348 | 349 | 350 | 353 | 354 | 355 | 356 | 357 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 371 | 372 | 373 | 374 | -------------------------------------------------------------------------------- /.github/sync-repo-settings.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # .github/sync-repo-settings.yaml 16 | # See https://github.com/googleapis/repo-automation-bots/tree/main/packages/sync-repo-settings for app options. 17 | rebaseMergeAllowed: true 18 | squashMergeAllowed: true 19 | mergeCommitAllowed: false 20 | deleteBranchOnMerge: true 21 | branchProtectionRules: 22 | - pattern: main 23 | isAdminEnforced: false 24 | requiresStrictStatusChecks: false 25 | requiredStatusCheckContexts: 26 | # .github/workflows/test.yml with a job called "test" 27 | - "test" 28 | # .github/workflows/lint.yml with a job called "lint" 29 | - "lint" 30 | # Google bots below 31 | - "cla/google" 32 | - "snippet-bot check" 33 | - "header-check" 34 | - "conventionalcommits.org" 35 | requiredApprovingReviewCount: 1 36 | requiresCodeOwnerReviews: true 37 | permissionRules: 38 | - team: workspace-devrel-dpe 39 | permission: admin 40 | - team: workspace-devrel 41 | permission: push 42 | -------------------------------------------------------------------------------- /.github/workflows/automation.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | --- 15 | name: Automation 16 | on: [ push, pull_request, workflow_dispatch ] 17 | jobs: 18 | dependabot: 19 | runs-on: ubuntu-latest 20 | if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' }} 21 | env: 22 | PR_URL: ${{github.event.pull_request.html_url}} 23 | GITHUB_TOKEN: ${{secrets.GOOGLEWORKSPACE_BOT_TOKEN}} 24 | steps: 25 | - name: approve 26 | run: gh pr review --approve "$PR_URL" 27 | - name: merge 28 | run: gh pr merge --auto --squash --delete-branch "$PR_URL" 29 | default-branch-migration: 30 | # this job helps with migrating the default branch to main 31 | # it pushes main to master if master exists and main is the default branch 32 | # it pushes master to main if master is the default branch 33 | runs-on: ubuntu-latest 34 | if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' }} 35 | steps: 36 | - uses: actions/checkout@v2 37 | with: 38 | fetch-depth: 0 39 | # required otherwise GitHub blocks infinite loops in pushes originating in an action 40 | token: ${{ secrets.GOOGLEWORKSPACE_BOT_TOKEN }} 41 | - name: Set env 42 | run: | 43 | # set DEFAULT BRANCH 44 | echo "DEFAULT_BRANCH=$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name')" >> "$GITHUB_ENV"; 45 | 46 | # set HAS_MASTER_BRANCH 47 | if [ -n "$(git ls-remote --heads origin master)" ]; then 48 | echo "HAS_MASTER_BRANCH=true" >> "$GITHUB_ENV" 49 | else 50 | echo "HAS_MASTER_BRANCH=false" >> "$GITHUB_ENV" 51 | fi 52 | env: 53 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 54 | - name: configure git 55 | run: | 56 | git config --global user.name 'googleworkspace-bot' 57 | git config --global user.email 'googleworkspace-bot@google.com' 58 | - if: ${{ env.DEFAULT_BRANCH == 'main' && env.HAS_MASTER_BRANCH == 'true' }} 59 | name: Update master branch from main 60 | run: | 61 | git checkout -B master 62 | git reset --hard origin/main 63 | git push origin master 64 | - if: ${{ env.DEFAULT_BRANCH == 'master'}} 65 | name: Update main branch from master 66 | run: | 67 | git checkout -B main 68 | git reset --hard origin/master 69 | git push origin main 70 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: Lint 16 | on: [push, pull_request] 17 | jobs: 18 | lint: 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v2 22 | - run: | 23 | echo "No lint checks"; 24 | exit 1; 25 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: Test 16 | on: [push, pull_request] 17 | jobs: 18 | test: 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v2 22 | - run: | 23 | echo "No tests"; 24 | exit 1; 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | credentials.json 3 | token.json 4 | .DS_Store -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Go samples for [Google Workspace APIs](https://developers.google.com/gsuite/) docs. 2 | 3 | To run the quickstarts, download a `credentials.json` file in the `quickstart` 4 | folder by following the instructions in `quickstart/README.md`. 5 | 6 | ## APIs 7 | 8 | | | **Apps Script** | **Calendar** | **Classroom** | **Docs** | **Drive V3** | **Gmail** | **Sheets** | **Slides** | **Tasks** | 9 | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | 10 | | GoDoc | [![GoDoc](https://godoc.org/google.golang.org/api/script/v1?status.svg)](https://godoc.org/google.golang.org/api/script/v1) | [![GoDoc](https://godoc.org/google.golang.org/api/calendar/v1?status.svg)](https://godoc.org/google.golang.org/api/calendar/v1) | [![GoDoc](https://godoc.org/google.golang.org/api/classroom/v1?status.svg)](https://godoc.org/google.golang.org/api/classroom/v1) | [![GoDoc](https://godoc.org/google.golang.org/api/docs/v1?status.svg)](https://godoc.org/google.golang.org/api/docs/v1) | [![GoDoc](https://godoc.org/google.golang.org/api/drive/v3?status.svg)](https://godoc.org/google.golang.org/api/drive/v3) | [![GoDoc](https://godoc.org/google.golang.org/api/gmail/v1?status.svg)](https://godoc.org/google.golang.org/api/gmail/v1) | [![GoDoc](https://godoc.org/google.golang.org/api/sheets/v4?status.svg)](https://godoc.org/google.golang.org/api/sheets/v4) | [![GoDoc](https://godoc.org/google.golang.org/api/slides/v1?status.svg)](https://godoc.org/google.golang.org/api/slides/v1) | [![GoDoc](https://godoc.org/google.golang.org/api/tasks/v1?status.svg)](https://godoc.org/google.golang.org/api/tasks/v1) | 11 | | Quickstart | [Link](https://developers.google.com/apps-script/api/quickstart/go) | [Link](https://developers.google.com/calendar/quickstart/go) | [Link](https://developers.google.com/classroom/quickstart/go) | [Link](https://developers.google.com/docs/api/quickstart/go) | [Link](https://developers.google.com/drive/v3/web/quickstart/go) | [Link](https://developers.google.com/gmail/api/quickstart/go) | [Link](https://developers.google.com/sheets/api/quickstart/go) | [Link](https://developers.google.com/slides/quickstart/go) | [Link](https://developers.google.com/google-apps/tasks/quickstart/go) | 12 | | Snippets | --- | --- | --- | --- | [Link](https://developers.google.com/drive/v3/web/about-sdk) | --- | --- | [Link](https://developers.google.com/slides/how-tos/overview) | --- | 13 | 14 | ### Admin SDK APIs 15 | 16 | - [Directory Quickstart](https://developers.google.com/admin-sdk/directory/v1/quickstart/go) [![GoDoc](https://godoc.org/google.golang.org/api/admin/directory/v1?status.svg)](https://godoc.org/google.golang.org/api/admin/directory/v1) 17 | - [Reports Quickstart](https://developers.google.com/admin-sdk/reports/v1/quickstart/go) [![GoDoc](https://godoc.org/google.golang.org/api/admin/reports/v1?status.svg)](https://godoc.org/google.golang.org/api/admin/reports/v1) 18 | - [Reseller Quickstart](https://developers.google.com/admin-sdk/reseller/v1/quickstart/go) [![GoDoc](https://godoc.org/google.golang.org/api/reseller/v1?status.svg)](https://godoc.org/google.golang.org/api/reseller/v1) 19 | 20 | ## Format 21 | 22 | `go fmt ./...` 23 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Report a security issue 2 | 3 | To report a security issue, please use [https://g.co/vulnz](https://g.co/vulnz). We use 4 | [https://g.co/vulnz](https://g.co/vulnz) for our intake, and do coordination and disclosure here on 5 | GitHub (including using GitHub Security Advisory). The Google Security Team will 6 | respond within 5 working days of your report on [https://g.co/vulnz](https://g.co/vulnz). 7 | -------------------------------------------------------------------------------- /admin_sdk/directory/README.md: -------------------------------------------------------------------------------- 1 | # Admin SDK Directory API Go Quickstart 2 | 3 | Complete the steps described in the [Admin SDK Directory API Go Quickstart](https://developers.google.com/admin-sdk/directory/v1/quickstart/go), and in about five minutes you'll have a simple Go command-line application that makes requests to the Directory API. 4 | 5 | ## Credentials 6 | 7 | Download the `credentials.json` file to this directory by following the steps in the above link. 8 | 9 | ## Install Dependencies 10 | 11 | ```bash 12 | go get google.golang.org/api/admin/directory/v1 13 | go get golang.org/x/oauth2/google 14 | ``` 15 | 16 | ## Run 17 | 18 | `go run quickstart.go` 19 | -------------------------------------------------------------------------------- /admin_sdk/directory/quickstart.go: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright Google Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | // [START admin_sdk_directory_quickstart] 18 | package main 19 | 20 | import ( 21 | "context" 22 | "encoding/json" 23 | "fmt" 24 | "log" 25 | "net/http" 26 | "os" 27 | 28 | "golang.org/x/oauth2" 29 | "golang.org/x/oauth2/google" 30 | admin "google.golang.org/api/admin/directory/v1" 31 | "google.golang.org/api/option" 32 | ) 33 | 34 | // Retrieve a token, saves the token, then returns the generated client. 35 | func getClient(config *oauth2.Config) *http.Client { 36 | // The file token.json stores the user's access and refresh tokens, and is 37 | // created automatically when the authorization flow completes for the first 38 | // time. 39 | tokFile := "token.json" 40 | tok, err := tokenFromFile(tokFile) 41 | if err != nil { 42 | tok = getTokenFromWeb(config) 43 | saveToken(tokFile, tok) 44 | } 45 | return config.Client(context.Background(), tok) 46 | } 47 | 48 | // Request a token from the web, then returns the retrieved token. 49 | func getTokenFromWeb(config *oauth2.Config) *oauth2.Token { 50 | authURL := config.AuthCodeURL("state-token", oauth2.AccessTypeOffline) 51 | fmt.Printf("Go to the following link in your browser then type the "+ 52 | "authorization code: \n%v\n", authURL) 53 | 54 | var authCode string 55 | if _, err := fmt.Scan(&authCode); err != nil { 56 | log.Fatalf("Unable to read authorization code: %v", err) 57 | } 58 | 59 | tok, err := config.Exchange(context.TODO(), authCode) 60 | if err != nil { 61 | log.Fatalf("Unable to retrieve token from web: %v", err) 62 | } 63 | return tok 64 | } 65 | 66 | // Retrieves a token from a local file. 67 | func tokenFromFile(file string) (*oauth2.Token, error) { 68 | f, err := os.Open(file) 69 | if err != nil { 70 | return nil, err 71 | } 72 | defer f.Close() 73 | tok := &oauth2.Token{} 74 | err = json.NewDecoder(f).Decode(tok) 75 | return tok, err 76 | } 77 | 78 | // Saves a token to a file path. 79 | func saveToken(path string, token *oauth2.Token) { 80 | fmt.Printf("Saving credential file to: %s\n", path) 81 | f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) 82 | if err != nil { 83 | log.Fatalf("Unable to cache oauth token: %v", err) 84 | } 85 | defer f.Close() 86 | json.NewEncoder(f).Encode(token) 87 | } 88 | 89 | func main() { 90 | ctx := context.Background() 91 | b, err := os.ReadFile("credentials.json") 92 | if err != nil { 93 | log.Fatalf("Unable to read client secret file: %v", err) 94 | } 95 | 96 | // If modifying these scopes, delete your previously saved token.json. 97 | config, err := google.ConfigFromJSON(b, admin.AdminDirectoryUserReadonlyScope) 98 | if err != nil { 99 | log.Fatalf("Unable to parse client secret file to config: %v", err) 100 | } 101 | client := getClient(config) 102 | 103 | srv, err := admin.NewService(ctx, option.WithHTTPClient(client)) 104 | if err != nil { 105 | log.Fatalf("Unable to retrieve directory Client %v", err) 106 | } 107 | 108 | r, err := srv.Users.List().Customer("my_customer").MaxResults(10). 109 | OrderBy("email").Do() 110 | if err != nil { 111 | log.Fatalf("Unable to retrieve users in domain: %v", err) 112 | } 113 | 114 | if len(r.Users) == 0 { 115 | fmt.Print("No users found.\n") 116 | } else { 117 | fmt.Print("Users:\n") 118 | for _, u := range r.Users { 119 | fmt.Printf("%s (%s)\n", u.PrimaryEmail, u.Name.FullName) 120 | } 121 | } 122 | } 123 | 124 | // [END admin_sdk_directory_quickstart] 125 | -------------------------------------------------------------------------------- /admin_sdk/reports/README.md: -------------------------------------------------------------------------------- 1 | # Admin SDK Reports API Go Quickstart 2 | 3 | Complete the steps described in the [Admin SDK Reports API Go Quickstart](https://developers.google.com/admin-sdk/reports/v1/quickstart/go), and in about five minutes you'll have a simple Go command-line application that makes requests to the Reports API. 4 | 5 | ## Credentials 6 | 7 | Download the `credentials.json` file to this Reports by following the steps in the above link. 8 | 9 | ## Install Dependencies 10 | 11 | ```bash 12 | go get google.golang.org/api/admin/reports/v1 13 | go get golang.org/x/oauth2/google 14 | ``` 15 | 16 | ## Run 17 | 18 | `go run quickstart.go` 19 | -------------------------------------------------------------------------------- /admin_sdk/reports/quickstart.go: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright Google Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | // [START admin_sdk_reports_quickstart] 18 | package main 19 | 20 | import ( 21 | "context" 22 | "encoding/json" 23 | "fmt" 24 | "log" 25 | "net/http" 26 | "os" 27 | "time" 28 | 29 | "golang.org/x/oauth2" 30 | "golang.org/x/oauth2/google" 31 | admin "google.golang.org/api/admin/reports/v1" 32 | "google.golang.org/api/option" 33 | ) 34 | 35 | // Retrieve a token, saves the token, then returns the generated client. 36 | func getClient(config *oauth2.Config) *http.Client { 37 | // The file token.json stores the user's access and refresh tokens, and is 38 | // created automatically when the authorization flow completes for the first 39 | // time. 40 | tokFile := "token.json" 41 | tok, err := tokenFromFile(tokFile) 42 | if err != nil { 43 | tok = getTokenFromWeb(config) 44 | saveToken(tokFile, tok) 45 | } 46 | return config.Client(context.Background(), tok) 47 | } 48 | 49 | // Request a token from the web, then returns the retrieved token. 50 | func getTokenFromWeb(config *oauth2.Config) *oauth2.Token { 51 | authURL := config.AuthCodeURL("state-token", oauth2.AccessTypeOffline) 52 | fmt.Printf("Go to the following link in your browser then type the "+ 53 | "authorization code: \n%v\n", authURL) 54 | 55 | var authCode string 56 | if _, err := fmt.Scan(&authCode); err != nil { 57 | log.Fatalf("Unable to read authorization code: %v", err) 58 | } 59 | 60 | tok, err := config.Exchange(context.TODO(), authCode) 61 | if err != nil { 62 | log.Fatalf("Unable to retrieve token from web: %v", err) 63 | } 64 | return tok 65 | } 66 | 67 | // Retrieves a token from a local file. 68 | func tokenFromFile(file string) (*oauth2.Token, error) { 69 | f, err := os.Open(file) 70 | if err != nil { 71 | return nil, err 72 | } 73 | defer f.Close() 74 | tok := &oauth2.Token{} 75 | err = json.NewDecoder(f).Decode(tok) 76 | return tok, err 77 | } 78 | 79 | // Saves a token to a file path. 80 | func saveToken(path string, token *oauth2.Token) { 81 | fmt.Printf("Saving credential file to: %s\n", path) 82 | f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) 83 | if err != nil { 84 | log.Fatalf("Unable to cache oauth token: %v", err) 85 | } 86 | defer f.Close() 87 | json.NewEncoder(f).Encode(token) 88 | } 89 | 90 | func main() { 91 | ctx := context.Background() 92 | b, err := os.ReadFile("credentials.json") 93 | if err != nil { 94 | log.Fatalf("Unable to read client secret file: %v", err) 95 | } 96 | 97 | // If modifying these scopes, delete your previously saved token.json. 98 | config, err := google.ConfigFromJSON(b, admin.AdminReportsAuditReadonlyScope) 99 | if err != nil { 100 | log.Fatalf("Unable to parse client secret file to config: %v", err) 101 | } 102 | client := getClient(config) 103 | 104 | srv, err := admin.NewService(ctx, option.WithHTTPClient(client)) 105 | if err != nil { 106 | log.Fatalf("Unable to retrieve reports Client %v", err) 107 | } 108 | 109 | r, err := srv.Activities.List("all", "login").MaxResults(10).Do() 110 | if err != nil { 111 | log.Fatalf("Unable to retrieve logins to domain. %v", err) 112 | } 113 | 114 | if len(r.Items) == 0 { 115 | fmt.Println("No logins found.") 116 | } else { 117 | fmt.Println("Logins:") 118 | for _, a := range r.Items { 119 | t, err := time.Parse(time.RFC3339Nano, a.Id.Time) 120 | if err != nil { 121 | fmt.Println("Unable to parse login time.") 122 | // Set time to zero. 123 | t = time.Time{} 124 | } 125 | fmt.Printf("%s: %s %s\n", t.Format(time.RFC822), a.Actor.Email, 126 | a.Events[0].Name) 127 | } 128 | } 129 | } 130 | 131 | // [END admin_sdk_reports_quickstart] 132 | -------------------------------------------------------------------------------- /admin_sdk/reseller/README.md: -------------------------------------------------------------------------------- 1 | # Admin SDK Reseller API Go Quickstart 2 | 3 | Complete the steps described in the [Admin SDK Reseller API Go Quickstart](https://developers.google.com/admin-sdk/reseller/v1/quickstart/go), and in about five minutes you'll have a simple Go command-line application that makes requests to the Reseller API. 4 | 5 | ## Credentials 6 | 7 | Download the `credentials.json` file to this Reports by following the steps in the above link. 8 | 9 | ## Install Dependencies 10 | 11 | ```bash 12 | go get google.golang.org/api/reseller/v1 13 | go get golang.org/x/oauth2/google 14 | ``` 15 | 16 | ## Run 17 | 18 | `go run quickstart.go` 19 | -------------------------------------------------------------------------------- /admin_sdk/reseller/quickstart.go: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright Google Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | // [START admin_sdk_reseller_quickstart] 18 | package main 19 | 20 | import ( 21 | "context" 22 | "encoding/json" 23 | "fmt" 24 | "log" 25 | "net/http" 26 | "os" 27 | 28 | "golang.org/x/oauth2" 29 | "golang.org/x/oauth2/google" 30 | "google.golang.org/api/option" 31 | "google.golang.org/api/reseller/v1" 32 | ) 33 | 34 | // Retrieve a token, saves the token, then returns the generated client. 35 | func getClient(config *oauth2.Config) *http.Client { 36 | // The file token.json stores the user's access and refresh tokens, and is 37 | // created automatically when the authorization flow completes for the first 38 | // time. 39 | tokFile := "token.json" 40 | tok, err := tokenFromFile(tokFile) 41 | if err != nil { 42 | tok = getTokenFromWeb(config) 43 | saveToken(tokFile, tok) 44 | } 45 | return config.Client(context.Background(), tok) 46 | } 47 | 48 | // Request a token from the web, then returns the retrieved token. 49 | func getTokenFromWeb(config *oauth2.Config) *oauth2.Token { 50 | authURL := config.AuthCodeURL("state-token", oauth2.AccessTypeOffline) 51 | fmt.Printf("Go to the following link in your browser then type the "+ 52 | "authorization code: \n%v\n", authURL) 53 | 54 | var authCode string 55 | if _, err := fmt.Scan(&authCode); err != nil { 56 | log.Fatalf("Unable to read authorization code: %v", err) 57 | } 58 | 59 | tok, err := config.Exchange(context.TODO(), authCode) 60 | if err != nil { 61 | log.Fatalf("Unable to retrieve token from web: %v", err) 62 | } 63 | return tok 64 | } 65 | 66 | // Retrieves a token from a local file. 67 | func tokenFromFile(file string) (*oauth2.Token, error) { 68 | f, err := os.Open(file) 69 | if err != nil { 70 | return nil, err 71 | } 72 | defer f.Close() 73 | tok := &oauth2.Token{} 74 | err = json.NewDecoder(f).Decode(tok) 75 | return tok, err 76 | } 77 | 78 | // Saves a token to a file path. 79 | func saveToken(path string, token *oauth2.Token) { 80 | fmt.Printf("Saving credential file to: %s\n", path) 81 | f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) 82 | if err != nil { 83 | log.Fatalf("Unable to cache oauth token: %v", err) 84 | } 85 | defer f.Close() 86 | json.NewEncoder(f).Encode(token) 87 | } 88 | 89 | func main() { 90 | ctx := context.Background() 91 | b, err := os.ReadFile("credentials.json") 92 | if err != nil { 93 | log.Fatalf("Unable to read client secret file: %v", err) 94 | } 95 | 96 | // If modifying these scopes, delete your previously saved token.json. 97 | config, err := google.ConfigFromJSON(b, reseller.AppsOrderScope) 98 | if err != nil { 99 | log.Fatalf("Unable to parse client secret file to config: %v", err) 100 | } 101 | client := getClient(config) 102 | 103 | srv, err := reseller.NewService(ctx, option.WithHTTPClient(client)) 104 | if err != nil { 105 | log.Fatalf("Unable to retrieve reseller Client %v", err) 106 | } 107 | 108 | r, err := srv.Subscriptions.List().MaxResults(10).Do() 109 | if err != nil { 110 | log.Fatalf("Unable to retrieve subscriptions. %v", err) 111 | } 112 | 113 | if len(r.Subscriptions) == 0 { 114 | fmt.Println("No subscriptions found.") 115 | } else { 116 | fmt.Println("Subscriptions:") 117 | for _, s := range r.Subscriptions { 118 | fmt.Printf("%s (%s, %s)\n", s.CustomerId, s.SkuId, s.Plan.PlanName) 119 | } 120 | } 121 | } 122 | 123 | // [END admin_sdk_reseller_quickstart] 124 | -------------------------------------------------------------------------------- /apps_script/execute/execute.go: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright Google Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package main 18 | 19 | import ( 20 | "context" 21 | "encoding/json" 22 | "fmt" 23 | "log" 24 | "net/http" 25 | "os" 26 | 27 | "golang.org/x/oauth2" 28 | "golang.org/x/oauth2/google" 29 | "google.golang.org/api/option" 30 | "google.golang.org/api/script/v1" 31 | ) 32 | 33 | // Retrieve a token, saves the token, then returns the generated client. 34 | func getClient(config *oauth2.Config) *http.Client { 35 | // The file token.json stores the user's access and refresh tokens, and is 36 | // created automatically when the authorization flow completes for the first 37 | // time. 38 | tokFile := "token.json" 39 | tok, err := tokenFromFile(tokFile) 40 | if err != nil { 41 | tok = getTokenFromWeb(config) 42 | saveToken(tokFile, tok) 43 | } 44 | return config.Client(context.Background(), tok) 45 | } 46 | 47 | // Request a token from the web, then returns the retrieved token. 48 | func getTokenFromWeb(config *oauth2.Config) *oauth2.Token { 49 | authURL := config.AuthCodeURL("state-token", oauth2.AccessTypeOffline) 50 | fmt.Printf("Go to the following link in your browser then type the "+ 51 | "authorization code: \n%v\n", authURL) 52 | 53 | var authCode string 54 | if _, err := fmt.Scan(&authCode); err != nil { 55 | log.Fatalf("Unable to read authorization code: %v", err) 56 | } 57 | 58 | tok, err := config.Exchange(context.TODO(), authCode) 59 | if err != nil { 60 | log.Fatalf("Unable to retrieve token from web: %v", err) 61 | } 62 | return tok 63 | } 64 | 65 | // Retrieves a token from a local file. 66 | func tokenFromFile(file string) (*oauth2.Token, error) { 67 | f, err := os.Open(file) 68 | if err != nil { 69 | return nil, err 70 | } 71 | defer f.Close() 72 | tok := &oauth2.Token{} 73 | err = json.NewDecoder(f).Decode(tok) 74 | return tok, err 75 | } 76 | 77 | // Saves a token to a file path. 78 | func saveToken(path string, token *oauth2.Token) { 79 | fmt.Printf("Saving credential file to: %s\n", path) 80 | f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) 81 | if err != nil { 82 | log.Fatalf("Unable to cache oauth token: %v", err) 83 | } 84 | defer f.Close() 85 | json.NewEncoder(f).Encode(token) 86 | } 87 | 88 | func main() { 89 | // [START apps_script_api_execute] 90 | ctx := context.Background() 91 | scriptId := "ENTER_YOUR_SCRIPT_ID_HERE" 92 | 93 | b, err := os.ReadFile("credentials.json") 94 | if err != nil { 95 | log.Fatalf("Unable to read client secret file: %v", err) 96 | } 97 | 98 | // If modifying these scopes, delete your previously saved token.json. 99 | config, err := google.ConfigFromJSON(b, "https://www.googleapis.com/auth/script.projects") 100 | if err != nil { 101 | log.Fatalf("Unable to parse client secret file to config: %v", err) 102 | } 103 | 104 | client := getClient(config) 105 | 106 | // Generate a service object. 107 | srv, err := script.NewService(ctx, option.WithHTTPClient(client)) 108 | if err != nil { 109 | log.Fatalf("Unable to retrieve script Client %v", err) 110 | } 111 | 112 | // Create an execution request object. 113 | req := script.ExecutionRequest{Function: "getFoldersUnderRoot"} 114 | 115 | // Make the API request. 116 | resp, err := srv.Scripts.Run(scriptId, &req).Do() 117 | if err != nil { 118 | // The API encountered a problem before the script started executing. 119 | log.Fatalf("Unable to execute Apps Script function. %v", err) 120 | } 121 | 122 | if resp.Error != nil { 123 | // The API executed, but the script returned an details. 124 | 125 | // Extract the first (and only) set of details details and cast as a map. 126 | // The values of this map are the script's 'errorMessage' and 127 | // 'errorType', and an array of stack trace elements (which also need to 128 | // be cast as maps). 129 | var details map[string]interface{} 130 | json.Unmarshal(resp.Error.Details[0], &details) 131 | fmt.Printf("Script details message: %s\n", details["errorMessage"]) 132 | 133 | if details["scriptStackTraceElements"] != nil { 134 | // There may not be a stacktrace if the script didn't start executing. 135 | fmt.Printf("Script details stacktrace:\n") 136 | for _, trace := range details["scriptStackTraceElements"].([]interface{}) { 137 | t := trace.(map[string]interface{}) 138 | fmt.Printf("\t%s: %d\n", t["function"], int(t["lineNumber"].(float64))) 139 | } 140 | } 141 | } else { 142 | // The result provided by the API needs to be cast into the correct type, 143 | // based upon what types the Apps Script function returns. Here, the 144 | // function returns an Apps Script Object with String keys and values, so 145 | // must be cast into a map (folderSet). 146 | var r map[string]interface{} 147 | json.Unmarshal(resp.Response, &r) 148 | folderSet := r["result"].(map[string]interface{}) 149 | if len(folderSet) == 0 { 150 | fmt.Printf("No folders returned!\n") 151 | } else { 152 | fmt.Printf("Folders under your root folder:\n") 153 | for id, folder := range folderSet { 154 | fmt.Printf("\t%s (%s)\n", folder, id) 155 | } 156 | } 157 | } 158 | // [END apps_script_api_execute] 159 | } 160 | -------------------------------------------------------------------------------- /apps_script/quickstart/README.md: -------------------------------------------------------------------------------- 1 | # Google Apps Script Go Quickstart 2 | 3 | Complete the steps described in the [Google Apps Script Go Quickstart](https://developers.google.com/apps-script/api/quickstart/go), and in about five minutes you'll have a simple Go command-line application that makes requests to the Apps Script API. 4 | 5 | ## Credentials 6 | 7 | Download the `credentials.json` file to this directory by following the steps in the above link. 8 | 9 | ## Install Dependencies 10 | 11 | ```bash 12 | go get google.golang.org/api/script/v1 13 | go get golang.org/x/oauth2/google 14 | ``` 15 | 16 | ## Run 17 | 18 | `go run quickstart.go` 19 | -------------------------------------------------------------------------------- /apps_script/quickstart/quickstart.go: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright Google Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | // [START apps_script_api_quickstart] 18 | package main 19 | 20 | import ( 21 | "context" 22 | "encoding/json" 23 | "fmt" 24 | "log" 25 | "net/http" 26 | "os" 27 | 28 | "golang.org/x/oauth2" 29 | "golang.org/x/oauth2/google" 30 | "google.golang.org/api/option" 31 | "google.golang.org/api/script/v1" 32 | ) 33 | 34 | // Retrieve a token, saves the token, then returns the generated client. 35 | func getClient(config *oauth2.Config) *http.Client { 36 | // The file token.json stores the user's access and refresh tokens, and is 37 | // created automatically when the authorization flow completes for the first 38 | // time. 39 | tokFile := "token.json" 40 | tok, err := tokenFromFile(tokFile) 41 | if err != nil { 42 | tok = getTokenFromWeb(config) 43 | saveToken(tokFile, tok) 44 | } 45 | return config.Client(context.Background(), tok) 46 | } 47 | 48 | // Request a token from the web, then returns the retrieved token. 49 | func getTokenFromWeb(config *oauth2.Config) *oauth2.Token { 50 | authURL := config.AuthCodeURL("state-token", oauth2.AccessTypeOffline) 51 | fmt.Printf("Go to the following link in your browser then type the "+ 52 | "authorization code: \n%v\n", authURL) 53 | 54 | var authCode string 55 | if _, err := fmt.Scan(&authCode); err != nil { 56 | log.Fatalf("Unable to read authorization code: %v", err) 57 | } 58 | 59 | tok, err := config.Exchange(context.TODO(), authCode) 60 | if err != nil { 61 | log.Fatalf("Unable to retrieve token from web: %v", err) 62 | } 63 | return tok 64 | } 65 | 66 | // Retrieves a token from a local file. 67 | func tokenFromFile(file string) (*oauth2.Token, error) { 68 | f, err := os.Open(file) 69 | if err != nil { 70 | return nil, err 71 | } 72 | defer f.Close() 73 | tok := &oauth2.Token{} 74 | err = json.NewDecoder(f).Decode(tok) 75 | return tok, err 76 | } 77 | 78 | // Saves a token to a file path. 79 | func saveToken(path string, token *oauth2.Token) { 80 | fmt.Printf("Saving credential file to: %s\n", path) 81 | f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) 82 | if err != nil { 83 | log.Fatalf("Unable to cache oauth token: %v", err) 84 | } 85 | defer f.Close() 86 | json.NewEncoder(f).Encode(token) 87 | } 88 | 89 | func main() { 90 | ctx := context.Background() 91 | b, err := os.ReadFile("credentials.json") 92 | if err != nil { 93 | log.Fatalf("Unable to read client secret file: %v", err) 94 | } 95 | 96 | // If modifying these scopes, delete your previously saved token.json. 97 | config, err := google.ConfigFromJSON(b, "https://www.googleapis.com/auth/script.projects") 98 | if err != nil { 99 | log.Fatalf("Unable to parse client secret file to config: %v", err) 100 | } 101 | client := getClient(config) 102 | 103 | srv, err := script.NewService(ctx, option.WithHTTPClient(client)) 104 | if err != nil { 105 | log.Fatalf("Unable to retrieve Script client: %v", err) 106 | } 107 | 108 | req := script.CreateProjectRequest{Title: "My Script"} 109 | createRes, err := srv.Projects.Create(&req).Do() 110 | if err != nil { 111 | // The API encountered a problem. 112 | log.Fatalf("The API returned an error: %v", err) 113 | } 114 | content := &script.Content{ 115 | ScriptId: createRes.ScriptId, 116 | Files: []*script.File{{ 117 | Name: "hello", 118 | Type: "SERVER_JS", 119 | Source: "function helloWorld() {\n console.log('Hello, world!');}", 120 | }, { 121 | Name: "appsscript", 122 | Type: "JSON", 123 | Source: "{\"timeZone\":\"America/New_York\",\"exceptionLogging\":" + 124 | "\"CLOUD\"}", 125 | }}, 126 | } 127 | updateContentRes, err := srv.Projects.UpdateContent(createRes.ScriptId, 128 | content).Do() 129 | if err != nil { 130 | // The API encountered a problem. 131 | log.Fatalf("The API returned an error: %v", err) 132 | } 133 | log.Printf("https://script.google.com/d/%v/edit", updateContentRes.ScriptId) 134 | } 135 | 136 | // [END apps_script_api_quickstart] 137 | -------------------------------------------------------------------------------- /calendar/quickstart/README.md: -------------------------------------------------------------------------------- 1 | # Google Calendar Go Quickstart 2 | 3 | Complete the steps described in the [Google Calendar Go Quickstart](https://developers.google.com/calendar/quickstart/go), and in about five minutes you'll have a simple Go command-line application that makes requests to the Calendar API. 4 | 5 | ## Credentials 6 | 7 | Download the `credentials.json` file to this directory by following the steps in the above link. 8 | 9 | ## Install Dependencies 10 | 11 | ```bash 12 | go get google.golang.org/api/calendar/v3 13 | go get golang.org/x/oauth2/google 14 | ``` 15 | 16 | ## Run 17 | 18 | `go run quickstart.go` 19 | -------------------------------------------------------------------------------- /calendar/quickstart/quickstart.go: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright Google Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | // [START calendar_quickstart] 18 | package main 19 | 20 | import ( 21 | "context" 22 | "encoding/json" 23 | "fmt" 24 | "log" 25 | "net/http" 26 | "os" 27 | "time" 28 | 29 | "golang.org/x/oauth2" 30 | "golang.org/x/oauth2/google" 31 | "google.golang.org/api/calendar/v3" 32 | "google.golang.org/api/option" 33 | ) 34 | 35 | // Retrieve a token, saves the token, then returns the generated client. 36 | func getClient(config *oauth2.Config) *http.Client { 37 | // The file token.json stores the user's access and refresh tokens, and is 38 | // created automatically when the authorization flow completes for the first 39 | // time. 40 | tokFile := "token.json" 41 | tok, err := tokenFromFile(tokFile) 42 | if err != nil { 43 | tok = getTokenFromWeb(config) 44 | saveToken(tokFile, tok) 45 | } 46 | return config.Client(context.Background(), tok) 47 | } 48 | 49 | // Request a token from the web, then returns the retrieved token. 50 | func getTokenFromWeb(config *oauth2.Config) *oauth2.Token { 51 | authURL := config.AuthCodeURL("state-token", oauth2.AccessTypeOffline) 52 | fmt.Printf("Go to the following link in your browser then type the "+ 53 | "authorization code: \n%v\n", authURL) 54 | 55 | var authCode string 56 | if _, err := fmt.Scan(&authCode); err != nil { 57 | log.Fatalf("Unable to read authorization code: %v", err) 58 | } 59 | 60 | tok, err := config.Exchange(context.TODO(), authCode) 61 | if err != nil { 62 | log.Fatalf("Unable to retrieve token from web: %v", err) 63 | } 64 | return tok 65 | } 66 | 67 | // Retrieves a token from a local file. 68 | func tokenFromFile(file string) (*oauth2.Token, error) { 69 | f, err := os.Open(file) 70 | if err != nil { 71 | return nil, err 72 | } 73 | defer f.Close() 74 | tok := &oauth2.Token{} 75 | err = json.NewDecoder(f).Decode(tok) 76 | return tok, err 77 | } 78 | 79 | // Saves a token to a file path. 80 | func saveToken(path string, token *oauth2.Token) { 81 | fmt.Printf("Saving credential file to: %s\n", path) 82 | f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) 83 | if err != nil { 84 | log.Fatalf("Unable to cache oauth token: %v", err) 85 | } 86 | defer f.Close() 87 | json.NewEncoder(f).Encode(token) 88 | } 89 | 90 | func main() { 91 | ctx := context.Background() 92 | b, err := os.ReadFile("credentials.json") 93 | if err != nil { 94 | log.Fatalf("Unable to read client secret file: %v", err) 95 | } 96 | 97 | // If modifying these scopes, delete your previously saved token.json. 98 | config, err := google.ConfigFromJSON(b, calendar.CalendarReadonlyScope) 99 | if err != nil { 100 | log.Fatalf("Unable to parse client secret file to config: %v", err) 101 | } 102 | client := getClient(config) 103 | 104 | srv, err := calendar.NewService(ctx, option.WithHTTPClient(client)) 105 | if err != nil { 106 | log.Fatalf("Unable to retrieve Calendar client: %v", err) 107 | } 108 | 109 | t := time.Now().Format(time.RFC3339) 110 | events, err := srv.Events.List("primary").ShowDeleted(false). 111 | SingleEvents(true).TimeMin(t).MaxResults(10).OrderBy("startTime").Do() 112 | if err != nil { 113 | log.Fatalf("Unable to retrieve next ten of the user's events: %v", err) 114 | } 115 | fmt.Println("Upcoming events:") 116 | if len(events.Items) == 0 { 117 | fmt.Println("No upcoming events found.") 118 | } else { 119 | for _, item := range events.Items { 120 | date := item.Start.DateTime 121 | if date == "" { 122 | date = item.Start.Date 123 | } 124 | fmt.Printf("%v (%v)\n", item.Summary, date) 125 | } 126 | } 127 | } 128 | 129 | // [END calendar_quickstart] 130 | -------------------------------------------------------------------------------- /classroom/quickstart/README.md: -------------------------------------------------------------------------------- 1 | # Classroom Go Quickstart 2 | 3 | Complete the steps described in the [Classroom Go Quickstart](https://developers.google.com/classroom/quickstart/go), and in about five minutes you'll have a simple Go command-line application that makes requests to the Classroom API. 4 | 5 | ## Credentials 6 | 7 | Download the `credentials.json` file to this directory by following the steps in the above link. 8 | 9 | ## Install 10 | 11 | ```bash 12 | go get google.golang.org/api/classroom/v1 13 | go get golang.org/x/oauth2/google 14 | ``` 15 | 16 | ## Run 17 | 18 | `go run quickstart.go` 19 | -------------------------------------------------------------------------------- /classroom/quickstart/quickstart.go: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright Google Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | // [START classroom_quickstart] 18 | package main 19 | 20 | import ( 21 | "context" 22 | "encoding/json" 23 | "fmt" 24 | "log" 25 | "net/http" 26 | "os" 27 | 28 | "golang.org/x/oauth2" 29 | "golang.org/x/oauth2/google" 30 | "google.golang.org/api/classroom/v1" 31 | "google.golang.org/api/option" 32 | ) 33 | 34 | // Retrieve a token, saves the token, then returns the generated client. 35 | func getClient(config *oauth2.Config) *http.Client { 36 | // The file token.json stores the user's access and refresh tokens, and is 37 | // created automatically when the authorization flow completes for the first 38 | // time. 39 | tokFile := "token.json" 40 | tok, err := tokenFromFile(tokFile) 41 | if err != nil { 42 | tok = getTokenFromWeb(config) 43 | saveToken(tokFile, tok) 44 | } 45 | return config.Client(context.Background(), tok) 46 | } 47 | 48 | // Request a token from the web, then returns the retrieved token. 49 | func getTokenFromWeb(config *oauth2.Config) *oauth2.Token { 50 | authURL := config.AuthCodeURL("state-token", oauth2.AccessTypeOffline) 51 | fmt.Printf("Go to the following link in your browser then type the "+ 52 | "authorization code: \n%v\n", authURL) 53 | 54 | var authCode string 55 | if _, err := fmt.Scan(&authCode); err != nil { 56 | log.Fatalf("Unable to read authorization code: %v", err) 57 | } 58 | 59 | tok, err := config.Exchange(context.TODO(), authCode) 60 | if err != nil { 61 | log.Fatalf("Unable to retrieve token from web: %v", err) 62 | } 63 | return tok 64 | } 65 | 66 | // Retrieves a token from a local file. 67 | func tokenFromFile(file string) (*oauth2.Token, error) { 68 | f, err := os.Open(file) 69 | if err != nil { 70 | return nil, err 71 | } 72 | defer f.Close() 73 | tok := &oauth2.Token{} 74 | err = json.NewDecoder(f).Decode(tok) 75 | return tok, err 76 | } 77 | 78 | // Saves a token to a file path. 79 | func saveToken(path string, token *oauth2.Token) { 80 | fmt.Printf("Saving credential file to: %s\n", path) 81 | f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) 82 | if err != nil { 83 | log.Fatalf("Unable to cache oauth token: %v", err) 84 | } 85 | defer f.Close() 86 | json.NewEncoder(f).Encode(token) 87 | } 88 | 89 | func main() { 90 | ctx := context.Background() 91 | b, err := os.ReadFile("credentials.json") 92 | if err != nil { 93 | log.Fatalf("Unable to read credentials file: %v", err) 94 | } 95 | 96 | // If modifying these scopes, delete your previously saved token.json. 97 | config, err := google.ConfigFromJSON(b, classroom.ClassroomCoursesReadonlyScope) 98 | if err != nil { 99 | log.Fatalf("Unable to parse client secret file to config: %v", err) 100 | } 101 | client := getClient(config) 102 | 103 | srv, err := classroom.NewService(ctx, option.WithHTTPClient(client)) 104 | if err != nil { 105 | log.Fatalf("Unable to create classroom Client %v", err) 106 | } 107 | 108 | r, err := srv.Courses.List().PageSize(10).Do() 109 | if err != nil { 110 | log.Fatalf("Unable to retrieve courses. %v", err) 111 | } 112 | if len(r.Courses) > 0 { 113 | fmt.Print("Courses:\n") 114 | for _, c := range r.Courses { 115 | fmt.Printf("%s (%s)\n", c.Name, c.Id) 116 | } 117 | } else { 118 | fmt.Print("No courses found.") 119 | } 120 | } 121 | 122 | // [END classroom_quickstart] 123 | -------------------------------------------------------------------------------- /classroom/snippets/createCourse.go: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright Google Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package main 18 | 19 | import ( 20 | "context" 21 | "fmt" 22 | "log" 23 | "net/http" 24 | 25 | "google.golang.org/api/classroom/v1" 26 | "google.golang.org/api/option" 27 | ) 28 | 29 | func createCourse(client *http.Client) { 30 | ctx := context.Background() 31 | srv, err := classroom.NewService(ctx, option.WithHTTPClient(client)) 32 | if err != nil { 33 | log.Fatalf("Unable to create classroom Client %v", err) 34 | } 35 | // [START classroom_create_course] 36 | c := &classroom.Course{ 37 | Name: "10th Grade Biology", 38 | Section: "Period 2", 39 | DescriptionHeading: "Welcome to 10th Grade Biology", 40 | Description: "We'll be learning about about the structure of living creatures from a combination of textbooks, guest lectures, and lab work. Expect to be excited!", 41 | Room: "301", 42 | OwnerId: "me", 43 | CourseState: "PROVISIONED", 44 | } 45 | course, err := srv.Courses.Create(c).Do() 46 | if err != nil { 47 | log.Fatalf("Course unable to be created %v", err) 48 | } 49 | // [END classroom_create_course] 50 | fmt.Printf("Created course: %v", course.Id) 51 | } 52 | -------------------------------------------------------------------------------- /classroom/snippets/getCourse.go: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright Google Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package main 18 | 19 | import ( 20 | "context" 21 | "fmt" 22 | "log" 23 | "net/http" 24 | "os" 25 | 26 | "golang.org/x/oauth2/google" 27 | "google.golang.org/api/classroom/v1" 28 | "google.golang.org/api/option" 29 | ) 30 | 31 | func getCourse(client *http.Client) { 32 | // [START classroom_get_course] 33 | ctx := context.Background() 34 | srv, err := classroom.NewService(ctx, option.WithHTTPClient(client)) 35 | if err != nil { 36 | log.Fatalf("Unable to create classroom Client %v", err) 37 | } 38 | id := "123456" 39 | course, err := srv.Courses.Get(id).Do() 40 | if err != nil { 41 | log.Fatalf("Course unable to be retrieved %v", err) 42 | } 43 | // [END classroom_get_course] 44 | fmt.Printf("Course with ID %v found.", course.Id) 45 | } 46 | 47 | func main() { 48 | b, err := os.ReadFile("credentials.json") 49 | if err != nil { 50 | log.Fatalf("Unable to read client secret file: %v", err) 51 | } 52 | 53 | // If modifying these scopes, delete your previously saved token.json. 54 | config, err := google.ConfigFromJSON(b, classroom.ClassroomCoursesScope) 55 | if err != nil { 56 | log.Fatalf("Unable to parse client secret file to config: %v", err) 57 | } 58 | client := getClient(config) 59 | getCourse(client) 60 | } 61 | -------------------------------------------------------------------------------- /classroom/snippets/oauth.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | "encoding/json" 6 | "fmt" 7 | "log" 8 | "net/http" 9 | "os" 10 | 11 | "golang.org/x/oauth2" 12 | ) 13 | 14 | // Retrieve a token, saves the token, then returns the generated client. 15 | func getClient(config *oauth2.Config) *http.Client { 16 | tokFile := "token.json" 17 | tok, err := tokenFromFile(tokFile) 18 | if err != nil { 19 | tok = getTokenFromWeb(config) 20 | saveToken(tokFile, tok) 21 | } 22 | return config.Client(context.Background(), tok) 23 | } 24 | 25 | // Request a token from the web, then returns the retrieved token. 26 | func getTokenFromWeb(config *oauth2.Config) *oauth2.Token { 27 | authURL := config.AuthCodeURL("state-token", oauth2.AccessTypeOffline) 28 | fmt.Printf("Go to the following link in your browser then type the "+ 29 | "authorization code: \n%v\n", authURL) 30 | 31 | var authCode string 32 | if _, err := fmt.Scan(&authCode); err != nil { 33 | log.Fatalf("Unable to read authorization code: %v", err) 34 | } 35 | 36 | tok, err := config.Exchange(context.TODO(), authCode) 37 | if err != nil { 38 | log.Fatalf("Unable to retrieve token from web: %v", err) 39 | } 40 | return tok 41 | } 42 | 43 | // Retrieves a token from a local file. 44 | func tokenFromFile(file string) (*oauth2.Token, error) { 45 | f, err := os.Open(file) 46 | if err != nil { 47 | return nil, err 48 | } 49 | defer f.Close() 50 | tok := &oauth2.Token{} 51 | err = json.NewDecoder(f).Decode(tok) 52 | return tok, err 53 | } 54 | 55 | // Saves a token to a file path. 56 | func saveToken(path string, token *oauth2.Token) { 57 | fmt.Printf("Saving credential file to: %s\n", path) 58 | f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) 59 | if err != nil { 60 | log.Fatalf("Unable to cache oauth token: %v", err) 61 | } 62 | defer f.Close() 63 | json.NewEncoder(f).Encode(token) 64 | } 65 | -------------------------------------------------------------------------------- /docs/quickstart/README.md: -------------------------------------------------------------------------------- 1 | # Docs Go Quickstart 2 | 3 | Complete the steps described in the [Docs Go Quickstart](https://developers.google.com/docs/api/quickstart/go), and in about five minutes you'll have a simple Go command-line application that makes requests to the Docs API. 4 | 5 | ## Credentials 6 | 7 | Download the `credentials.json` file to this directory by following the steps in the above link. 8 | 9 | ## Install 10 | 11 | ```bash 12 | go get google.golang.org/api/docs/v1 13 | go get golang.org/x/oauth2/google 14 | ``` 15 | 16 | ## Run 17 | 18 | `go run quickstart.go` 19 | -------------------------------------------------------------------------------- /docs/quickstart/quickstart.go: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright Google Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | // [START docs_quickstart] 19 | package main 20 | 21 | import ( 22 | "context" 23 | "encoding/json" 24 | "fmt" 25 | "log" 26 | "net/http" 27 | "os" 28 | 29 | "golang.org/x/oauth2" 30 | "golang.org/x/oauth2/google" 31 | "google.golang.org/api/docs/v1" 32 | "google.golang.org/api/option" 33 | ) 34 | 35 | // Retrieves a token, saves the token, then returns the generated client. 36 | func getClient(config *oauth2.Config) *http.Client { 37 | tokFile := "token.json" 38 | tok, err := tokenFromFile(tokFile) 39 | if err != nil { 40 | tok = getTokenFromWeb(config) 41 | saveToken(tokFile, tok) 42 | } 43 | return config.Client(context.Background(), tok) 44 | } 45 | 46 | // Requests a token from the web, then returns the retrieved token. 47 | func getTokenFromWeb(config *oauth2.Config) *oauth2.Token { 48 | authURL := config.AuthCodeURL("state-token", oauth2.AccessTypeOffline) 49 | fmt.Printf("Go to the following link in your browser then type the "+ 50 | "authorization code: \n%v\n", authURL) 51 | 52 | var authCode string 53 | if _, err := fmt.Scan(&authCode); err != nil { 54 | log.Fatalf("Unable to read authorization code: %v", err) 55 | } 56 | 57 | tok, err := config.Exchange(oauth2.NoContext, authCode) 58 | if err != nil { 59 | log.Fatalf("Unable to retrieve token from web: %v", err) 60 | } 61 | return tok 62 | } 63 | 64 | // Retrieves a token from a local file. 65 | func tokenFromFile(file string) (*oauth2.Token, error) { 66 | f, err := os.Open(file) 67 | defer f.Close() 68 | if err != nil { 69 | return nil, err 70 | } 71 | tok := &oauth2.Token{} 72 | err = json.NewDecoder(f).Decode(tok) 73 | return tok, err 74 | } 75 | 76 | // Saves a token to a file path. 77 | func saveToken(path string, token *oauth2.Token) { 78 | fmt.Printf("Saving credential file to: %s\n", path) 79 | f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) 80 | defer f.Close() 81 | if err != nil { 82 | log.Fatalf("Unable to cache OAuth token: %v", err) 83 | } 84 | json.NewEncoder(f).Encode(token) 85 | } 86 | 87 | func main() { 88 | ctx := context.Background() 89 | b, err := os.ReadFile("credentials.json") 90 | if err != nil { 91 | log.Fatalf("Unable to read client secret file: %v", err) 92 | } 93 | 94 | // If modifying these scopes, delete your previously saved token.json. 95 | config, err := google.ConfigFromJSON(b, "https://www.googleapis.com/auth/documents.readonly") 96 | if err != nil { 97 | log.Fatalf("Unable to parse client secret file to config: %v", err) 98 | } 99 | client := getClient(config) 100 | 101 | srv, err := docs.NewService(ctx, option.WithHTTPClient(client)) 102 | if err != nil { 103 | log.Fatalf("Unable to retrieve Docs client: %v", err) 104 | } 105 | 106 | // Prints the title of the requested doc: 107 | // https://docs.google.com/document/d/195j9eDD3ccgjQRttHhJPymLJUCOUjs-jmwTrekvdjFE/edit 108 | docId := "195j9eDD3ccgjQRttHhJPymLJUCOUjs-jmwTrekvdjFE" 109 | doc, err := srv.Documents.Get(docId).Do() 110 | if err != nil { 111 | log.Fatalf("Unable to retrieve data from document: %v", err) 112 | } 113 | fmt.Printf("The title of the doc is: %s\n", doc.Title) 114 | } 115 | 116 | // [START docs_quickstart] 117 | -------------------------------------------------------------------------------- /drive/activity-v2/quickstart/quickstart.go: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright Google Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | // [START drive_activity_v2_quickstart] 18 | package main 19 | 20 | import ( 21 | "context" 22 | "encoding/json" 23 | "fmt" 24 | "log" 25 | "net/http" 26 | "os" 27 | "reflect" 28 | "strings" 29 | 30 | "golang.org/x/oauth2" 31 | "golang.org/x/oauth2/google" 32 | "google.golang.org/api/driveactivity/v2" 33 | "google.golang.org/api/option" 34 | ) 35 | 36 | // Retrieve a token, saves the token, then returns the generated client. 37 | func getClient(config *oauth2.Config) *http.Client { 38 | // The file token.json stores the user's access and refresh tokens, and is 39 | // created automatically when the authorization flow completes for the first 40 | // time. 41 | tokFile := "token.json" 42 | tok, err := tokenFromFile(tokFile) 43 | if err != nil { 44 | tok = getTokenFromWeb(config) 45 | saveToken(tokFile, tok) 46 | } 47 | return config.Client(context.Background(), tok) 48 | } 49 | 50 | // Request a token from the web, then returns the retrieved token. 51 | func getTokenFromWeb(config *oauth2.Config) *oauth2.Token { 52 | authURL := config.AuthCodeURL("state-token", oauth2.AccessTypeOffline) 53 | fmt.Printf("Go to the following link in your browser then type the "+ 54 | "authorization code: \n%v\n", authURL) 55 | 56 | var authCode string 57 | if _, err := fmt.Scan(&authCode); err != nil { 58 | log.Fatalf("Unable to read authorization code: %v", err) 59 | } 60 | 61 | tok, err := config.Exchange(context.TODO(), authCode) 62 | if err != nil { 63 | log.Fatalf("Unable to retrieve token from web: %v", err) 64 | } 65 | return tok 66 | } 67 | 68 | // Retrieves a token from a local file. 69 | func tokenFromFile(file string) (*oauth2.Token, error) { 70 | f, err := os.Open(file) 71 | if err != nil { 72 | return nil, err 73 | } 74 | defer f.Close() 75 | tok := &oauth2.Token{} 76 | err = json.NewDecoder(f).Decode(tok) 77 | return tok, err 78 | } 79 | 80 | // Saves a token to a file path. 81 | func saveToken(path string, token *oauth2.Token) { 82 | fmt.Printf("Saving credential file to: %s\n", path) 83 | f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) 84 | if err != nil { 85 | log.Fatalf("Unable to cache oauth token: %v", err) 86 | } 87 | defer f.Close() 88 | json.NewEncoder(f).Encode(token) 89 | } 90 | 91 | // Returns a string representation of the first elements in a list. 92 | func truncated(array []string) string { 93 | return truncatedTo(array, 2) 94 | } 95 | 96 | // Returns a string representation of the first elements in a list. 97 | func truncatedTo(array []string, limit int) string { 98 | var contents string 99 | var more string 100 | if len(array) <= limit { 101 | contents = strings.Join(array, ", ") 102 | more = "" 103 | } else { 104 | contents = strings.Join(array[0:limit], ", ") 105 | more = ", ..." 106 | } 107 | return fmt.Sprintf("[%s%s]", contents, more) 108 | } 109 | 110 | // Returns the name of a set property in an object, or else "unknown". 111 | func getOneOf(m interface{}) string { 112 | v := reflect.ValueOf(m) 113 | for i := 0; i < v.NumField(); i++ { 114 | if !v.Field(i).IsNil() { 115 | return v.Type().Field(i).Name 116 | } 117 | } 118 | return "unknown" 119 | } 120 | 121 | // Returns a time associated with an activity. 122 | func getTimeInfo(activity *driveactivity.DriveActivity) string { 123 | if activity.Timestamp != "" { 124 | return activity.Timestamp 125 | } 126 | if activity.TimeRange != nil { 127 | return activity.TimeRange.EndTime 128 | } 129 | return "unknown" 130 | } 131 | 132 | // Returns the type of action. 133 | func getActionInfo(action *driveactivity.ActionDetail) string { 134 | return getOneOf(*action) 135 | } 136 | 137 | // Returns user information, or the type of user if not a known user. 138 | func getUserInfo(user *driveactivity.User) string { 139 | if user.KnownUser != nil { 140 | if user.KnownUser.IsCurrentUser { 141 | return "people/me" 142 | } 143 | return user.KnownUser.PersonName 144 | } 145 | return getOneOf(*user) 146 | } 147 | 148 | // Returns actor information, or the type of actor if not a user. 149 | func getActorInfo(actor *driveactivity.Actor) string { 150 | if actor.User != nil { 151 | return getUserInfo(actor.User) 152 | } 153 | return getOneOf(*actor) 154 | } 155 | 156 | // Returns information for a list of actors. 157 | func getActorsInfo(actors []*driveactivity.Actor) []string { 158 | actorsInfo := make([]string, len(actors)) 159 | for i := range actors { 160 | actorsInfo[i] = getActorInfo(actors[i]) 161 | } 162 | return actorsInfo 163 | } 164 | 165 | // Returns the type of a target and an associated title. 166 | func getTargetInfo(target *driveactivity.Target) string { 167 | if target.DriveItem != nil { 168 | return fmt.Sprintf("driveItem:\"%s\"", target.DriveItem.Title) 169 | } 170 | if target.Drive != nil { 171 | return fmt.Sprintf("drive:\"%s\"", target.Drive.Title) 172 | } 173 | if target.FileComment != nil { 174 | parent := target.FileComment.Parent 175 | if parent != nil { 176 | return fmt.Sprintf("fileComment:\"%s\"", parent.Title) 177 | } 178 | return "fileComment:unknown" 179 | } 180 | return getOneOf(*target) 181 | } 182 | 183 | // Returns information for a list of targets. 184 | func getTargetsInfo(targets []*driveactivity.Target) []string { 185 | targetsInfo := make([]string, len(targets)) 186 | for i := range targets { 187 | targetsInfo[i] = getTargetInfo(targets[i]) 188 | } 189 | return targetsInfo 190 | } 191 | 192 | func main() { 193 | ctx := context.Background() 194 | b, err := os.ReadFile("credentials.json") 195 | if err != nil { 196 | log.Fatalf("Unable to read client secret file: %v", err) 197 | } 198 | 199 | // If modifying these scopes, delete your previously saved token.json. 200 | config, err := google.ConfigFromJSON(b, driveactivity.DriveActivityReadonlyScope) 201 | if err != nil { 202 | log.Fatalf("Unable to parse client secret file to config: %v", err) 203 | } 204 | client := getClient(config) 205 | 206 | srv, err := driveactivity.NewService(ctx, option.WithHTTPClient(client)) 207 | if err != nil { 208 | log.Fatalf("Unable to retrieve driveactivity Client %v", err) 209 | } 210 | 211 | q := driveactivity.QueryDriveActivityRequest{PageSize: 10} 212 | r, err := srv.Activity.Query(&q).Do() 213 | if err != nil { 214 | log.Fatalf("Unable to retrieve list of activities. %v", err) 215 | } 216 | 217 | fmt.Println("Recent Activity:") 218 | if len(r.Activities) > 0 { 219 | for _, a := range r.Activities { 220 | time := getTimeInfo(a) 221 | action := getActionInfo(a.PrimaryActionDetail) 222 | actors := getActorsInfo(a.Actors) 223 | targets := getTargetsInfo(a.Targets) 224 | fmt.Printf("%s: %s, %s, %s\n", time, truncated(actors), action, truncated(targets)) 225 | } 226 | } else { 227 | fmt.Print("No activity.") 228 | } 229 | } 230 | 231 | // [END drive_activity_v2_quickstart] 232 | -------------------------------------------------------------------------------- /drive/activity/quickstart/quickstart.go: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright Google Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | // [START drive_activity_quickstart] 18 | package main 19 | 20 | import ( 21 | "context" 22 | "encoding/json" 23 | "fmt" 24 | "log" 25 | "net/http" 26 | "os" 27 | "time" 28 | 29 | "golang.org/x/oauth2" 30 | "golang.org/x/oauth2/google" 31 | "google.golang.org/api/appsactivity/v1" 32 | "google.golang.org/api/option" 33 | ) 34 | 35 | // Retrieve a token, saves the token, then returns the generated client. 36 | func getClient(config *oauth2.Config) *http.Client { 37 | // The file token.json stores the user's access and refresh tokens, and is 38 | // created automatically when the authorization flow completes for the first 39 | // time. 40 | tokFile := "token.json" 41 | tok, err := tokenFromFile(tokFile) 42 | if err != nil { 43 | tok = getTokenFromWeb(config) 44 | saveToken(tokFile, tok) 45 | } 46 | return config.Client(context.Background(), tok) 47 | } 48 | 49 | // Request a token from the web, then returns the retrieved token. 50 | func getTokenFromWeb(config *oauth2.Config) *oauth2.Token { 51 | authURL := config.AuthCodeURL("state-token", oauth2.AccessTypeOffline) 52 | fmt.Printf("Go to the following link in your browser then type the "+ 53 | "authorization code: \n%v\n", authURL) 54 | 55 | var authCode string 56 | if _, err := fmt.Scan(&authCode); err != nil { 57 | log.Fatalf("Unable to read authorization code: %v", err) 58 | } 59 | 60 | tok, err := config.Exchange(context.TODO(), authCode) 61 | if err != nil { 62 | log.Fatalf("Unable to retrieve token from web: %v", err) 63 | } 64 | return tok 65 | } 66 | 67 | // Retrieves a token from a local file. 68 | func tokenFromFile(file string) (*oauth2.Token, error) { 69 | f, err := os.Open(file) 70 | if err != nil { 71 | return nil, err 72 | } 73 | defer f.Close() 74 | tok := &oauth2.Token{} 75 | err = json.NewDecoder(f).Decode(tok) 76 | return tok, err 77 | } 78 | 79 | // Saves a token to a file path. 80 | func saveToken(path string, token *oauth2.Token) { 81 | fmt.Printf("Saving credential file to: %s\n", path) 82 | f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) 83 | if err != nil { 84 | log.Fatalf("Unable to cache oauth token: %v", err) 85 | } 86 | defer f.Close() 87 | json.NewEncoder(f).Encode(token) 88 | } 89 | 90 | func main() { 91 | ctx := context.Background() 92 | b, err := os.ReadFile("credentials.json") 93 | if err != nil { 94 | log.Fatalf("Unable to read client secret file: %v", err) 95 | } 96 | 97 | // If modifying these scopes, delete your previously saved token.json. 98 | config, err := google.ConfigFromJSON(b, appsactivity.ActivityScope) 99 | if err != nil { 100 | log.Fatalf("Unable to parse client secret file to config: %v", err) 101 | } 102 | client := getClient(config) 103 | 104 | srv, err := appsactivity.NewService(ctx, option.WithHTTPClient(client)) 105 | if err != nil { 106 | log.Fatalf("Unable to retrieve appsactivity Client %v", err) 107 | } 108 | 109 | r, err := srv.Activities.List().Source("drive.google.com"). 110 | DriveAncestorId("root").PageSize(10).Do() 111 | if err != nil { 112 | log.Fatalf("Unable to retrieve list of activiites. %v", err) 113 | } 114 | 115 | fmt.Println("Recent Activity:") 116 | if len(r.Activities) > 0 { 117 | for _, a := range r.Activities { 118 | event := a.CombinedEvent 119 | when := time.Unix(0, int64(event.EventTimeMillis)) 120 | user := event.User 121 | target := event.Target 122 | if user == nil || target == nil { 123 | continue 124 | } 125 | fmt.Printf("%s: %s %s %s %s\n", when.Format(time.RFC822), user.Name, 126 | event.PrimaryEventType, target.Name, target.MimeType) 127 | } 128 | } else { 129 | fmt.Print("No recent activity.") 130 | } 131 | 132 | } 133 | 134 | // [END drive_activity_quickstart] 135 | -------------------------------------------------------------------------------- /drive/quickstart/README.md: -------------------------------------------------------------------------------- 1 | # Google Drive Go Quickstart 2 | 3 | Complete the steps described in the [Google Drive Go Quickstart](https://developers.google.com/drive/v3/web/quickstart/go), and in about five minutes you'll have a simple Go command-line application that makes requests to the Drive API. 4 | 5 | ## Credentials 6 | 7 | Download the `credentials.json` file to this directory by following the steps in the above link. 8 | 9 | ## Install Dependencies 10 | 11 | ```bash 12 | go get google.golang.org/api/drive/v3 13 | go get golang.org/x/oauth2/google 14 | ``` 15 | 16 | ## Run 17 | 18 | `go run quickstart.go` 19 | -------------------------------------------------------------------------------- /drive/quickstart/quickstart.go: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright Google Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | // [START drive_quickstart] 18 | package main 19 | 20 | import ( 21 | "context" 22 | "encoding/json" 23 | "fmt" 24 | "log" 25 | "net/http" 26 | "os" 27 | 28 | "golang.org/x/oauth2" 29 | "golang.org/x/oauth2/google" 30 | "google.golang.org/api/drive/v3" 31 | "google.golang.org/api/option" 32 | ) 33 | 34 | // Retrieve a token, saves the token, then returns the generated client. 35 | func getClient(config *oauth2.Config) *http.Client { 36 | // The file token.json stores the user's access and refresh tokens, and is 37 | // created automatically when the authorization flow completes for the first 38 | // time. 39 | tokFile := "token.json" 40 | tok, err := tokenFromFile(tokFile) 41 | if err != nil { 42 | tok = getTokenFromWeb(config) 43 | saveToken(tokFile, tok) 44 | } 45 | return config.Client(context.Background(), tok) 46 | } 47 | 48 | // Request a token from the web, then returns the retrieved token. 49 | func getTokenFromWeb(config *oauth2.Config) *oauth2.Token { 50 | authURL := config.AuthCodeURL("state-token", oauth2.AccessTypeOffline) 51 | fmt.Printf("Go to the following link in your browser then type the "+ 52 | "authorization code: \n%v\n", authURL) 53 | 54 | var authCode string 55 | if _, err := fmt.Scan(&authCode); err != nil { 56 | log.Fatalf("Unable to read authorization code %v", err) 57 | } 58 | 59 | tok, err := config.Exchange(context.TODO(), authCode) 60 | if err != nil { 61 | log.Fatalf("Unable to retrieve token from web %v", err) 62 | } 63 | return tok 64 | } 65 | 66 | // Retrieves a token from a local file. 67 | func tokenFromFile(file string) (*oauth2.Token, error) { 68 | f, err := os.Open(file) 69 | if err != nil { 70 | return nil, err 71 | } 72 | defer f.Close() 73 | tok := &oauth2.Token{} 74 | err = json.NewDecoder(f).Decode(tok) 75 | return tok, err 76 | } 77 | 78 | // Saves a token to a file path. 79 | func saveToken(path string, token *oauth2.Token) { 80 | fmt.Printf("Saving credential file to: %s\n", path) 81 | f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) 82 | if err != nil { 83 | log.Fatalf("Unable to cache oauth token: %v", err) 84 | } 85 | defer f.Close() 86 | json.NewEncoder(f).Encode(token) 87 | } 88 | 89 | func main() { 90 | ctx := context.Background() 91 | b, err := os.ReadFile("credentials.json") 92 | if err != nil { 93 | log.Fatalf("Unable to read client secret file: %v", err) 94 | } 95 | 96 | // If modifying these scopes, delete your previously saved token.json. 97 | config, err := google.ConfigFromJSON(b, drive.DriveMetadataReadonlyScope) 98 | if err != nil { 99 | log.Fatalf("Unable to parse client secret file to config: %v", err) 100 | } 101 | client := getClient(config) 102 | 103 | srv, err := drive.NewService(ctx, option.WithHTTPClient(client)) 104 | if err != nil { 105 | log.Fatalf("Unable to retrieve Drive client: %v", err) 106 | } 107 | 108 | r, err := srv.Files.List().PageSize(10). 109 | Fields("nextPageToken, files(id, name)").Do() 110 | if err != nil { 111 | log.Fatalf("Unable to retrieve files: %v", err) 112 | } 113 | fmt.Println("Files:") 114 | if len(r.Files) == 0 { 115 | fmt.Println("No files found.") 116 | } else { 117 | for _, i := range r.Files { 118 | fmt.Printf("%s (%s)\n", i.Name, i.Id) 119 | } 120 | } 121 | } 122 | 123 | // [END drive_quickstart] 124 | -------------------------------------------------------------------------------- /gmail/quickstart/README.md: -------------------------------------------------------------------------------- 1 | # Gmail Go Quickstart 2 | 3 | Complete the steps described in the [Gmail Go Quickstart](https://developers.google.com/gmail/api/quickstart/go), and in about five minutes you'll have a simple Go command-line application that makes requests to the Gmail API. 4 | 5 | ## Credentials 6 | 7 | Download the `credentials.json` file to this directory by following the steps in the above link. 8 | 9 | ## Install 10 | 11 | ```bash 12 | go get google.golang.org/api/gmail/v1 13 | go get golang.org/x/oauth2/google 14 | ``` 15 | 16 | ## Run 17 | 18 | `go run quickstart.go` 19 | -------------------------------------------------------------------------------- /gmail/quickstart/quickstart.go: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright Google Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | // [START gmail_quickstart] 18 | package main 19 | 20 | import ( 21 | "context" 22 | "encoding/json" 23 | "fmt" 24 | "log" 25 | "net/http" 26 | "os" 27 | 28 | "golang.org/x/oauth2" 29 | "golang.org/x/oauth2/google" 30 | "google.golang.org/api/gmail/v1" 31 | "google.golang.org/api/option" 32 | ) 33 | 34 | // Retrieve a token, saves the token, then returns the generated client. 35 | func getClient(config *oauth2.Config) *http.Client { 36 | // The file token.json stores the user's access and refresh tokens, and is 37 | // created automatically when the authorization flow completes for the first 38 | // time. 39 | tokFile := "token.json" 40 | tok, err := tokenFromFile(tokFile) 41 | if err != nil { 42 | tok = getTokenFromWeb(config) 43 | saveToken(tokFile, tok) 44 | } 45 | return config.Client(context.Background(), tok) 46 | } 47 | 48 | // Request a token from the web, then returns the retrieved token. 49 | func getTokenFromWeb(config *oauth2.Config) *oauth2.Token { 50 | authURL := config.AuthCodeURL("state-token", oauth2.AccessTypeOffline) 51 | fmt.Printf("Go to the following link in your browser then type the "+ 52 | "authorization code: \n%v\n", authURL) 53 | 54 | var authCode string 55 | if _, err := fmt.Scan(&authCode); err != nil { 56 | log.Fatalf("Unable to read authorization code: %v", err) 57 | } 58 | 59 | tok, err := config.Exchange(context.TODO(), authCode) 60 | if err != nil { 61 | log.Fatalf("Unable to retrieve token from web: %v", err) 62 | } 63 | return tok 64 | } 65 | 66 | // Retrieves a token from a local file. 67 | func tokenFromFile(file string) (*oauth2.Token, error) { 68 | f, err := os.Open(file) 69 | if err != nil { 70 | return nil, err 71 | } 72 | defer f.Close() 73 | tok := &oauth2.Token{} 74 | err = json.NewDecoder(f).Decode(tok) 75 | return tok, err 76 | } 77 | 78 | // Saves a token to a file path. 79 | func saveToken(path string, token *oauth2.Token) { 80 | fmt.Printf("Saving credential file to: %s\n", path) 81 | f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) 82 | if err != nil { 83 | log.Fatalf("Unable to cache oauth token: %v", err) 84 | } 85 | defer f.Close() 86 | json.NewEncoder(f).Encode(token) 87 | } 88 | 89 | func main() { 90 | ctx := context.Background() 91 | b, err := os.ReadFile("credentials.json") 92 | if err != nil { 93 | log.Fatalf("Unable to read client secret file: %v", err) 94 | } 95 | 96 | // If modifying these scopes, delete your previously saved token.json. 97 | config, err := google.ConfigFromJSON(b, gmail.GmailReadonlyScope) 98 | if err != nil { 99 | log.Fatalf("Unable to parse client secret file to config: %v", err) 100 | } 101 | client := getClient(config) 102 | 103 | srv, err := gmail.NewService(ctx, option.WithHTTPClient(client)) 104 | if err != nil { 105 | log.Fatalf("Unable to retrieve Gmail client: %v", err) 106 | } 107 | 108 | user := "me" 109 | r, err := srv.Users.Labels.List(user).Do() 110 | if err != nil { 111 | log.Fatalf("Unable to retrieve labels: %v", err) 112 | } 113 | if len(r.Labels) == 0 { 114 | fmt.Println("No labels found.") 115 | return 116 | } 117 | fmt.Println("Labels:") 118 | for _, l := range r.Labels { 119 | fmt.Printf("- %s\n", l.Name) 120 | } 121 | } 122 | 123 | // [END gmail_quickstart] 124 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/googleworkspace/go-samples 2 | 3 | go 1.16 4 | 5 | require ( 6 | github.com/stretchr/testify v1.7.0 7 | golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094 8 | google.golang.org/api v0.94.0 9 | ) 10 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 2 | cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 3 | cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= 4 | cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= 5 | cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= 6 | cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= 7 | cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= 8 | cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= 9 | cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= 10 | cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= 11 | cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= 12 | cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= 13 | cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= 14 | cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= 15 | cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= 16 | cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= 17 | cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= 18 | cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= 19 | cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= 20 | cloud.google.com/go v0.81.0 h1:at8Tk2zUz63cLPR0JPWm5vp77pEZmzxEQBEfRKn1VV8= 21 | cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= 22 | cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= 23 | cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM= 24 | cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= 25 | cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= 26 | cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= 27 | cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= 28 | cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= 29 | cloud.google.com/go v0.99.0 h1:y/cM2iqGgGi5D5DQZl6D9STN/3dR/Vx5Mp8s752oJTY= 30 | cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= 31 | cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= 32 | cloud.google.com/go v0.102.0 h1:DAq3r8y4mDgyB/ZPJ9v/5VJNqjgJAxTn6ZYLlUywOu8= 33 | cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= 34 | cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= 35 | cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= 36 | cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= 37 | cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= 38 | cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= 39 | cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= 40 | cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= 41 | cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM= 42 | cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= 43 | cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s= 44 | cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= 45 | cloud.google.com/go/compute v1.7.0 h1:v/k9Eueb8aAJ0vZuxKMrgm6kPhCLZU9HxFU+AFDs9Uk= 46 | cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= 47 | cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= 48 | cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= 49 | cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= 50 | cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= 51 | cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= 52 | cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= 53 | cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= 54 | cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= 55 | cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= 56 | cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= 57 | cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= 58 | cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= 59 | cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= 60 | dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= 61 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 62 | github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= 63 | github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= 64 | github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= 65 | github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= 66 | github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= 67 | github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= 68 | github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= 69 | github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= 70 | github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= 71 | github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= 72 | github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= 73 | github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= 74 | github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= 75 | github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= 76 | github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= 77 | github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= 78 | github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= 79 | github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= 80 | github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= 81 | github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= 82 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 83 | github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 84 | github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 85 | github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= 86 | github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= 87 | github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= 88 | github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= 89 | github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= 90 | github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= 91 | github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= 92 | github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= 93 | github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= 94 | github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= 95 | github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= 96 | github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= 97 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 98 | github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= 99 | github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= 100 | github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= 101 | github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= 102 | github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 103 | github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 104 | github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= 105 | github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= 106 | github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= 107 | github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= 108 | github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= 109 | github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= 110 | github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= 111 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 112 | github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 113 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 114 | github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= 115 | github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= 116 | github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= 117 | github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= 118 | github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= 119 | github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= 120 | github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= 121 | github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= 122 | github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= 123 | github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= 124 | github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= 125 | github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= 126 | github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= 127 | github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= 128 | github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= 129 | github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= 130 | github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= 131 | github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= 132 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 133 | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 134 | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 135 | github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 136 | github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 137 | github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 138 | github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 139 | github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 140 | github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 141 | github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 142 | github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= 143 | github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 144 | github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 145 | github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= 146 | github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 147 | github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= 148 | github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= 149 | github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= 150 | github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= 151 | github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= 152 | github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= 153 | github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= 154 | github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= 155 | github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= 156 | github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= 157 | github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= 158 | github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= 159 | github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= 160 | github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= 161 | github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= 162 | github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= 163 | github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= 164 | github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= 165 | github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= 166 | github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 167 | github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= 168 | github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 169 | github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= 170 | github.com/googleapis/enterprise-certificate-proxy v0.1.0 h1:zO8WHNx/MYiAKJ3d5spxZXZE6KHmIQGQcAzwUzV7qQw= 171 | github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= 172 | github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= 173 | github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= 174 | github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= 175 | github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= 176 | github.com/googleapis/gax-go/v2 v2.1.1 h1:dp3bWCh+PPO1zjRRiCSczJav13sBvG4UhNyVTa1KqdU= 177 | github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= 178 | github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= 179 | github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM= 180 | github.com/googleapis/gax-go/v2 v2.4.0 h1:dS9eYAjhrE2RjmzYw2XAPvcXfmcQLtFEQWn0CR82awk= 181 | github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= 182 | github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= 183 | github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= 184 | github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= 185 | github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= 186 | github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= 187 | github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= 188 | github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= 189 | github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= 190 | github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= 191 | github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= 192 | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= 193 | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= 194 | github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= 195 | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 196 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 197 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 198 | github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= 199 | github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= 200 | github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= 201 | github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= 202 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 203 | github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= 204 | github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= 205 | github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 206 | github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= 207 | github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 208 | github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 209 | github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 210 | github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 211 | github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 212 | github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= 213 | go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= 214 | go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= 215 | go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= 216 | go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= 217 | go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= 218 | go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= 219 | go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= 220 | go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= 221 | go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= 222 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 223 | golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 224 | golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 225 | golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 226 | golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 227 | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 228 | golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 229 | golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= 230 | golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= 231 | golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= 232 | golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= 233 | golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= 234 | golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= 235 | golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= 236 | golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= 237 | golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= 238 | golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= 239 | golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 240 | golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= 241 | golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 242 | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 243 | golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 244 | golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 245 | golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 246 | golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= 247 | golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= 248 | golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= 249 | golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= 250 | golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= 251 | golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= 252 | golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= 253 | golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= 254 | golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= 255 | golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= 256 | golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= 257 | golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 258 | golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 259 | golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 260 | golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 261 | golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 262 | golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 263 | golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 264 | golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 265 | golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 266 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 267 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 268 | golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 269 | golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 270 | golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= 271 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 272 | golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 273 | golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 274 | golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 275 | golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 276 | golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 277 | golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 278 | golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 279 | golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 280 | golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= 281 | golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= 282 | golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= 283 | golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= 284 | golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= 285 | golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= 286 | golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= 287 | golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= 288 | golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 289 | golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 290 | golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 291 | golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 292 | golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 293 | golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 294 | golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= 295 | golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= 296 | golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 h1:a8jGStKg0XqKDlKqjLrXn0ioF5MH36pT7Z0BRTqLhbk= 297 | golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 298 | golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= 299 | golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= 300 | golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= 301 | golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= 302 | golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= 303 | golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= 304 | golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e h1:TsQ7F31D3bUCLeqPT0u+yjp1guoArKaNKmCr22PYgTQ= 305 | golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= 306 | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= 307 | golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= 308 | golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= 309 | golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= 310 | golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= 311 | golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= 312 | golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= 313 | golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= 314 | golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= 315 | golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= 316 | golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= 317 | golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c h1:pkQiBZBvdos9qq4wBAHqlzuZHEXo07pqV06ef90u1WI= 318 | golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= 319 | golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= 320 | golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= 321 | golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= 322 | golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 h1:RerP+noqYHUQ8CMRcPlC2nvTa4dcBIjegkuWdcUDuqg= 323 | golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= 324 | golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= 325 | golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= 326 | golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= 327 | golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= 328 | golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094 h1:2o1E+E8TpNLklK9nHiPiK1uzIYrIHt+cQx3ynCwq9V8= 329 | golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= 330 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 331 | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 332 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 333 | golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 334 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 335 | golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 336 | golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 337 | golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 338 | golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 339 | golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 340 | golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 341 | golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 342 | golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 343 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 344 | golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 345 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 346 | golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 347 | golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 348 | golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 349 | golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 350 | golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 351 | golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 352 | golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 353 | golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 354 | golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 355 | golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 356 | golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 357 | golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 358 | golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 359 | golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 360 | golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 361 | golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 362 | golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 363 | golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 364 | golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 365 | golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 366 | golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 367 | golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 368 | golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 369 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 370 | golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 371 | golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 372 | golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 373 | golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 374 | golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 375 | golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 376 | golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 377 | golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 378 | golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 379 | golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 380 | golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 h1:hZR0X1kPW+nwyJ9xRxqZk1vx5RUObAPBdKVvXPDUH/E= 381 | golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 382 | golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 383 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 384 | golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 385 | golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 386 | golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 387 | golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 388 | golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 389 | golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 390 | golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 391 | golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= 392 | golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 393 | golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 394 | golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 395 | golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 396 | golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 397 | golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 398 | golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 399 | golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 400 | golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 401 | golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d h1:Zu/JngovGLVi6t2J3nmAf3AoTDwuzw85YZ3b9o4yU7s= 402 | golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 403 | golang.org/x/sys v0.0.0-20220624220833-87e55d714810 h1:rHZQSjJdAI4Xf5Qzeh2bBc5YJIkPFVM6oDtMFYmgws0= 404 | golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 405 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 406 | golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= 407 | golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 408 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 409 | golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 410 | golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= 411 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 412 | golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 413 | golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 414 | golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= 415 | golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 416 | golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= 417 | golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= 418 | golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 419 | golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 420 | golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 421 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 422 | golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 423 | golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= 424 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 425 | golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 426 | golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 427 | golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 428 | golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 429 | golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 430 | golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= 431 | golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= 432 | golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= 433 | golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 434 | golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 435 | golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 436 | golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 437 | golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 438 | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 439 | golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 440 | golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 441 | golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 442 | golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 443 | golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 444 | golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 445 | golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 446 | golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 447 | golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 448 | golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 449 | golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 450 | golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 451 | golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= 452 | golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= 453 | golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= 454 | golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= 455 | golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= 456 | golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= 457 | golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= 458 | golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= 459 | golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= 460 | golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= 461 | golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= 462 | golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 463 | golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 464 | golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 465 | golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 466 | golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= 467 | golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= 468 | golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= 469 | golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= 470 | golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= 471 | golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= 472 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 473 | golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 474 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 475 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= 476 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 477 | golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 478 | golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= 479 | golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f h1:uF6paiQQebLeSXkrTqHqz0MXhXXS1KgF41eUdBNvxK0= 480 | golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= 481 | google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= 482 | google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= 483 | google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= 484 | google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= 485 | google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= 486 | google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= 487 | google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= 488 | google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= 489 | google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= 490 | google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= 491 | google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= 492 | google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= 493 | google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= 494 | google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= 495 | google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= 496 | google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= 497 | google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= 498 | google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= 499 | google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= 500 | google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= 501 | google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= 502 | google.golang.org/api v0.47.0 h1:sQLWZQvP6jPGIP4JGPkJu4zHswrv81iobiyszr3b/0I= 503 | google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= 504 | google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= 505 | google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= 506 | google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= 507 | google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= 508 | google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= 509 | google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= 510 | google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= 511 | google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= 512 | google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= 513 | google.golang.org/api v0.64.0 h1:l3pi8ncrQgB9+ncFw3A716L8lWujnXniBYbxWqqy6tE= 514 | google.golang.org/api v0.64.0/go.mod h1:931CdxA8Rm4t6zqTFGSsgwbAEZ2+GMYurbndwSimebM= 515 | google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g= 516 | google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= 517 | google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= 518 | google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= 519 | google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= 520 | google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw= 521 | google.golang.org/api v0.80.0/go.mod h1:xY3nI94gbvBrE0J6NHXhxOmW97HG7Khjkku6AFB3Hyg= 522 | google.golang.org/api v0.84.0 h1:NMB9J4cCxs9xEm+1Z9QiO3eFvn7EnQj3Eo3hN6ugVlg= 523 | google.golang.org/api v0.84.0/go.mod h1:NTsGnUFJMYROtiquksZHBWtHfeMC7iYthki7Eq3pa8o= 524 | google.golang.org/api v0.94.0 h1:KtKM9ru3nzQioV1HLlUf1cR7vMYJIpgls5VhAYQXIwA= 525 | google.golang.org/api v0.94.0/go.mod h1:eADj+UBuxkh5zlrSntJghuNeg8HwQ1w5lTKkuqaETEI= 526 | google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 527 | google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 528 | google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 529 | google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= 530 | google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= 531 | google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= 532 | google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= 533 | google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= 534 | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= 535 | google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= 536 | google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= 537 | google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= 538 | google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= 539 | google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 540 | google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 541 | google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= 542 | google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= 543 | google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= 544 | google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= 545 | google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= 546 | google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= 547 | google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= 548 | google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= 549 | google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= 550 | google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= 551 | google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= 552 | google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= 553 | google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= 554 | google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= 555 | google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= 556 | google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= 557 | google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= 558 | google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= 559 | google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= 560 | google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= 561 | google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= 562 | google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= 563 | google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= 564 | google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= 565 | google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= 566 | google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= 567 | google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= 568 | google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= 569 | google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= 570 | google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= 571 | google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= 572 | google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= 573 | google.golang.org/genproto v0.0.0-20210329143202-679c6ae281ee/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= 574 | google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= 575 | google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384 h1:z+j74wi4yV+P7EtK9gPLGukOk7mFOy9wMQaC0wNb7eY= 576 | google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= 577 | google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= 578 | google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= 579 | google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= 580 | google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= 581 | google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= 582 | google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= 583 | google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= 584 | google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= 585 | google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= 586 | google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= 587 | google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= 588 | google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= 589 | google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= 590 | google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= 591 | google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= 592 | google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= 593 | google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= 594 | google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= 595 | google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= 596 | google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb h1:ZrsicilzPCS/Xr8qtBZZLpy4P9TYXAfl49ctG1/5tgw= 597 | google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= 598 | google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= 599 | google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= 600 | google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= 601 | google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= 602 | google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= 603 | google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= 604 | google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= 605 | google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= 606 | google.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= 607 | google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= 608 | google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= 609 | google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= 610 | google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= 611 | google.golang.org/genproto v0.0.0-20220518221133-4f43b3371335/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= 612 | google.golang.org/genproto v0.0.0-20220523171625-347a074981d8/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= 613 | google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= 614 | google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90 h1:4SPz2GL2CXJt28MTF8V6Ap/9ZiVbQlJeGSd9qtA7DLs= 615 | google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= 616 | google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f h1:hJ/Y5SqPXbarffmAsApliUlcvMU+wScNGfyop4bZm8o= 617 | google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= 618 | google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= 619 | google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= 620 | google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= 621 | google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= 622 | google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= 623 | google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= 624 | google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= 625 | google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= 626 | google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= 627 | google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= 628 | google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= 629 | google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= 630 | google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= 631 | google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= 632 | google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= 633 | google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= 634 | google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= 635 | google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= 636 | google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= 637 | google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= 638 | google.golang.org/grpc v1.37.1 h1:ARnQJNWxGyYJpdf/JXscNlQr/uv607ZPU9Z7ogHi+iI= 639 | google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= 640 | google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= 641 | google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= 642 | google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= 643 | google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= 644 | google.golang.org/grpc v1.40.1 h1:pnP7OclFFFgFi4VHQDQDaoXUVauOFyktqTsqqgzFKbc= 645 | google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= 646 | google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= 647 | google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= 648 | google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= 649 | google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= 650 | google.golang.org/grpc v1.47.0 h1:9n77onPX5F3qfFCqjy9dhn8PbNQsIKeVU04J9G7umt8= 651 | google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= 652 | google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= 653 | google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= 654 | google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= 655 | google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= 656 | google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= 657 | google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= 658 | google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 659 | google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 660 | google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 661 | google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= 662 | google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= 663 | google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= 664 | google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= 665 | google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= 666 | google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= 667 | google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= 668 | google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= 669 | google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= 670 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 671 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= 672 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 673 | gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= 674 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 675 | gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 676 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= 677 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 678 | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 679 | honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 680 | honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 681 | honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 682 | honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= 683 | honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= 684 | honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= 685 | rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= 686 | rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= 687 | rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= 688 | -------------------------------------------------------------------------------- /people/quickstart/README.md: -------------------------------------------------------------------------------- 1 | # People Go Quickstart 2 | 3 | Complete the steps described in the [People Go Quickstart](https://developers.google.com/people/quickstart/go), and in about five minutes you'll have a simple Go command-line application that makes requests to the People API. 4 | 5 | ## Credentials 6 | 7 | Download the `credentials.json` file to this directory by following the steps in the above link. 8 | 9 | ## Install 10 | 11 | ```bash 12 | go get google.golang.org/api/people/v1 13 | go get golang.org/x/oauth2/google 14 | ``` 15 | 16 | ## Run 17 | 18 | `go run quickstart.go` 19 | -------------------------------------------------------------------------------- /people/quickstart/quickstart.go: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright Google Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | // [START people_quickstart] 18 | package main 19 | 20 | import ( 21 | "context" 22 | "encoding/json" 23 | "fmt" 24 | "log" 25 | "net/http" 26 | "os" 27 | 28 | "golang.org/x/oauth2" 29 | "golang.org/x/oauth2/google" 30 | "google.golang.org/api/option" 31 | "google.golang.org/api/people/v1" 32 | ) 33 | 34 | // Retrieve a token, saves the token, then returns the generated client. 35 | func getClient(config *oauth2.Config) *http.Client { 36 | // The file token.json stores the user's access and refresh tokens, and is 37 | // created automatically when the authorization flow completes for the first 38 | // time. 39 | tokFile := "token.json" 40 | tok, err := tokenFromFile(tokFile) 41 | if err != nil { 42 | tok = getTokenFromWeb(config) 43 | saveToken(tokFile, tok) 44 | } 45 | return config.Client(context.Background(), tok) 46 | } 47 | 48 | // Request a token from the web, then returns the retrieved token. 49 | func getTokenFromWeb(config *oauth2.Config) *oauth2.Token { 50 | authURL := config.AuthCodeURL("state-token", oauth2.AccessTypeOffline) 51 | fmt.Printf("Go to the following link in your browser then type the "+ 52 | "authorization code: \n%v\n", authURL) 53 | 54 | var authCode string 55 | if _, err := fmt.Scan(&authCode); err != nil { 56 | log.Fatalf("Unable to read authorization code: %v", err) 57 | } 58 | 59 | tok, err := config.Exchange(context.TODO(), authCode) 60 | if err != nil { 61 | log.Fatalf("Unable to retrieve token from web: %v", err) 62 | } 63 | return tok 64 | } 65 | 66 | // Retrieves a token from a local file. 67 | func tokenFromFile(file string) (*oauth2.Token, error) { 68 | f, err := os.Open(file) 69 | if err != nil { 70 | return nil, err 71 | } 72 | defer f.Close() 73 | tok := &oauth2.Token{} 74 | err = json.NewDecoder(f).Decode(tok) 75 | return tok, err 76 | } 77 | 78 | // Saves a token to a file path. 79 | func saveToken(path string, token *oauth2.Token) { 80 | fmt.Printf("Saving credential file to: %s\n", path) 81 | f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) 82 | if err != nil { 83 | log.Fatalf("Unable to cache oauth token: %v", err) 84 | } 85 | defer f.Close() 86 | json.NewEncoder(f).Encode(token) 87 | } 88 | 89 | func main() { 90 | ctx := context.Background() 91 | b, err := os.ReadFile("credentials.json") 92 | if err != nil { 93 | log.Fatalf("Unable to read client secret file: %v", err) 94 | } 95 | 96 | // If modifying these scopes, delete your previously saved token.json. 97 | config, err := google.ConfigFromJSON(b, people.ContactsReadonlyScope) 98 | if err != nil { 99 | log.Fatalf("Unable to parse client secret file to config: %v", err) 100 | } 101 | client := getClient(config) 102 | 103 | srv, err := people.NewService(ctx, option.WithHTTPClient(client)) 104 | if err != nil { 105 | log.Fatalf("Unable to create people Client %v", err) 106 | } 107 | 108 | r, err := srv.People.Connections.List("people/me").PageSize(10). 109 | PersonFields("names,emailAddresses").Do() 110 | if err != nil { 111 | log.Fatalf("Unable to retrieve people. %v", err) 112 | } 113 | if len(r.Connections) > 0 { 114 | fmt.Print("List 10 connection names:\n") 115 | for _, c := range r.Connections { 116 | names := c.Names 117 | if len(names) > 0 { 118 | name := names[0].DisplayName 119 | fmt.Printf("%s\n", name) 120 | } 121 | } 122 | } else { 123 | fmt.Print("No connections found.") 124 | } 125 | } 126 | 127 | // [END people_quickstart] 128 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "config:base" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /sheets/quickstart/README.md: -------------------------------------------------------------------------------- 1 | # Google Sheets Go Quickstart 2 | 3 | Complete the steps described in the [Google Sheets Go Quickstart](https://developers.google.com/sheets/api/quickstart/go), and in about five minutes you'll have a simple Go command-line application that makes requests to the Sheets API. 4 | 5 | ## Credentials 6 | 7 | Download the `credentials.json` file to this directory by following the steps in the above link. 8 | 9 | ## Install 10 | 11 | ```bash 12 | go get google.golang.org/api/sheets/v4 13 | go get golang.org/x/oauth2/google 14 | ``` 15 | 16 | ## Run 17 | 18 | `go run quickstart.go` 19 | -------------------------------------------------------------------------------- /sheets/quickstart/quickstart.go: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright Google Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | // [START sheets_quickstart] 18 | package main 19 | 20 | import ( 21 | "context" 22 | "encoding/json" 23 | "fmt" 24 | "log" 25 | "net/http" 26 | "os" 27 | 28 | "golang.org/x/oauth2" 29 | "golang.org/x/oauth2/google" 30 | "google.golang.org/api/option" 31 | "google.golang.org/api/sheets/v4" 32 | ) 33 | 34 | // Retrieve a token, saves the token, then returns the generated client. 35 | func getClient(config *oauth2.Config) *http.Client { 36 | // The file token.json stores the user's access and refresh tokens, and is 37 | // created automatically when the authorization flow completes for the first 38 | // time. 39 | tokFile := "token.json" 40 | tok, err := tokenFromFile(tokFile) 41 | if err != nil { 42 | tok = getTokenFromWeb(config) 43 | saveToken(tokFile, tok) 44 | } 45 | return config.Client(context.Background(), tok) 46 | } 47 | 48 | // Request a token from the web, then returns the retrieved token. 49 | func getTokenFromWeb(config *oauth2.Config) *oauth2.Token { 50 | authURL := config.AuthCodeURL("state-token", oauth2.AccessTypeOffline) 51 | fmt.Printf("Go to the following link in your browser then type the "+ 52 | "authorization code: \n%v\n", authURL) 53 | 54 | var authCode string 55 | if _, err := fmt.Scan(&authCode); err != nil { 56 | log.Fatalf("Unable to read authorization code: %v", err) 57 | } 58 | 59 | tok, err := config.Exchange(context.TODO(), authCode) 60 | if err != nil { 61 | log.Fatalf("Unable to retrieve token from web: %v", err) 62 | } 63 | return tok 64 | } 65 | 66 | // Retrieves a token from a local file. 67 | func tokenFromFile(file string) (*oauth2.Token, error) { 68 | f, err := os.Open(file) 69 | if err != nil { 70 | return nil, err 71 | } 72 | defer f.Close() 73 | tok := &oauth2.Token{} 74 | err = json.NewDecoder(f).Decode(tok) 75 | return tok, err 76 | } 77 | 78 | // Saves a token to a file path. 79 | func saveToken(path string, token *oauth2.Token) { 80 | fmt.Printf("Saving credential file to: %s\n", path) 81 | f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) 82 | if err != nil { 83 | log.Fatalf("Unable to cache oauth token: %v", err) 84 | } 85 | defer f.Close() 86 | json.NewEncoder(f).Encode(token) 87 | } 88 | 89 | func main() { 90 | ctx := context.Background() 91 | b, err := os.ReadFile("credentials.json") 92 | if err != nil { 93 | log.Fatalf("Unable to read client secret file: %v", err) 94 | } 95 | 96 | // If modifying these scopes, delete your previously saved token.json. 97 | config, err := google.ConfigFromJSON(b, "https://www.googleapis.com/auth/spreadsheets.readonly") 98 | if err != nil { 99 | log.Fatalf("Unable to parse client secret file to config: %v", err) 100 | } 101 | client := getClient(config) 102 | 103 | srv, err := sheets.NewService(ctx, option.WithHTTPClient(client)) 104 | if err != nil { 105 | log.Fatalf("Unable to retrieve Sheets client: %v", err) 106 | } 107 | 108 | // Prints the names and majors of students in a sample spreadsheet: 109 | // https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit 110 | spreadsheetId := "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms" 111 | readRange := "Class Data!A2:E" 112 | resp, err := srv.Spreadsheets.Values.Get(spreadsheetId, readRange).Do() 113 | if err != nil { 114 | log.Fatalf("Unable to retrieve data from sheet: %v", err) 115 | } 116 | 117 | if len(resp.Values) == 0 { 118 | fmt.Println("No data found.") 119 | } else { 120 | fmt.Println("Name, Major:") 121 | for _, row := range resp.Values { 122 | // Print columns A and E, which correspond to indices 0 and 4. 123 | fmt.Printf("%s, %s\n", row[0], row[4]) 124 | } 125 | } 126 | } 127 | 128 | // [END sheets_quickstart] 129 | -------------------------------------------------------------------------------- /slides/quickstart/README.md: -------------------------------------------------------------------------------- 1 | # Google Slides Go Quickstart 2 | 3 | Complete the steps described in the [Google Slides Go Quickstart](https://developers.google.com/slides/quickstart/go), and in about five minutes you'll have a simple Go command-line application that makes requests to the Slides API. 4 | 5 | ## Credentials 6 | 7 | Download the `credentials.json` file to this directory by following the steps in the above link. 8 | 9 | ## Install 10 | 11 | ```bash 12 | go get google.golang.org/api/slides/v1 13 | go get golang.org/x/oauth2/google 14 | ``` 15 | 16 | ## Run 17 | 18 | `go run quickstart.go` 19 | -------------------------------------------------------------------------------- /slides/quickstart/quickstart.go: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright Google Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | // [START slides_quickstart] 18 | package main 19 | 20 | import ( 21 | "context" 22 | "encoding/json" 23 | "fmt" 24 | "log" 25 | "net/http" 26 | "os" 27 | 28 | "golang.org/x/oauth2" 29 | "golang.org/x/oauth2/google" 30 | "google.golang.org/api/option" 31 | "google.golang.org/api/slides/v1" 32 | ) 33 | 34 | // Retrieve a token, saves the token, then returns the generated client. 35 | func getClient(config *oauth2.Config) *http.Client { 36 | // The file token.json stores the user's access and refresh tokens, and is 37 | // created automatically when the authorization flow completes for the first 38 | // time. 39 | tokFile := "token.json" 40 | tok, err := tokenFromFile(tokFile) 41 | if err != nil { 42 | tok = getTokenFromWeb(config) 43 | saveToken(tokFile, tok) 44 | } 45 | return config.Client(context.Background(), tok) 46 | } 47 | 48 | // Request a token from the web, then returns the retrieved token. 49 | func getTokenFromWeb(config *oauth2.Config) *oauth2.Token { 50 | authURL := config.AuthCodeURL("state-token", oauth2.AccessTypeOffline) 51 | fmt.Printf("Go to the following link in your browser then type the "+ 52 | "authorization code: \n%v\n", authURL) 53 | 54 | var authCode string 55 | if _, err := fmt.Scan(&authCode); err != nil { 56 | log.Fatalf("Unable to read authorization code: %v", err) 57 | } 58 | 59 | tok, err := config.Exchange(context.TODO(), authCode) 60 | if err != nil { 61 | log.Fatalf("Unable to retrieve token from web: %v", err) 62 | } 63 | return tok 64 | } 65 | 66 | // Retrieves a token from a local file. 67 | func tokenFromFile(file string) (*oauth2.Token, error) { 68 | f, err := os.Open(file) 69 | if err != nil { 70 | return nil, err 71 | } 72 | defer f.Close() 73 | tok := &oauth2.Token{} 74 | err = json.NewDecoder(f).Decode(tok) 75 | return tok, err 76 | } 77 | 78 | // Saves a token to a file path. 79 | func saveToken(path string, token *oauth2.Token) { 80 | fmt.Printf("Saving credential file to: %s\n", path) 81 | f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) 82 | if err != nil { 83 | log.Fatalf("Unable to cache oauth token: %v", err) 84 | } 85 | defer f.Close() 86 | json.NewEncoder(f).Encode(token) 87 | } 88 | 89 | func main() { 90 | ctx := context.Background() 91 | b, err := os.ReadFile("credentials.json") 92 | if err != nil { 93 | log.Fatalf("Unable to read client secret file: %v", err) 94 | } 95 | 96 | // If modifying these scopes, delete your previously saved token.json. 97 | config, err := google.ConfigFromJSON(b, "https://www.googleapis.com/auth/presentations.readonly") 98 | if err != nil { 99 | log.Fatalf("Unable to parse client secret file to config: %v", err) 100 | } 101 | client := getClient(config) 102 | 103 | srv, err := slides.NewService(ctx, option.WithHTTPClient(client)) 104 | if err != nil { 105 | log.Fatalf("Unable to retrieve Slides client: %v", err) 106 | } 107 | 108 | // Prints the number of slides and elements in a sample presentation: 109 | // https://docs.google.com/presentation/d/1EAYk18WDjIG-zp_0vLm3CsfQh_i8eXc67Jo2O9C6Vuc/edit 110 | presentationId := "1EAYk18WDjIG-zp_0vLm3CsfQh_i8eXc67Jo2O9C6Vuc" 111 | presentation, err := srv.Presentations.Get(presentationId).Do() 112 | if err != nil { 113 | log.Fatalf("Unable to retrieve data from presentation: %v", err) 114 | } 115 | 116 | fmt.Printf("The presentation contains %d slides:\n", len(presentation.Slides)) 117 | for i, slide := range presentation.Slides { 118 | fmt.Printf("- Slide #%d contains %d elements.\n", (i + 1), 119 | len(slide.PageElements)) 120 | } 121 | } 122 | 123 | // [END slides_quickstart] 124 | -------------------------------------------------------------------------------- /slides/snippets/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | export GOPATH="$PWD" 4 | go get -v ... 5 | -------------------------------------------------------------------------------- /slides/snippets/oauth.go: -------------------------------------------------------------------------------- 1 | package snippets 2 | 3 | import ( 4 | "context" 5 | "log" 6 | 7 | "golang.org/x/oauth2/google" 8 | "google.golang.org/api/drive/v2" 9 | "google.golang.org/api/option" 10 | "google.golang.org/api/sheets/v4" 11 | "google.golang.org/api/slides/v1" 12 | ) 13 | 14 | // A group of Google services. 15 | type Services struct { 16 | Drive *drive.Service 17 | Slides *slides.Service 18 | Sheets *sheets.Service 19 | } 20 | 21 | // Gets Google services authenticated with Drive, Slides, and Sheets. 22 | func getServices() *Services { 23 | ctx := context.Background() 24 | // Uses env GOOGLE_APPLICATION_CREDENTIALS 25 | client, err := google.DefaultClient(ctx, 26 | drive.DriveScope, 27 | slides.PresentationsScope, 28 | sheets.SpreadsheetsScope) 29 | if err != nil { 30 | log.Fatalf("Error creating Google client: %v", err) 31 | } 32 | driveService, err := drive.NewService(ctx, option.WithHTTPClient(client)) 33 | if err != nil { 34 | log.Fatalf("Error creating Drive client: %v", err) 35 | } 36 | slidesService, err := slides.NewService(ctx, option.WithHTTPClient(client)) 37 | if err != nil { 38 | log.Fatalf("Error creating Slides client: %v", err) 39 | } 40 | sheetsService, err := sheets.NewService(ctx, option.WithHTTPClient(client)) 41 | if err != nil { 42 | log.Fatalf("Error creating Sheets client: %v", err) 43 | } 44 | return &Services{ 45 | Drive: driveService, 46 | Slides: slidesService, 47 | Sheets: sheetsService, 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /slides/snippets/presentations.go: -------------------------------------------------------------------------------- 1 | package snippets 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | 7 | "google.golang.org/api/drive/v2" 8 | "google.golang.org/api/slides/v1" 9 | ) 10 | 11 | func createPresentation() string { 12 | slidesService := getServices().Slides 13 | // [START slides_create_presentation] 14 | // Create a presentation and request a PresentationId. 15 | p := &slides.Presentation{ 16 | Title: "Title", 17 | } 18 | presentation, err := slidesService.Presentations.Create(p).Fields( 19 | "presentationId", 20 | ).Do() 21 | if err != nil { 22 | log.Fatalf("Unable to create presentation. %v", err) 23 | } 24 | fmt.Printf("Created presentation with ID: %s", presentation.PresentationId) 25 | // [END slides_create_presentation] 26 | return presentation.PresentationId 27 | } 28 | 29 | func copyPresentation(id string, title string) string { 30 | driveService := getServices().Drive 31 | // [START slides_copy_presentation] 32 | // Copy a presentation. 33 | file := drive.File{ 34 | Title: title, 35 | } 36 | presentationCopyFile, err := driveService.Files.Copy(id, &file).Do() 37 | if err != nil { 38 | log.Fatalf("Unable to copy presentation. %v", err) 39 | } 40 | presentationCopyId := presentationCopyFile.Id 41 | // [END slides_copy_presentation] 42 | return presentationCopyId 43 | } 44 | 45 | func createSlide(presentationId string) slides.BatchUpdatePresentationResponse { 46 | slidesService := getServices().Slides 47 | // [START slides_create_slide] 48 | // Add a slide at index 1 using the predefined "TITLE_AND_TWO_COLUMNS" layout 49 | // and the ID "MyNewSlide_001". 50 | slideId := "MyNewSlide_001" 51 | requests := []*slides.Request{{ 52 | CreateSlide: &slides.CreateSlideRequest{ 53 | ObjectId: slideId, 54 | InsertionIndex: 1, 55 | SlideLayoutReference: &slides.LayoutReference{ 56 | PredefinedLayout: "TITLE_AND_TWO_COLUMNS", 57 | }, 58 | }, 59 | }} 60 | 61 | // If you wish to populate the slide with elements, add create requests here, 62 | // using the slide ID specified above. 63 | 64 | // Execute the request. 65 | body := &slides.BatchUpdatePresentationRequest{ 66 | Requests: requests, 67 | } 68 | response, err := slidesService.Presentations.BatchUpdate(presentationId, body).Do() 69 | if err != nil { 70 | log.Fatalf("Unable to create slide. %v", err) 71 | } 72 | fmt.Printf("Created slide with ID: %s", response.Replies[0].CreateSlide.ObjectId) 73 | // [END slides_create_slide] 74 | return *response 75 | } 76 | 77 | func createTextBoxWithText(presentationId string, slideId string) slides.BatchUpdatePresentationResponse { 78 | slidesService := getServices().Slides 79 | // [START slides_create_textbox_with_text] 80 | // Create a new square text box, using a supplied object ID. 81 | textBoxId := "MyTextBox_01" 82 | pt350 := slides.Dimension{ 83 | Magnitude: 350, 84 | Unit: "PT", 85 | } 86 | requests := []*slides.Request{{ 87 | // Create a new square text box, using a supplied object ID. 88 | CreateShape: &slides.CreateShapeRequest{ 89 | ObjectId: textBoxId, 90 | ShapeType: "TEXT_BOX", 91 | ElementProperties: &slides.PageElementProperties{ 92 | PageObjectId: slideId, 93 | Size: &slides.Size{ 94 | Height: &pt350, 95 | Width: &pt350, 96 | }, 97 | Transform: &slides.AffineTransform{ 98 | ScaleX: 1.0, 99 | ScaleY: 1.0, 100 | TranslateX: 350.0, 101 | TranslateY: 100.0, 102 | Unit: "PT", 103 | }, 104 | }, 105 | }, 106 | }, { 107 | // Insert text into the box, using the object ID given to it. 108 | InsertText: &slides.InsertTextRequest{ 109 | ObjectId: textBoxId, 110 | InsertionIndex: 0, 111 | Text: "New Box Text Inserted", 112 | }, 113 | }} 114 | 115 | // Execute the requests. 116 | body := &slides.BatchUpdatePresentationRequest{ 117 | Requests: requests, 118 | } 119 | response, err := slidesService.Presentations.BatchUpdate(presentationId, body).Do() 120 | if err != nil { 121 | log.Printf("Unable to create text box. %v", err) 122 | } 123 | fmt.Printf("Created text box with ID: %s", response.Replies[0].CreateShape.ObjectId) 124 | // [END slides_create_textbox_with_text] 125 | return *response 126 | } 127 | 128 | func createImage(presentationId string, slideId string) slides.BatchUpdatePresentationResponse { 129 | slidesService := getServices().Slides 130 | imageURL := "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" 131 | // [START slides_create_image] 132 | // Create a new image, using the supplied object ID, with content downloaded from imageURL. 133 | imageId := "MyImageId_01" 134 | emu4M := slides.Dimension{Magnitude: 4000000, Unit: "EMU"} 135 | requests := []*slides.Request{{ 136 | CreateImage: &slides.CreateImageRequest{ 137 | ObjectId: imageId, 138 | Url: imageURL, 139 | ElementProperties: &slides.PageElementProperties{ 140 | PageObjectId: slideId, 141 | Size: &slides.Size{ 142 | Height: &emu4M, 143 | Width: &emu4M, 144 | }, 145 | Transform: &slides.AffineTransform{ 146 | ScaleX: 1.0, 147 | ScaleY: 1.0, 148 | TranslateX: 100000.0, 149 | TranslateY: 100000.0, 150 | Unit: "EMU", 151 | }, 152 | }, 153 | }, 154 | }} 155 | 156 | // Execute the request. 157 | body := &slides.BatchUpdatePresentationRequest{ 158 | Requests: requests, 159 | } 160 | response, err := slidesService.Presentations.BatchUpdate(presentationId, body).Do() 161 | if err != nil { 162 | log.Fatalf("Unable to create image. %v", err) 163 | } else { 164 | fmt.Printf("Created image with ID: %s", response.Replies[0].CreateImage.ObjectId) 165 | } 166 | // [END slides_create_image] 167 | return *response 168 | } 169 | 170 | func textMerging(templatePresentationId string, dataSpreadsheetId string) []slides.BatchUpdatePresentationResponse { 171 | slidesService := getServices().Slides 172 | driveService := getServices().Drive 173 | sheetsService := getServices().Sheets 174 | responses := make([]slides.BatchUpdatePresentationResponse, 0) 175 | 176 | // [START slides_text_merging] 177 | // Use the Sheets API to load data, one record per row. 178 | dataRangeNotation := "Customers!A2:M6" 179 | sheetsResponse, _ := sheetsService.Spreadsheets.Values.Get(dataSpreadsheetId, dataRangeNotation).Do() 180 | values := sheetsResponse.Values 181 | 182 | // For each record, create a new merged presentation. 183 | for _, row := range values { 184 | customerName := row[2].(string) 185 | caseDescription := row[5].(string) 186 | totalPortfolio := row[11].(string) 187 | 188 | // Duplicate the template presentation using the Drive API. 189 | copyTitle := customerName + " presentation" 190 | file := drive.File{ 191 | Title: copyTitle, 192 | } 193 | presentationFile, _ := driveService.Files.Copy(templatePresentationId, &file).Do() 194 | presentationId := presentationFile.Id 195 | 196 | // Create the text merge (replaceAllText) requests for this presentation. 197 | requests := []*slides.Request{{ 198 | ReplaceAllText: &slides.ReplaceAllTextRequest{ 199 | ContainsText: &slides.SubstringMatchCriteria{ 200 | Text: "{{customer-name}}", 201 | MatchCase: true, 202 | }, 203 | ReplaceText: customerName, 204 | }, 205 | }, { 206 | ReplaceAllText: &slides.ReplaceAllTextRequest{ 207 | ContainsText: &slides.SubstringMatchCriteria{ 208 | Text: "{{case-description}}", 209 | MatchCase: true, 210 | }, 211 | ReplaceText: caseDescription, 212 | }, 213 | }, { 214 | ReplaceAllText: &slides.ReplaceAllTextRequest{ 215 | ContainsText: &slides.SubstringMatchCriteria{ 216 | Text: "{{total-portfolio}}", 217 | MatchCase: true, 218 | }, 219 | ReplaceText: totalPortfolio, 220 | }, 221 | }} 222 | 223 | // Execute the requests for this presentation. 224 | body := &slides.BatchUpdatePresentationRequest{ 225 | Requests: requests, 226 | } 227 | response, _ := slidesService.Presentations.BatchUpdate(presentationId, body).Do() 228 | // [START_EXCLUDE silent] 229 | responses = append(responses, *response) 230 | // [END_EXCLUDE silent] 231 | 232 | // Count total number of replacements made. 233 | var numReplacements int64 = 0 234 | for _, resp := range response.Replies { 235 | numReplacements += resp.ReplaceAllText.OccurrencesChanged 236 | } 237 | 238 | fmt.Printf("Created merged presentation for %s with ID %s\n", customerName, presentationId) 239 | fmt.Printf("Replaced %d text instances.\n", numReplacements) 240 | } 241 | // [END slides_text_merging] 242 | return responses 243 | } 244 | 245 | func imageMerging(templatePresentationId string, imageURL string, customerName string) slides.BatchUpdatePresentationResponse { 246 | slidesService := getServices().Slides 247 | driveService := getServices().Drive 248 | logoURL := imageURL 249 | customerGraphicURL := imageURL 250 | 251 | // [START slides_image_merging] 252 | // Duplicate the template presentation using the Drive API. 253 | copyTitle := customerName + " presentation" 254 | file := drive.File{ 255 | Title: copyTitle, 256 | } 257 | presentationFile, _ := driveService.Files.Copy(templatePresentationId, &file).Do() 258 | presentationId := presentationFile.Id 259 | 260 | // Create the image merge (replaceAllShapesWithImage) requests. 261 | requests := []*slides.Request{{ 262 | ReplaceAllShapesWithImage: &slides.ReplaceAllShapesWithImageRequest{ 263 | ImageUrl: logoURL, 264 | ReplaceMethod: "CENTER_INSIDE", 265 | ContainsText: &slides.SubstringMatchCriteria{ 266 | Text: "{{company-logo}}", 267 | MatchCase: true, 268 | }, 269 | }, 270 | }, { 271 | ReplaceAllShapesWithImage: &slides.ReplaceAllShapesWithImageRequest{ 272 | ImageUrl: customerGraphicURL, 273 | ReplaceMethod: "CENTER_INSIDE", 274 | ContainsText: &slides.SubstringMatchCriteria{ 275 | Text: "{{customer-graphic}}", 276 | MatchCase: true, 277 | }, 278 | }, 279 | }} 280 | 281 | // Execute the requests for this presentation. 282 | body := &slides.BatchUpdatePresentationRequest{Requests: requests} 283 | response, _ := slidesService.Presentations.BatchUpdate(presentationId, body).Do() 284 | 285 | // Count total number of replacements made. 286 | var numReplacements int64 = 0 287 | for _, resp := range response.Replies { 288 | numReplacements += resp.ReplaceAllShapesWithImage.OccurrencesChanged 289 | } 290 | fmt.Printf("Created merged presentation with ID %s\n", presentationId) 291 | fmt.Printf("Replaced %d shapes instances with images.\n", numReplacements) 292 | // [END slides_image_merging] 293 | return *response 294 | } 295 | 296 | func simpleTextReplace(presentationId string, shapeId string, replacementText string) slides.BatchUpdatePresentationResponse { 297 | slidesService := getServices().Slides 298 | // [START slides_simple_text_replace] 299 | // Remove existing text in the shape, then insert the new text. 300 | requests := []*slides.Request{{ 301 | DeleteText: &slides.DeleteTextRequest{ 302 | ObjectId: shapeId, 303 | TextRange: &slides.Range{ 304 | Type: "All", 305 | }, 306 | }, 307 | }, { 308 | InsertText: &slides.InsertTextRequest{ 309 | ObjectId: shapeId, 310 | InsertionIndex: 0, 311 | Text: replacementText, 312 | }, 313 | }} 314 | 315 | // Execute the requests. 316 | body := &slides.BatchUpdatePresentationRequest{Requests: requests} 317 | response, _ := slidesService.Presentations.BatchUpdate(presentationId, body).Do() 318 | fmt.Printf("Replaced text in shape with ID: %s", shapeId) 319 | // [END slides_simple_text_replace] 320 | return *response 321 | } 322 | 323 | func textStyleUpdate(presentationId string, shapeId string) slides.BatchUpdatePresentationResponse { 324 | slidesService := getServices().Slides 325 | // [START slides_text_style_update] 326 | // Update the text style so that the first 5 characters are bolded 327 | // and italicized, and the next 5 are displayed in blue 14 pt Times 328 | // New Roman font, and the next five are hyperlinked. 329 | requests := []*slides.Request{{ 330 | UpdateTextStyle: &slides.UpdateTextStyleRequest{ 331 | ObjectId: shapeId, 332 | TextRange: &slides.Range{ 333 | Type: "FIXED_RANGE", 334 | StartIndex: ptrInt64(0), 335 | EndIndex: ptrInt64(5), 336 | ForceSendFields: []string{"StartIndex"}, 337 | }, 338 | Style: &slides.TextStyle{ 339 | Bold: true, 340 | Italic: true, 341 | }, 342 | Fields: "bold,italic", 343 | }, 344 | }, { 345 | UpdateTextStyle: &slides.UpdateTextStyleRequest{ 346 | ObjectId: shapeId, 347 | TextRange: &slides.Range{ 348 | Type: "FIXED_RANGE", 349 | StartIndex: ptrInt64(5), 350 | EndIndex: ptrInt64(10), 351 | }, 352 | Style: &slides.TextStyle{ 353 | FontFamily: "Times New Roman", 354 | FontSize: &slides.Dimension{ 355 | Magnitude: 14.0, 356 | Unit: "PT", 357 | }, 358 | ForegroundColor: &slides.OptionalColor{ 359 | OpaqueColor: &slides.OpaqueColor{ 360 | RgbColor: &slides.RgbColor{ 361 | Blue: 1.0, 362 | Green: 0.0, 363 | Red: 0.0, 364 | }, 365 | }, 366 | }, 367 | }, 368 | Fields: "foregroundColor,fontFamily,fontSize", 369 | }, 370 | }, { 371 | UpdateTextStyle: &slides.UpdateTextStyleRequest{ 372 | ObjectId: shapeId, 373 | TextRange: &slides.Range{ 374 | Type: "FIXED_RANGE", 375 | StartIndex: ptrInt64(10), 376 | EndIndex: ptrInt64(15), 377 | }, 378 | Style: &slides.TextStyle{ 379 | Link: &slides.Link{ 380 | Url: "www.example.com", 381 | }, 382 | }, 383 | Fields: "link", 384 | }, 385 | }} 386 | 387 | // Execute the requests. 388 | body := &slides.BatchUpdatePresentationRequest{Requests: requests} 389 | response, _ := slidesService.Presentations.BatchUpdate(presentationId, body).Do() 390 | fmt.Printf("Updated text style for shape with ID: %s", shapeId) 391 | // [END slides_text_style_update] 392 | return *response 393 | } 394 | 395 | func ptrInt64(i int64) *int64 { 396 | return &i 397 | } 398 | 399 | func createBulletedText(presentationId string, shapeId string) slides.BatchUpdatePresentationResponse { 400 | slidesService := getServices().Slides 401 | // [START slides_create_bulleted_text] 402 | // Add arrow-diamond-disc bullets to all text in the shape. 403 | requests := []*slides.Request{{ 404 | CreateParagraphBullets: &slides.CreateParagraphBulletsRequest{ 405 | ObjectId: shapeId, 406 | TextRange: &slides.Range{ 407 | Type: "ALL", 408 | }, 409 | BulletPreset: "BULLET_ARROW_DIAMOND_DISC", 410 | }, 411 | }} 412 | 413 | // Execute the requests. 414 | body := &slides.BatchUpdatePresentationRequest{Requests: requests} 415 | response, _ := slidesService.Presentations.BatchUpdate(presentationId, body).Do() 416 | fmt.Printf("Added a linked Sheets chart with ID %s", shapeId) 417 | // [END slides_create_bulleted_text] 418 | return *response 419 | } 420 | 421 | func createSheetsChart(presentationId string, pageId string, spreadsheetId string, sheetChartId int64) slides.BatchUpdatePresentationResponse { 422 | slidesService := getServices().Slides 423 | // [START slides_create_sheets_chart] 424 | // Embed a Sheets chart (indicated by the spreadsheetId and sheetChartId) onto 425 | // a page in the presentation. Setting the linking mode as "LINKED" allows the 426 | // chart to be refreshed if the Sheets version is updated. 427 | emu4M := slides.Dimension{Magnitude: 4000000, Unit: "EMU"} 428 | presentationChartId := "MyEmbeddedChart" 429 | requests := []*slides.Request{{ 430 | CreateSheetsChart: &slides.CreateSheetsChartRequest{ 431 | ObjectId: presentationChartId, 432 | SpreadsheetId: spreadsheetId, 433 | ChartId: sheetChartId, 434 | LinkingMode: "LINKED", 435 | ElementProperties: &slides.PageElementProperties{ 436 | PageObjectId: pageId, 437 | Size: &slides.Size{ 438 | Height: &emu4M, 439 | Width: &emu4M, 440 | }, 441 | Transform: &slides.AffineTransform{ 442 | ScaleX: 1.0, 443 | ScaleY: 1.0, 444 | TranslateX: 100000.0, 445 | TranslateY: 100000.0, 446 | Unit: "EMU", 447 | }, 448 | }, 449 | }, 450 | }} 451 | 452 | // Execute the requests. 453 | body := &slides.BatchUpdatePresentationRequest{Requests: requests} 454 | response, _ := slidesService.Presentations.BatchUpdate(presentationId, body).Do() 455 | fmt.Printf("Added a linked Sheets chart with ID %s", presentationChartId) 456 | // [END slides_create_sheets_chart] 457 | return *response 458 | } 459 | 460 | func createRefreshSheetsChart(presentationId string, presentationChartId string) slides.BatchUpdatePresentationResponse { 461 | slidesService := getServices().Slides 462 | // [START slides_refresh_sheets_chart] 463 | requests := []*slides.Request{{ 464 | RefreshSheetsChart: &slides.RefreshSheetsChartRequest{ 465 | ObjectId: presentationChartId, 466 | }, 467 | }} 468 | 469 | // Execute the requests. 470 | body := &slides.BatchUpdatePresentationRequest{Requests: requests} 471 | response, _ := slidesService.Presentations.BatchUpdate(presentationId, body).Do() 472 | fmt.Printf("Refreshed a linked Sheets chart with ID %s", presentationChartId) 473 | // [END slides_refresh_sheets_chart] 474 | return *response 475 | } 476 | -------------------------------------------------------------------------------- /slides/snippets/presentations_test.go: -------------------------------------------------------------------------------- 1 | package snippets 2 | 3 | import ( 4 | "github.com/stretchr/testify/assert" 5 | "testing" 6 | ) 7 | 8 | const IMAGE_URL = "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" 9 | const TEMPLATE_PRESENTATION_ID = "1wJUN1B5CQ2wQOBzmz2apky48QNK1OsE2oNKHPMLpKDc" 10 | const DATA_SPREADSHEET_ID = "14KaZMq2aCAGt5acV77zaA_Ps8aDt04G7T0ei4KiXLX8" 11 | const CHART_ID = 1107320627 12 | const CUSTOMER_NAME = "Fake Customer" 13 | 14 | func TestCreatePresentation(t *testing.T) { 15 | presentationId := createPresentation() 16 | assert.NotNil(t, presentationId) 17 | deleteFileOnCleanup(presentationId) 18 | } 19 | 20 | func TestCopyPresentation(t *testing.T) { 21 | presentationId := createPresentation() 22 | copyId := copyPresentation(presentationId, "My Duplicate Presentation") 23 | assert.NotNil(t, copyId) 24 | deleteFileOnCleanup(presentationId) 25 | deleteFileOnCleanup(copyId) 26 | } 27 | 28 | func TestCreateSlide(t *testing.T) { 29 | presentationId := createPresentation() 30 | response := createSlide(presentationId) 31 | assert.NotNil(t, response) 32 | assert.Equal(t, 1, len(response.Replies)) 33 | assert.NotNil(t, response.Replies[0].CreateSlide.ObjectId) 34 | } 35 | 36 | func TestCreateTextBox(t *testing.T) { 37 | presentationId := createTestPresentation() 38 | pageId := createTestSlide(presentationId) 39 | assert.NotNil(t, pageId) 40 | response := createTextBoxWithText(presentationId, pageId) 41 | assert.Equal(t, 2, len(response.Replies)) 42 | boxId := response.Replies[0].CreateShape.ObjectId 43 | assert.NotNil(t, boxId) 44 | } 45 | 46 | func TestCreateImage(t *testing.T) { 47 | presentationId := createTestPresentation() 48 | pageId := createTestSlide(presentationId) 49 | response := createImage(presentationId, pageId) 50 | assert.Equal(t, 1, len(response.Replies)) 51 | imageId := response.Replies[0].CreateImage.ObjectId 52 | assert.NotNil(t, imageId) 53 | } 54 | 55 | func TestTextMerge(t *testing.T) { 56 | responses := textMerging(TEMPLATE_PRESENTATION_ID, DATA_SPREADSHEET_ID) 57 | for _, response := range responses { 58 | assert.NotNil(t, response.PresentationId) 59 | assert.Equal(t, int64(3), int64(len(response.Replies))) 60 | var numReplacements int64 = 0 61 | for _, reply := range response.Replies { 62 | numReplacements += reply.ReplaceAllText.OccurrencesChanged 63 | } 64 | assert.Equal(t, int64(4), int64(numReplacements)) 65 | deleteFileOnCleanup(response.PresentationId) 66 | } 67 | } 68 | 69 | func TestImageMerge(t *testing.T) { 70 | response := imageMerging(TEMPLATE_PRESENTATION_ID, IMAGE_URL, CUSTOMER_NAME) 71 | presentationId := response.PresentationId 72 | assert.NotNil(t, presentationId) 73 | assert.Equal(t, 2, len(response.Replies)) 74 | var numReplacements int64 = 0 75 | for _, reply := range response.Replies { 76 | numReplacements += reply.ReplaceAllShapesWithImage.OccurrencesChanged 77 | } 78 | assert.Equal(t, int64(2), numReplacements) 79 | deleteFileOnCleanup(response.PresentationId) 80 | } 81 | 82 | func TestSimpleTextReplace(t *testing.T) { 83 | presentationId := createTestPresentation() 84 | pageId := createTestSlide(presentationId) 85 | boxId := createTestTextbox(presentationId, pageId) 86 | response := simpleTextReplace(presentationId, boxId, "MY NEW TEXT") 87 | assert.Equal(t, 2, len(response.Replies)) 88 | } 89 | 90 | func TestTextStyleUpdate(t *testing.T) { 91 | presentationId := createTestPresentation() 92 | pageId := createTestSlide(presentationId) 93 | boxId := createTestTextbox(presentationId, pageId) 94 | response := textStyleUpdate(presentationId, boxId) 95 | assert.Equal(t, 3, len(response.Replies)) 96 | } 97 | 98 | func TestCreateBulletText(t *testing.T) { 99 | presentationId := createTestPresentation() 100 | pageId := createTestSlide(presentationId) 101 | boxId := createTestTextbox(presentationId, pageId) 102 | response := createBulletedText(presentationId, boxId) 103 | assert.Equal(t, 1, len(response.Replies)) 104 | } 105 | 106 | func TestCreateSheetsChart(t *testing.T) { 107 | presentationId := createTestPresentation() 108 | pageId := createTestSlide(presentationId) 109 | response := createSheetsChart(presentationId, pageId, DATA_SPREADSHEET_ID, CHART_ID) 110 | assert.Equal(t, 1, len(response.Replies)) 111 | assert.NotNil(t, response.Replies[0].CreateSheetsChart.ObjectId) 112 | } 113 | 114 | func TestRefreshSheetsChart(t *testing.T) { 115 | presentationId := createTestPresentation() 116 | pageId := createTestSlide(presentationId) 117 | chartId := createTestSheetsChart(presentationId, pageId, DATA_SPREADSHEET_ID, CHART_ID) 118 | response := createRefreshSheetsChart(presentationId, chartId) 119 | assert.Equal(t, 1, len(response.Replies)) 120 | } 121 | -------------------------------------------------------------------------------- /slides/snippets/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | export GOOGLE_APPLICATION_CREDENTIALS="$PWD/../application_credentials.json"; 4 | export GOPATH="$PWD" 5 | go test -v ./... 6 | -------------------------------------------------------------------------------- /slides/snippets/test_utils.go: -------------------------------------------------------------------------------- 1 | package snippets 2 | 3 | import ( 4 | "google.golang.org/api/slides/v1" 5 | "log" 6 | ) 7 | 8 | func deleteFileOnCleanup(id string) { 9 | getServices().Drive.Files.Delete(id) 10 | } 11 | 12 | func createTestPresentation() string { 13 | slidesService := getServices().Slides 14 | presentation := &slides.Presentation{ 15 | Title: "Test Presentation", 16 | } 17 | presentationCreateCall, _ := slidesService.Presentations.Create(presentation).Fields( 18 | "presentationId", 19 | ).Do() 20 | return presentationCreateCall.PresentationId 21 | } 22 | 23 | func createTestSlide(presentationId string) string { 24 | requests := []*slides.Request{{ 25 | CreateSlide: &slides.CreateSlideRequest{ 26 | ObjectId: "TestSlide", 27 | InsertionIndex: 0, 28 | SlideLayoutReference: &slides.LayoutReference{ 29 | PredefinedLayout: "BLANK", 30 | }, 31 | }, 32 | }} 33 | 34 | body := &slides.BatchUpdatePresentationRequest{ 35 | Requests: requests, 36 | } 37 | response, err := getServices().Slides.Presentations.BatchUpdate(presentationId, body).Do() 38 | if err != nil { 39 | log.Fatalf("Unable to create test slide. %v", err) 40 | } 41 | return response.Replies[0].CreateSlide.ObjectId 42 | } 43 | 44 | func createTestTextbox(presentationId string, pageId string) string { 45 | slidesService := getServices().Slides 46 | boxId := "MyTextBox_01" 47 | pt350 := slides.Dimension{ 48 | Magnitude: 350, 49 | Unit: "PT", 50 | } 51 | requests := []*slides.Request{{ 52 | CreateShape: &slides.CreateShapeRequest{ 53 | ObjectId: boxId, 54 | ShapeType: "TEXT_BOX", 55 | ElementProperties: &slides.PageElementProperties{ 56 | PageObjectId: pageId, 57 | Size: &slides.Size{ 58 | Height: &pt350, 59 | Width: &pt350, 60 | }, 61 | Transform: &slides.AffineTransform{ 62 | ScaleX: 1, 63 | ScaleY: 1, 64 | TranslateX: 350, 65 | TranslateY: 350, 66 | Unit: "PT", 67 | }, 68 | }, 69 | }, 70 | }, { 71 | InsertText: &slides.InsertTextRequest{ 72 | ObjectId: boxId, 73 | InsertionIndex: 0, 74 | Text: "New Box Text Inserted", 75 | }, 76 | }} 77 | 78 | // Execute the requests. 79 | body := &slides.BatchUpdatePresentationRequest{Requests: requests} 80 | response, _ := slidesService.Presentations.BatchUpdate(presentationId, body).Do() 81 | return response.Replies[0].CreateShape.ObjectId 82 | } 83 | 84 | func createTestSheetsChart(presentationId string, pageId string, spreadsheetId string, sheetChartId int64) string { 85 | slidesService := getServices().Slides 86 | chartId := "MyChart_01" 87 | emu4M := slides.Dimension{Magnitude: 4000000, Unit: "EMU"} 88 | requests := []*slides.Request{{ 89 | CreateSheetsChart: &slides.CreateSheetsChartRequest{ 90 | ObjectId: chartId, 91 | SpreadsheetId: spreadsheetId, 92 | ChartId: sheetChartId, 93 | LinkingMode: "LINKED", 94 | ElementProperties: &slides.PageElementProperties{ 95 | PageObjectId: pageId, 96 | Size: &slides.Size{ 97 | Height: &emu4M, 98 | Width: &emu4M, 99 | }, 100 | Transform: &slides.AffineTransform{ 101 | ScaleX: 1, 102 | ScaleY: 1, 103 | TranslateX: 100000, 104 | TranslateY: 100000, 105 | Unit: "EMU", 106 | }, 107 | }, 108 | }, 109 | }} 110 | 111 | // Execute the requests. 112 | body := &slides.BatchUpdatePresentationRequest{Requests: requests} 113 | response, _ := slidesService.Presentations.BatchUpdate(presentationId, body).Do() 114 | return response.Replies[0].CreateSheetsChart.ObjectId 115 | } 116 | -------------------------------------------------------------------------------- /tasks/quickstart/README.md: -------------------------------------------------------------------------------- 1 | # Tasks Go Quickstart 2 | 3 | Complete the steps described in the [Tasks Go Quickstart](https://developers.google.com/google-apps/tasks/quickstart/go), and in about five minutes you'll have a simple Go command-line application that makes requests to the Tasks API. 4 | 5 | ## Credentials 6 | 7 | Download the `credentials.json` file to this directory by following the steps in the above link. 8 | 9 | ## Install 10 | 11 | ```bash 12 | go get google.golang.org/api/tasks/v1 13 | go get golang.org/x/oauth2/google 14 | ``` 15 | 16 | ## Run 17 | 18 | `go run quickstart.go` 19 | -------------------------------------------------------------------------------- /tasks/quickstart/quickstart.go: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright Google Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | // [START tasks_quickstart] 18 | package main 19 | 20 | import ( 21 | "context" 22 | "encoding/json" 23 | "fmt" 24 | "log" 25 | "net/http" 26 | "os" 27 | 28 | "golang.org/x/oauth2" 29 | "golang.org/x/oauth2/google" 30 | "google.golang.org/api/option" 31 | "google.golang.org/api/tasks/v1" 32 | ) 33 | 34 | // Retrieve a token, saves the token, then returns the generated client. 35 | func getClient(config *oauth2.Config) *http.Client { 36 | // The file token.json stores the user's access and refresh tokens, and is 37 | // created automatically when the authorization flow completes for the first 38 | // time. 39 | tokFile := "token.json" 40 | tok, err := tokenFromFile(tokFile) 41 | if err != nil { 42 | tok = getTokenFromWeb(config) 43 | saveToken(tokFile, tok) 44 | } 45 | return config.Client(context.Background(), tok) 46 | } 47 | 48 | // Request a token from the web, then returns the retrieved token. 49 | func getTokenFromWeb(config *oauth2.Config) *oauth2.Token { 50 | authURL := config.AuthCodeURL("state-token", oauth2.AccessTypeOffline) 51 | fmt.Printf("Go to the following link in your browser then type the "+ 52 | "authorization code: \n%v\n", authURL) 53 | 54 | var authCode string 55 | if _, err := fmt.Scan(&authCode); err != nil { 56 | log.Fatalf("Unable to read authorization code: %v", err) 57 | } 58 | 59 | tok, err := config.Exchange(context.TODO(), authCode) 60 | if err != nil { 61 | log.Fatalf("Unable to retrieve token from web: %v", err) 62 | } 63 | return tok 64 | } 65 | 66 | // Retrieves a token from a local file. 67 | func tokenFromFile(file string) (*oauth2.Token, error) { 68 | f, err := os.Open(file) 69 | if err != nil { 70 | return nil, err 71 | } 72 | defer f.Close() 73 | tok := &oauth2.Token{} 74 | err = json.NewDecoder(f).Decode(tok) 75 | return tok, err 76 | } 77 | 78 | // Saves a token to a file path. 79 | func saveToken(path string, token *oauth2.Token) { 80 | fmt.Printf("Saving credential file to: %s\n", path) 81 | f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) 82 | if err != nil { 83 | log.Fatalf("Unable to cache oauth token: %v", err) 84 | } 85 | defer f.Close() 86 | json.NewEncoder(f).Encode(token) 87 | } 88 | 89 | func main() { 90 | ctx := context.Background() 91 | b, err := os.ReadFile("credentials.json") 92 | if err != nil { 93 | log.Fatalf("Unable to read client secret file: %v", err) 94 | } 95 | 96 | // If modifying these scopes, delete your previously saved token.json. 97 | config, err := google.ConfigFromJSON(b, tasks.TasksReadonlyScope) 98 | if err != nil { 99 | log.Fatalf("Unable to parse client secret file to config: %v", err) 100 | } 101 | client := getClient(config) 102 | 103 | srv, err := tasks.NewService(ctx, option.WithHTTPClient(client)) 104 | if err != nil { 105 | log.Fatalf("Unable to retrieve tasks Client %v", err) 106 | } 107 | 108 | r, err := srv.Tasklists.List().MaxResults(10).Do() 109 | if err != nil { 110 | log.Fatalf("Unable to retrieve task lists. %v", err) 111 | } 112 | 113 | fmt.Println("Task Lists:") 114 | if len(r.Items) > 0 { 115 | for _, i := range r.Items { 116 | fmt.Printf("%s (%s)\n", i.Title, i.Id) 117 | } 118 | } else { 119 | fmt.Print("No task lists found.") 120 | } 121 | } 122 | 123 | // [END tasks_quickstart] 124 | --------------------------------------------------------------------------------