@poap-xyz/providers
Advanced tools
Comparing version 0.0.31 to 0.0.32
@@ -5,1 +5,2 @@ export { PoapMomentsApi } from './PoapMomentsApi/PoapMomentsApi'; | ||
export { AuthenticationProviderHttp } from './AuthenticationProviderHttp/AuthenticationProviderHttp'; | ||
export { InvalidMediaError } from './PoapMomentsApi/errors/InvalidMediaError'; |
@@ -1,2 +0,2 @@ | ||
export { InvalidMediaFileError } from './core/PoapMomentsApi/errors/InvalidMediaFileError'; | ||
export { InvalidMediaError } from './core/PoapMomentsApi/errors/InvalidMediaError'; | ||
export { DropResponse } from './ports/DropApiProvider/Types/response'; | ||
@@ -3,0 +3,0 @@ export { AuthenticationProvider } from './ports/AuthenticationProvider/AuthenticationProvider'; |
export interface CreateMomentInput { | ||
dropId: number; | ||
author: string; | ||
mediaKey: string; | ||
mediaKeys: string[]; | ||
tokenId?: number; | ||
description?: string; | ||
} |
@@ -5,5 +5,2 @@ export interface CreateMomentResponse { | ||
createdOn: Date; | ||
media: { | ||
gateways: string[]; | ||
}; | ||
dropId: number; | ||
@@ -10,0 +7,0 @@ tokenId?: number; |
@@ -5,1 +5,2 @@ export { PoapMomentsApi } from './PoapMomentsApi/PoapMomentsApi'; | ||
export { AuthenticationProviderHttp } from './AuthenticationProviderHttp/AuthenticationProviderHttp'; | ||
export { InvalidMediaError } from './PoapMomentsApi/errors/InvalidMediaError'; |
@@ -1,2 +0,2 @@ | ||
export { InvalidMediaFileError } from './core/PoapMomentsApi/errors/InvalidMediaFileError'; | ||
export { InvalidMediaError } from './core/PoapMomentsApi/errors/InvalidMediaError'; | ||
export { DropResponse } from './ports/DropApiProvider/Types/response'; | ||
@@ -3,0 +3,0 @@ export { AuthenticationProvider } from './ports/AuthenticationProvider/AuthenticationProvider'; |
export interface CreateMomentInput { | ||
dropId: number; | ||
author: string; | ||
mediaKey: string; | ||
mediaKeys: string[]; | ||
tokenId?: number; | ||
description?: string; | ||
} |
@@ -5,5 +5,2 @@ export interface CreateMomentResponse { | ||
createdOn: Date; | ||
media: { | ||
gateways: string[]; | ||
}; | ||
dropId: number; | ||
@@ -10,0 +7,0 @@ tokenId?: number; |
@@ -5,1 +5,2 @@ export { PoapMomentsApi } from './PoapMomentsApi/PoapMomentsApi'; | ||
export { AuthenticationProviderHttp } from './AuthenticationProviderHttp/AuthenticationProviderHttp'; | ||
export { InvalidMediaError } from './PoapMomentsApi/errors/InvalidMediaError'; |
@@ -1,2 +0,2 @@ | ||
export { InvalidMediaFileError } from './core/PoapMomentsApi/errors/InvalidMediaFileError'; | ||
export { InvalidMediaError } from './core/PoapMomentsApi/errors/InvalidMediaError'; | ||
export { DropResponse } from './ports/DropApiProvider/Types/response'; | ||
@@ -3,0 +3,0 @@ export { AuthenticationProvider } from './ports/AuthenticationProvider/AuthenticationProvider'; |
@@ -7,5 +7,6 @@ (function (global, factory) { | ||
class InvalidMediaFileError extends Error { | ||
constructor() { | ||
super(`InvalidMediaFile error: This media file is invalid or cannot be processed.`); | ||
class InvalidMediaError extends Error { | ||
constructor(reason) { | ||
super(`There was an while creating Moment. Invalid media file. Reason: ${reason}`); | ||
this.name = InvalidMediaError.name; | ||
} | ||
@@ -73,3 +74,3 @@ } | ||
if (status === MediaStatus.INVALID) { | ||
throw new InvalidMediaFileError(); | ||
throw new InvalidMediaError('status is invalid'); | ||
} | ||
@@ -83,9 +84,18 @@ await new Promise((resolve) => setTimeout(resolve, delay)); | ||
async createMoment(input) { | ||
const response = await axios.post(`${this.baseUrl}/moments`, input, { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: await this.getAuthorizationToken(), | ||
}, | ||
}); | ||
return response.data; | ||
var _a; | ||
try { | ||
const response = await axios.post(`${this.baseUrl}/moments`, input, { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: await this.getAuthorizationToken(), | ||
}, | ||
}); | ||
return response.data; | ||
} | ||
catch (error) { | ||
if (error instanceof axios.AxiosError && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 409) { | ||
throw new InvalidMediaError(error.response.data.message); | ||
} | ||
throw error; | ||
} | ||
} | ||
@@ -223,3 +233,3 @@ async getAuthorizationToken() { | ||
exports.AuthenticationProviderHttp = AuthenticationProviderHttp; | ||
exports.InvalidMediaFileError = InvalidMediaFileError; | ||
exports.InvalidMediaError = InvalidMediaError; | ||
exports.PoapCompass = PoapCompass; | ||
@@ -226,0 +236,0 @@ exports.PoapDropApi = PoapDropApi; |
export interface CreateMomentInput { | ||
dropId: number; | ||
author: string; | ||
mediaKey: string; | ||
mediaKeys: string[]; | ||
tokenId?: number; | ||
description?: string; | ||
} |
@@ -5,5 +5,2 @@ export interface CreateMomentResponse { | ||
createdOn: Date; | ||
media: { | ||
gateways: string[]; | ||
}; | ||
dropId: number; | ||
@@ -10,0 +7,0 @@ tokenId?: number; |
{ | ||
"name": "@poap-xyz/providers", | ||
"version": "0.0.31", | ||
"version": "0.0.32", | ||
"description": "Providers module for the poap.js library", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.cjs", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
110288
1225