Files
keyboard/keyBoard/Class/Me/VM/KBMyVM.h
2025-12-04 16:59:59 +08:00

53 lines
1.9 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// KBMyVM.h
// keyBoard
//
// Created by Mac on 2025/12/3.
//
#import <Foundation/Foundation.h>
#import "KBCharacter.h"
@class KBUser;
NS_ASSUME_NONNULL_BEGIN
/// 用户人设发生变更(例如从“我的键盘”中删除)时的进程内通知。
/// userInfo:
/// @"characterId" : NSNumber(NSInteger) 被删除或变更的人设 id
extern NSString * const KBUserCharacterDeletedNotification;
typedef void(^KBMyUserDetailCompletion)(KBUser *_Nullable user, NSError *_Nullable error);
typedef void(^KBCharacterListCompletion)(NSArray<KBCharacter *> *characterArray, NSError *_Nullable error);
typedef void(^KBUpLoadAvatarCompletion)(BOOL success, NSError * _Nullable error);
typedef void(^KBUpdateUserInfoCompletion)(BOOL success, NSError * _Nullable error);
typedef void(^KBUpdateCharacterSortCompletion)(BOOL success, NSError * _Nullable error);
typedef void(^KBDeleteUserCharacterCompletion)(BOOL success, NSError * _Nullable error);
@interface KBMyVM : NSObject
/// 获取当前用户详情(/user/detail
- (void)fetchUserDetailWithCompletion:(KBMyUserDetailCompletion)completion;
/// 用户人设列表(/character/listByUser
- (void)fetchCharacterListByUserWithCompletion:(KBCharacterListCompletion)completion;
/// 更新用户人设排序
- (void)updateUserCharacterSortWithSortArray:(NSArray<NSNumber *> *)sortArray
completion:(KBUpdateCharacterSortCompletion)completion;
/// 删除用户人设(/character/delUserCharacter
- (void)deleteUserCharacterWithId:(NSNumber *)characterId
completion:(KBDeleteUserCharacterCompletion)completion;
/// 上传头像
- (void)upLoadAvatarWithData:(NSData *)avatarData completion:(KBUpLoadAvatarCompletion)completion;
/// 更新用户信息 -(头像、用户名、性别)
- (void)updateUserInfo:(KBUser *)user completion:(KBUpdateUserInfoCompletion)completion;
/// 退出登录
- (void)logout;
@end
NS_ASSUME_NONNULL_END