Skip to content

Commit

Permalink
chore: adds migration to changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
barbmarcio committed Aug 13, 2024
1 parent 11ccf2f commit 5334a22
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 5 deletions.
80 changes: 78 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,84 @@ We follow the format used by [Open Telemetry](https://github.com/open-telemetry/

- Add implementation for TopsortClient ([#43](https://github.com/Topsort/topsort.js/pull/43))

As part of new implementation, now a client is initialized receiving a config as `const topsortClient = new TopsortClient(config)`
And all the functions will be found within the client, as `topsortClient.createAuction(auction)` or `topsortClient.reportEvent(event)`
As part of the new implementation, a Topsort Client that embeds all functions is now initialized by receiving a config. Additionally, some type names have been renamed:
- _TopsortAuction_ > **Auction**
- _TopsortEvents_ > **Event**

Migration steps:

#### Auctions - Before
```js
import { TopsortAuction, Config, reportAuction } from "@topsort/sdk";

const auction: TopsortAuction = {
//...
};

const config: Config = {
apiKey: "API_KEY",
};

createAuction(config, auction)
.then((result) => console.log(result))
.catch((error) => console.error(error));
```

#### Auctions - After
```js
import { Auction, Config, TopsortClient } from "@topsort/sdk";

const auction: Auction = {
//...
};

const config: Config = {
apiKey: "API_KEY",
};

const topsortClient = new TopsortClient(config);

topsortClient.createAuction(auction)
.then((result) => console.log(result))
.catch((error) => console.error(error));
```


#### Events - Before
```js
import { TopsortEvent, Config, reportEvent } from "@topsort/sdk";

const event: TopsortEvent = {
//...
};

const config: Config = {
apiKey: "API_KEY",
};

reportEvent(config, event)
.then((result) => console.log(result))
.catch((error) => console.error(error));
```

#### Events - After
```js
import { Event, Config, TopsortClient } from "@topsort/sdk";

const event: Event = {
//...
};

const config: Config = {
apiKey: "API_KEY",
};

const topsortClient = new TopsortClient(config);

topsortClient.reportEvent(event)
.then((result) => console.log(result))
.catch((error) => console.error(error));
```

- Fix CI/CD for release process ([#38](https://github.com/Topsort/topsort.js/pull/38))
- Convert some parameters to optional ([#36](https://github.com/Topsort/topsort.js/pull/36))
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const config = {

const topsortClient = new TopsortClient(config)

topsortClient.createAuction(config, auctionDetails)
topsortClient.createAuction(auctionDetails)
.then((result) => console.log(result))
.catch((error) => console.error(error));
```
Expand Down Expand Up @@ -148,7 +148,7 @@ const config = {

const topsortClient = new TopsortClient(config)

topsortClient.reportEvent(config, event)
topsortClient.reportEvent(event)
.then((result) => console.log(result))
.catch((error) => console.error(error));
```
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@topsort/sdk",
"version": "0.3.0",
"description": "",
"description": "The official Topsort SDK for TypeScript and JavaScript",
"packageManager": "[email protected]",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down

0 comments on commit 5334a22

Please sign in to comment.