/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ApiEmptyResponse } from '../models/ApiEmptyResponse';
import type { ApiResponse_ChannelCategory } from '../models/ApiResponse_ChannelCategory';
import type { ApiResponse_ChannelDetail } from '../models/ApiResponse_ChannelDetail';
import type { ApiResponse_ChannelMember } from '../models/ApiResponse_ChannelMember';
import type { ApiResponse_Vec_ChannelCategory } from '../models/ApiResponse_Vec_ChannelCategory';
import type { ApiResponse_Vec_ChannelDetail } from '../models/ApiResponse_Vec_ChannelDetail';
import type { ApiResponse_Vec_ChannelMember } from '../models/ApiResponse_Vec_ChannelMember';
import type { CreateCategoryParams } from '../models/CreateCategoryParams';
import type { CreateChannelParams } from '../models/CreateChannelParams';
import type { InviteMemberParams } from '../models/InviteMemberParams';
import type { UpdateCategoryParams } from '../models/UpdateCategoryParams';
import type { UpdateChannelParams } from '../models/UpdateChannelParams';
import type { UpdateMemberParams } from '../models/UpdateMemberParams';
import type { CancelablePromise } from '../core/CancelablePromise';
import { OpenAPI } from '../core/OpenAPI';
import { request as __request } from '../core/request';
export class ImService {
	/**
	 * List categories
	 * @returns ApiResponse_Vec_ChannelCategory Categories listed successfully
	 * @throws ApiError
	 */
	public static imCategoryList({
		workspaceName,
	}: {
		workspaceName: string,
	}): CancelablePromise<ApiResponse_Vec_ChannelCategory> {
		return __request(OpenAPI, {
			method: 'GET',
			url: '/api/v1/im/workspaces/{workspace_name}/categories',
			path: {
				'workspace_name': workspaceName,
			},
			errors: {
				401: `Authentication required`,
				404: `Workspace not found`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * @returns ApiResponse_ChannelCategory Category created successfully
	 * @throws ApiError
	 */
	public static imCategoryCreate({
		workspaceName,
		requestBody,
	}: {
		workspaceName: string,
		/**
		 * Category creation parameters
		 */
		requestBody: CreateCategoryParams,
	}): CancelablePromise<ApiResponse_ChannelCategory> {
		return __request(OpenAPI, {
			method: 'POST',
			url: '/api/v1/im/workspaces/{workspace_name}/categories',
			path: {
				'workspace_name': workspaceName,
			},
			body: requestBody,
			mediaType: 'application/json',
			errors: {
				400: `Invalid parameters`,
				401: `Authentication required`,
				404: `Workspace not found`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Update a category
	 * @returns ApiResponse_ChannelCategory Category updated successfully
	 * @throws ApiError
	 */
	public static imCategoryUpdate({
		workspaceName,
		categoryId,
		requestBody,
	}: {
		workspaceName: string,
		categoryId: string,
		/**
		 * Category update parameters
		 */
		requestBody: UpdateCategoryParams,
	}): CancelablePromise<ApiResponse_ChannelCategory> {
		return __request(OpenAPI, {
			method: 'PUT',
			url: '/api/v1/im/workspaces/{workspace_name}/categories/{category_id}',
			path: {
				'workspace_name': workspaceName,
				'category_id': categoryId,
			},
			body: requestBody,
			mediaType: 'application/json',
			errors: {
				400: `Invalid parameters`,
				401: `Authentication required`,
				404: `Workspace or category not found`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Delete a category
	 * @returns ApiEmptyResponse Category deleted successfully
	 * @throws ApiError
	 */
	public static imCategoryDelete({
		workspaceName,
		categoryId,
	}: {
		workspaceName: string,
		categoryId: string,
	}): CancelablePromise<ApiEmptyResponse> {
		return __request(OpenAPI, {
			method: 'DELETE',
			url: '/api/v1/im/workspaces/{workspace_name}/categories/{category_id}',
			path: {
				'workspace_name': workspaceName,
				'category_id': categoryId,
			},
			errors: {
				401: `Authentication required`,
				404: `Workspace or category not found`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * List channels
	 * @returns ApiResponse_Vec_ChannelDetail Channels listed successfully
	 * @throws ApiError
	 */
	public static imChannelList({
		workspaceName,
		channelType,
		channelKind,
		categoryId,
		archived,
		limit,
		offset,
	}: {
		workspaceName: string,
		channelType?: string | null,
		channelKind?: string | null,
		categoryId?: string | null,
		archived?: boolean | null,
		limit?: number | null,
		offset?: number | null,
	}): CancelablePromise<ApiResponse_Vec_ChannelDetail> {
		return __request(OpenAPI, {
			method: 'GET',
			url: '/api/v1/im/workspaces/{workspace_name}/channels',
			path: {
				'workspace_name': workspaceName,
			},
			query: {
				'channel_type': channelType,
				'channel_kind': channelKind,
				'category_id': categoryId,
				'archived': archived,
				'limit': limit,
				'offset': offset,
			},
			errors: {
				401: `Authentication required`,
				404: `Workspace not found`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Create a channel
	 * @returns ApiResponse_ChannelDetail Channel created successfully
	 * @throws ApiError
	 */
	public static imChannelCreate({
		workspaceName,
		requestBody,
	}: {
		workspaceName: string,
		/**
		 * Channel creation parameters
		 */
		requestBody: CreateChannelParams,
	}): CancelablePromise<ApiResponse_ChannelDetail> {
		return __request(OpenAPI, {
			method: 'POST',
			url: '/api/v1/im/workspaces/{workspace_name}/channels',
			path: {
				'workspace_name': workspaceName,
			},
			body: requestBody,
			mediaType: 'application/json',
			errors: {
				400: `Invalid parameters`,
				401: `Authentication required`,
				404: `Workspace not found`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Get a channel
	 * @returns ApiResponse_ChannelDetail Channel retrieved successfully
	 * @throws ApiError
	 */
	public static imChannelGet({
		workspaceName,
		channelId,
	}: {
		workspaceName: string,
		channelId: string,
	}): CancelablePromise<ApiResponse_ChannelDetail> {
		return __request(OpenAPI, {
			method: 'GET',
			url: '/api/v1/im/workspaces/{workspace_name}/channels/{channel_id}',
			path: {
				'workspace_name': workspaceName,
				'channel_id': channelId,
			},
			errors: {
				401: `Authentication required`,
				404: `Workspace or channel not found`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Update a channel
	 * @returns ApiResponse_ChannelDetail Channel updated successfully
	 * @throws ApiError
	 */
	public static imChannelUpdate({
		workspaceName,
		channelId,
		requestBody,
	}: {
		workspaceName: string,
		channelId: string,
		/**
		 * Channel update parameters
		 */
		requestBody: UpdateChannelParams,
	}): CancelablePromise<ApiResponse_ChannelDetail> {
		return __request(OpenAPI, {
			method: 'PUT',
			url: '/api/v1/im/workspaces/{workspace_name}/channels/{channel_id}',
			path: {
				'workspace_name': workspaceName,
				'channel_id': channelId,
			},
			body: requestBody,
			mediaType: 'application/json',
			errors: {
				400: `Invalid parameters`,
				401: `Authentication required`,
				404: `Workspace or channel not found`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Delete a channel
	 * @returns ApiEmptyResponse Channel deleted successfully
	 * @throws ApiError
	 */
	public static imChannelDelete({
		workspaceName,
		channelId,
	}: {
		workspaceName: string,
		channelId: string,
	}): CancelablePromise<ApiEmptyResponse> {
		return __request(OpenAPI, {
			method: 'DELETE',
			url: '/api/v1/im/workspaces/{workspace_name}/channels/{channel_id}',
			path: {
				'workspace_name': workspaceName,
				'channel_id': channelId,
			},
			errors: {
				401: `Authentication required`,
				404: `Workspace or channel not found`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Join a channel
	 * @returns ApiResponse_ChannelMember Joined channel successfully
	 * @throws ApiError
	 */
	public static imMemberJoin({
		workspaceName,
		channelId,
	}: {
		workspaceName: string,
		channelId: string,
	}): CancelablePromise<ApiResponse_ChannelMember> {
		return __request(OpenAPI, {
			method: 'POST',
			url: '/api/v1/im/workspaces/{workspace_name}/channels/{channel_id}/join',
			path: {
				'workspace_name': workspaceName,
				'channel_id': channelId,
			},
			errors: {
				401: `Authentication required`,
				404: `Workspace or channel not found`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Leave a channel
	 * @returns ApiEmptyResponse Left channel successfully
	 * @throws ApiError
	 */
	public static imMemberLeave({
		workspaceName,
		channelId,
	}: {
		workspaceName: string,
		channelId: string,
	}): CancelablePromise<ApiEmptyResponse> {
		return __request(OpenAPI, {
			method: 'POST',
			url: '/api/v1/im/workspaces/{workspace_name}/channels/{channel_id}/leave',
			path: {
				'workspace_name': workspaceName,
				'channel_id': channelId,
			},
			errors: {
				401: `Authentication required`,
				404: `Workspace or channel not found`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * List channel members
	 * @returns ApiResponse_Vec_ChannelMember Members listed successfully
	 * @throws ApiError
	 */
	public static imMemberList({
		workspaceName,
		channelId,
		limit,
		offset,
	}: {
		workspaceName: string,
		channelId: string,
		limit?: number | null,
		offset?: number | null,
	}): CancelablePromise<ApiResponse_Vec_ChannelMember> {
		return __request(OpenAPI, {
			method: 'GET',
			url: '/api/v1/im/workspaces/{workspace_name}/channels/{channel_id}/members',
			path: {
				'workspace_name': workspaceName,
				'channel_id': channelId,
			},
			query: {
				'limit': limit,
				'offset': offset,
			},
			errors: {
				401: `Authentication required`,
				404: `Workspace or channel not found`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Invite a member
	 * @returns ApiResponse_ChannelMember Member invited successfully
	 * @throws ApiError
	 */
	public static imMemberInvite({
		workspaceName,
		channelId,
		requestBody,
	}: {
		workspaceName: string,
		channelId: string,
		/**
		 * Invitation parameters
		 */
		requestBody: InviteMemberParams,
	}): CancelablePromise<ApiResponse_ChannelMember> {
		return __request(OpenAPI, {
			method: 'POST',
			url: '/api/v1/im/workspaces/{workspace_name}/channels/{channel_id}/members',
			path: {
				'workspace_name': workspaceName,
				'channel_id': channelId,
			},
			body: requestBody,
			mediaType: 'application/json',
			errors: {
				400: `Invalid parameters`,
				401: `Authentication required`,
				404: `Workspace or channel not found`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Update member role
	 * @returns ApiResponse_ChannelMember Member updated successfully
	 * @throws ApiError
	 */
	public static imMemberUpdate({
		workspaceName,
		channelId,
		userId,
		requestBody,
	}: {
		workspaceName: string,
		channelId: string,
		userId: string,
		/**
		 * Member update parameters
		 */
		requestBody: UpdateMemberParams,
	}): CancelablePromise<ApiResponse_ChannelMember> {
		return __request(OpenAPI, {
			method: 'PUT',
			url: '/api/v1/im/workspaces/{workspace_name}/channels/{channel_id}/members/{user_id}',
			path: {
				'workspace_name': workspaceName,
				'channel_id': channelId,
				'user_id': userId,
			},
			body: requestBody,
			mediaType: 'application/json',
			errors: {
				400: `Invalid parameters`,
				401: `Authentication required`,
				404: `Workspace, channel or member not found`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Kick a member
	 * @returns ApiEmptyResponse Member kicked successfully
	 * @throws ApiError
	 */
	public static imMemberKick({
		workspaceName,
		channelId,
		userId,
	}: {
		workspaceName: string,
		channelId: string,
		userId: string,
	}): CancelablePromise<ApiEmptyResponse> {
		return __request(OpenAPI, {
			method: 'DELETE',
			url: '/api/v1/im/workspaces/{workspace_name}/channels/{channel_id}/members/{user_id}',
			path: {
				'workspace_name': workspaceName,
				'channel_id': channelId,
				'user_id': userId,
			},
			errors: {
				401: `Authentication required`,
				404: `Workspace, channel or member not found`,
				500: `Internal server error`,
			},
		});
	}
}
