tayeh.js
Advanced tools
Comparing version 0.2.8 to 0.2.9
import { AxiosRequestConfig, AxiosResponse } from 'axios'; | ||
import { UploadImage, UploadResponse, UploadSound, UploadVideo, UploadVoice } from './types'; | ||
import { UploadResponse } from './types'; | ||
export declare const MEDIA_BASE_URL = "https://blob.tayeh.ir"; | ||
@@ -8,10 +8,10 @@ export declare class Media { | ||
protected get<T>(endpoint: string, options?: AxiosRequestConfig): Promise<AxiosResponse<T>>; | ||
protected post<T>(endpoint: string, body?: {}, options?: AxiosRequestConfig): Promise<AxiosResponse<T>>; | ||
protected post<T>(endpoint: string, body: any, options?: AxiosRequestConfig): Promise<AxiosResponse<T>>; | ||
getMedia(media_id: string): Promise<AxiosResponse<ReadableStream<any>>>; | ||
uploadVideo(body: UploadVideo): Promise<AxiosResponse<UploadResponse>>; | ||
uploadVoice(body: UploadVoice): Promise<AxiosResponse<UploadResponse>>; | ||
uploadSound(body: UploadSound): Promise<AxiosResponse<UploadResponse>>; | ||
uploadImage(body: UploadImage): Promise<AxiosResponse<UploadResponse>>; | ||
uploadBanner(body: UploadImage): Promise<AxiosResponse<UploadResponse>>; | ||
uploadAvatar(body: UploadImage): Promise<AxiosResponse<UploadResponse>>; | ||
uploadVideo(file: File): Promise<AxiosResponse<UploadResponse>>; | ||
uploadVoice(file: File): Promise<AxiosResponse<UploadResponse>>; | ||
uploadSound(file: File): Promise<AxiosResponse<UploadResponse>>; | ||
uploadImage(file: File): Promise<AxiosResponse<UploadResponse>>; | ||
uploadBanner(file: File): Promise<AxiosResponse<UploadResponse>>; | ||
uploadAvatar(file: File): Promise<AxiosResponse<UploadResponse>>; | ||
} |
@@ -29,3 +29,3 @@ "use strict"; | ||
} | ||
post(endpoint, body = {}, options) { | ||
post(endpoint, body, options) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -40,25 +40,37 @@ const url = `${exports.MEDIA_BASE_URL}/${endpoint}`; | ||
} | ||
uploadVideo(body) { | ||
uploadVideo(file) { | ||
const path = 'video'; | ||
return this.post(path, body); | ||
const formData = new FormData(); | ||
formData.append('video', file); | ||
return this.post(path, formData); | ||
} | ||
uploadVoice(body) { | ||
uploadVoice(file) { | ||
const path = 'voice'; | ||
return this.post(path, body); | ||
const formData = new FormData(); | ||
formData.append('voice', file); | ||
return this.post(path, formData); | ||
} | ||
uploadSound(body) { | ||
uploadSound(file) { | ||
const path = 'sound'; | ||
return this.post(path, body); | ||
const formData = new FormData(); | ||
formData.append('sound', file); | ||
return this.post(path, formData); | ||
} | ||
uploadImage(body) { | ||
uploadImage(file) { | ||
const path = 'image'; | ||
return this.post(path, body); | ||
const formData = new FormData(); | ||
formData.append('image', file); | ||
return this.post(path, formData); | ||
} | ||
uploadBanner(body) { | ||
uploadBanner(file) { | ||
const path = 'banner'; | ||
return this.post(path, body); | ||
const formData = new FormData(); | ||
formData.append('image', file); | ||
return this.post(path, formData); | ||
} | ||
uploadAvatar(body) { | ||
uploadAvatar(file) { | ||
const path = 'avatar'; | ||
return this.post(path, body); | ||
const formData = new FormData(); | ||
formData.append('image', file); | ||
return this.post(path, formData); | ||
} | ||
@@ -65,0 +77,0 @@ } |
{ | ||
"name": "tayeh.js", | ||
"version": "0.2.08", | ||
"version": "0.2.09", | ||
"description": "tayeh shop-api client", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
198310
3880