@atlaskit/media-store
Advanced tools
Comparing version 8.4.1 to 8.5.0
# @atlaskit/media-store | ||
## 8.5.0 | ||
- [minor] [0f42ec1](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/0f42ec1): | ||
Use /items endpoint in media-core | ||
## 8.4.1 | ||
@@ -4,0 +9,0 @@ - [patch] [2c40be7](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/2c40be7): |
@@ -1,2 +0,2 @@ | ||
import { MediaFile, MediaCollection, MediaCollectionItems, MediaUpload, MediaChunksProbe } from './models/media'; | ||
import { MediaFile, MediaCollection, MediaCollectionItems, MediaUpload, MediaChunksProbe, MediaCollectionItemFullDetails } from './models/media'; | ||
import { AsapBasedAuth, AuthContext, ClientAltBasedAuth, MediaApiConfig } from './models/auth'; | ||
@@ -23,2 +23,3 @@ import { RequestMethod, RequestParams, RequestHeaders } from './utils/request'; | ||
getImage: (id: string, params?: MediaStoreGetFileImageParams | undefined) => Promise<Blob>; | ||
getItems: (ids: string[], collectionName?: string | undefined) => Promise<MediaStoreResponse<ItemsPayload>>; | ||
getImageMetadata: (id: string, params?: MediaStoreGetFileImageParams | undefined) => Promise<{ | ||
@@ -31,2 +32,11 @@ metadata: ImageMetadata; | ||
} | ||
export interface FileItem { | ||
id: string; | ||
type: 'file'; | ||
details: MediaCollectionItemFullDetails; | ||
collection?: string; | ||
} | ||
export interface ItemsPayload { | ||
items: FileItem[]; | ||
} | ||
export declare type ImageMetadataArtifact = { | ||
@@ -33,0 +43,0 @@ url?: string; |
@@ -16,2 +16,6 @@ import * as tslib_1 from "tslib"; | ||
}; | ||
var jsonHeaders = { | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json', | ||
}; | ||
var MediaStore = /** @class */ (function () { | ||
@@ -81,2 +85,15 @@ function MediaStore(config) { | ||
}; | ||
this.getItems = function (ids, collectionName) { | ||
var descriptors = ids.map(function (id) { return ({ | ||
type: 'file', | ||
id: id, | ||
collection: collectionName, | ||
}); }); | ||
return _this.request('/items', { | ||
method: 'POST', | ||
body: JSON.stringify({ descriptors: descriptors }), | ||
headers: jsonHeaders, | ||
authContext: { collectionName: collectionName }, | ||
}).then(mapResponseToJson); | ||
}; | ||
this.getImageMetadata = function (id, params) { | ||
@@ -94,6 +111,3 @@ return _this.request("/file/" + id + "/image/metadata", { | ||
authContext: { collectionName: collectionName }, | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Accept: 'application/json', | ||
}, | ||
headers: jsonHeaders, | ||
}).then(mapResponseToJson); | ||
@@ -198,6 +212,3 @@ }; | ||
}), | ||
headers: { | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json', | ||
}, | ||
headers: jsonHeaders, | ||
}).then(mapResponseToJson); | ||
@@ -212,6 +223,3 @@ }; | ||
body: JSON.stringify(body), | ||
headers: { | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json', | ||
}, | ||
headers: jsonHeaders, | ||
}).then(mapResponseToJson); | ||
@@ -248,6 +256,3 @@ }; | ||
body: JSON.stringify(body), | ||
headers: { | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json', | ||
}, | ||
headers: jsonHeaders, | ||
}).then(mapResponseToVoid); | ||
@@ -260,6 +265,3 @@ }; | ||
body: JSON.stringify(body), | ||
headers: { | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json', | ||
}, | ||
headers: jsonHeaders, | ||
params: params, | ||
@@ -266,0 +268,0 @@ }).then(mapResponseToJson); |
@@ -1,2 +0,2 @@ | ||
import { MediaFile, MediaCollection, MediaCollectionItems, MediaUpload, MediaChunksProbe } from './models/media'; | ||
import { MediaFile, MediaCollection, MediaCollectionItems, MediaUpload, MediaChunksProbe, MediaCollectionItemFullDetails } from './models/media'; | ||
import { AsapBasedAuth, AuthContext, ClientAltBasedAuth, MediaApiConfig } from './models/auth'; | ||
@@ -23,2 +23,3 @@ import { RequestMethod, RequestParams, RequestHeaders } from './utils/request'; | ||
getImage: (id: string, params?: MediaStoreGetFileImageParams | undefined) => Promise<Blob>; | ||
getItems: (ids: string[], collectionName?: string | undefined) => Promise<MediaStoreResponse<ItemsPayload>>; | ||
getImageMetadata: (id: string, params?: MediaStoreGetFileImageParams | undefined) => Promise<{ | ||
@@ -31,2 +32,11 @@ metadata: ImageMetadata; | ||
} | ||
export interface FileItem { | ||
id: string; | ||
type: 'file'; | ||
details: MediaCollectionItemFullDetails; | ||
collection?: string; | ||
} | ||
export interface ItemsPayload { | ||
items: FileItem[]; | ||
} | ||
export declare type ImageMetadataArtifact = { | ||
@@ -33,0 +43,0 @@ url?: string; |
@@ -18,2 +18,6 @@ "use strict"; | ||
}; | ||
var jsonHeaders = { | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json', | ||
}; | ||
var MediaStore = /** @class */ (function () { | ||
@@ -83,2 +87,15 @@ function MediaStore(config) { | ||
}; | ||
this.getItems = function (ids, collectionName) { | ||
var descriptors = ids.map(function (id) { return ({ | ||
type: 'file', | ||
id: id, | ||
collection: collectionName, | ||
}); }); | ||
return _this.request('/items', { | ||
method: 'POST', | ||
body: JSON.stringify({ descriptors: descriptors }), | ||
headers: jsonHeaders, | ||
authContext: { collectionName: collectionName }, | ||
}).then(request_1.mapResponseToJson); | ||
}; | ||
this.getImageMetadata = function (id, params) { | ||
@@ -96,6 +113,3 @@ return _this.request("/file/" + id + "/image/metadata", { | ||
authContext: { collectionName: collectionName }, | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Accept: 'application/json', | ||
}, | ||
headers: jsonHeaders, | ||
}).then(request_1.mapResponseToJson); | ||
@@ -200,6 +214,3 @@ }; | ||
}), | ||
headers: { | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json', | ||
}, | ||
headers: jsonHeaders, | ||
}).then(request_1.mapResponseToJson); | ||
@@ -214,6 +225,3 @@ }; | ||
body: JSON.stringify(body), | ||
headers: { | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json', | ||
}, | ||
headers: jsonHeaders, | ||
}).then(request_1.mapResponseToJson); | ||
@@ -250,6 +258,3 @@ }; | ||
body: JSON.stringify(body), | ||
headers: { | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json', | ||
}, | ||
headers: jsonHeaders, | ||
}).then(request_1.mapResponseToVoid); | ||
@@ -262,6 +267,3 @@ }; | ||
body: JSON.stringify(body), | ||
headers: { | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json', | ||
}, | ||
headers: jsonHeaders, | ||
params: params, | ||
@@ -268,0 +270,0 @@ }).then(request_1.mapResponseToJson); |
{ | ||
"name": "@atlaskit/media-store", | ||
"version": "8.4.1", | ||
"version": "8.5.0", | ||
"sideEffects": false | ||
} |
{ | ||
"name": "@atlaskit/media-store", | ||
"version": "8.4.1", | ||
"version": "8.5.0", | ||
"description": "Media Store API Web Client Library", | ||
@@ -29,3 +29,4 @@ "license": "Apache-2.0", | ||
"@atlaskit/docs": "^6.0.0", | ||
"@atlaskit/media-test-helpers": "^18.3.0", | ||
"@atlaskit/media-card": "^44.0.2", | ||
"@atlaskit/media-test-helpers": "^18.6.0", | ||
"@types/fetch-mock": "^6.0.3", | ||
@@ -32,0 +33,0 @@ "fetch-mock": "^6.5.2", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
127701
2041
6