Documentation
¶
Index ¶
- Constants
- Variables
- type Birthday
- type CardInfo
- type CardListTransactionsOptions
- type CardService
- type CardTransaction
- type Client
- type Dept
- type EnterpriseService
- type ErrorResponse
- type IDToken
- type Identity
- type Major
- type Organize
- type Position
- type Positions
- type Post
- type Profile
- type ProfileService
- type Response
- type Type
Constants ¶
const ( Issuer = "https://jaccount.sjtu.edu.cn/oauth2/" LogoutURL = "https://jaccount.sjtu.edu.cn/oauth2/logout" )
const ( // ScopeOpenID is the mandatory scope for all OpenID Connect OAuth2 requests. ScopeOpenID = "openid" // Read Scope ScopeBasic = "basic" ScopeEssential = "essential" ScopeProfile = "profile" ScopeTasks = "tasks" ScopeNotifications = "notifications" ScopePrivacy = "privacy" ScopeIntrospect = "introspect" ScopeReadApps = "read_apps" ScopeWriteApps = "write_apps" ScopeExchangeData = "exchange_data" // Write Scope ScopeSendNotification = "send_notification" ScopeReadMails = "read_mails" ScopeSendMail = "send_mail" ScopeStorage = "storage" ScopeModifyNotification = "modify_notification" ScopeLessons = "lessons" ScopeClasses = "classes" ScopeExams = "exams" ScopeScores = "scores" ScopeStudentList = "student_list" ScopeCardInfo = "card_info" ScopeCardTransactions = "card_transactions" ScopeWriteCardInfo = "write_card_info" ScopeIncome = "income" ScopeCreateJAccount = "create_jaccount" ScopeEditJAccount = "edit_jaccount" ScopeNetServiceInfo = "net_service_info" ScopeConnectWechat = "connect_wechat" ScopeConnectShmec = "connect_shmec" ScopePrint = "print" ScopeConnectFinance = "connect_finance" ScopeStudentAffairs = "student_affairs" )
Variables ¶
var Endpoint = oauth2.Endpoint{
AuthURL: "https://jaccount.sjtu.edu.cn/oauth2/authorize",
TokenURL: "https://jaccount.sjtu.edu.cn/oauth2/token",
}
Endpoint is jAccount's OAuth 2.0 endpoint.
Functions ¶
This section is empty.
Types ¶
type Birthday ¶
type Birthday struct { BirthYear string `json:"birthYear,omitempty"` BirthMonth string `json:"birthMonth,omitempty"` BirthDay string `json:"birthDay,omitempty"` }
Birthday represents the birthday of the user.
type CardInfo ¶
type CardInfo struct { User *Profile `json:"user,omitempty"` CardNO string `json:"cardNo,omitempty"` CardID string `json:"cardId,omitempty"` BankNO string `json:"bankNo,omitempty"` CardBalance float64 `json:"cardBalance,omitempty"` Transbalance float64 `json:"transbalance,omitempty"` Lost bool `json:"lost,omitempty"` Frozen bool `json:"frozen,omitempty"` }
type CardService ¶
type CardService service
CardService handles communications with the card data related methods of the jAccount API.
See https://developer.sjtu.edu.cn/api/card.html for more information.
func (*CardService) GetCardInfo ¶
func (s *CardService) GetCardInfo(ctx context.Context) (*CardInfo, error)
GetCardInfo returns the card information for the user.
See https://developer.sjtu.edu.cn/api/card.html#%E8%8E%B7%E5%8F%96%E6%A0%A1%E5%9B%AD%E5%8D%A1%E4%BF%A1%E6%81%AF for more information.
func (*CardService) ListTransactions ¶
func (s *CardService) ListTransactions(ctx context.Context, opts *CardListTransactionsOptions) ([]*CardTransaction, error)
ListTransactions returns a list of transactions for the given card.
See https://developer.sjtu.edu.cn/api/card.html#%E8%8E%B7%E5%8F%96%E4%BA%A4%E6%98%93%E8%AE%B0%E5%BD%95%E4%BF%A1%E6%81%AF for more information.
type CardTransaction ¶
type CardTransaction struct { DateTime int64 `json:"dateTime,omitempty"` System string `json:"system,omitempty"` Merchant string `json:"merchant,omitempty"` Description string `json:"description,omitempty"` Amount float64 `json:"amount,omitempty"` CardBalance float64 `json:"cardBalance,omitempty"` }
type Client ¶
type Client struct { BaseURL *url.URL UserAgent string Profile *ProfileService Card *CardService Enterprise *EnterpriseService // contains filtered or unexported fields }
Client manages communication with the jAccount API.
type EnterpriseService ¶
type EnterpriseService service
EnterpriseService handles communications with the enterprise data related methods of the jAccount API.
See https://developer.sjtu.edu.cn/api/enterprise.html for more information.
func (*EnterpriseService) GetUserPositions ¶
func (s *EnterpriseService) GetUserPositions(ctx context.Context) (*Positions, error)
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response ErrNO int `json:"errno,omitempty"` InternalError string `json:"error,omitempty"` Total int `json:"total,omitempty"` }
ErrorResponse reports one or more errors caused by an API request.
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type IDToken ¶
type IDToken struct { Issuer string Audience string Subject string Expiry time.Time IssuedAt time.Time Nonce string Name string Code string Type Type }
func VerifyToken ¶
type Identity ¶
type Identity struct { Kind string `json:"kind,omitempty"` IsDefault bool `json:"isDefault,omitempty"` Code string `json:"code,omitempty"` UserType string `json:"userType,omitempty"` Organize *Organize `json:"organize,omitempty"` MgtOrganize *Organize `json:"mgtOrganize,omitempty"` Status string `json:"status,omitempty"` ExpireDate string `json:"expireDate,omitempty"` CreateDate int64 `json:"createDate,omitempty"` UpdateDate int64 `json:"updateDate,omitempty"` ClassNO string `json:"classNo,omitempty"` Gjm string `json:"gjm,omitempty"` Major *Major `json:"major,omitempty"` AdmissionDate string `json:"admissionDate,omitempty"` TrainLevel string `json:"trainLevel,omitempty"` GraduateDate string `json:"graduateDate,omitempty"` }
Identity represents the identification of the user.
type Profile ¶
type Profile struct { ID string `json:"id,omitempty"` Account string `json:"account,omitempty"` Name string `json:"name,omitempty"` Kind string `json:"kind,omitempty"` Code string `json:"code,omitempty"` UserType string `json:"userType,omitempty"` Organize *Organize `json:"organize,omitempty"` ClassNO string `json:"classNo,omitempty"` Birthday *Birthday `json:"birthday,omitempty"` Gender string `json:"gender,omitempty"` Email string `json:"email,omitempty"` TimeZone int `json:"timeZone,omitempty"` Identities []*Identity `json:"identities,omitempty"` CardNO string `json:"cardNo,omitempty"` CardType string `json:"cardType,omitempty"` UnionID string `json:"unionId,omitempty"` }
Profile represents the profile of the user.
type ProfileService ¶
type ProfileService service
ProfileService handles communications with the profile data related methods of the jAccount API.
See https://developer.sjtu.edu.cn/api/profile.html for more information.
type Response ¶
type Response struct { ErrNO int `json:"errno,omitempty"` Error string `json:"error,omitempty"` Total int `json:"total,omitempty"` NextToken string `json:"nextToken,omitempty"` Entities json.RawMessage `json:"entities,omitempty"` }
Response is a jAccount API response.
type Type ¶
type Type string
const ( // FACULTY represents "教职工". FACULTY Type = "faculty" // STUDENT represents "学生". STUDENT Type = "student" // MEDICAL_SCHOOL_FACULTY represents "医学院教职工". MEDICAL_SCHOOL_FACULTY Type = "yxy" // AFFILIATED_UNIT_FACULTY represents "附属单位职工". AFFILIATED_UNIT_FACULTY Type = "fsyyjzg" // VIP represents "贵宾". VIP Type = "vip" // POSTPHD represents "博士后". POSTPHD Type = "postphd" // EXTERNAL_TEACHER represents "外聘教师". EXTERNAL_TEACHER Type = "external_teacher" // SUMMER represents "暑期生". SUMMER Type = "summer" // TEAM represents "集体账号". TEAM Type = "team" // ALUMNI represents "校友". ALUMNI Type = "alumni" // GREEN represents "绿色通道". GREEN Type = "green" // OUTSIDE represents "合作交流". OUTSIDE Type = "outside" )