import axios from "axios"; import { userServiceClient } from "@/grpcweb"; export function signin(email: string, password: string) { return axios.post("/api/v1/auth/signin", { email, password, }); } export function signup(email: string, nickname: string, password: string) { return axios.post("/api/v1/auth/signup", { email, nickname, password, }); } export function signout() { return axios.post("/api/v1/auth/logout"); } export function getMyselfUser() { return axios.get("/api/v1/user/me"); } export function getUserList() { return axios.get("/api/v1/user"); } export function getUserById(id: number) { return axios.get(`/api/v1/user/${id}`); } export function createUser(userCreate: UserCreate) { return axios.post("/api/v1/user", userCreate); } export function patchUser(userPatch: UserPatch) { return axios.patch(`/api/v1/user/${userPatch.id}`, userPatch); } export function deleteUser(userId: UserId) { return userServiceClient.deleteUser({ id: userId }); } export function getShortcutList(shortcutFind?: ShortcutFind) { const queryList = []; if (shortcutFind?.tag) { queryList.push(`tag=${shortcutFind.tag}`); } return axios.get(`/api/v1/shortcut?${queryList.join("&")}`); } export function getShortcutById(id: number) { return axios.get(`/api/v1/shortcut/${id}`); } export function createShortcut(shortcutCreate: ShortcutCreate) { return axios.post("/api/v1/shortcut", shortcutCreate); } export function getShortcutAnalytics(shortcutId: ShortcutId) { return axios.get(`/api/v1/shortcut/${shortcutId}/analytics`); } export function patchShortcut(shortcutPatch: ShortcutPatch) { return axios.patch(`/api/v1/shortcut/${shortcutPatch.id}`, shortcutPatch); } export function deleteShortcutById(shortcutId: ShortcutId) { return axios.delete(`/api/v1/shortcut/${shortcutId}`); } export function getUrlFavicon(url: string) { return axios.get(`/api/v1/url/favicon?url=${url}`); }