Skip to content

Commit

Permalink
update: subscription level
Browse files Browse the repository at this point in the history
  • Loading branch information
zmh-program committed Nov 29, 2023
1 parent 9423edb commit 0b092b6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ if sub, err := instance.GetSubscription(); err == nil {
}

// buy subscription
if err := instance.Subscribe(1); err == nil {
fmt.Println("bought subscription for 1 month successfully")
if err := instance.Subscribe(1, 1); err == nil {
fmt.Println("bought basic subscription for 1 month successfully")
}

// get package
Expand Down
3 changes: 2 additions & 1 deletion quota.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ func (i *Instance) GetSubscription() (*Subscription, error) {
return data, nil
}

func (i *Instance) Subscribe(month int) error {
func (i *Instance) Subscribe(level int, month int) error {
data, err := utils.PostForm[Subscribe](i.Mix("/subscribe"), i.GetHeaders(), map[string]interface{}{
"level": level,
"month": month,
})

Expand Down
2 changes: 1 addition & 1 deletion quota_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func TestInstance_Subscribe(t *testing.T) {
return
}

err := instance.Subscribe(1)
err := instance.Subscribe(1, 1)
if err != nil {
t.Error(err)
}
Expand Down

0 comments on commit 0b092b6

Please sign in to comment.