@ccw-api/api 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +367 -0
- package/dist/esm/src/bfs-web/index.js +4 -0
- package/dist/esm/src/bfs-web/users/{oid}/extensions.js +21 -0
- package/dist/esm/src/bfs-web/users/{oid}/extensions.test.js +4 -0
- package/dist/esm/src/community-web/api/v1/short_code/encode.js +25 -0
- package/dist/esm/src/community-web/api/v1/short_code/shortcode.test.js +5 -0
- package/dist/esm/src/community-web/approval/approval.test.js +5 -0
- package/dist/esm/src/community-web/approval/list.js +16 -0
- package/dist/esm/src/community-web/base/dateTime.js +10 -0
- package/dist/esm/src/community-web/base/dateTime.test.js +6 -0
- package/dist/esm/src/community-web/campaign_resource/detail.js +12 -0
- package/dist/esm/src/community-web/campaign_resource/detail.test.js +10 -0
- package/dist/esm/src/community-web/ccw-main/status.js +12 -0
- package/dist/esm/src/community-web/ccw-main/status.test.js +4 -0
- package/dist/esm/src/community-web/check_in_record/check_in_record.test.js +8 -0
- package/dist/esm/src/community-web/check_in_record/detail.js +11 -0
- package/dist/esm/src/community-web/check_in_record/insert.js +12 -0
- package/dist/esm/src/community-web/cloud_asset/search.js +25 -0
- package/dist/esm/src/community-web/cloud_asset/search.test.js +6 -0
- package/dist/esm/src/community-web/cloud_asset/user/privacy.js +11 -0
- package/dist/esm/src/community-web/cloud_asset/user/privacy.test.js +4 -0
- package/dist/esm/src/community-web/comment/create.js +16 -0
- package/dist/esm/src/community-web/comment/create.test.js +13 -0
- package/dist/esm/src/community-web/comment/like_record/create.js +13 -0
- package/dist/esm/src/community-web/comment/like_record/create.test.js +4 -0
- package/dist/esm/src/community-web/comment/page.js +24 -0
- package/dist/esm/src/community-web/comment/page.test.js +15 -0
- package/dist/esm/src/community-web/comment/page_by_topic.js +28 -0
- package/dist/esm/src/community-web/comment/page_by_topic.test.js +13 -0
- package/dist/esm/src/community-web/comment/reply.js +17 -0
- package/dist/esm/src/community-web/comment/reply.test.js +4 -0
- package/dist/esm/src/community-web/config/detail.js +13 -0
- package/dist/esm/src/community-web/config/detail.test.js +9 -0
- package/dist/esm/src/community-web/creation/detail.js +14 -0
- package/dist/esm/src/community-web/creation/detail.test.js +18 -0
- package/dist/esm/src/community-web/creation/excellent/list.js +13 -0
- package/dist/esm/src/community-web/creation/excellent/list.test.js +10 -0
- package/dist/esm/src/community-web/creation/introduction/detail.js +13 -0
- package/dist/esm/src/community-web/creation/introduction/detail.test.js +17 -0
- package/dist/esm/src/community-web/creation/like/detail.js +13 -0
- package/dist/esm/src/community-web/creation/like/detail.test.js +19 -0
- package/dist/esm/src/community-web/creation/loading/tips.js +11 -0
- package/dist/esm/src/community-web/creation/loading/tips.test.js +8 -0
- package/dist/esm/src/community-web/creation/own/page.js +26 -0
- package/dist/esm/src/community-web/creation/own/page.test.js +4 -0
- package/dist/esm/src/community-web/creation/page.js +24 -0
- package/dist/esm/src/community-web/creation/page.test.js +16 -0
- package/dist/esm/src/community-web/creation/page_by_student.js +24 -0
- package/dist/esm/src/community-web/creation/page_by_student.test.js +20 -0
- package/dist/esm/src/community-web/creation/potential/list.js +13 -0
- package/dist/esm/src/community-web/creation/potential/list.test.js +10 -0
- package/dist/esm/src/community-web/creation/recommend.js +23 -0
- package/dist/esm/src/community-web/creation/recommend.test.js +10 -0
- package/dist/esm/src/community-web/creation/search/page.js +24 -0
- package/dist/esm/src/community-web/creation/search/page.test.js +5 -0
- package/dist/esm/src/community-web/creation/smart_contract/split_rule/create.js +14 -0
- package/dist/esm/src/community-web/creation/smart_contract/split_rule/create.test.js +4 -0
- package/dist/esm/src/community-web/creation/smart_contract/split_rule/detail.js +13 -0
- package/dist/esm/src/community-web/creation/smart_contract/split_rule/detail.test.js +4 -0
- package/dist/esm/src/community-web/creation/student/detail.js +13 -0
- package/dist/esm/src/community-web/creation/student/detail.test.js +17 -0
- package/dist/esm/src/community-web/creation/submit.js +12 -0
- package/dist/esm/src/community-web/creation/submit.test.js +32 -0
- package/dist/esm/src/community-web/creation/tag/list.js +12 -0
- package/dist/esm/src/community-web/creation/tag/list.test.js +10 -0
- package/dist/esm/src/community-web/creation/team_member/list.js +14 -0
- package/dist/esm/src/community-web/creation/team_member/list.test.js +4 -0
- package/dist/esm/src/community-web/creation/team_member/produce_ticket.js +13 -0
- package/dist/esm/src/community-web/creation/team_member/produce_ticket.test.js +4 -0
- package/dist/esm/src/community-web/creation/teamwork_log/page.js +38 -0
- package/dist/esm/src/community-web/creation/teamwork_log/page.test.js +4 -0
- package/dist/esm/src/community-web/creation/update.js +22 -0
- package/dist/esm/src/community-web/creation/update.test.js +4 -0
- package/dist/esm/src/community-web/creation_activity_stats/list.js +13 -0
- package/dist/esm/src/community-web/creation_activity_stats/list.test.js +5 -0
- package/dist/esm/src/community-web/creation_attribute/detail.js +24 -0
- package/dist/esm/src/community-web/creation_attribute/detail.test.js +10 -0
- package/dist/esm/src/community-web/creation_donated_record/ranking_list.js +22 -0
- package/dist/esm/src/community-web/creation_donated_record/ranking_list.test.js +12 -0
- package/dist/esm/src/community-web/creation_favorite/detail.js +13 -0
- package/dist/esm/src/community-web/creation_favorite/detail.test.js +5 -0
- package/dist/esm/src/community-web/creation_recommend_position/list.js +14 -0
- package/dist/esm/src/community-web/creation_recommend_position/list.test.js +5 -0
- package/dist/esm/src/community-web/creation_release/code_profiling/detail.js +14 -0
- package/dist/esm/src/community-web/creation_release/code_profiling/detail.test.js +5 -0
- package/dist/esm/src/community-web/creation_release/page.js +24 -0
- package/dist/esm/src/community-web/creation_release/page.test.js +12 -0
- package/dist/esm/src/community-web/creation_screenshot/page.js +20 -0
- package/dist/esm/src/community-web/creation_screenshot/page.test.js +11 -0
- package/dist/esm/src/community-web/creation_stats/view.js +14 -0
- package/dist/esm/src/community-web/creation_stats/view.test.js +6 -0
- package/dist/esm/src/community-web/currency/account/personal.js +11 -0
- package/dist/esm/src/community-web/currency/account/personal.test.js +4 -0
- package/dist/esm/src/community-web/emoji/all.js +11 -0
- package/dist/esm/src/community-web/emoji/all.test.js +11 -0
- package/dist/esm/src/community-web/emoji/category/list.js +11 -0
- package/dist/esm/src/community-web/emoji/category/list.test.js +9 -0
- package/dist/esm/src/community-web/emoji/page.js +23 -0
- package/dist/esm/src/community-web/emoji/page.test.js +12 -0
- package/dist/esm/src/community-web/event.js +13 -0
- package/dist/esm/src/community-web/event.test.js +5 -0
- package/dist/esm/src/community-web/hash_tag/detail.js +13 -0
- package/dist/esm/src/community-web/hash_tag/hash_tag_detail.test.js +9 -0
- package/dist/esm/src/community-web/hash_tag/managed/list.js +29 -0
- package/dist/esm/src/community-web/hash_tag/managed/managed_list.test.js +10 -0
- package/dist/esm/src/community-web/hash_tag/recommend/list.js +11 -0
- package/dist/esm/src/community-web/hash_tag/recommend/list.test.js +4 -0
- package/dist/esm/src/community-web/hash_tag_creation/hash_tag_creation_list_relation.test.js +4 -0
- package/dist/esm/src/community-web/hash_tag_creation/hash_tag_creation_mine.test.js +4 -0
- package/dist/esm/src/community-web/hash_tag_creation/list_relation.js +13 -0
- package/dist/esm/src/community-web/hash_tag_creation/list_relation.test.js +5 -0
- package/dist/esm/src/community-web/hash_tag_creation/mine.js +29 -0
- package/dist/esm/src/community-web/hash_tag_favorite/detail.js +13 -0
- package/dist/esm/src/community-web/hash_tag_favorite/hash_tag_favorite_detail.test.js +4 -0
- package/dist/esm/src/community-web/health/check.js +12 -0
- package/dist/esm/src/community-web/health/check.test.js +10 -0
- package/dist/esm/src/community-web/historical_team_member/page.js +27 -0
- package/dist/esm/src/community-web/historical_team_member/page.test.js +12 -0
- package/dist/esm/src/community-web/index.js +190 -0
- package/dist/esm/src/community-web/leaflets/item/list.js +13 -0
- package/dist/esm/src/community-web/leaflets/item/list.test.js +5 -0
- package/dist/esm/src/community-web/locked_user/detail.js +13 -0
- package/dist/esm/src/community-web/locked_user/detail.test.js +6 -0
- package/dist/esm/src/community-web/muted_user/detail.js +13 -0
- package/dist/esm/src/community-web/muted_user/detail.test.js +6 -0
- package/dist/esm/src/community-web/notification/page.js +23 -0
- package/dist/esm/src/community-web/notification/page.test.js +4 -0
- package/dist/esm/src/community-web/notification/stats/v2.js +13 -0
- package/dist/esm/src/community-web/notification/stats/v2.test.js +4 -0
- package/dist/esm/src/community-web/notify_message/notify_message.test.js +5 -0
- package/dist/esm/src/community-web/notify_message/show.js +12 -0
- package/dist/esm/src/community-web/post/detail.js +13 -0
- package/dist/esm/src/community-web/post/post.test.js +9 -0
- package/dist/esm/src/community-web/search/hot_words.js +13 -0
- package/dist/esm/src/community-web/search/search.test.js +6 -0
- package/dist/esm/src/community-web/short_url/create.js +15 -0
- package/dist/esm/src/community-web/short_url/decompress.js +13 -0
- package/dist/esm/src/community-web/short_url/decompress.test.js +4 -0
- package/dist/esm/src/community-web/short_url/shortUrl.test.js +4 -0
- package/dist/esm/src/community-web/student/block_record/block_record_list.test.js +4 -0
- package/dist/esm/src/community-web/student/block_record/block_record_status.test.js +8 -0
- package/dist/esm/src/community-web/student/block_record/detail.js +13 -0
- package/dist/esm/src/community-web/student/block_record/detail.test.js +4 -0
- package/dist/esm/src/community-web/student/block_record/list.js +21 -0
- package/dist/esm/src/community-web/student/block_record/status.js +13 -0
- package/dist/esm/src/community-web/student/following/page.js +24 -0
- package/dist/esm/src/community-web/student/following/page.test.js +6 -0
- package/dist/esm/src/community-web/students/creator_score.js +12 -0
- package/dist/esm/src/community-web/students/creator_score.test.js +4 -0
- package/dist/esm/src/community-web/students/last_active_at.js +13 -0
- package/dist/esm/src/community-web/students/last_active_at.test.js +6 -0
- package/dist/esm/src/community-web/students/list.js +13 -0
- package/dist/esm/src/community-web/students/list.test.js +7 -0
- package/dist/esm/src/community-web/students/list_sessions.js +21 -0
- package/dist/esm/src/community-web/students/list_sessions.test.js +4 -0
- package/dist/esm/src/community-web/students/profile.js +13 -0
- package/dist/esm/src/community-web/students/profile.test.js +6 -0
- package/dist/esm/src/community-web/students/reputation_score_log/page.js +21 -0
- package/dist/esm/src/community-web/students/reputation_score_log/reputation_score_log.test.js +4 -0
- package/dist/esm/src/community-web/students/self/detail.js +15 -0
- package/dist/esm/src/community-web/students/self/self_detail.test.js +4 -0
- package/dist/esm/src/community-web/students/stats.js +13 -0
- package/dist/esm/src/community-web/students/stats.test.js +7 -0
- package/dist/esm/src/community-web/students/update.js +31 -0
- package/dist/esm/src/community-web/students/update.test.js +4 -0
- package/dist/esm/src/community-web/study-community/cloud_variable/create.js +15 -0
- package/dist/esm/src/community-web/study-community/cloud_variable/create.test.js +4 -0
- package/dist/esm/src/community-web/study-community/comment/delete.js +13 -0
- package/dist/esm/src/community-web/study-community/comment/delete.test.js +4 -0
- package/dist/esm/src/community-web/study-community/comment/fold.js +13 -0
- package/dist/esm/src/community-web/study-community/comment/fold.test.js +4 -0
- package/dist/esm/src/community-web/study-community/comment/reset_weight.js +13 -0
- package/dist/esm/src/community-web/study-community/comment/reset_weight.test.js +4 -0
- package/dist/esm/src/community-web/study-community/comment/top.js +13 -0
- package/dist/esm/src/community-web/study-community/comment/top.test.js +4 -0
- package/dist/esm/src/community-web/study-community/member/detail.js +12 -0
- package/dist/esm/src/community-web/study-community/member/member_detail.test.js +4 -0
- package/dist/esm/src/community-web/study-community/spread_feed/unread/count.js +13 -0
- package/dist/esm/src/community-web/study-community/spread_feed/unread/spread_feed_unread_count.test.js +5 -0
- package/dist/esm/src/community-web/subject_area/page.js +22 -0
- package/dist/esm/src/community-web/subject_area/page_by_channel.js +22 -0
- package/dist/esm/src/community-web/subject_area/subject_area_page.test.js +5 -0
- package/dist/esm/src/community-web/subject_area/subject_area_page_by_channel.test.js +5 -0
- package/dist/esm/src/community-web/task/award.js +13 -0
- package/dist/esm/src/community-web/task/mine.js +12 -0
- package/dist/esm/src/community-web/task/task_award.test.js +5 -0
- package/dist/esm/src/community-web/task/task_mine.test.js +4 -0
- package/dist/esm/src/community-web/typical_project/page.js +25 -0
- package/dist/esm/src/community-web/typical_project/page.test.js +12 -0
- package/dist/esm/src/community-web/typical_project/student/unread_count.js +14 -0
- package/dist/esm/src/community-web/typical_project/student/unread_count.test.js +4 -0
- package/dist/esm/src/community-web/user-card/detail.js +13 -0
- package/dist/esm/src/community-web/user-card/user_card_detail.test.js +6 -0
- package/dist/esm/src/community-web/user_label/list.js +12 -0
- package/dist/esm/src/community-web/user_label/user_label_list.test.js +5 -0
- package/dist/esm/src/coverage.test.js +5 -0
- package/dist/esm/src/gandi-main/bulletins/detail.js +12 -0
- package/dist/esm/src/gandi-main/bulletins/detail.test.js +17 -0
- package/dist/esm/src/gandi-main/bulletins/page.js +24 -0
- package/dist/esm/src/gandi-main/bulletins/page.test.js +6 -0
- package/dist/esm/src/gandi-main/index.js +8 -0
- package/dist/esm/src/gandi-main/timestamp/current.js +9 -0
- package/dist/esm/src/gandi-main/timestamp/current.test.js +6 -0
- package/dist/esm/src/index.js +12 -0
- package/dist/esm/src/queryPages.js +22 -0
- package/dist/esm/src/sso/index.js +8 -0
- package/dist/esm/src/sso/web/auth/auth.test.js +15 -0
- package/dist/esm/src/sso/web/auth/login-by-password.js +27 -0
- package/dist/esm/src/sso/web/auth/logout.js +11 -0
- package/dist/esm/src/sso/web/auth/logout_by_session.js +12 -0
- package/dist/esm/types/notification.js +7 -0
- package/dist/esm/types/notificationContent.js +1 -0
- package/dist/node/src/bfs-web/index.js +7 -0
- package/dist/node/src/bfs-web/users/{oid}/extensions.js +25 -0
- package/dist/node/src/bfs-web/users/{oid}/extensions.test.js +6 -0
- package/dist/node/src/community-web/api/v1/short_code/encode.js +29 -0
- package/dist/node/src/community-web/api/v1/short_code/shortcode.test.js +7 -0
- package/dist/node/src/community-web/approval/approval.test.js +7 -0
- package/dist/node/src/community-web/approval/list.js +23 -0
- package/dist/node/src/community-web/base/dateTime.js +17 -0
- package/dist/node/src/community-web/base/dateTime.test.js +8 -0
- package/dist/node/src/community-web/campaign_resource/detail.js +16 -0
- package/dist/node/src/community-web/campaign_resource/detail.test.js +12 -0
- package/dist/node/src/community-web/ccw-main/status.js +16 -0
- package/dist/node/src/community-web/ccw-main/status.test.js +6 -0
- package/dist/node/src/community-web/check_in_record/check_in_record.test.js +10 -0
- package/dist/node/src/community-web/check_in_record/detail.js +15 -0
- package/dist/node/src/community-web/check_in_record/insert.js +16 -0
- package/dist/node/src/community-web/cloud_asset/search.js +29 -0
- package/dist/node/src/community-web/cloud_asset/search.test.js +8 -0
- package/dist/node/src/community-web/cloud_asset/user/privacy.js +15 -0
- package/dist/node/src/community-web/cloud_asset/user/privacy.test.js +6 -0
- package/dist/node/src/community-web/comment/create.js +20 -0
- package/dist/node/src/community-web/comment/create.test.js +15 -0
- package/dist/node/src/community-web/comment/like_record/create.js +17 -0
- package/dist/node/src/community-web/comment/like_record/create.test.js +6 -0
- package/dist/node/src/community-web/comment/page.js +28 -0
- package/dist/node/src/community-web/comment/page.test.js +17 -0
- package/dist/node/src/community-web/comment/page_by_topic.js +32 -0
- package/dist/node/src/community-web/comment/page_by_topic.test.js +15 -0
- package/dist/node/src/community-web/comment/reply.js +21 -0
- package/dist/node/src/community-web/comment/reply.test.js +6 -0
- package/dist/node/src/community-web/config/detail.js +17 -0
- package/dist/node/src/community-web/config/detail.test.js +11 -0
- package/dist/node/src/community-web/creation/detail.js +18 -0
- package/dist/node/src/community-web/creation/detail.test.js +20 -0
- package/dist/node/src/community-web/creation/excellent/list.js +17 -0
- package/dist/node/src/community-web/creation/excellent/list.test.js +12 -0
- package/dist/node/src/community-web/creation/introduction/detail.js +17 -0
- package/dist/node/src/community-web/creation/introduction/detail.test.js +19 -0
- package/dist/node/src/community-web/creation/like/detail.js +17 -0
- package/dist/node/src/community-web/creation/like/detail.test.js +21 -0
- package/dist/node/src/community-web/creation/loading/tips.js +15 -0
- package/dist/node/src/community-web/creation/loading/tips.test.js +10 -0
- package/dist/node/src/community-web/creation/own/page.js +30 -0
- package/dist/node/src/community-web/creation/own/page.test.js +6 -0
- package/dist/node/src/community-web/creation/page.js +28 -0
- package/dist/node/src/community-web/creation/page.test.js +18 -0
- package/dist/node/src/community-web/creation/page_by_student.js +28 -0
- package/dist/node/src/community-web/creation/page_by_student.test.js +22 -0
- package/dist/node/src/community-web/creation/potential/list.js +17 -0
- package/dist/node/src/community-web/creation/potential/list.test.js +12 -0
- package/dist/node/src/community-web/creation/recommend.js +27 -0
- package/dist/node/src/community-web/creation/recommend.test.js +12 -0
- package/dist/node/src/community-web/creation/search/page.js +28 -0
- package/dist/node/src/community-web/creation/search/page.test.js +7 -0
- package/dist/node/src/community-web/creation/smart_contract/split_rule/create.js +18 -0
- package/dist/node/src/community-web/creation/smart_contract/split_rule/create.test.js +6 -0
- package/dist/node/src/community-web/creation/smart_contract/split_rule/detail.js +17 -0
- package/dist/node/src/community-web/creation/smart_contract/split_rule/detail.test.js +6 -0
- package/dist/node/src/community-web/creation/student/detail.js +17 -0
- package/dist/node/src/community-web/creation/student/detail.test.js +19 -0
- package/dist/node/src/community-web/creation/submit.js +16 -0
- package/dist/node/src/community-web/creation/submit.test.js +34 -0
- package/dist/node/src/community-web/creation/tag/list.js +16 -0
- package/dist/node/src/community-web/creation/tag/list.test.js +12 -0
- package/dist/node/src/community-web/creation/team_member/list.js +18 -0
- package/dist/node/src/community-web/creation/team_member/list.test.js +6 -0
- package/dist/node/src/community-web/creation/team_member/produce_ticket.js +17 -0
- package/dist/node/src/community-web/creation/team_member/produce_ticket.test.js +6 -0
- package/dist/node/src/community-web/creation/teamwork_log/page.js +42 -0
- package/dist/node/src/community-web/creation/teamwork_log/page.test.js +6 -0
- package/dist/node/src/community-web/creation/update.js +26 -0
- package/dist/node/src/community-web/creation/update.test.js +6 -0
- package/dist/node/src/community-web/creation_activity_stats/list.js +17 -0
- package/dist/node/src/community-web/creation_activity_stats/list.test.js +7 -0
- package/dist/node/src/community-web/creation_attribute/detail.js +28 -0
- package/dist/node/src/community-web/creation_attribute/detail.test.js +12 -0
- package/dist/node/src/community-web/creation_donated_record/ranking_list.js +26 -0
- package/dist/node/src/community-web/creation_donated_record/ranking_list.test.js +14 -0
- package/dist/node/src/community-web/creation_favorite/detail.js +17 -0
- package/dist/node/src/community-web/creation_favorite/detail.test.js +7 -0
- package/dist/node/src/community-web/creation_recommend_position/list.js +18 -0
- package/dist/node/src/community-web/creation_recommend_position/list.test.js +7 -0
- package/dist/node/src/community-web/creation_release/code_profiling/detail.js +18 -0
- package/dist/node/src/community-web/creation_release/code_profiling/detail.test.js +7 -0
- package/dist/node/src/community-web/creation_release/page.js +28 -0
- package/dist/node/src/community-web/creation_release/page.test.js +14 -0
- package/dist/node/src/community-web/creation_screenshot/page.js +24 -0
- package/dist/node/src/community-web/creation_screenshot/page.test.js +13 -0
- package/dist/node/src/community-web/creation_stats/view.js +18 -0
- package/dist/node/src/community-web/creation_stats/view.test.js +8 -0
- package/dist/node/src/community-web/currency/account/personal.js +15 -0
- package/dist/node/src/community-web/currency/account/personal.test.js +6 -0
- package/dist/node/src/community-web/emoji/all.js +15 -0
- package/dist/node/src/community-web/emoji/all.test.js +13 -0
- package/dist/node/src/community-web/emoji/category/list.js +15 -0
- package/dist/node/src/community-web/emoji/category/list.test.js +11 -0
- package/dist/node/src/community-web/emoji/page.js +27 -0
- package/dist/node/src/community-web/emoji/page.test.js +14 -0
- package/dist/node/src/community-web/event.js +17 -0
- package/dist/node/src/community-web/event.test.js +7 -0
- package/dist/node/src/community-web/hash_tag/detail.js +17 -0
- package/dist/node/src/community-web/hash_tag/hash_tag_detail.test.js +11 -0
- package/dist/node/src/community-web/hash_tag/managed/list.js +33 -0
- package/dist/node/src/community-web/hash_tag/managed/managed_list.test.js +12 -0
- package/dist/node/src/community-web/hash_tag/recommend/list.js +15 -0
- package/dist/node/src/community-web/hash_tag/recommend/list.test.js +6 -0
- package/dist/node/src/community-web/hash_tag_creation/hash_tag_creation_list_relation.test.js +6 -0
- package/dist/node/src/community-web/hash_tag_creation/hash_tag_creation_mine.test.js +6 -0
- package/dist/node/src/community-web/hash_tag_creation/list_relation.js +17 -0
- package/dist/node/src/community-web/hash_tag_creation/list_relation.test.js +7 -0
- package/dist/node/src/community-web/hash_tag_creation/mine.js +33 -0
- package/dist/node/src/community-web/hash_tag_favorite/detail.js +17 -0
- package/dist/node/src/community-web/hash_tag_favorite/hash_tag_favorite_detail.test.js +6 -0
- package/dist/node/src/community-web/health/check.js +16 -0
- package/dist/node/src/community-web/health/check.test.js +12 -0
- package/dist/node/src/community-web/historical_team_member/page.js +31 -0
- package/dist/node/src/community-web/historical_team_member/page.test.js +14 -0
- package/dist/node/src/community-web/index.js +193 -0
- package/dist/node/src/community-web/leaflets/item/list.js +17 -0
- package/dist/node/src/community-web/leaflets/item/list.test.js +7 -0
- package/dist/node/src/community-web/locked_user/detail.js +17 -0
- package/dist/node/src/community-web/locked_user/detail.test.js +8 -0
- package/dist/node/src/community-web/muted_user/detail.js +17 -0
- package/dist/node/src/community-web/muted_user/detail.test.js +8 -0
- package/dist/node/src/community-web/notification/page.js +27 -0
- package/dist/node/src/community-web/notification/page.test.js +6 -0
- package/dist/node/src/community-web/notification/stats/v2.js +17 -0
- package/dist/node/src/community-web/notification/stats/v2.test.js +6 -0
- package/dist/node/src/community-web/notify_message/notify_message.test.js +7 -0
- package/dist/node/src/community-web/notify_message/show.js +16 -0
- package/dist/node/src/community-web/post/detail.js +17 -0
- package/dist/node/src/community-web/post/post.test.js +11 -0
- package/dist/node/src/community-web/search/hot_words.js +17 -0
- package/dist/node/src/community-web/search/search.test.js +8 -0
- package/dist/node/src/community-web/short_url/create.js +19 -0
- package/dist/node/src/community-web/short_url/decompress.js +17 -0
- package/dist/node/src/community-web/short_url/decompress.test.js +6 -0
- package/dist/node/src/community-web/short_url/shortUrl.test.js +6 -0
- package/dist/node/src/community-web/student/block_record/block_record_list.test.js +6 -0
- package/dist/node/src/community-web/student/block_record/block_record_status.test.js +10 -0
- package/dist/node/src/community-web/student/block_record/detail.js +17 -0
- package/dist/node/src/community-web/student/block_record/detail.test.js +6 -0
- package/dist/node/src/community-web/student/block_record/list.js +25 -0
- package/dist/node/src/community-web/student/block_record/status.js +17 -0
- package/dist/node/src/community-web/student/following/page.js +28 -0
- package/dist/node/src/community-web/student/following/page.test.js +8 -0
- package/dist/node/src/community-web/students/creator_score.js +16 -0
- package/dist/node/src/community-web/students/creator_score.test.js +6 -0
- package/dist/node/src/community-web/students/last_active_at.js +17 -0
- package/dist/node/src/community-web/students/last_active_at.test.js +8 -0
- package/dist/node/src/community-web/students/list.js +17 -0
- package/dist/node/src/community-web/students/list.test.js +9 -0
- package/dist/node/src/community-web/students/list_sessions.js +25 -0
- package/dist/node/src/community-web/students/list_sessions.test.js +6 -0
- package/dist/node/src/community-web/students/profile.js +17 -0
- package/dist/node/src/community-web/students/profile.test.js +8 -0
- package/dist/node/src/community-web/students/reputation_score_log/page.js +25 -0
- package/dist/node/src/community-web/students/reputation_score_log/reputation_score_log.test.js +6 -0
- package/dist/node/src/community-web/students/self/detail.js +19 -0
- package/dist/node/src/community-web/students/self/self_detail.test.js +6 -0
- package/dist/node/src/community-web/students/stats.js +17 -0
- package/dist/node/src/community-web/students/stats.test.js +9 -0
- package/dist/node/src/community-web/students/update.js +35 -0
- package/dist/node/src/community-web/students/update.test.js +6 -0
- package/dist/node/src/community-web/study-community/cloud_variable/create.js +19 -0
- package/dist/node/src/community-web/study-community/cloud_variable/create.test.js +6 -0
- package/dist/node/src/community-web/study-community/comment/delete.js +17 -0
- package/dist/node/src/community-web/study-community/comment/delete.test.js +6 -0
- package/dist/node/src/community-web/study-community/comment/fold.js +17 -0
- package/dist/node/src/community-web/study-community/comment/fold.test.js +6 -0
- package/dist/node/src/community-web/study-community/comment/reset_weight.js +17 -0
- package/dist/node/src/community-web/study-community/comment/reset_weight.test.js +6 -0
- package/dist/node/src/community-web/study-community/comment/top.js +17 -0
- package/dist/node/src/community-web/study-community/comment/top.test.js +6 -0
- package/dist/node/src/community-web/study-community/member/detail.js +16 -0
- package/dist/node/src/community-web/study-community/member/member_detail.test.js +6 -0
- package/dist/node/src/community-web/study-community/spread_feed/unread/count.js +17 -0
- package/dist/node/src/community-web/study-community/spread_feed/unread/spread_feed_unread_count.test.js +7 -0
- package/dist/node/src/community-web/subject_area/page.js +26 -0
- package/dist/node/src/community-web/subject_area/page_by_channel.js +26 -0
- package/dist/node/src/community-web/subject_area/subject_area_page.test.js +7 -0
- package/dist/node/src/community-web/subject_area/subject_area_page_by_channel.test.js +7 -0
- package/dist/node/src/community-web/task/award.js +17 -0
- package/dist/node/src/community-web/task/mine.js +16 -0
- package/dist/node/src/community-web/task/task_award.test.js +7 -0
- package/dist/node/src/community-web/task/task_mine.test.js +6 -0
- package/dist/node/src/community-web/typical_project/page.js +29 -0
- package/dist/node/src/community-web/typical_project/page.test.js +14 -0
- package/dist/node/src/community-web/typical_project/student/unread_count.js +18 -0
- package/dist/node/src/community-web/typical_project/student/unread_count.test.js +6 -0
- package/dist/node/src/community-web/user-card/detail.js +17 -0
- package/dist/node/src/community-web/user-card/user_card_detail.test.js +8 -0
- package/dist/node/src/community-web/user_label/list.js +16 -0
- package/dist/node/src/community-web/user_label/user_label_list.test.js +7 -0
- package/dist/node/src/coverage.test.js +7 -0
- package/dist/node/src/gandi-main/bulletins/detail.js +16 -0
- package/dist/node/src/gandi-main/bulletins/detail.test.js +19 -0
- package/dist/node/src/gandi-main/bulletins/page.js +28 -0
- package/dist/node/src/gandi-main/bulletins/page.test.js +8 -0
- package/dist/node/src/gandi-main/index.js +11 -0
- package/dist/node/src/gandi-main/timestamp/current.js +13 -0
- package/dist/node/src/gandi-main/timestamp/current.test.js +8 -0
- package/dist/node/src/index.js +19 -0
- package/dist/node/src/queryPages.js +26 -0
- package/dist/node/src/sso/index.js +11 -0
- package/dist/node/src/sso/web/auth/auth.test.js +17 -0
- package/dist/node/src/sso/web/auth/login-by-password.js +31 -0
- package/dist/node/src/sso/web/auth/logout.js +15 -0
- package/dist/node/src/sso/web/auth/logout_by_session.js +16 -0
- package/dist/node/types/notification.js +10 -0
- package/dist/node/types/notificationContent.js +2 -0
- package/dist/types/community-web/api/v1/short_code/encode.d.ts +42 -0
- package/dist/types/community-web/approval/list.d.ts +27 -0
- package/dist/types/community-web/base/dateTime.d.ts +5 -0
- package/dist/types/community-web/campaign_resource/detail.d.ts +17 -0
- package/dist/types/community-web/check_in_record/detail.d.ts +14 -0
- package/dist/types/community-web/check_in_record/insert.d.ts +10 -0
- package/dist/types/community-web/cloud_asset/search.d.ts +44 -0
- package/dist/types/community-web/cloud_asset/user/privacy.d.ts +14 -0
- package/dist/types/community-web/comment/page.d.ts +19 -0
- package/dist/types/community-web/comment/page_by_topic.d.ts +19 -0
- package/dist/types/community-web/config/detail.d.ts +11 -0
- package/dist/types/community-web/creation/detail.d.ts +15 -0
- package/dist/types/community-web/creation/excellent/list.d.ts +12 -0
- package/dist/types/community-web/creation/introduction/detail.d.ts +13 -0
- package/dist/types/community-web/creation/like/detail.d.ts +13 -0
- package/dist/types/community-web/creation/loading/tips.d.ts +9 -0
- package/dist/types/community-web/creation/page.d.ts +16 -0
- package/dist/types/community-web/creation/page_by_student.d.ts +16 -0
- package/dist/types/community-web/creation/potential/list.d.ts +12 -0
- package/dist/types/community-web/creation/recommend.d.ts +15 -0
- package/dist/types/community-web/creation/search/page.d.ts +15 -0
- package/dist/types/community-web/creation/student/detail.d.ts +13 -0
- package/dist/types/community-web/creation/tag/list.d.ts +11 -0
- package/dist/types/community-web/index.d.ts +50 -0
- package/dist/types/community-web/short_url/create.d.ts +11 -0
- package/dist/types/index.d.ts +37 -0
- package/dist/types/queryPages.d.ts +9 -0
- package/dist/types/src/bfs-web/index.d.ts +4 -0
- package/dist/types/src/bfs-web/users/{oid}/extensions.d.ts +12 -0
- package/dist/types/src/community-web/api/v1/short_code/encode.d.ts +42 -0
- package/dist/types/src/community-web/approval/list.d.ts +27 -0
- package/dist/types/src/community-web/base/dateTime.d.ts +5 -0
- package/dist/types/src/community-web/campaign_resource/detail.d.ts +17 -0
- package/dist/types/src/community-web/ccw-main/status.d.ts +11 -0
- package/dist/types/src/community-web/check_in_record/detail.d.ts +17 -0
- package/dist/types/src/community-web/check_in_record/insert.d.ts +10 -0
- package/dist/types/src/community-web/cloud_asset/search.d.ts +44 -0
- package/dist/types/src/community-web/cloud_asset/user/privacy.d.ts +14 -0
- package/dist/types/src/community-web/comment/create.d.ts +40 -0
- package/dist/types/src/community-web/comment/like_record/create.d.ts +11 -0
- package/dist/types/src/community-web/comment/page.d.ts +19 -0
- package/dist/types/src/community-web/comment/page_by_topic.d.ts +19 -0
- package/dist/types/src/community-web/comment/reply.d.ts +27 -0
- package/dist/types/src/community-web/config/detail.d.ts +11 -0
- package/dist/types/src/community-web/creation/detail.d.ts +15 -0
- package/dist/types/src/community-web/creation/excellent/list.d.ts +12 -0
- package/dist/types/src/community-web/creation/introduction/detail.d.ts +13 -0
- package/dist/types/src/community-web/creation/like/detail.d.ts +13 -0
- package/dist/types/src/community-web/creation/loading/tips.d.ts +9 -0
- package/dist/types/src/community-web/creation/own/page.d.ts +17 -0
- package/dist/types/src/community-web/creation/page.d.ts +16 -0
- package/dist/types/src/community-web/creation/page_by_student.d.ts +16 -0
- package/dist/types/src/community-web/creation/potential/list.d.ts +12 -0
- package/dist/types/src/community-web/creation/recommend.d.ts +15 -0
- package/dist/types/src/community-web/creation/search/page.d.ts +17 -0
- package/dist/types/src/community-web/creation/smart_contract/split_rule/create.d.ts +25 -0
- package/dist/types/src/community-web/creation/smart_contract/split_rule/detail.d.ts +31 -0
- package/dist/types/src/community-web/creation/student/detail.d.ts +13 -0
- package/dist/types/src/community-web/creation/submit.d.ts +39 -0
- package/dist/types/src/community-web/creation/tag/list.d.ts +11 -0
- package/dist/types/src/community-web/creation/team_member/list.d.ts +15 -0
- package/dist/types/src/community-web/creation/team_member/produce_ticket.d.ts +12 -0
- package/dist/types/src/community-web/creation/teamwork_log/page.d.ts +42 -0
- package/dist/types/src/community-web/creation/update.d.ts +19 -0
- package/dist/types/src/community-web/creation_activity_stats/list.d.ts +20 -0
- package/dist/types/src/community-web/creation_attribute/detail.d.ts +34 -0
- package/dist/types/src/community-web/creation_donated_record/ranking_list.d.ts +19 -0
- package/dist/types/src/community-web/creation_favorite/detail.d.ts +13 -0
- package/dist/types/src/community-web/creation_recommend_position/list.d.ts +13 -0
- package/dist/types/src/community-web/creation_release/code_profiling/detail.d.ts +60 -0
- package/dist/types/src/community-web/creation_release/page.d.ts +16 -0
- package/dist/types/src/community-web/creation_screenshot/page.d.ts +15 -0
- package/dist/types/src/community-web/creation_stats/view.d.ts +14 -0
- package/dist/types/src/community-web/currency/account/personal.d.ts +12 -0
- package/dist/types/src/community-web/emoji/all.d.ts +27 -0
- package/dist/types/src/community-web/emoji/category/list.d.ts +16 -0
- package/dist/types/src/community-web/emoji/page.d.ts +17 -0
- package/dist/types/src/community-web/event.d.ts +11 -0
- package/dist/types/src/community-web/hash_tag/detail.d.ts +12 -0
- package/dist/types/src/community-web/hash_tag/managed/list.d.ts +18 -0
- package/dist/types/src/community-web/hash_tag/recommend/list.d.ts +8 -0
- package/dist/types/src/community-web/hash_tag_creation/list_relation.d.ts +13 -0
- package/dist/types/src/community-web/hash_tag_creation/mine.d.ts +18 -0
- package/dist/types/src/community-web/hash_tag_favorite/detail.d.ts +12 -0
- package/dist/types/src/community-web/health/check.d.ts +14 -0
- package/dist/types/src/community-web/historical_team_member/page.d.ts +17 -0
- package/dist/types/src/community-web/index.d.ts +190 -0
- package/dist/types/src/community-web/leaflets/item/list.d.ts +25 -0
- package/dist/types/src/community-web/locked_user/detail.d.ts +24 -0
- package/dist/types/src/community-web/muted_user/detail.d.ts +11 -0
- package/dist/types/src/community-web/notification/page.d.ts +15 -0
- package/dist/types/src/community-web/notification/stats/v2.d.ts +12 -0
- package/dist/types/src/community-web/notify_message/show.d.ts +17 -0
- package/dist/types/src/community-web/post/detail.d.ts +50 -0
- package/dist/types/src/community-web/search/hot_words.d.ts +11 -0
- package/dist/types/src/community-web/short_url/create.d.ts +11 -0
- package/dist/types/src/community-web/short_url/decompress.d.ts +11 -0
- package/dist/types/src/community-web/student/block_record/detail.d.ts +35 -0
- package/dist/types/src/community-web/student/block_record/list.d.ts +18 -0
- package/dist/types/src/community-web/student/block_record/status.d.ts +16 -0
- package/dist/types/src/community-web/student/following/page.d.ts +17 -0
- package/dist/types/src/community-web/students/creator_score.d.ts +9 -0
- package/dist/types/src/community-web/students/last_active_at.d.ts +14 -0
- package/dist/types/src/community-web/students/list.d.ts +13 -0
- package/dist/types/src/community-web/students/list_sessions.d.ts +12 -0
- package/dist/types/src/community-web/students/profile.d.ts +13 -0
- package/dist/types/src/community-web/students/reputation_score_log/page.d.ts +11 -0
- package/dist/types/src/community-web/students/self/detail.d.ts +18 -0
- package/dist/types/src/community-web/students/stats.d.ts +13 -0
- package/dist/types/src/community-web/students/update.d.ts +18 -0
- package/dist/types/src/community-web/study-community/cloud_variable/create.d.ts +15 -0
- package/dist/types/src/community-web/study-community/comment/delete.d.ts +11 -0
- package/dist/types/src/community-web/study-community/comment/fold.d.ts +11 -0
- package/dist/types/src/community-web/study-community/comment/reset_weight.d.ts +11 -0
- package/dist/types/src/community-web/study-community/comment/top.d.ts +14 -0
- package/dist/types/src/community-web/study-community/member/detail.d.ts +25 -0
- package/dist/types/src/community-web/study-community/spread_feed/unread/count.d.ts +12 -0
- package/dist/types/src/community-web/subject_area/page.d.ts +71 -0
- package/dist/types/src/community-web/subject_area/page_by_channel.d.ts +73 -0
- package/dist/types/src/community-web/task/award.d.ts +19 -0
- package/dist/types/src/community-web/task/mine.d.ts +29 -0
- package/dist/types/src/community-web/typical_project/page.d.ts +29 -0
- package/dist/types/src/community-web/typical_project/student/unread_count.d.ts +13 -0
- package/dist/types/src/community-web/user-card/detail.d.ts +43 -0
- package/dist/types/src/community-web/user_label/list.d.ts +11 -0
- package/dist/types/src/gandi-main/bulletins/detail.d.ts +16 -0
- package/dist/types/src/gandi-main/bulletins/page.d.ts +19 -0
- package/dist/types/src/gandi-main/index.d.ts +8 -0
- package/dist/types/src/gandi-main/timestamp/current.d.ts +7 -0
- package/dist/types/src/index.d.ts +119 -0
- package/dist/types/src/queryPages.d.ts +9 -0
- package/dist/types/src/sso/index.d.ts +8 -0
- package/dist/types/src/sso/web/auth/login-by-password.d.ts +50 -0
- package/dist/types/src/sso/web/auth/logout.d.ts +6 -0
- package/dist/types/src/sso/web/auth/logout_by_session.d.ts +7 -0
- package/dist/types/sso/index.d.ts +8 -0
- package/dist/types/sso/web/auth/login-by-password.d.ts +50 -0
- package/dist/types/sso/web/auth/logout.d.ts +6 -0
- package/dist/types/sso/web/auth/logout_by_session.d.ts +7 -0
- package/dist/types/types/notification.d.ts +66 -0
- package/dist/types/types/notificationContent.d.ts +126 -0
- package/package.json +6 -1
- package/AGENT.md +0 -271
- package/coverage/clover.xml +0 -605
- package/coverage/coverage-final.json +0 -49
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -671
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov.info +0 -977
- package/tsconfig.esm.json +0 -8
- package/tsconfig.json +0 -14
- package/tsconfig.node.json +0 -9
- package/tsconfig.types.json +0 -9
package/README.md
ADDED
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
# @ccw-api/api
|
|
2
|
+
|
|
3
|
+
CCW(创作社区)前后端接口 SDK,整合 `sso.ccw.site` 与 `community-web.ccw.site`
|
|
4
|
+
两大服务的常用 API,提供完整的 TypeScript 类型与开箱即用的分页封装。
|
|
5
|
+
|
|
6
|
+
- 包格式:**ESM + CJS + .d.ts 三产物**同时产出
|
|
7
|
+
- 类型:所有请求 / 响应字段**强类型**,后端 key 固定约束(如 `MongoDBId`、`CNameOssUrl`、`UUID`)
|
|
8
|
+
- 分页:统一返回 `PagesRes<T>`(含 `totalNum` / `totalPages` / `sortField` 等元信息)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 安装
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @ccw-api/api
|
|
16
|
+
# 或
|
|
17
|
+
pnpm add @ccw-api/api
|
|
18
|
+
# 或
|
|
19
|
+
yarn add @ccw-api/api
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
> 唯一运行时依赖:`@ccw-api/axios`(内置鉴权 header 注入的 axios 封装)。
|
|
23
|
+
> `@ccw-api/api` 已将常用的 token 设置方法 **`setToken` 重新导出**,无需再单独依赖 axios 包。
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 快速开始
|
|
28
|
+
|
|
29
|
+
### 1. 初始化 Token(前置条件)
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { setToken } from "@ccw-api/api";
|
|
33
|
+
|
|
34
|
+
// 直接传入后端下发的 session token
|
|
35
|
+
setToken("abcdefgfoo");
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
所有 `@ccw-api/api` 的方法都会复用同一个 axios 单例,**调用 API 时无需再传入鉴权参数**。
|
|
39
|
+
|
|
40
|
+
### 2. 调用方式
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { sso, communityWeb, gandiMain, bfsWeb } from "@ccw-api/api"; // ✅ 推荐:具名导入
|
|
44
|
+
// 或
|
|
45
|
+
import api from "@ccw-api/api"; // ✅ default 导入:api.sso / api.communityWeb / api.gandiMain / api.bfsWeb
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 模块一:SSO(sso.ccw.site)
|
|
51
|
+
|
|
52
|
+
账号认证相关,共 3 个 API:
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
const { loginByPassword, logout, logoutBySession } = sso;
|
|
56
|
+
|
|
57
|
+
// 账号密码登录
|
|
58
|
+
await loginByPassword("student_number", "xxxxx", {
|
|
59
|
+
device: "WEB",
|
|
60
|
+
browser: "Chrome",
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// 登出当前 session
|
|
64
|
+
await logout();
|
|
65
|
+
|
|
66
|
+
// 强制某个 session 下线用于登陆设备管理
|
|
67
|
+
await logoutBySession("64...session_oid");
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 模块二:Community-Web(community-web.ccw.site)
|
|
73
|
+
|
|
74
|
+
覆盖作品 / 学生 / 星球 / 评论 / 通知 / 任务 / 表情 / 签到 / 云资产 / 学科专区 等业务领域,共 **95 个 API**。
|
|
75
|
+
下面是常用场景示例。
|
|
76
|
+
|
|
77
|
+
### 学生与作品
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
// 拉取学生档案
|
|
81
|
+
const profile = await communityWeb.getStudentProfile(
|
|
82
|
+
"63c2807d669fa967f17f5559",
|
|
83
|
+
);
|
|
84
|
+
// ^? StudentOverview(包含头像、简介、统计字段等)
|
|
85
|
+
|
|
86
|
+
// 我的创作分
|
|
87
|
+
const score = await communityWeb.getCreatorScore();
|
|
88
|
+
console.log(score.rank); // "ORDINARY" | "HACKER" | "ADVANCED"
|
|
89
|
+
|
|
90
|
+
// 分页拉取某学生的作品列表(含 totalNum / totalPages)
|
|
91
|
+
const creations = await communityWeb.getCreationsByStudent(
|
|
92
|
+
"63c2807d669fa967f17f5559",
|
|
93
|
+
{ page: 1, perPage: 12, sortField: "createdAt", sortType: "DESC" },
|
|
94
|
+
);
|
|
95
|
+
// creations: PagesRes<CreationSimple>
|
|
96
|
+
console.log(creations.totalNum, creations.data[0].title);
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 星球(HashTag)与作品关联
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
// 查询某作品加入了哪些星球
|
|
103
|
+
const planets = await communityWeb.getPlanetsOfCreation(
|
|
104
|
+
"69929185f8d6142487fd4b2e",
|
|
105
|
+
);
|
|
106
|
+
// planets: HashTagCreationRelation[]
|
|
107
|
+
// planets[0].rank → "ORDINARY"(星球审核等级,与创作分 CreatorScore.rank 概念不同)
|
|
108
|
+
|
|
109
|
+
// 查询我加入某星球的作品分页(排除一个星球 + 过滤状态)
|
|
110
|
+
const mine = await communityWeb.getMyHashTagCreations(
|
|
111
|
+
"蔚蓝档案",
|
|
112
|
+
["PUBLISHED"],
|
|
113
|
+
{ page: 1, perPage: 8, sortField: "lastPassedAt", sortType: "DESC" },
|
|
114
|
+
);
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 通知(细化了 15 种 contentCategory)
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
import type {
|
|
121
|
+
NotificationContent,
|
|
122
|
+
PostCommentContent,
|
|
123
|
+
FollowedContent,
|
|
124
|
+
} from "@ccw-api/api";
|
|
125
|
+
|
|
126
|
+
const page = await communityWeb.getNotificationPage("COMMENT_TO_ME", {
|
|
127
|
+
page: 1,
|
|
128
|
+
perPage: 20,
|
|
129
|
+
});
|
|
130
|
+
// page.data[].content 类型是 NotificationContent(判别联合)
|
|
131
|
+
// 用 contentCategory 做类型收窄:
|
|
132
|
+
|
|
133
|
+
for (const notif of page.data) {
|
|
134
|
+
switch (notif.contentCategory) {
|
|
135
|
+
case "POST_COMMENT": {
|
|
136
|
+
const c = notif.content as PostCommentContent;
|
|
137
|
+
console.log("评论者:", c.sender, "文章:", c.subject_outline);
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
case "FOLLOWED": {
|
|
141
|
+
const c = notif.content as FollowedContent;
|
|
142
|
+
console.log("新粉丝:", c.sender, c.sender_id);
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
case "CREATION_SHARE":
|
|
146
|
+
case "SESSION_CREATED":
|
|
147
|
+
case "COMMUNITY_ACTIVITY":
|
|
148
|
+
case "POST_VISIBILITY_CHANGED":
|
|
149
|
+
// ……共 15 种,可按 IDE 补全逐项处理
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// 拉取所有分组的未读统计
|
|
154
|
+
const stats = await communityWeb.getNotificationStats();
|
|
155
|
+
// stats.creationInteraction stats.commentToMe stats.followMe ……
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### 任务、表情、金币、签到
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
// 我的任务列表
|
|
162
|
+
const tasks = await communityWeb.getMyTasks();
|
|
163
|
+
|
|
164
|
+
// 领取某个任务奖励
|
|
165
|
+
await communityWeb.acceptAward("61273ccf1730f4308e853f6a");
|
|
166
|
+
|
|
167
|
+
// 个人金币余额(充值 / 赠送 / 提现 三栏分离)
|
|
168
|
+
const coin = await communityWeb.getPersonalCurrencyAccount();
|
|
169
|
+
// coin: { internalCurrencyBalance, topUpCurrencyBalance, withdrawCurrencyBalance }
|
|
170
|
+
|
|
171
|
+
// 全部表情包 + 分页 + 分类
|
|
172
|
+
const [allEmoji, emojiPage, categories] = await Promise.all([
|
|
173
|
+
communityWeb.getAllEmojis(),
|
|
174
|
+
communityWeb.getEmojiPage("ENABLED", { page: 1, perPage: 50 }),
|
|
175
|
+
communityWeb.getEmojiCategoryList(),
|
|
176
|
+
]);
|
|
177
|
+
|
|
178
|
+
// 签到
|
|
179
|
+
await communityWeb.insertCheckInRecord(); // 今日打卡
|
|
180
|
+
const history = await communityWeb.getCheckInRecords();
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### 黑名单、封禁、禁言查询
|
|
184
|
+
|
|
185
|
+
```ts
|
|
186
|
+
const STUDENT = "63c2807d669fa967f17f5559";
|
|
187
|
+
|
|
188
|
+
// 轻量:是否拉黑(只返回 NOT_BLOCKED / BLOCKING)
|
|
189
|
+
const s = await communityWeb.getStudentBlockStatus(STUDENT);
|
|
190
|
+
|
|
191
|
+
// 详细:完整的 BlockActionRecord(拉黑动作记录,oid / createdAt / fromEntityId)
|
|
192
|
+
const detail = await communityWeb.getStudentBlockRecordDetail(STUDENT);
|
|
193
|
+
|
|
194
|
+
// 封禁详情(带泛型,locked=false 时其他字段全为 null)
|
|
195
|
+
const locked = await communityWeb.getLockedUserDetail<true>(
|
|
196
|
+
"642c0e8a59230841adf62406",
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
// 禁言详情(studentNumber 是 244373873 这种数字字符串,null 表示未禁言)
|
|
200
|
+
const muted = await communityWeb.getMutedUserDetail("244373873");
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## 模块三:Gandi-Main(gandi-main.ccw.site)
|
|
206
|
+
|
|
207
|
+
公告与服务器时间相关,共 **3 个 API**:
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
const { getCurrentTimestamp, getBulletinsPage, getBulletinDetail } = gandiMain;
|
|
211
|
+
|
|
212
|
+
// 服务端当前毫秒级时间戳(比客户端时间更可靠,可用于签到、排行榜等需要严格时间判断的场景)
|
|
213
|
+
const ts = await gandiMain.getCurrentTimestamp();
|
|
214
|
+
|
|
215
|
+
// 分页拉取公告列表(默认按 publishedAt 倒序,过滤已发布)
|
|
216
|
+
const bulletins = await gandiMain.getBulletinsPage("PUBLISHED", {
|
|
217
|
+
page: 1,
|
|
218
|
+
perPage: 10,
|
|
219
|
+
});
|
|
220
|
+
// bulletins.data[0].title / id / publishedAt
|
|
221
|
+
|
|
222
|
+
// 某条公告详情
|
|
223
|
+
const detail = await gandiMain.getBulletinDetail(123);
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## 模块四:BFS-Web(bfs-web.ccw.site)
|
|
229
|
+
|
|
230
|
+
用户扩展(extension)管理,共 **1 个 API**:
|
|
231
|
+
|
|
232
|
+
```ts
|
|
233
|
+
const { getUserExtensions } = bfsWeb;
|
|
234
|
+
|
|
235
|
+
// 分页查询某用户上传/使用过的扩展列表(默认按 updatedAt 倒序)
|
|
236
|
+
const exts = await bfsWeb.getUserExtensions("63c2807d669fa967f17f5559", {
|
|
237
|
+
page: 1,
|
|
238
|
+
perPage: 20,
|
|
239
|
+
});
|
|
240
|
+
// exts: PagesRes<Extension>
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
### 通用工具型 API
|
|
246
|
+
|
|
247
|
+
```ts
|
|
248
|
+
// 生成短链
|
|
249
|
+
await communityWeb.createShortUrl("https://ccw.site/detail/xxx");
|
|
250
|
+
|
|
251
|
+
// 生成邀请码(api/v1/short_code/encode)
|
|
252
|
+
await communityWeb.encodeShortCode("hello world", 1, 6);
|
|
253
|
+
|
|
254
|
+
// 服务器时间
|
|
255
|
+
await communityWeb.getTime();
|
|
256
|
+
|
|
257
|
+
// 埋点事件上报
|
|
258
|
+
await communityWeb.sendEvent("creation_detail_view_6880873d2211fa69e41c9d19");
|
|
259
|
+
|
|
260
|
+
// 广告横幅
|
|
261
|
+
await communityWeb.getLeafletsItemList(1001);
|
|
262
|
+
|
|
263
|
+
// 学科专区(分页 / 按频道)
|
|
264
|
+
await communityWeb.getSubjectAreaPage({ page: 1, perPage: 20 });
|
|
265
|
+
await communityWeb.getSubjectAreaPageByChannel("PRIMARY");
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## 类型系统
|
|
271
|
+
|
|
272
|
+
### 原语类型(`types/api.d.ts`)
|
|
273
|
+
|
|
274
|
+
可直接从包顶层作为 `type` 导入:
|
|
275
|
+
|
|
276
|
+
```ts
|
|
277
|
+
import type {
|
|
278
|
+
MongoDBId, // 24 位 hex 字符串(ObjectId)
|
|
279
|
+
CNameOssUrl, // https://m.ccw.site/... 或 https://m.xiguacity.cn/... OSS URL
|
|
280
|
+
UUID, // `${string}-${string}-${string}-${string}-${string}` 类型体操
|
|
281
|
+
ApiResponse, // { code, msg, body: T } 后端统一响应壳(SDK 内部已拆)
|
|
282
|
+
} from "@ccw-api/api";
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### 领域命名空间
|
|
286
|
+
|
|
287
|
+
每个 `types/*.d.ts` 作为一个命名空间重新导出,**避免同名类型冲突**(典型如 `Student` vs `StudentOverview` vs `Account.Types.Student`):
|
|
288
|
+
|
|
289
|
+
```ts
|
|
290
|
+
import type {
|
|
291
|
+
Api, // 原语类型(MongoDBId / CNameOssUrl / UUID / ApiResponse ...)
|
|
292
|
+
UserData, // Student / StudentOverview / CreatorScore / UserCard ...
|
|
293
|
+
Creation, // Creation / HashTag / HashTagCreationRank / CreationRelease ...
|
|
294
|
+
Comment, // Comment / CommentStatus ...
|
|
295
|
+
Notification, // Notification / NotificationSenderInfo / NotificationGroup ...
|
|
296
|
+
NotificationContent, // 15 种通知 content 判别联合
|
|
297
|
+
Pages, // PageArgs / PagesRes
|
|
298
|
+
Session, // StudentSession / SessionArea
|
|
299
|
+
Account, // AccountTypes
|
|
300
|
+
Approval, // ApprovalTag
|
|
301
|
+
} from "@ccw-api/api";
|
|
302
|
+
|
|
303
|
+
type Score = UserData.CreatorScore["rank"]; // "ORDINARY" | "HACKER" | "ADVANCED"
|
|
304
|
+
type PlanetRank = Creation.HashTagCreationRank; // "ORDINARY"
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## 分页约定
|
|
310
|
+
|
|
311
|
+
所有分页 API 都遵循同一套形状(详见 `types/pages.d.ts` + `src/queryPages.ts`):
|
|
312
|
+
|
|
313
|
+
```ts
|
|
314
|
+
import type { PageArgs, PagesRes } from "@ccw-api/api";
|
|
315
|
+
|
|
316
|
+
// 入参 T extends string
|
|
317
|
+
// Partial<PageArgs<SortField|T>>,默认 { page:1, perPage:20, sortType:"DESC" }
|
|
318
|
+
// 出参 PagesRes<T> 完整结构:
|
|
319
|
+
const p: PagesRes<Creation.Creation> = {
|
|
320
|
+
data: [], // 当前页数据
|
|
321
|
+
page: 1,
|
|
322
|
+
perPage: 20,
|
|
323
|
+
offset: 0,
|
|
324
|
+
totalNum: 1234, // 总条数 —— 之前版本被截断,目前 SDK 已完整透出
|
|
325
|
+
totalPages: 62, // 总页数
|
|
326
|
+
sortField: "createdAt",
|
|
327
|
+
sortType: "DESC",
|
|
328
|
+
};
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## 开发 & 发布
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
# 三产物构建(node / esm / .d.ts)
|
|
337
|
+
npm run build
|
|
338
|
+
|
|
339
|
+
# 跑测试(Jest 30 + ts-jest,101 suites / 106 tests)
|
|
340
|
+
npm test
|
|
341
|
+
npm run test:dev # watch 模式
|
|
342
|
+
|
|
343
|
+
# 文档(TypeDoc,生成到 doc/ 或默认输出目录)
|
|
344
|
+
npm run doc
|
|
345
|
+
npm run doc:dev
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
`npm publish` 会自动触发 `prepublishOnly` → **build + test** 全跑一遍,失败会阻断发布。
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## 目录与规范
|
|
353
|
+
|
|
354
|
+
所有 API 文件严格遵循 `AGENT.md` 规范:
|
|
355
|
+
|
|
356
|
+
- **按域名分组**:`src/sso` / `src/community-web` / `src/gandi-main` / `src/bfs-web`,内部子目录对应 URL 路径
|
|
357
|
+
- **单文件单接口**:文件名 `kebab-case`,对应 endpoint 最后一段
|
|
358
|
+
- **7 段式模板**(每个 API 文件内部固定顺序):
|
|
359
|
+
1. `import`
|
|
360
|
+
2. `export const url = "https://..."`(调试 & 测试直接引用)
|
|
361
|
+
3. `export type Req = { ... }`
|
|
362
|
+
4. `export type Res = { ... }`(响应体内部,不含 `ApiResponse` 外层)
|
|
363
|
+
5. 辅助类型
|
|
364
|
+
6. JSDoc(`@param` / `@returns`)
|
|
365
|
+
7. `export async function xxx(): Promise<Res>`
|
|
366
|
+
|
|
367
|
+
新增 API 时,**最后记得在对应服务的 `index.ts`(如 `src/community-web/index.ts`、`src/gandi-main/index.ts` 等)里 `import + 对象字面量聚合导出`**,否则外部访问不到。
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ccwAxios } from "@ccw-api/axios";
|
|
2
|
+
import { DEFAULT_PAGE_ARGS, queryPage } from "src/queryPages";
|
|
3
|
+
export const url = "https://bfs-web.ccw.site/users";
|
|
4
|
+
/**
|
|
5
|
+
* 获取用户扩展列表分页
|
|
6
|
+
* @param {MongoDBId} userOid 用户id
|
|
7
|
+
* @param {Partial<PageArgs<"createdAt" | "updatedAt" | T>>} pageArgs_ 分页参数
|
|
8
|
+
* @returns {Promise<Res>} 扩展分页列表
|
|
9
|
+
*/
|
|
10
|
+
export async function getUserExtensions(userOid, pageArgs_ = {
|
|
11
|
+
sortField: "updatedAt",
|
|
12
|
+
}) {
|
|
13
|
+
const pageArgs = {
|
|
14
|
+
...DEFAULT_PAGE_ARGS,
|
|
15
|
+
...pageArgs_,
|
|
16
|
+
};
|
|
17
|
+
const queryUrl = queryPage(`${url}/${userOid}/extensions`, pageArgs);
|
|
18
|
+
return await ccwAxios
|
|
19
|
+
.get(queryUrl)
|
|
20
|
+
.then((res) => res.data.body);
|
|
21
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ccwAxios } from "@ccw-api/axios";
|
|
2
|
+
export const url = "https://community-web.ccw.site/api/v1/short_code/encode";
|
|
3
|
+
/**
|
|
4
|
+
* 生成作品邀请码
|
|
5
|
+
* @param {MongoDBId} inviterId 邀请人id
|
|
6
|
+
* @param {CNameOssUrl} inviterAvatar 邀请人头像
|
|
7
|
+
* @param {string} inviterName 邀请人用户名
|
|
8
|
+
* @param {MongoDBId} creationOid 作品id
|
|
9
|
+
* @returns {Promise<Res>}
|
|
10
|
+
*/
|
|
11
|
+
export async function encodeShortCode(inviterId, inviterAvatar, inviterName, creationOid) {
|
|
12
|
+
const req = {
|
|
13
|
+
origin: {
|
|
14
|
+
inviterAvatar,
|
|
15
|
+
inviterName,
|
|
16
|
+
inviterId,
|
|
17
|
+
inviterType: "STUDENT",
|
|
18
|
+
entrance: "create_detail",
|
|
19
|
+
creationOid,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
return await ccwAxios
|
|
23
|
+
.post(url, req)
|
|
24
|
+
.then((res) => res.data.body);
|
|
25
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { encodeShortCode } from "./encode";
|
|
2
|
+
test("test shortcode", async () => {
|
|
3
|
+
const res = await encodeShortCode("63c2807d669fa967f17f5559", "https://m.ccw.site/user_projects_assets/244373873/3fc7886d05aed9f369d2c0bb2d677fc0.jpeg", "孟夫子驾到", "6386e11cfc1ed14684de07f8");
|
|
4
|
+
expect(res.code).toHaveLength("yZdXmD3PvwVPA30W".length);
|
|
5
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import ccwAxios from "@ccw-api/axios";
|
|
2
|
+
export const url = "https://community-web.ccw.site/approval/list";
|
|
3
|
+
/**
|
|
4
|
+
* 获取特定用户的勋章数据
|
|
5
|
+
* @param {MongoDBId} studentOid 用户id
|
|
6
|
+
* @returns {Promise<Res<Tid, Tn>>} 勋章数据
|
|
7
|
+
*/
|
|
8
|
+
export async function getApprovalTags(studentOid) {
|
|
9
|
+
const req = {
|
|
10
|
+
objectId: studentOid,
|
|
11
|
+
objectType: "STUDENT",
|
|
12
|
+
};
|
|
13
|
+
return await ccwAxios
|
|
14
|
+
.post(url, req)
|
|
15
|
+
.then((res) => res.data.body);
|
|
16
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import ccwAxios from "@ccw-api/axios";
|
|
2
|
+
export const url = "https://community-web.ccw.site/base/dateTime";
|
|
3
|
+
/**
|
|
4
|
+
* @returns {Promise<number>} 当前时间戳,相当于Date.now()
|
|
5
|
+
*/
|
|
6
|
+
export async function getTime() {
|
|
7
|
+
return ccwAxios
|
|
8
|
+
.post(url, undefined)
|
|
9
|
+
.then((res) => res.data.body);
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ccwAxios } from "@ccw-api/axios";
|
|
2
|
+
export const url = "https://community-web.ccw.site/campaign_resource/detail";
|
|
3
|
+
/**
|
|
4
|
+
* 不知道这个接口有什么用,请查看https://www.ccw.site/pages/tags自行寻找用法
|
|
5
|
+
* @param {K} keyword 活动关键词
|
|
6
|
+
* @returns {Promise<Res<K>>}
|
|
7
|
+
*/
|
|
8
|
+
export async function getCampaignResources(keyword) {
|
|
9
|
+
return await ccwAxios
|
|
10
|
+
.post(url, { keyword })
|
|
11
|
+
.then((res) => res.data.body);
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { getCampaignResources } from "./detail";
|
|
2
|
+
test("get campaign resources with tags keyword", async () => {
|
|
3
|
+
const res = await getCampaignResources("tags");
|
|
4
|
+
expect(res.keyword).toBe("tags");
|
|
5
|
+
expect(res.resourceType).toBe("SUBJECT_AREA");
|
|
6
|
+
});
|
|
7
|
+
test("get campaign resources with mmo keyword", async () => {
|
|
8
|
+
const res = await getCampaignResources("mmo");
|
|
9
|
+
expect(res.keyword).toBe("mmo");
|
|
10
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ccwAxios } from "@ccw-api/axios";
|
|
2
|
+
export const url = "https://community-web.ccw.site/ccw-main/status";
|
|
3
|
+
/**
|
|
4
|
+
* ccw-main/status
|
|
5
|
+
* @returns {Promise<Res>} 信息
|
|
6
|
+
*/
|
|
7
|
+
export async function getCCWMainStatus() {
|
|
8
|
+
const req = {};
|
|
9
|
+
return await ccwAxios
|
|
10
|
+
.post(url, req)
|
|
11
|
+
.then((res) => res.data.body);
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { getCheckInRecords } from "./detail";
|
|
2
|
+
import { insertCheckInRecord } from "./insert";
|
|
3
|
+
test("get check in records should fail without channel", async () => {
|
|
4
|
+
await expect(getCheckInRecords).rejects.toThrow("ccw axios Request failed: token为空(4001082401)");
|
|
5
|
+
});
|
|
6
|
+
test("insert check in record should fail without token", async () => {
|
|
7
|
+
await expect(insertCheckInRecord).rejects.toThrow("ccw axios Request failed: token为空(4001082401)");
|
|
8
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ccwAxios } from "@ccw-api/axios";
|
|
2
|
+
export const url = "https://community-web.ccw.site/check_in_record/detail";
|
|
3
|
+
/**
|
|
4
|
+
* 获取本月签到记录
|
|
5
|
+
*/
|
|
6
|
+
export async function getCheckInRecords() {
|
|
7
|
+
const req = { scene: "HOMEPAGE" };
|
|
8
|
+
return await ccwAxios
|
|
9
|
+
.post(url, req)
|
|
10
|
+
.then((res) => res.data.body);
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ccwAxios } from "@ccw-api/axios";
|
|
2
|
+
export const url = "https://community-web.ccw.site/check_in_record/insert";
|
|
3
|
+
/**
|
|
4
|
+
* 插入签到记录(相当于签到)
|
|
5
|
+
* @returns {Promise<boolean>} 是否成功
|
|
6
|
+
*/
|
|
7
|
+
export async function insertCheckInRecord() {
|
|
8
|
+
const req = { scene: "HOMEPAGE" };
|
|
9
|
+
return await ccwAxios
|
|
10
|
+
.post(url, req)
|
|
11
|
+
.then((res) => res.data.body);
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ccwAxios } from "@ccw-api/axios";
|
|
2
|
+
import { DEFAULT_PAGE_ARGS, queryPage } from "src/queryPages";
|
|
3
|
+
export const url = "https://community-web.ccw.site/cloud_asset/search";
|
|
4
|
+
const dpa = {
|
|
5
|
+
...DEFAULT_PAGE_ARGS,
|
|
6
|
+
sortField: "createdAt",
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* 获取用户云背包特定目录内素材
|
|
10
|
+
* @param {MongoDBId} creatorOid 用户id
|
|
11
|
+
* @param {string} path 目录(例如'/23azZqHBnqj/2BzzTdi5I5C/')
|
|
12
|
+
* @param {Partial<PageArgs<SortField | T>>} pageArgs_ 分页参数
|
|
13
|
+
* @returns {Promise<Res>} 目录内的素材分页结果
|
|
14
|
+
*/
|
|
15
|
+
export async function searchCloudAssets(creatorOid, path = "/", pageArgs_ = {}) {
|
|
16
|
+
const pageArgs = {
|
|
17
|
+
...dpa,
|
|
18
|
+
...pageArgs_,
|
|
19
|
+
};
|
|
20
|
+
const queryUrl = queryPage(url, pageArgs);
|
|
21
|
+
const req = { creatorOid, path };
|
|
22
|
+
return await ccwAxios
|
|
23
|
+
.post(queryUrl, req)
|
|
24
|
+
.then((res) => res.data.body);
|
|
25
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { searchCloudAssets } from "./search";
|
|
2
|
+
test("search cloud assets should fail without token", async () => {
|
|
3
|
+
const userId = "63c2807d669fa967f17f5559";
|
|
4
|
+
const path = "/23azZqHBnqj/";
|
|
5
|
+
await expect(searchCloudAssets(userId, path)).rejects.toThrow("ccw axios Request failed: token为空(4001082401)");
|
|
6
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ccwAxios } from "@ccw-api/axios";
|
|
2
|
+
export const url = "https://community-web.ccw.site/cloud_asset/user/privacy";
|
|
3
|
+
/**
|
|
4
|
+
* 获取用户云存储空间信息
|
|
5
|
+
* @returns {Promise<Res>} 存储空间信息
|
|
6
|
+
*/
|
|
7
|
+
export async function getUserAssetStorageSize() {
|
|
8
|
+
return await ccwAxios
|
|
9
|
+
.post(url, {})
|
|
10
|
+
.then((res) => res.data.body);
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ccwAxios } from "@ccw-api/axios";
|
|
2
|
+
export const url = "https://community-web.ccw.site/comment/create";
|
|
3
|
+
/**
|
|
4
|
+
* 创建评论
|
|
5
|
+
* @param {string} content 评论内容
|
|
6
|
+
* @param {MinimalTopicInfo} topic 主题信息
|
|
7
|
+
* @param {string} sectionType 板块类型
|
|
8
|
+
* @returns {Promise<Res>} 创建的评论
|
|
9
|
+
*/
|
|
10
|
+
export async function createComment(content, topic, sectionType) {
|
|
11
|
+
topic.outline ??= "foo";
|
|
12
|
+
const req = { content, topic, sectionType };
|
|
13
|
+
return await ccwAxios
|
|
14
|
+
.post(url, req)
|
|
15
|
+
.then((res) => res.data.body);
|
|
16
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createComment } from "./create";
|
|
2
|
+
import { getPostDetail } from "../post/detail";
|
|
3
|
+
let samplePost;
|
|
4
|
+
beforeAll(async () => {
|
|
5
|
+
samplePost = await getPostDetail("0173b23d-139d-4c48-ad98-0aa17b5d3b60");
|
|
6
|
+
}, 30000);
|
|
7
|
+
test("create comment should fail without token", async () => {
|
|
8
|
+
await expect(createComment("test", {
|
|
9
|
+
outline: "a",
|
|
10
|
+
subjectOid: samplePost.oid,
|
|
11
|
+
subjectType: "POST",
|
|
12
|
+
}, "COMMENT")).rejects.toThrow("token为空");
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ccwAxios } from "@ccw-api/axios";
|
|
2
|
+
export const url = "https://community-web.ccw.site/comment/like_record/create";
|
|
3
|
+
/**
|
|
4
|
+
* 点赞评论
|
|
5
|
+
* @param {number} commentId 评论id
|
|
6
|
+
* @returns {Promise<Res>} 操作是否成功
|
|
7
|
+
*/
|
|
8
|
+
export async function likeComment(commentId) {
|
|
9
|
+
const req = { commentId };
|
|
10
|
+
return await ccwAxios
|
|
11
|
+
.post(url, req)
|
|
12
|
+
.then((res) => res.data.body);
|
|
13
|
+
}
|