/**
 * Generated by orval v8.23.0 🍺
 * Do not edit manually.
 * FastAPI
 * OpenAPI spec version: v2.2.0
 */
import type {
  BodyUploadImageUploadImagePost,
  BodyUploadProfilePictureUploadProfilePictureMePost,
  HTTPValidationError,
  UploadImageUploadImagePostParams
} from '../model';

import { customInstance } from '.././client';

export type uploadImageUploadImagePostResponse200 = {
  data: unknown
  status: 200
}

export type uploadImageUploadImagePostResponse422 = {
  data: HTTPValidationError
  status: 422
}

export type uploadImageUploadImagePostResponseSuccess = (uploadImageUploadImagePostResponse200) & {
  headers: Headers;
};
export type uploadImageUploadImagePostResponseError = (uploadImageUploadImagePostResponse422) & {
  headers: Headers;
};

export type uploadImageUploadImagePostResponse = (uploadImageUploadImagePostResponseSuccess | uploadImageUploadImagePostResponseError)

export const getUploadImageUploadImagePostUrl = (params: UploadImageUploadImagePostParams,) => {
  const normalizedParams = new URLSearchParams();

  Object.entries(params || {}).forEach(([key, value]) => {

    if (value !== undefined) {
      normalizedParams.append(key, value === null ? 'null' : String(value))
    }
  });

  const stringifiedParams = normalizedParams.toString();

  return stringifiedParams.length > 0 ? `/upload/image?${stringifiedParams}` : `/upload/image`
}

/**
 * @summary Upload Image
 */
export const uploadImageUploadImagePost = async (bodyUploadImageUploadImagePost: BodyUploadImageUploadImagePost,
    params: UploadImageUploadImagePostParams, options?: Parameters<typeof customInstance>[1]): Promise<uploadImageUploadImagePostResponse> => {
    const formData = new FormData();
formData.append(`file`, bodyUploadImageUploadImagePost.file);

  return customInstance<uploadImageUploadImagePostResponse>(getUploadImageUploadImagePostUrl(params),
  {
    ...options,
    method: 'POST'
    ,
    body: formData
  }
);}


export type uploadProfilePictureUploadProfilePictureMePostResponse200 = {
  data: unknown
  status: 200
}

export type uploadProfilePictureUploadProfilePictureMePostResponse422 = {
  data: HTTPValidationError
  status: 422
}

export type uploadProfilePictureUploadProfilePictureMePostResponseSuccess = (uploadProfilePictureUploadProfilePictureMePostResponse200) & {
  headers: Headers;
};
export type uploadProfilePictureUploadProfilePictureMePostResponseError = (uploadProfilePictureUploadProfilePictureMePostResponse422) & {
  headers: Headers;
};

export type uploadProfilePictureUploadProfilePictureMePostResponse = (uploadProfilePictureUploadProfilePictureMePostResponseSuccess | uploadProfilePictureUploadProfilePictureMePostResponseError)

export const getUploadProfilePictureUploadProfilePictureMePostUrl = () => {




  return `/upload/profile_picture/me`
}

/**
 * Given the uploaded file, store it on the server
 *
 * Use the generated URL to assign the image to the user's profile
 *
 * Return the relevant image information
 * @summary Upload Profile Picture
 */
export const uploadProfilePictureUploadProfilePictureMePost = async (bodyUploadProfilePictureUploadProfilePictureMePost: BodyUploadProfilePictureUploadProfilePictureMePost, options?: Parameters<typeof customInstance>[1]): Promise<uploadProfilePictureUploadProfilePictureMePostResponse> => {
    const formData = new FormData();
formData.append(`file`, bodyUploadProfilePictureUploadProfilePictureMePost.file);

  return customInstance<uploadProfilePictureUploadProfilePictureMePostResponse>(getUploadProfilePictureUploadProfilePictureMePostUrl(),
  {
    ...options,
    method: 'POST'
    ,
    body: formData
  }
);}


