@clevercloud/client
Advanced tools
Comparing version 6.0.0 to 7.0.0-beta.0
# Clever Client changelog | ||
## Unreleased (????-??-??) | ||
* Add new zones API `GET /v4/product/zones` in `api/v4/product.js` with `getAllZones()`. | ||
### ⚠️ BREAKING CHANGES | ||
* Move `GET /products/zones` to `api/product` with `getAllZones()` | ||
* Used to be `api/unknown` with `todo_getZones()` | ||
In order to support both v2 *and* v4 endpoints we changed the way we handle the version prefix. | ||
* You no longer need to configure it as part of the `API_HOST` when you call `prefixUrl(API_HOST)` in your `sendToApi()`. | ||
* You only need to defined the origin with no trailing slash. Example for production: `'https://api.clever-cloud.com'`. | ||
* All v2 service modules that you imported from `esm/api` or `cjs/api` were moved to `esm/api/v2` or `cjs/api/v2`. | ||
## 6.0.0 (2020-05-26) | ||
@@ -4,0 +19,0 @@ |
{ | ||
"name": "@clevercloud/client", | ||
"version": "6.0.0", | ||
"version": "7.0.0-beta.0", | ||
"description": "JavaScript REST client and utils for Clever Cloud's API", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/CleverCloud/clever-client.js", |
@@ -43,3 +43,3 @@ # JavaScript REST client and utils for Clever Cloud's API | ||
// load and cache config and tokens | ||
const API_HOST = 'https://api.clever-cloud.com/v2' | ||
const API_HOST = 'https://api.clever-cloud.com' | ||
const tokens = { | ||
@@ -65,3 +65,3 @@ OAUTH_CONSUMER_KEY: 'your OAUTH_CONSUMER_KEY', | ||
```js | ||
import { getAllEnvVars } from '@clevercloud/client/esm/api/application.js'; | ||
import { getAllEnvVars } from '@clevercloud/client/esm/api/v2/application.js'; | ||
import { sendToApi } from '../send-to-api.js'; | ||
@@ -88,3 +88,3 @@ | ||
// load and cache config and tokens | ||
const API_HOST = 'https://api.clever-cloud.com/v2' | ||
const API_HOST = 'https://api.clever-cloud.com' | ||
const tokens = { | ||
@@ -110,3 +110,3 @@ OAUTH_CONSUMER_KEY: 'your OAUTH_CONSUMER_KEY', | ||
```js | ||
const application = require('@clevercloud/client/cjs/api/application.js'); | ||
const application = require('@clevercloud/client/cjs/api/v2/application.js'); | ||
const { sendToApi } = require('../send-to-api.js'); | ||
@@ -119,2 +119,19 @@ | ||
## How can I get the oAuth configuration? | ||
A general documentation is proposed on [our Website](https://www.clever-cloud.com/doc/clever-cloud-apis/cc-api/). | ||
As stated in the documentation: | ||
> You need to create an oAuth consumer token in the Clever Cloud console. Click on "Create...", then on "an oauth consumer" under your organization name. All created consumers will appear under the list of applications and add-ons. | ||
Once you got the consumer, you still need to generate the aAuth tokens. You may do the whole aAuth dance in the browser. | ||
If you use the [clever-tools](https://github.com/CleverCloud/clever-tools) CLI, you can also generate tokens using the following command : | ||
```sh | ||
clever login | ||
``` | ||
Once successfully logged in, you’ll be provided with a token / secret couple. | ||
## How can I generate a REST client from the API? | ||
@@ -144,11 +161,12 @@ | ||
1. Fetch the Clever Cloud Open API document (prod, see below for preprod) | ||
1. Patch the document with `.cache/openapi-clever.patched.json` (this step should disappear one day) | ||
1. Fetch the Clever Cloud Open API document for v2 (prod, see below for preprod) | ||
1. Patch the document with `./data/patch-for-openapi-clever-v2.json` (this step should disappear one day) | ||
1. Extract all routes from patched document | ||
1. Merge similar routes (`/self` and `/organisatio/{id}`) | ||
1. Generate client code (ES6 modules, tree-shakabled, annotated with JSDoc...) | ||
1. Read local Open API document for v4 (waiting for a published one) | ||
1. Merge similar routes (`/self` and `/organisation/{id}`) | ||
1. Generate client code (ES6 modules, tree-shakabled, annotated with JSDoc...) | ||
1. Clear destination path `esm/api` | ||
1. Write code in appropriate files (grouped by service) | ||
1. Write code in appropriate files (grouped by service and with a subdir by version) | ||
1. Generate legacy client (which uses new generated client) | ||
1. Write code for legacy client in `esm/api/legacy-client.js` | ||
1. Write code for legacy client in `esm/api/v2/legacy-client.js` | ||
@@ -192,3 +210,3 @@ NOTE: The first step caches the Open API document locally for next calls, be sure to run this command to clear the content of `.cache` if you want a clean build: | ||
// Load and cache config and tokens | ||
const API_HOST = 'https://api.clever-cloud.com/v2'; | ||
const API_HOST = 'https://api.clever-cloud.com'; | ||
const tokens = { | ||
@@ -221,3 +239,3 @@ OAUTH_CONSUMER_KEY: 'your OAUTH_CONSUMER_KEY', | ||
// Load and cache config and tokens | ||
const API_HOST = 'https://api.clever-cloud.com/v2'; | ||
const API_HOST = 'https://api.clever-cloud.com'; | ||
const tokens = { | ||
@@ -224,0 +242,0 @@ OAUTH_CONSUMER_KEY: 'your OAUTH_CONSUMER_KEY', |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
424902
84
12923
311
1
1