//
//  ChatNetApi.m
//  TUIContact
//
//  Created by gan on 2025/3/24.
//

#import <Foundation/Foundation.h>
#import "ChatNetApi.h"


@implementation ChatNetApi

//获取普通聊天列表
+(void)getchats:(NSDictionary *_Nullable)parameters succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    [GBaseNetApi.shareInstance httpGetToken:parameters url:@"/api/sys/chat/list" succ:succ fail:fail];
}
//获取置顶聊天列表
+(void)gettopchats:(NSDictionary *_Nullable)parameters succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    [GBaseNetApi.shareInstance httpGetToken:parameters url:@"/api/sys/chat/topList" succ:succ fail:fail];
}


//删除聊天列表
+(void)removechat:(NSString *_Nullable)chatId succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    NSString *urlstr=[NSString stringWithFormat:@"/api/sys/chat/%@",chatId];
    [GBaseNetApi.shareInstance httpDelToken:nil url:urlstr succ:succ fail:fail];
}

//设置置顶聊天列表
+(void)settopchats:(NSString *_Nullable)chatId succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    NSString *urlstr=[NSString stringWithFormat:@"/api/sys/chat/top?chatId=%@",chatId];
    [GBaseNetApi.shareInstance httpGetToken:nil url:urlstr succ:succ fail:fail];
}

//取消置顶聊天列表
+(void)canceltopchat:(NSString *_Nullable)chatId succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    NSString *urlstr=[NSString stringWithFormat:@"/api/sys/chat/cancelTop?chatId=%@",chatId];
    [GBaseNetApi.shareInstance httpGetToken:nil url:urlstr succ:succ fail:fail];
}

//获取聊天窗离线消息  type=0私聊，type=1是群聊
+(void)getOutLineMsg:(NSString *_Nullable)chatId type:(NSInteger)type succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    NSString *urlstr=[NSString stringWithFormat:@"/api/sys/messages/allMessage?type=%ld&chatId=%@",(long)type,chatId];
    NSLog(@"urlstr:%@",urlstr);
    [GBaseNetApi.shareInstance httpGetToken:nil url:urlstr succ:succ fail:fail];
}

//获取群聊消息  type=0私聊，type=1是群聊
+(void)getqunOutLineMsg:(NSString *_Nullable)chatId timestamp:(NSInteger)timestamp size:(NSInteger)size succ:(nullable GSucc)succ fail:(nullable GFail)fail{
    NSString *urlstr=[NSString stringWithFormat:@"/api/sys/messages/queryGroupMessage?timestamp=%ld&chatId=%@&size=%ld",(long)timestamp,chatId,(long)size];
    [GBaseNetApi.shareInstance httpGetToken:nil url:urlstr succ:succ fail:fail];
}

@end
