Api class
Loading indicators. Api GetX Controller
Api is the Api class for commuting backend.
It extends GetxController
to update when user information changes.
Constructors
- Api()
Properties
- apiUrl ↔ String
-
apiUrl is the api url.
getter/setter pair
-
authChanges
↔ BehaviorSubject<
ApiUser?> -
authChanges is posted on user login or logout. (Not on profile reading or updating)
getter/setter pair
- cart ↔ Cart
-
쇼핑몰 카트
getter/setter pair
- dio ↔ Dio
-
getter/setter pair
- enableFirebase ↔ bool?
-
To use firebase or not.
getter/setter pair
- enableMessaging ↔ bool?
-
Firebase Messaging
getter/setter pair
- error ↔ PublishSubject
-
errror
is posted on any error.getter/setter pair - firebaseAuth → FirebaseAuth
-
no setter
-
firebaseInitialized
↔ BehaviorSubject<
bool> -
firebaseInitialized will be posted with
true
when it is initialized.getter/setter pair - firestore → FirebaseFirestore
-
The firestore is Firestore database instance.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- idx → int?
-
no setter
- imageCompressor ↔ Function?
-
Image compressor after taking Image.
getter/setter pair
- isAdmin → bool
-
no setter
- isNewCommentOnMyPostOrComment → bool
-
no setter
- loggedIn → bool
-
no setter
- name → String?
-
no setter
- nickname → String?
-
no setter
- nicknameOrName → String?
-
no setter
- notLoggedIn → bool
-
no setter
- onForegroundMessage ↔ Function?
-
onForegroundMessage will be posted when there is a foreground message.
getter/setter pair
- onMessageOpenedFromBackground ↔ Function?
-
getter/setter pair
- onMessageOpenedFromTermiated ↔ Function?
-
getter/setter pair
- onNotificationPermissionDenied ↔ Function?
-
Event handlers on perssion state changes. for iOS only.
These event will be called when permission is denied or not determined.
getter/setter pair
- onNotificationPermissionNotDetermined ↔ Function?
-
getter/setter pair
- photoUrl → String?
-
no setter
-
profileChanges
↔ BehaviorSubject<
ApiUser?> -
The profileChanges is posted when user profile changed and login & logout.
getter/setter pair
- profileComplete → bool
-
no setter
- profileLoading ↔ bool
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sessionId → String?
-
no setter
-
settingChanges
↔ PublishSubject<
Map< String, dynamic> > -
App Settings
getter/setter pair
-
settings
↔ Map<
String, dynamic> -
settings is the settings that was develivered over settingChanges event.
getter/setter pair
- token ↔ String?
-
token is the push notification token.
getter/setter pair
-
translationChanges
↔ PublishSubject<
Map< String, dynamic> ?> -
Translations
getter/setter pair
- user ↔ ApiUser?
-
getter/setter pair
- userIdx → String?
-
no setter
Methods
-
addFriend(
{required String otherIdx}) → Future< ApiFriend> - 친구 추가
-
appGet(
String table) → Future - Get login user's record of a table.
-
appUpdate(
String table, String field, String value) → Future - Update login user's record of a table.
-
backupCart(
) → dynamic -
blockFriend(
{required String otherIdx}) → Future< ApiFriend> -
blockListFriend(
) → Future< List< ApiShortUser> > -
categoryCreate(
{String? id, String title = ''}) → Future< ApiCategory> -
categoryGet(
String id) → Future< ApiCategory> - Get a category
-
categoryGets(
List< String> ids) → Future<List< ApiCategory> > - Gets a list of category
-
categorySearch(
{int limit = 10}) → Future< List< ApiCategory> > -
categoryUpdate(
{required String id, String? field, String? value, Map< String, dynamic> ? data}) → Future<ApiCategory> - Category Update
-
checkUserProfile(
) → Future< bool> - Return true if there is no problem on user's profile or throws an error.
-
commentDelete(
ApiComment comment, ApiPost post) → Future< String?> - Deletes a comment.
-
commentEdit(
{String? idx, String? rootIdx, String? parentIdx, String? content, List< ApiFile> ? files, Map<String, dynamic> ? data, ApiComment? comment}) → Future<ApiComment> -
commentSearch(
{String? userIdx, String? categoryIdx, bool? files, int limit = 20, int page = 1, String order = 'DESC'}) → Future< List< ApiComment> > - 코멘트 검색
-
deleteFile(
String? idx, {dynamic postOrComment}) → Future< int> - Deletes a file.
-
deleteFriend(
{required String otherIdx}) → Future< ApiFriend> -
editComment(
{dynamic content = '', List< ApiFile> ? files, required ApiPost post, ApiComment? parent, ApiComment? comment}) → Future<ApiComment> -
editPost(
{int? id, String? category, String? title, String? content, List< ApiFile> ? files, Map<String, dynamic> ? data, ApiPost? post}) → Future<ApiPost> - edit(create or update) post
-
fetchPosts(
ApiForum forum) → Future< void> -
Fetch posts based on the options of
forum
-
friendRelationship(
{required String otherIdx}) → Future< ApiFriend> -
getPost(
dynamic id) → Future< ApiPost> -
getPosts(
{String? category, int limit = 20, int paged = 1, String? userIdx}) → Future< List< ApiPost> > -
getPosts is an alias of
searchPosts
-
init(
{required String apiUrl, bool enableFirebase = false, bool enableMessaging = false, Function? onNotificationPermissionDenied, Function? onNotificationPermissionNotDetermined, Function? onForegroundMessage, Function? onMessageOpenedFromTermiated, Function? onMessageOpenedFromBackground, Function? imageCompressor, Function? initUser}) → Future< void> - Initialization
-
isSubscribeChat(
dynamic topic) → bool -
isSubscribeTopic(
dynamic topic) → bool -
listFriend(
) → Future< List< ApiShortUser> > -
login(
{required String email, required String password}) → Future< ApiUser?> -
loginOrRegister(
{required String email, required String password, Map< String, dynamic> ? data}) → Future<ApiUser?> -
logout(
) → Future< void> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
otherUserProfile(
{String? idx, String? email, String? firebaseUid}) → Future< ApiUser> - Returns other user profile data.
-
pointHistorySearch(
{String select = 'idx, fromUserIdx, toUserIdx, createdAt', String where = '1', int page = 1, int limit = 10}) → Future< List< ApiPointHistory> > -
pointMove(
{String? postIdx, String? point}) → Future< int?> -
postCount(
String where) → Future< String?> - count post based on the condition
-
postDelete(
ApiPost post, [ApiForum? forum]) → Future< String?> - Deletes a post.
-
postEdit(
{String? idx, String? relationIdx, String? categoryId, String? subcategory, String? title, String? content, List< ApiFile> ? files, String? code, Map<String, dynamic> ? data, ApiPost? post}) → Future<ApiPost> -
postGet(
String idx) → Future< ApiPost> -
postGets(
List< int> idxes) → Future<List< ApiPost> > -
postSearch(
{String? postOnTop, String? categoryId, List< String> ? categoryIds, String? subcategory, String? code, int? limit = 20, int page = 1, String? userIdx, String? relationIdx, String? searchKey = '', bool photo = false, String? type, String order = 'idx', String by = 'DESC', int? days}) → Future<List< ApiPost> > - Get posts from backend.
-
postToday(
{required String categoryId, String userIdx = '0', int limit = 10}) → Future< List< ApiPost> > - Returns a post of today based on the categoryId and userIdx. 오늘 작성한 글을 가져온다.
-
query(
String table, String where) → Future - Query directly to database with SQL.
-
refreshProfile(
{String? sessionId}) → Future< ApiUser?> - Refresh user profile and notify
-
refreshUserProfile(
) → Future< ApiUser?> - Refresh user profile
-
register(
{required String email, required String password, Map< String, dynamic> ? data}) → Future<ApiUser?> -
data
will be saved as user property. You can save whatever but may need to update the ApiUser model accordingly. -
reportArticle(
String idx) → Future - 글 또는 코멘트를 신고
-
request<
T> (Map< String, dynamic> data) → Future<T> -
restoreCart(
) → dynamic - 장바구니 복구
-
searchComments(
{String? userIdx, int limit = 20, int page = 1, String order = 'DESC'}) → Future< List< ApiComment> > -
searchKeyStats(
{int days = 1}) → Future< List< ApiSearchKeyStat> > - Load search keywords from Backend
-
searchPost(
{int? postIdOnTop, String? category, int limit = 20, int paged = 1, String? author, String? searchKey}) → Future< List< ApiPost> > - Get posts from backend.
-
sendMessageToTokens(
{String? tokens, String? title, String? body, Map< String, dynamic> ? data, String? imageUrl}) → dynamic -
sendMessageToTopic(
{String? topic, String? title, String? body, Map< String, dynamic> ? data, String? imageUrl}) → dynamic -
sendPushNotificationToUsers(
{List< String> ? users, String? subscription, String? title, String? body, Map<String, dynamic> ? data, String? imageUrl}) → Future -
setConfig(
String code, dynamic data) → dynamic - 설정을 서버에 저장한다. 주의: 관리자만 사용 할 수 있다. 관리자가 아니면 백엔드에서 에러가 난다.
-
subscribeOrUnsubscribe(
{String? route, String? topic}) → Future< ApiUser?> - @todo change method name.
-
subscribeOrUnsubscribeTopic(
String? topic) → Future< ApiUser?> -
subscribeTopic(
String topic, [dynamic tokens]) → dynamic -
takeUploadFile(
{required ImageSource source, int quality = 90, bool deletePreviousUpload = false, String taxonomy = '', int entity = 0, String code = '', required Function? onProgress}) → Future< ApiFile> - 사진업로드
-
thumbnailUrl(
{String? src, String? code, int width = 320, int height = 320, int quality = 75, bool original = false}) → String - Return thumbnail image url of an upload file/image.
-
toString(
) → String -
A string representation of this object.
inherited
-
unblockFriend(
{required String otherIdx}) → Future< ApiFriend> -
unsubscribeTopic(
String topic, [dynamic tokens]) → dynamic -
updateToken(
String? token, {String topic = ''}) → Future - Save token to backend.
-
uploadFile(
{File? file, Uint8List? bytes, Function? onProgress, bool deletePreviousUpload = false, String taxonomy = '', int entity = 0, String code = ''}) → Future< ApiFile> -
userHeart(
) → Future< String?> -
userOptionSwitch(
{String? option, String route = 'user.switch'}) → Future< ApiUser?> -
Switch
option
toon
andoff
. Ifoption
doesnt exist it switch toon
. Ifoption
ison
it switch tooff
. Ifoption
isoff
it switch toon
. -
userOptionSwitchOff(
String option) → Future< ApiUser?> -
it will always switch the
option
:off
-
userOptionSwitchOn(
String option) → Future< ApiUser?> -
it will always switch the
option
:on
-
userSearch(
{String? name}) → Future< List< ApiShortUser> > -
userUpdate(
Map< String, dynamic> data) → Future<ApiUser?> -
userUpdateFirebaseUid(
String uid) → Future< void> - Save firebase uid into centerx.
-
version(
) → Future - Get version of backend api.
-
vote(
dynamic postOrComment, String choice) → Future
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited