@dawntech/blip-tools 0.3.0 → 0.3.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.
|
@@ -8,4 +8,10 @@ export default class BlipMedia {
|
|
|
8
8
|
* @returns A public URL
|
|
9
9
|
*/
|
|
10
10
|
uploadMedia(content: Blob): Promise<string>;
|
|
11
|
+
/**
|
|
12
|
+
* Generates a new public URI to access blip chat media. Blip medias have expiration dates so you need to generate new ones to access the data.
|
|
13
|
+
* @param expiredMediaUri Blip media expired URI
|
|
14
|
+
* @returns A new public URI
|
|
15
|
+
*/
|
|
16
|
+
refreshMediaUri(expiredMediaUri: string): Promise<string>;
|
|
11
17
|
}
|
|
@@ -30,4 +30,26 @@ export default class BlipMedia {
|
|
|
30
30
|
throw handleError(error);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Generates a new public URI to access blip chat media. Blip medias have expiration dates so you need to generate new ones to access the data.
|
|
35
|
+
* @param expiredMediaUri Blip media expired URI
|
|
36
|
+
* @returns A new public URI
|
|
37
|
+
*/
|
|
38
|
+
async refreshMediaUri(expiredMediaUri) {
|
|
39
|
+
try {
|
|
40
|
+
const response = await this.api.post('/commands', {
|
|
41
|
+
id: randomUUID(),
|
|
42
|
+
to: 'postmaster@media.msging.net',
|
|
43
|
+
method: 'set',
|
|
44
|
+
type: 'text/plain',
|
|
45
|
+
uri: '/refresh-media-uri',
|
|
46
|
+
resource: expiredMediaUri,
|
|
47
|
+
});
|
|
48
|
+
validateResponse(response);
|
|
49
|
+
return response.data.resource;
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
throw handleError(error);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
33
55
|
}
|