1、左侧为一个主题素材的列表,用户每点击一个素材,其操作按钮:删除文件、重命名、保存,会随着素材的变化而变化。如图1
2、举例如下:ajax-loader.gif,其仅允许操作:删除文件、重命名,不允许操作:保存。如图2
3、举例如下:settings_data.json,其仅允许操作:保存,不允许操作:删除文件、重命名。如图3
4、查看 GitHub 上的获取文件的 页面的网络请求 ,查看 README.md,请求网址: https://github.com/shuijingwan/larabbs/blob/main/README.md ,其响应为 HTML 结构,但是其允许操作:编辑文件、删除文件。如图4
5、查看 GitHub 上的获取文件的 REST API,查看 README.md,请求网址: /repos/{owner}/{repo}/readme ,其响应为 JSON 结构,但是其无是否允许操作的字段。如图5
6、查看 GitHub 应用程序权限,搜索:/repos/:owner/:repo/readme,其仅标注此接口是一个读取类型。并未针对基于具体的当前用户与具体的文件,而设置一些更为具体的操作权限。此属于接口内部的细分权限。如图6
7、查看 GitHub 上的获取文件的 GraphQL API,请求:resource ,其响应为类型: UniformResourceLocatable。如图7
8、查看类型: UniformResourceLocatable,其本质上为一个接口类型。查看另一个接口类型:Updatable,针对主题素材的是否允许操作,应该参考 Updatable 实现。检查当前用户是否可以更新此对象。如图8
9、参考使用 Explorer,我计划在 Altair 中请求。新建窗口:https://api.github.com/graphql ,点击左上角的 设置Headers。如图9
10、在 Key(密钥)字段中,输入 Authorization。 在 Value(值)字段中,输入 Bearer <token>,其中 <token> 是您生成的 OAuth 令牌。如图10
11、通过自我查询来测试您的访问,测试通过。如图11
请求
query { viewer { login } }
响应
{ "data": { "viewer": { "login": "shuijingwan" } } }
12、查询资源:https://github.com/shuijingwan/larabbs/blob/main/README.md ,响应 null,无是否允许更新操作的响应字段。如图12
13、查询用户下的项目编号为 1 ,分别获取单个项目与项目列表,viewerCanUpdate 。如图13
请求
query{ user(login: "shuijingwan"){ project(number: 1){ viewerCanUpdate } ...projects } } fragment projects on User{ projects(first:1){ edges{ cursor node{ viewerCanUpdate } } totalCount } }
响应
{ "data": { "user": { "project": { "viewerCanUpdate": true }, "projects": { "edges": [ { "cursor": "Y3Vyc29yOnYyOpHOANZ4WQ==", "node": { "viewerCanUpdate": true } } ], "totalCount": 1 } } } }
14、最终决定实现 类型 themeAsset(key:String!),在响应字段中添加:deletable、renameable、updatable。如图14
请求
query{ onlineStoreTheme(themeId: "vogue"){ ...themeAsset } } fragment themeAsset on OnlineStoreTheme { themeAsset(key: "assets/iconfont/iconfont.css") { id themeId version content key mimeType category schema createdAt updatedAt deletable renameable updatable } }
响应
{ "data": { "onlineStoreTheme": { "themeAsset": { "id": "1", "themeId": "vogue", "version": "", "content": "@font-face {/n font-family: /"iconfont/"; /* Project id 2455235 *//n src: /n url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAABYEAAsAAAAAKLQAABWzAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGYACJKAq4OK4wATYCJAOBOAteAAQgBYRnB4RmG4oiVUaFjQMgJtY9yf7/ltwYMLADtO5ZMuKULZpDHcrFl0IDW6IxHg4JbghPcEf2kD51nuu0V7UaaKOf2HZxoYusNuLC9nYp/zveKgujqbTNUEqI+rXPfrD7iUDdXYB9FKCMAmIVo1DIyCgsDyQnpE5FpXZ4fpu9T6QgaZAfBAkLQRv0awMGiB8r5mGtjVpgLIxFwyJCd+mCRbOr1rW70l01UzlTbcLS4UQQX4B9IQKtdASGIuuz2/52WxaYQwZZbpO0PQgQCAr4+PXxawA0QACBeRAYXruE0vwcPc2x0wkZG42diCIofPrU2nJg+nybrdSq73lpT8tvtdeWCWyArCR7EM4i4Pq5XpsUiD/wloUhV1Un9yWFvCQHKeffFfKLKb8issNc8VLMFYBcHYLwSLrjK3WNrXC6qlMk8dmj2AGrRekx7VjOuomsKKkYMaATI1NCRF+3PRMUEGRuM70zO68Y0I/VtS8EPBY2tQLeqTrW3FgHSK/VsYqsCr/bxe7T+kEb44B+XG8Ynpyfv/qbxZEAGscAdlS7j2Y1AM+M+inOoWC+BZfXB+xYAw5ggDGxGvqauqG6ALBXOj4rQdHthFMmAFhRZ8m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iEmBf5bShFdXzJNUSTuqSuCjEDMNlj0EhZ9mcFamlyrXcbAlYc6ahFsJPQRrZ8Gmq4ugUIWs6GZDrQ96b1azZkgzgk+2J0S5JJJ5gU33C44x8X04l2pXqpy2wInpcozmPtwS6tCUlWZlLz6FzbACZ1JPdyDXZxmXbENQXQE5Dv6jn1wlHjHxDjxRGqsGgx8Se6KELnbWOFB299iXogwC9zR3YYz+JnngZdxclvQp0qzxgOwPwWVMtT6/TqjRZQIodiRUzFr3XHOogwgE8OpHuNNaIC6JuSKXMhSOQ1W/S4RIAAAA=') format('woff2');/n}/n/n.iconfont {/n font-family: /"iconfont/" !important;/n font-size: 16px;/n font-style: normal;/n -webkit-font-smoothing: antialiased;/n -moz-osx-font-smoothing: grayscale;/n}/n/n.icon-shouqidefuben:before {/n content: /"//e61f/";/n}/n/n.icon-zhankai:before {/n content: /"//e620/";/n}/n/n.icon-guanbiicon:before {/n content: /"//e605/";/n}/n/n.icon-yigou:before {/n content: /"//e606/";/n}/n/n.icon-bofang:before {/n content: /"//e940/";/n}/n/n.icon-fanyeyou:before {/n content: /"//e61d/";/n}/n/n.icon-you1:before {/n content: /"//e7b9/";/n}/n/n.icon-fanyezuo:before {/n content: /"//e61c/";/n}/n/n.icon-diqiu:before {/n content: /"//e844/";/n}/n/n.icon-youtube:before {/n content: /"//e612/";/n}/n/n.icon-instagram:before {/n content: /"//f1d3/";/n}/n/n.icon-leftarrow:before {/n content: /"//e691/";/n}/n/n.icon-sousuo:before {/n content: /"//e6b9/";/n}/n/n.icon-youjiantou1:before {/n content: /"//e609/";/n}/n/n.icon-sanjiaodown:before {/n content: /"//e6b5/";/n}/n/n.icon-huobi:before {/n content: /"//e608/";/n}/n/n.icon-earth:before {/n content: /"//e9ee/";/n}/n/n.icon-menu:before {/n content: /"//e633/";/n}/n/n.icon-LC_icon_search_line_2:before {/n content: /"//e60e/";/n}/n/n.icon-gouwuche:before {/n content: /"//e61b/";/n}/n/n.icon-ren:before {/n content: /"//e6c5/";/n}/n/n.icon-youjiantoufuben:before {/n content: /"//e64d/";/n}/n/n.icon-bofang1:before {/n content: /"//e6c6/";/n}/n/n.icon-you:before {/n content: /"//e671/";/n}/n/n.icon-zuo:before {/n content: /"//e6f7/";/n}/n/n.icon-xia:before {/n content: /"//e63c/";/n}/n/n.icon-youjiantou2:before {/n content: /"//e602/";/n}/n/n.icon-zuojiantou:before {/n content: /"//e603/";/n}/n/n.icon-jingdiananli_wujiaoxing_shoucanghou:before {/n content: /"//e64a/";/n}/n/n.icon-jingdiananli_kongwujiaoxing_shoucang:before {/n content: /"//e64b/";/n}/n/n.icon-icontouxiang:before {/n content: /"//e678/";/n}/n/n.icon-gou:before {/n content: /"//e63b/";/n}/n/n.icon-web__bitebiyoujiantou:before {/n content: /"//e62f/";/n}/n/n.icon-web__bitebizuojiantou:before {/n content: /"//e630/";/n}/n/n.icon-cancel-1-copy:before {/n content: /"//e61a/";/n}/n/n.icon-shangxia:before {/n content: /"//e60b/";/n}/n/n.icon-gouwucheman:before {/n content: /"//e604/";/n}/n/n.icon-duigou:before {/n content: /"//e60f/";/n}/n/n.icon-xiajiantou1:before {/n content: /"//e62a/";/n}/n/n.icon-_pinterest:before {/n content: /"//e653/";/n}/n/n.icon-icomoonfacebook:before {/n content: /"//e654/";/n}/n/n.icon-guge1:before {/n content: /"//e655/";/n}/n/n.icon-twitter:before {/n content: /"//e656/";/n}/n/n.icon-biaoqian:before {/n content: /"//e718/";/n}/n/n.icon-2:before {/n content: /"//e601/";/n}/n/n", "key": "assets/iconfont/iconfont.css", "mimeType": "text/plain", "category": "unknown", "schema": null, "createdAt": "2022-02-15 09:59:41", "updatedAt": "2022-02-15 09:59:41", "deletable": false, "renameable": false, "updatable": false } } } }
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/250713.html