@pbvision/partner-sdk 0.1.9 → 0.1.11

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.
Files changed (3) hide show
  1. package/README.md +13 -1
  2. package/package.json +1 -1
  3. package/src/index.js +27 -4
package/README.md CHANGED
@@ -12,6 +12,7 @@ standard length game, so we'll notify your servers when the results are ready.
12
12
  - [Send Videos](#send-videos)
13
13
  - [Option 1: PBV downloads your video from a URL](#option-1-pbv-downloads-your-video-from-a-url)
14
14
  - [Option 2: Upload your video](#option-2-upload-your-video)
15
+ - [Video Editors](#video-editors)
15
16
  - [After Video Processing is Done](#after-video-processing-is-done)
16
17
  - [Callback Data](#callback-data)
17
18
  - [Video Guidelines](#video-guidelines)
@@ -117,10 +118,21 @@ const optionalMetadata = {
117
118
  await pbv.uploadVideo(YOUR_VIDEO_FILENAME, optionalMetadata);
118
119
  ```
119
120
 
121
+ ### Video Editors
122
+
123
+ Editors can tag themselves and friends in the video. They also have access to
124
+ the video even if the video is private (to make uploaded by your partner
125
+ account private by default, please email us).
126
+
127
+ You can get the current list of editors on a video by using the `getVideoEditors()`
128
+ method. Similarly, the `setVideoEditors()` method can be used to change the
129
+ email addresses which have editor access on your video.
130
+
120
131
  ## After Video Processing is Done
121
132
 
122
133
  When our AI is done processing your video, we will email the players in the
123
- game (_if_ their email addresses were provided via `userEmails`).
134
+ game (_if_ their email addresses were provided via `userEmails`). These users
135
+ will be "editors" on the video and be able to tag themselves and their friends.
124
136
 
125
137
  If you [provided a webhook](#webhook-setup), then we'll send
126
138
  an HTTP POST request to your server. Your server should acknowledge this
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pbvision/partner-sdk",
3
3
  "description": "SDK for interacting with the PB Vision pickleball AI engine.",
4
- "version": "0.1.9",
4
+ "version": "0.1.11",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "engines": {
package/src/index.js CHANGED
@@ -47,6 +47,28 @@ export class PBVision {
47
47
  return this.__callAPI('webhook/set', { url: webhookUrl })
48
48
  }
49
49
 
50
+ /**
51
+ * Gets the email addresses (if any) which have editor access to a video your
52
+ * partner account uploaded.
53
+ *
54
+ * @param {string} vid video id
55
+ */
56
+ async getVideoEditors (vid) {
57
+ return this.__callAPI('video/editors/get', { vid })
58
+ }
59
+
60
+ /**
61
+ * Sets the email addresses (if any) which have editor access to a video your
62
+ * partner account uploaded.
63
+ *
64
+ * @param {string} vid video id
65
+ * @param {Array<string>} editorEmails a list of 0 to 4 email addresses to
66
+ * allow edit access to the video (replaces any previous editors list).
67
+ */
68
+ async setVideoEditors (vid, editorEmails) {
69
+ return this.__callAPI('video/editors/set', { vid, editorEmails })
70
+ }
71
+
50
72
  /**
51
73
  * @typedef {Object} VideoUrlToDownloadResponse
52
74
  * @property {string} vid the ID of the new video
@@ -62,13 +84,13 @@ export class PBVision {
62
84
  * @param {VideoMetadata} [metadata]
63
85
  * @returns {VideoUrlToDownloadResponse}
64
86
  */
65
- async sendVideoUrlToDownload (videoUrl, { userEmails = [], name, desc, gameStartEpoch, facility, court } = {}) {
87
+ async sendVideoUrlToDownload (videoUrl, { userEmails = [], name, desc, gameStartEpoch, facility, court, fid } = {}) {
66
88
  assert(typeof videoUrl === 'string' && videoUrl.startsWith('http'),
67
89
  'URL must be a string beginning with http')
68
90
  assert(videoUrl.split('?')[0].endsWith('.mp4'), 'video URL must have the .mp4 extension')
69
91
  const resp = await this.__callAPI(
70
92
  'add_video_by_url',
71
- { url: videoUrl, userEmails, name, desc, gameStartEpoch, facility, court })
93
+ { url: videoUrl, userEmails, name, desc, gameStartEpoch, facility, court, fid })
72
94
  return JSON.parse(resp)
73
95
  }
74
96
 
@@ -102,6 +124,7 @@ export class PBVision {
102
124
  * @property {integer} [gameStartEpoch] the epoch at which the game started
103
125
  * @property {string} [facility] the facility where the game was recorded (e.g., "Cool Club #3 - Barcelona")
104
126
  * @property {string} [court] the court where the game was recorded (e.g., "11A")
127
+ * @property {integer} [fid] the ID of the folder in which this video should be added
105
128
  */
106
129
 
107
130
  /**
@@ -114,10 +137,10 @@ export class PBVision {
114
137
  * @param {VideoMetadata} [metadata]
115
138
  * @returns {VideoUrlToDownloadResponse}
116
139
  */
117
- async uploadVideo (mp4Filename, { userEmails = [], name, desc, gameStartEpoch, facility, court } = {}) {
140
+ async uploadVideo (mp4Filename, { userEmails = [], name, desc, gameStartEpoch, facility, court, fid } = {}) {
118
141
  const pieces = mp4Filename.split('.')
119
142
  const ext = pieces[pieces.length - 1]
120
- const makeVIDResp = await this.__callAPI('make_video_id', { userEmails, name, desc, gameStartEpoch, facility, court, fileExt: ext })
143
+ const makeVIDResp = await this.__callAPI('make_video_id', { userEmails, name, desc, gameStartEpoch, facility, court, fid, fileExt: ext })
121
144
  const { hasCredits, vid } = JSON.parse(makeVIDResp)
122
145
  if (hasCredits === false) {
123
146
  return { hasCredits }