Skip to content

Commit

Permalink
Refactor & improve public API (#86)
Browse files Browse the repository at this point in the history
* Add hono and try some routes

* Test openai/swagger

* Move some routes to the new folder structure

* Moved some more routes into their new folder

* Refactor some more endpoints

* Move more endpoints

* Add deployment detail endpoint

* Add tags & summaries

* Move version and provider attribute endpoints

* Move graphs endpoints

* Move  blocks endpoints

* Remove unecessary openapi properties

* Improve doc

* Add eslint

* Improve typing

* .

* Cleanup

* Remove /api prefix and migrate dashboardRouter to hono

* Migrate web3-index router to hono

* Fix merge

* Change api urls in deploy website

* Add version to baseapiurl

* Add cors to hono

* Convert required user endpoints

* Convert optional user routes

* Remove unused dependencies

* .

* .

* .

* Improve typing

* Add legacy router

* Add sentry middleware

* Add jwks caching

* Set correct swagger servers

* Add documentation

* Rename providers to services

* Merge fixes

* .
  • Loading branch information
Redm4x authored Feb 13, 2024
1 parent c9f7e46 commit 6ef9b88
Show file tree
Hide file tree
Showing 92 changed files with 14,926 additions and 21,482 deletions.
17 changes: 17 additions & 0 deletions api/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"env": {
"browser": true,
"es2021": true
},
"ignorePatterns": ["node_modules/", "dist/", "webpack.*.js"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"rules": {
"@typescript-eslint/no-unused-vars": ["error", { "ignoreRestSiblings": true }]
}
}
38 changes: 38 additions & 0 deletions api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,41 @@ Auth0Issuer|ex: `'https://dev-5aprb0lr.us.auth0.com/'`
Auth0Issuer|ex: `'https://auth.cloudmos.io/'`
StripeSecretKey|ex: `sk_test_12aw315wdawd3...293d12d32df8jf`
WebsiteUrl|`http://localhost:3001`

## Changes from **beta** to **v1** (February 2024)

### Api Versioning

The public api version will now be included in the url like so: api.cloudmos.io/**v1**/\<endpoint>

Changes that are backward compatible like adding new endpoint will be done in the existing version.
Changes that are **not** backward compatible, such as removing an endpoint, will be done in a new version. When releasing a new version, a list of breaking changes will be made available. We will keep the old version available for a while to give users enough time to migrate their applications to the latest version.

### Swagger Documentation

A swagger documentation is now available at https://api.cloudmos.io/v1/swagger. You can use it to see the list of available endpoints and try them directly in your browser.

### Route Changes

The `/api` prefix was removed from every public endpoints and instead the version should be used (ex: `/v1/<endpoint>`)

Here is a list of endpoints that have changed in this release. Old endpoints will temporarily redirect to the new ones. In future releases, the [versioning system](#api-versioning) will be used instead of redirects.


|Old|New|
|-|-
|`/predicted-block-date/<height>/<blockWindow>` | `/predicted-block-date/<height>?blockWindow=<blockWindow>`
|`/predicted-date-height/<timestamp>/<blockWindow>` | `/predicted-date-height/<timestamp>?blockWindow=<blockWindow>`
|`/getNetworkCapacity`|`/network-capacity`
|`/marketData`|`/market-data`
|`/dashboardData`|`/dashboard-data`
|`getMainnetNodes`|`/nodes/mainnet`
|`/getSandboxNodes`|`/nodes/sandbox`
|`/getTestnetNodes`|`/nodes/testnet`
|`/getProviderAttributesSchema`|`/provider-attributes-schema`
|`/getMainnetVersion`|`/version/mainnet`
|`/getSandboxVersion`|`/version/sandbox`
|`/getTestnetVersion`|`/version/testnet`
|`/getProviderGraphData/<dataName>`|`/provider-graph-data/<dataName>`
|`/getProviderActiveLeasesGraphData/<address>`|`/provider-active-leases-graph-data/<address>`
|`/getGraphData/<dataName>`|`/graph-data/<dataName>`
Loading

0 comments on commit 6ef9b88

Please sign in to comment.