Skip to content

Commit

Permalink
Feature/moments readme update (#64)
Browse files Browse the repository at this point in the history
* Update Moments Readme

* bump version
  • Loading branch information
nacho9900 authored Sep 12, 2023
1 parent 43b9dd4 commit f960384
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 34 deletions.
6 changes: 3 additions & 3 deletions packages/drops/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/drops",
"version": "0.0.37",
"version": "0.0.38",
"description": "Drops module for the poap.js library",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
Expand All @@ -26,7 +26,7 @@
"build": "rollup -c --bundleConfigAsCjs"
},
"dependencies": {
"@poap-xyz/providers": "0.0.37",
"@poap-xyz/utils": "0.0.37"
"@poap-xyz/providers": "0.0.38",
"@poap-xyz/utils": "0.0.38"
}
}
51 changes: 38 additions & 13 deletions packages/moments/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,52 @@ yarn add @poap-xyz/moments @poap-xyz/utils @poap-xyz/providers axios form-data
## Usage

```javascript
import { MomentsClient, createMomentInput, Moment } from '@poap-xyz/moments';
import { PoapCompass, PoapMomentsApi } from '@poap-xyz/providers';
import { MomentsClient, CreateMomentInput, Moment } from '@poap-xyz/moments';
import { PoapCompass, PoapMomentsApi, AuthenticationProviderHttp } from '@poap-xyz/providers';
import fs from 'fs';

// Set up the PoapMomentsApi with proper authentication
const momentsApi = new PoapMomentsApi({
authenticationProvider: new AuthenticationProviderHttp(
'CLIENT_ID',
'CLIENT_SECRET',
),
});

const client = new MomentsClient(
new PoapMomentsApi('your_api_key'),
new PoapCompass('your_api_key'),
momentsApi,
new PoapCompass('your_api_key_for_compass'),
);

const input: createMomentInput = {
dropId: 110148,
/**
* The Token ID related to the moment (Optional)
*/
tokenId: 6568008,
file: await fs.promises.readFile('src/assets/poap.png'),
author: '0x82AB2941Cf555CED5ad7Ed232a5B5f6083815FBC',
mimeType: 'image/png',
const input: CreateMomentInput = {
dropId: 110148,
tokenId: 6568008, // Optional: The Token ID related to the moment
medias: [{
fileBinary: await fs.promises.readFile('src/assets/poap.png'),
fileType: 'image/png',
}],
author: '0x82AB2941Cf555CED5ad7Ed232a5B5f6083815FBC',
description: 'Your moment description here', // Optional description for the moment
onStepUpdate: (step) => {
console.log(step); // Monitor the step-by-step process of creating a moment
},
onFileUploadProgress: (progress) => {
console.log(progress); // Monitor file upload progress
},
timeOut: 5000, // Optional: Set a timeout for the media processing
};
const moment: Moment = await client.createMoment(input);
```
Explanations for each step:

| Step Name | Explanation |
|-------------------------|----------------------------------------------------------|
| `UPLOADING_MEDIA` | The process of uploading media assets. |
| `PROCESSING_MEDIA` | The media assets are being processed after upload. |
| `PROCESSING_MEDIA_ERROR`| An error occurred during the media processing phase. |
| `UPLOADING_MOMENT` | The process of uploading the moment's data. |
| `FINISHED` | The entire operation of creating the moment is complete. |


## Documentation

Expand Down
6 changes: 3 additions & 3 deletions packages/moments/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/moments",
"version": "0.0.37",
"version": "0.0.38",
"description": "Moments module for the poap.js library",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
Expand All @@ -26,8 +26,8 @@
"build": "rollup -c --bundleConfigAsCjs"
},
"dependencies": {
"@poap-xyz/providers": "0.0.37",
"@poap-xyz/utils": "0.0.37",
"@poap-xyz/providers": "0.0.38",
"@poap-xyz/utils": "0.0.38",
"uuid": "^9.0.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/performance/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/performance",
"version": "0.0.37",
"version": "0.0.38",
"description": "Performance module for the poap.js library",
"type": "module",
"main": "dist/cjs/index.cjs",
Expand Down
6 changes: 3 additions & 3 deletions packages/poaps/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/poaps",
"version": "0.0.37",
"version": "0.0.38",
"description": "Poaps module for the poap.js library",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
Expand All @@ -26,7 +26,7 @@
"build": "rollup -c --bundleConfigAsCjs"
},
"dependencies": {
"@poap-xyz/providers": "0.0.37",
"@poap-xyz/utils": "0.0.37"
"@poap-xyz/providers": "0.0.38",
"@poap-xyz/utils": "0.0.38"
}
}
2 changes: 1 addition & 1 deletion packages/providers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/providers",
"version": "0.0.37",
"version": "0.0.38",
"description": "Providers module for the poap.js library",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
Expand Down
4 changes: 2 additions & 2 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/utils",
"version": "0.0.37",
"version": "0.0.38",
"description": "Utils module for the poap.js library",
"type": "module",
"main": "dist/cjs/index.cjs",
Expand All @@ -25,5 +25,5 @@
"scripts": {
"build": "rollup -c --bundleConfigAsCjs"
},
"stableVersion": "0.0.37"
"stableVersion": "0.0.38"
}
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -864,17 +864,17 @@ __metadata:
version: 0.0.0-use.local
resolution: "@poap-xyz/drops@workspace:packages/drops"
dependencies:
"@poap-xyz/providers": 0.0.37
"@poap-xyz/utils": 0.0.37
"@poap-xyz/providers": 0.0.38
"@poap-xyz/utils": 0.0.38
languageName: unknown
linkType: soft

"@poap-xyz/moments@*, @poap-xyz/moments@workspace:packages/moments":
version: 0.0.0-use.local
resolution: "@poap-xyz/moments@workspace:packages/moments"
dependencies:
"@poap-xyz/providers": 0.0.37
"@poap-xyz/utils": 0.0.37
"@poap-xyz/providers": 0.0.38
"@poap-xyz/utils": 0.0.38
"@types/uuid": ^9.0.2
uuid: ^9.0.0
languageName: unknown
Expand All @@ -890,12 +890,12 @@ __metadata:
version: 0.0.0-use.local
resolution: "@poap-xyz/poaps@workspace:packages/poaps"
dependencies:
"@poap-xyz/providers": 0.0.37
"@poap-xyz/utils": 0.0.37
"@poap-xyz/providers": 0.0.38
"@poap-xyz/utils": 0.0.38
languageName: unknown
linkType: soft

"@poap-xyz/providers@*, @poap-xyz/[email protected].37, @poap-xyz/providers@workspace:packages/providers":
"@poap-xyz/providers@*, @poap-xyz/[email protected].38, @poap-xyz/providers@workspace:packages/providers":
version: 0.0.0-use.local
resolution: "@poap-xyz/providers@workspace:packages/providers"
dependencies:
Expand All @@ -906,7 +906,7 @@ __metadata:
languageName: unknown
linkType: soft

"@poap-xyz/utils@*, @poap-xyz/[email protected].37, @poap-xyz/utils@workspace:packages/utils":
"@poap-xyz/utils@*, @poap-xyz/[email protected].38, @poap-xyz/utils@workspace:packages/utils":
version: 0.0.0-use.local
resolution: "@poap-xyz/utils@workspace:packages/utils"
languageName: unknown
Expand Down

0 comments on commit f960384

Please sign in to comment.