@pbvision/partner-sdk 0.0.3 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -3
- package/package.json +1 -1
- package/src/index.js +6 -5
package/README.md
CHANGED
|
@@ -76,8 +76,14 @@ Next, tell us to download and work on the video. You can do this using our SDK:
|
|
|
76
76
|
import { PBVision } from '@pbvision/partner-sdk'
|
|
77
77
|
|
|
78
78
|
const pbv = new PBVision(YOUR_API_KEY)
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
// you can omit this metadata, or provide some or all of this object-- whatever you'd like!
|
|
80
|
+
const optionalMetadata = {
|
|
81
|
+
userEmails: [],
|
|
82
|
+
name: 'Dink Championship 2024',
|
|
83
|
+
desc: 'A longer description, if you want',
|
|
84
|
+
gameStartEpoch: 1711393200 // when the game was played
|
|
85
|
+
}
|
|
86
|
+
await pbv.sendVideoUrlToDownload(YOUR_VIDEO_URL, optionalMetadata)
|
|
81
87
|
```
|
|
82
88
|
|
|
83
89
|
Alternatively, you can just use `curl`:
|
|
@@ -98,7 +104,7 @@ You can directly upload your video from a file using the SDK too:
|
|
|
98
104
|
import { PBVision } from '@pbvision/partner-sdk'
|
|
99
105
|
|
|
100
106
|
const pbv = new PBVision(YOUR_API_KEY)
|
|
101
|
-
// you can omit this metadata, or provide
|
|
107
|
+
// you can omit this metadata, or provide some or all of this object-- whatever you'd like!
|
|
102
108
|
const optionalMetadata = {
|
|
103
109
|
userEmails: [],
|
|
104
110
|
name: 'Dink Championship 2024',
|
|
@@ -124,6 +130,7 @@ The HTTP POST body will contain JSON which looks like this:
|
|
|
124
130
|
{
|
|
125
131
|
"from_url": "https://example.com/my-video.mp4",
|
|
126
132
|
"webpage": "https://app.pb.vision/video/xyz",
|
|
133
|
+
"cutVideo": "https://storage.googleapis.com/pbv-pro/xyz/f50272db-69a8-49ed-9d92-3a4d067af87c/rallies.mp4",
|
|
127
134
|
"events": EVENTS_DATA,
|
|
128
135
|
"insights": INSIGHTS_DATA,
|
|
129
136
|
"error": {
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -43,14 +43,15 @@ export class PBVision {
|
|
|
43
43
|
* processing is complete, your webhook URL will receive a callback.
|
|
44
44
|
*
|
|
45
45
|
* @param {string} videoUrl the publicly available URL of the video
|
|
46
|
-
* @param {
|
|
47
|
-
* this video; they'll be notified when the video is done processing
|
|
46
|
+
* @param {VideoMetadata} [metadata]
|
|
48
47
|
*/
|
|
49
|
-
async sendVideoUrlToDownload (videoUrl, userEmails = []) {
|
|
48
|
+
async sendVideoUrlToDownload (videoUrl, { userEmails = [], name, desc, gameStartEpoch } = {}) {
|
|
50
49
|
assert(typeof videoUrl === 'string' && videoUrl.startsWith('http'),
|
|
51
50
|
'URL must be a string beginning with http')
|
|
52
|
-
assert(videoUrl.endsWith('.mp4'), 'video URL must have the .mp4 extension')
|
|
53
|
-
this.__callAPI(
|
|
51
|
+
assert(videoUrl.split('?')[0].endsWith('.mp4'), 'video URL must have the .mp4 extension')
|
|
52
|
+
this.__callAPI(
|
|
53
|
+
'add_video_by_url',
|
|
54
|
+
{ url: videoUrl, userEmails, name, desc, gameStartEpoch })
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
async __callAPI (path, body) {
|