From f9603846f0c753ab0fd1b48aa8dca51082dd122f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ignacio=20Nicol=C3=A1s=20Negro=20Caino?= Date: Tue, 12 Sep 2023 14:49:09 -0300 Subject: [PATCH] Feature/moments readme update (#64) * Update Moments Readme * bump version --- packages/drops/package.json | 6 ++-- packages/moments/README.md | 51 +++++++++++++++++++++++-------- packages/moments/package.json | 6 ++-- packages/performance/package.json | 2 +- packages/poaps/package.json | 6 ++-- packages/providers/package.json | 2 +- packages/utils/package.json | 4 +-- yarn.lock | 16 +++++----- 8 files changed, 59 insertions(+), 34 deletions(-) diff --git a/packages/drops/package.json b/packages/drops/package.json index 6e58cdaf..5d1a8edc 100644 --- a/packages/drops/package.json +++ b/packages/drops/package.json @@ -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", @@ -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" } } diff --git a/packages/moments/README.md b/packages/moments/README.md index 89481ff8..b03612fb 100644 --- a/packages/moments/README.md +++ b/packages/moments/README.md @@ -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 diff --git a/packages/moments/package.json b/packages/moments/package.json index 9c3dd0c7..33d57d92 100644 --- a/packages/moments/package.json +++ b/packages/moments/package.json @@ -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", @@ -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": { diff --git a/packages/performance/package.json b/packages/performance/package.json index 109a5129..84ff9bdf 100644 --- a/packages/performance/package.json +++ b/packages/performance/package.json @@ -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", diff --git a/packages/poaps/package.json b/packages/poaps/package.json index 6d02cde5..59994ab1 100644 --- a/packages/poaps/package.json +++ b/packages/poaps/package.json @@ -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", @@ -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" } } diff --git a/packages/providers/package.json b/packages/providers/package.json index 67d89f6d..fd081013 100644 --- a/packages/providers/package.json +++ b/packages/providers/package.json @@ -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", diff --git a/packages/utils/package.json b/packages/utils/package.json index 27029c4f..39f95831 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -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", @@ -25,5 +25,5 @@ "scripts": { "build": "rollup -c --bundleConfigAsCjs" }, - "stableVersion": "0.0.37" + "stableVersion": "0.0.38" } diff --git a/yarn.lock b/yarn.lock index c9dad7de..eb02cb38 100644 --- a/yarn.lock +++ b/yarn.lock @@ -864,8 +864,8 @@ __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 @@ -873,8 +873,8 @@ __metadata: 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 @@ -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/providers@0.0.37, @poap-xyz/providers@workspace:packages/providers": +"@poap-xyz/providers@*, @poap-xyz/providers@0.0.38, @poap-xyz/providers@workspace:packages/providers": version: 0.0.0-use.local resolution: "@poap-xyz/providers@workspace:packages/providers" dependencies: @@ -906,7 +906,7 @@ __metadata: languageName: unknown linkType: soft -"@poap-xyz/utils@*, @poap-xyz/utils@0.0.37, @poap-xyz/utils@workspace:packages/utils": +"@poap-xyz/utils@*, @poap-xyz/utils@0.0.38, @poap-xyz/utils@workspace:packages/utils": version: 0.0.0-use.local resolution: "@poap-xyz/utils@workspace:packages/utils" languageName: unknown