/** @format */

import web from "@/utils/axios/web.ts";

/**
 * 初始化ali oss
 * @param data 用户id
 */
export const initAliOSS = (data: any) => {
	return web.request({
		url: "/oss/oss/ali/init",
		method: "post",
		params: {
			userId: data,
		},
	});
};
/**
 * 获取文件目录信息
 * @param userId 用户id
 * @param dirName 目录名称
 * @param bucket  桶名称
 */
export const getDirAndFileList = (userId: any, dirName: any, bucket: any) => {
	return web.request({
		url: "/oss/oss/ali/listDir",
		method: "get",
		params: {
			userId: userId,
			dirName: dirName,
			bucket: bucket,
		},
	});
};
/**
 * 查询Ali OSS所有桶
 * @param userId
 */
export const getAllAliOSsBucket = (userId: any) => {
	return web.request({
		url: `/oss/oss/ali/seleteBucket`,
		method: "post",
		params: {
			userId: userId,
		},
	});
};

/**
 * 获取所有阿里云oss配置
 * @param userId
 */
export const getAllAliOSSConfig = (userId: any) => {
	return web.request({
		url: `/oss/oss/ali/return_online`,
		method: "get",
		params: {
			userId: userId,
		},
	});
};
