├── codegen ├── .gitignore ├── run_codegen.sh ├── readme.txt └── codegen.stoneg.py ├── .eslintignore ├── .github ├── ISSUE_TEMPLATE │ ├── config.yml │ ├── question_help.md │ ├── bug_report.md │ └── feature_request.md ├── workflows │ ├── ci.yml │ ├── coverage.yml │ ├── deploy-gh-pages.yml │ └── spec_update.yml ├── pull_request_template.md └── dependabot.yml ├── test ├── .eslintrc.js └── unit │ └── utils.test.ts ├── .gitignore ├── .nycrc.json ├── .gitmodules ├── tsconfig.json ├── CODE_OF_CONDUCT.md ├── src ├── cookie.ts ├── index.html ├── team │ └── index.html ├── apicalls.ts ├── sidebar.css ├── codeview.ts ├── utils.ts └── main.ts ├── LICENSE ├── README.md ├── .eslintrc.js ├── package.json ├── gulpfile.js └── CONTRIBUTING.md /codegen/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | src/endpoints.ts 2 | gulpfile.js -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false -------------------------------------------------------------------------------- /test/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | mocha: true, 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .nyc_output 2 | coverage 3 | /node_modules 4 | /typings 5 | /build 6 | /npm-debug.log 7 | /ReadMe.html 8 | /.idea 9 | -------------------------------------------------------------------------------- /.nycrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "all": true, 3 | "include": [ 4 | "src/*.ts" 5 | ], 6 | "require": ["ts-node/register"] 7 | } -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "codegen/spec"] 2 | path = codegen/spec 3 | url = https://github.com/dropbox/dropbox-api-spec.git 4 | [submodule "codegen/stone"] 5 | path = codegen/stone 6 | url = https://github.com/dropbox/stone.git 7 | -------------------------------------------------------------------------------- /codegen/run_codegen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Arun Debray 4 | # 27 July 2015 5 | 6 | # Quick wrapper for how to run my code generator 7 | # Will be edited as necessary (e.g. with the correct path) 8 | PYTHONPATH=stone python -m stone.cli -a:all codegen.stoneg.py test_output spec/*.stone 9 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "noImplicitAny": true, 5 | "noEmitOnError": true, 6 | "noEmit": true, 7 | "typeRoots": [ 8 | "node_modules/@types" 9 | ] 10 | }, 11 | "files": [ 12 | "src/main.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Dropbox Code Of Conduct 2 | 3 | *Dropbox believes that an inclusive development environment fosters greater technical achievement. To encourage a diverse group of contributors we've adopted this code of conduct.* 4 | 5 | Please read the Official Dropbox [Code of Conduct](https://opensource.dropbox.com/coc/) before contributing. -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | pull_request: 4 | 5 | jobs: 6 | CI: 7 | continue-on-error: true 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v2 11 | - name: Setup Node.js environment 12 | uses: actions/setup-node@v2.1.5 13 | with: 14 | node-version: 14 15 | - name: Install SDK 16 | run: | 17 | npm install 18 | - name: Run Linter 19 | run: | 20 | npm run lint -------------------------------------------------------------------------------- /codegen/readme.txt: -------------------------------------------------------------------------------- 1 | This directory will contain a program for generating code for the endpoints for the API Explorer. 2 | 3 | There's a minimal amount of code to actually generate, since each endpoint is wrapped up into a Typescript object, 4 | and the API Explorer uses the object's properties; thus, all we must do is generate the constructors for the objects 5 | themselves. 6 | 7 | I'm planning on using our existing utilities for working with Babel files, which means I'll probably also have to 8 | figure out how to put the API Explorer into the main codebase at the same time. 9 | -------------------------------------------------------------------------------- /test/unit/utils.test.ts: -------------------------------------------------------------------------------- 1 | import * as Utils from '../../src/utils'; 2 | 3 | describe('Endpoint Tests', () => { 4 | it('Can be constructed', (done) => { 5 | const test_endpoint = new Utils.Endpoint('users', 'get_current_account', 6 | { 7 | allow_app_folder_app: 'True', 8 | is_cloud_doc_auth: 'False', 9 | is_preview: 'False', 10 | select_admin_mode: 'whole_team', 11 | style: 'rpc', 12 | auth: 'user', 13 | host: 'api', 14 | scope: 'account_info.read', 15 | }); 16 | done(); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 4 | 5 | ## **Checklist** 6 | 7 | 8 | **General Contributing** 9 | - [ ] Have you read the Code of Conduct and signed the [CLA](https://opensource.dropbox.com/cla/)? 10 | 11 | **Is This a Code Change?** 12 | - [ ] Non-code related change (markdown/git settings etc) 13 | - [ ] Code Change 14 | - [ ] Example/Test Code Change 15 | 16 | **Validation** 17 | - [ ] Does `npm test` pass? 18 | - [ ] Does `npm lint` pass? 19 | - [ ] Have you tested this change locally? -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question_help.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F4AC Questions / Help" 3 | about: Get help with issues you are experiencing 4 | title: '' 5 | labels: help-wanted, question 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Before you start** 11 | Have you checked StackOverflow, previous issues, and Dropbox Developer Forums for help? 12 | 13 | **What is your question?** 14 | A clear and concise description the question. 15 | 16 | **Screenshots** 17 | If applicable, add screenshots to help explain your question. 18 | 19 | **Versions** 20 | * What platform/browser are you using? (if applicable) 21 | 22 | **Additional context** 23 | Add any other context about the question here. -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "npm" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "monthly" 12 | 13 | - package-ecosystem: "github-actions" 14 | directory: "/" 15 | schedule: 16 | interval: "monthly" 17 | -------------------------------------------------------------------------------- /.github/workflows/coverage.yml: -------------------------------------------------------------------------------- 1 | name: CodeCov 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | schedule: 8 | - cron: 0 0 * * * 9 | 10 | jobs: 11 | Unit: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | - name: Setup Node.js environment 16 | uses: actions/setup-node@v2.1.5 17 | with: 18 | node-version: '14' 19 | - name: Install SDK 20 | run: | 21 | npm install 22 | - name: Generate Unit Test Coverage 23 | run: | 24 | npm run coverage:unit 25 | - name: Publish Coverage 26 | uses: codecov/codecov-action@v1.3.2 27 | with: 28 | flags: unit 29 | fail_ci_if_error: true -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F41B Bug report" 3 | about: Create a report to help us improve the API Explorer 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of the bug. 12 | 13 | **To Reproduce** 14 | The steps to reproduce the behavior 15 | 16 | **Expected Behavior** 17 | A clear description of what you expected to happen. 18 | 19 | **Actual Behavior** 20 | A clear description of what actually happened 21 | 22 | **Screenshots** 23 | If applicable, add screenshots to help explain your problem. 24 | 25 | **Versions** 26 | * What platform/browser are you using? (if applicable) 27 | 28 | **Additional context** 29 | Add any other context about the problem here. -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F680 Feature Request" 3 | about: Suggest an idea for the API Explorer 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Why is this feature valuable to you? Does it solve a problem you're having?** 11 | A clear and concise description of why this feature is valuable. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. (if applicable) 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /src/cookie.ts: -------------------------------------------------------------------------------- 1 | /* The files contains helper functions to interact with cookie storage. This will be 2 | used a fallback when session/local storage is not allowed (safari private browsing 3 | mode etc.) 4 | */ 5 | 6 | type StringMap = { [index: string]: string }; 7 | 8 | export const setItem = (key: string, item: string): void => { 9 | document.cookie = `${encodeURIComponent(key)}=${encodeURIComponent(item)}`; 10 | }; 11 | 12 | export const getItem = (key: string) : any => { 13 | const dict = getAll(); 14 | return dict[key]; 15 | }; 16 | 17 | export const getAll = (): StringMap => { 18 | const dict : StringMap = {}; 19 | const cookies: string[] = document.cookie.split('; '); 20 | 21 | cookies.forEach((value) => { 22 | if (value.length > 0) { 23 | const items: string[] = value.split('='); 24 | dict[decodeURIComponent(items[0])] = decodeURIComponent(items[1]); 25 | } 26 | }); 27 | 28 | return dict; 29 | }; 30 | -------------------------------------------------------------------------------- /.github/workflows/deploy-gh-pages.yml: -------------------------------------------------------------------------------- 1 | name: Deploy To Github Pages 2 | on: 3 | push: 4 | branches: [ main ] 5 | jobs: 6 | build: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: Checkout 🛎️ 10 | uses: actions/checkout@v2 11 | with: 12 | persist-credentials: false 13 | submodules: 'recursive' 14 | - name: Setup Python 15 | uses: actions/setup-python@v2.2.2 16 | with: 17 | python-version: 3.7 18 | - name: Install Packages 19 | run: | 20 | cd codegen/stone 21 | python setup.py install 22 | cd .. 23 | npm install 24 | ./run_codegen.sh 25 | cd .. 26 | npm run build 27 | - name: Deploy 🚀 28 | uses: JamesIves/github-pages-deploy-action@releases/v3 29 | with: 30 | ACCESS_TOKEN: ${{ secrets.GH_PAGES_PUBLISH_TOKEN }} 31 | BRANCH: gh-pages # The branch the action should deploy to. 32 | FOLDER: build # The folder the action should deploy. 33 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 |extends react.Component
{
432 | constructor(props: P) {
433 | super(props);
434 | }
435 |
436 | public render(): any { // eslint-disable-line class-methods-use-this
437 | throw new Error('Not implemented.');
438 | }
439 | }
440 |
441 | // The ParamInput area handles the input field of a single parameter to an endpoint.
442 | interface SingleParamInputProps {
443 | key: string;
444 | handler: ValueHandler;
445 | param: Parameter
446 | }
447 |
448 | /* Input component for single parameter.
449 | */
450 | class SingleParamInput extends ParamInput