185 lines
8.2 KiB
Plaintext
185 lines
8.2 KiB
Plaintext
syntax = "v1"
|
|
|
|
info (
|
|
title: "星遇社交平台 API"
|
|
desc: "账户、发现、动态、会员与 IM REST 接口定义"
|
|
author: "Xingyu"
|
|
version: "1.0"
|
|
)
|
|
|
|
type LoginRequest { Phone string `json:"phone"`; Password string `json:"password"`; DeviceID string `json:"deviceId"` }
|
|
type LoginResponse { AccessToken string `json:"accessToken"`; RefreshToken string `json:"refreshToken"`; ExpiresIn int64 `json:"expiresIn"`; UserID int64 `json:"userId"` }
|
|
type CreatePostRequest { Content string `json:"content"`; Media []string `json:"media"`; Location string `json:"location"`; Visibility int `json:"visibility"` }
|
|
type SMSRequest { Phone string `json:"phone"`; Scene string `json:"scene"` }
|
|
type ResetPasswordRequest { Phone string `json:"phone"`; Code string `json:"code"`; Password string `json:"password"` }
|
|
type SendMessageRequest { ClientMsgID string `json:"clientMsgId"`; Type int `json:"type"`; Content map[string]string `json:"content"` }
|
|
type UserVerificationRequest { Type string `json:"type"`; RealName string `json:"realName"`; DocumentNumber string `json:"documentNumber"`; Evidence []string `json:"evidence"` }
|
|
type AdminProfileRequest { Phone string `json:"phone"`; Nickname string `json:"nickname"`; Avatar string `json:"avatar"`; Cover string `json:"cover"`; Gender int `json:"gender"`; Birthday string `json:"birthday"`; Height int `json:"height"`; CityCode string `json:"cityCode"`; City string `json:"city"`; Occupation string `json:"occupation"`; Bio string `json:"bio"` }
|
|
type VerificationRequest { Type string `json:"type"`; Status string `json:"status"`; RealName string `json:"realName"`; DocumentMask string `json:"documentMask"`; Remark string `json:"remark"` }
|
|
type MembershipGrantRequest { Operation string `json:"operation"`; PlanID int64 `json:"planId"`; ExpiresAt string `json:"expiresAt"`; Reason string `json:"reason"` }
|
|
type PasswordResetByAdminRequest { NewPassword string `json:"newPassword"` }
|
|
type AdminCreateUserRequest { Phone string `json:"phone"`; Password string `json:"password"`; Nickname string `json:"nickname"`; Gender int `json:"gender,optional"`; City string `json:"city,optional"`; Bio string `json:"bio,optional"` }
|
|
type SanctionRequest { Type string `json:"type"`; Reason string `json:"reason"`; ExpiresAt string `json:"expiresAt"` }
|
|
type MembershipPlanRequest { Code string `json:"code"`; Name string `json:"name"`; Level int `json:"level"`; DurationDays int `json:"durationDays"`; DailyActiveChatLimit int `json:"dailyActiveChatLimit"`; DailyLikeLimit int `json:"dailyLikeLimit"`; CanViewVisitors bool `json:"canViewVisitors"`; CanInvisibleVisit bool `json:"canInvisibleVisit"`; RecommendationWeight int `json:"recommendationWeight"`; PriceCent int `json:"priceCent"`; OriginalPriceCent int `json:"originalPriceCent"`; Status int `json:"status"`; SortOrder int `json:"sortOrder"` }
|
|
type AdminOrderUpdateRequest { ProductID int64 `json:"productId"`; AmountCent int `json:"amountCent"`; Channel string `json:"channel"`; Status string `json:"status"` }
|
|
type AdminAccountRequest { Username string `json:"username"`; DisplayName string `json:"displayName"`; Password string `json:"password"`; Status int `json:"status"`; RoleIDs []int64 `json:"roleIds"` }
|
|
type AdminRoleRequest { Code string `json:"code"`; Name string `json:"name"`; Description string `json:"description"`; Status int `json:"status"`; Permissions []string `json:"permissions"` }
|
|
type MessageModerationRequest { Action string `json:"action"`; Reason string `json:"reason"` }
|
|
type FeedbackHandleRequest { Status string `json:"status"`; Reply string `json:"reply"` }
|
|
type AccountClosureHandleRequest { Action string `json:"action"`; Reason string `json:"reason"` }
|
|
type AppVersionRequest { Platform string `json:"platform"`; Version string `json:"version"`; BuildNumber int `json:"buildNumber"`; ForceUpdate bool `json:"forceUpdate"`; DownloadURL string `json:"downloadUrl"`; ReleaseNotes string `json:"releaseNotes"`; Status int `json:"status"` }
|
|
|
|
@server (prefix: /api/v1)
|
|
service social-api {
|
|
@handler Login
|
|
post /auth/login/password (LoginRequest) returns (LoginResponse)
|
|
@handler SendSMS
|
|
post /auth/sms/send (SMSRequest)
|
|
@handler ResetPassword
|
|
post /auth/password/reset (ResetPasswordRequest)
|
|
@handler Me
|
|
get /me
|
|
@handler MyVerification
|
|
get /me/verification
|
|
@handler SubmitVerification
|
|
post /me/verification (UserVerificationRequest)
|
|
@handler SearchUsers
|
|
get /users/search
|
|
@handler Following
|
|
get /me/following
|
|
@handler Followers
|
|
get /me/followers
|
|
@handler Visitors
|
|
get /me/visitors
|
|
@handler Privacy
|
|
get /me/privacy
|
|
@handler NotificationSettings
|
|
get /me/notification-settings
|
|
@handler UpdateNotificationSettings
|
|
put /me/notification-settings
|
|
@handler MyDevices
|
|
get /me/devices
|
|
@handler MyFeedback
|
|
get /me/feedback
|
|
@handler SubmitFeedback
|
|
post /me/feedback
|
|
@handler AccountClosure
|
|
get /me/account-closure
|
|
@handler MyOrders
|
|
get /me/orders
|
|
@handler MyReports
|
|
get /me/reports
|
|
@handler Discover
|
|
// Each item may include latestPost: id, content, createdAt, media and mediaThumbnails (up to 3 images).
|
|
get /discover/recommendations
|
|
@handler Nearby
|
|
// Query: gender=1|2, online=0|1, minAge=18..100, maxAge=18..100, page, pageSize. Each item may include latestPost.
|
|
get /nearby/users
|
|
@handler Feed
|
|
get /feed
|
|
@handler CreatePost
|
|
post /posts (CreatePostRequest)
|
|
@handler PostDetail
|
|
get /posts/:id
|
|
@handler Comments
|
|
get /posts/:id/comments
|
|
@handler Conversations
|
|
get /im/conversations
|
|
@handler Messages
|
|
get /im/conversations/:id/messages
|
|
@handler SendMessage
|
|
post /im/conversations/:id/messages (SendMessageRequest)
|
|
@handler RecallMessage
|
|
post /im/messages/:id/recall
|
|
@handler MembershipPlans
|
|
get /membership/plans
|
|
@handler PaymentChannels
|
|
get /payment/channels
|
|
@handler CreateOrder
|
|
post /orders
|
|
@handler PayOrder
|
|
post /orders/:id/pay
|
|
}
|
|
|
|
@server (prefix: /admin/v1)
|
|
service social-admin-api {
|
|
@handler AdminCreateUser
|
|
post /users (AdminCreateUserRequest)
|
|
@handler AdminUsers
|
|
get /users
|
|
@handler AdminUserDetail
|
|
get /users/:id
|
|
@handler AdminUpdateProfile
|
|
put /users/:id/profile (AdminProfileRequest)
|
|
@handler AdminUpdateVerification
|
|
put /users/:id/verification (VerificationRequest)
|
|
@handler AdminUpdateMembership
|
|
put /users/:id/membership (MembershipGrantRequest)
|
|
@handler AdminResetPassword
|
|
post /users/:id/password-reset (PasswordResetByAdminRequest)
|
|
@handler AdminForceLogout
|
|
post /users/:id/force-logout
|
|
@handler AdminUserSanctions
|
|
get /users/:id/sanctions
|
|
@handler AdminCreateSanction
|
|
post /users/:id/sanctions (SanctionRequest)
|
|
@handler AdminRevokeSanction
|
|
post /sanctions/:id/revoke
|
|
@handler AdminOrders
|
|
get /orders
|
|
@handler AdminUpdateOrder
|
|
put /orders/:id (AdminOrderUpdateRequest)
|
|
@handler AdminDeleteOrder
|
|
delete /orders/:id
|
|
@handler AdminMarkOrderPaid
|
|
post /orders/:id/pay
|
|
@handler AdminCloseOrder
|
|
post /orders/:id/close
|
|
@handler AdminRefundOrder
|
|
post /orders/:id/refund
|
|
@handler AdminMembershipPlans
|
|
get /membership/plans
|
|
@handler AdminCreateMembershipPlan
|
|
post /membership/plans (MembershipPlanRequest)
|
|
@handler AdminUpdateMembershipPlan
|
|
put /membership/plans/:id (MembershipPlanRequest)
|
|
@handler AdminDeleteMembershipPlan
|
|
delete /membership/plans/:id
|
|
@handler AdminMessages
|
|
get /messages
|
|
@handler AdminModerateMessage
|
|
post /messages/:id/moderate (MessageModerationRequest)
|
|
@handler AdminFeedback
|
|
get /client-feedback
|
|
@handler AdminHandleFeedback
|
|
put /client-feedback/:id (FeedbackHandleRequest)
|
|
@handler AdminAccountClosures
|
|
get /account-closures
|
|
@handler AdminCancelAccountClosure
|
|
put /account-closures/:id (AccountClosureHandleRequest)
|
|
@handler AdminAppVersions
|
|
get /app-versions
|
|
@handler AdminCreateAppVersion
|
|
post /app-versions (AppVersionRequest)
|
|
@handler AdminUpdateAppVersion
|
|
put /app-versions/:id (AppVersionRequest)
|
|
@handler AdminDeleteAppVersion
|
|
delete /app-versions/:id
|
|
@handler AdminAccounts
|
|
get /admin-users
|
|
@handler AdminCreateAccount
|
|
post /admin-users (AdminAccountRequest)
|
|
@handler AdminUpdateAccount
|
|
put /admin-users/:id (AdminAccountRequest)
|
|
@handler AdminRoles
|
|
get /admin-roles
|
|
@handler AdminCreateRole
|
|
post /admin-roles (AdminRoleRequest)
|
|
@handler AdminUpdateRole
|
|
put /admin-roles/:id (AdminRoleRequest)
|
|
@handler AdminDeleteRole
|
|
delete /admin-roles/:id
|
|
@handler AdminPermissions
|
|
get /admin-permissions
|
|
}
|