1.4.5.2
This commit is contained in:
16
EdgeAPI/internal/dnsclients/dnsla/response_all_line_list.go
Normal file
16
EdgeAPI/internal/dnsclients/dnsla/response_all_line_list.go
Normal file
@@ -0,0 +1,16 @@
|
||||
// Copyright 2023 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package dnsla
|
||||
|
||||
type AllLineListResponseChild struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Code string `json:"code"`
|
||||
Children []AllLineListResponseChild `json:"children"`
|
||||
}
|
||||
|
||||
type AllLineListResponse struct {
|
||||
BaseResponse
|
||||
|
||||
Data []AllLineListResponseChild `json:"data"`
|
||||
}
|
||||
21
EdgeAPI/internal/dnsclients/dnsla/response_base.go
Normal file
21
EdgeAPI/internal/dnsclients/dnsla/response_base.go
Normal file
@@ -0,0 +1,21 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package dnsla
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/iwind/TeaGo/types"
|
||||
)
|
||||
|
||||
type BaseResponse struct {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
func (this *BaseResponse) Success() bool {
|
||||
return this.Code == 200
|
||||
}
|
||||
|
||||
func (this *BaseResponse) Error() error {
|
||||
return errors.New("code:" + types.String(this.Code) + ", message:" + this.Msg)
|
||||
}
|
||||
11
EdgeAPI/internal/dnsclients/dnsla/response_domain.go
Normal file
11
EdgeAPI/internal/dnsclients/dnsla/response_domain.go
Normal file
@@ -0,0 +1,11 @@
|
||||
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package dnsla
|
||||
|
||||
type DomainResponse struct {
|
||||
BaseResponse
|
||||
|
||||
Data struct {
|
||||
Id string `json:"id"`
|
||||
} `json:"data"`
|
||||
}
|
||||
15
EdgeAPI/internal/dnsclients/dnsla/response_domain_list.go
Normal file
15
EdgeAPI/internal/dnsclients/dnsla/response_domain_list.go
Normal file
@@ -0,0 +1,15 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package dnsla
|
||||
|
||||
type DomainListResponse struct {
|
||||
BaseResponse
|
||||
|
||||
Data struct {
|
||||
Total int `json:"total"`
|
||||
Results []struct {
|
||||
Id string `json:"id"`
|
||||
Domain string `json:"domain"`
|
||||
} `json:"results"`
|
||||
} `json:"data"`
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package dnsla
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDomainListResponse(t *testing.T) {
|
||||
var bodyJSON = []byte(`{
|
||||
"status": {
|
||||
"code": 300,
|
||||
"name": "操作成功",
|
||||
"message": "",
|
||||
"request_time": "2022-08-07 07:43:34"
|
||||
},
|
||||
"total": {
|
||||
"all_total": 3,
|
||||
"data_total": 3,
|
||||
"skip_number": 0
|
||||
},
|
||||
"datas": [
|
||||
{
|
||||
"domainid": 6772732,
|
||||
"userid": 459662,
|
||||
"domainname": "hello3.com",
|
||||
"grade": "免费套餐",
|
||||
"domain_status": "正常",
|
||||
"domain_active": "yes",
|
||||
"groupid": 0,
|
||||
"nsstate": "未知",
|
||||
"createtime": "2022-08-07 07:42:27"
|
||||
},
|
||||
{
|
||||
"domainid": 6772731,
|
||||
"userid": 459662,
|
||||
"domainname": "hello2.com",
|
||||
"grade": "免费套餐",
|
||||
"domain_status": "正常",
|
||||
"domain_active": "yes",
|
||||
"groupid": 0,
|
||||
"nsstate": "未知",
|
||||
"createtime": "2022-08-07 07:42:19"
|
||||
},
|
||||
{
|
||||
"domainid": 6772358,
|
||||
"userid": 459662,
|
||||
"domainname": "hello1234.com",
|
||||
"grade": "免费套餐",
|
||||
"domain_status": "正常",
|
||||
"domain_active": "yes",
|
||||
"groupid": 0,
|
||||
"nsstate": "错误",
|
||||
"createtime": "2022-08-07 11:42:05"
|
||||
}
|
||||
]
|
||||
}`)
|
||||
var resp = &DomainListResponse{}
|
||||
err := json.Unmarshal(bodyJSON, resp)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Logf("%+v", resp)
|
||||
t.Log(resp.Success(), resp.Error())
|
||||
}
|
||||
11
EdgeAPI/internal/dnsclients/dnsla/response_record_create.go
Normal file
11
EdgeAPI/internal/dnsclients/dnsla/response_record_create.go
Normal file
@@ -0,0 +1,11 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package dnsla
|
||||
|
||||
type RecordCreateResponse struct {
|
||||
BaseResponse
|
||||
|
||||
Data struct {
|
||||
Id string `json:"id"`
|
||||
} `json:"data"`
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package dnsla
|
||||
|
||||
type RecordDeleteResponse struct {
|
||||
BaseResponse
|
||||
}
|
||||
22
EdgeAPI/internal/dnsclients/dnsla/response_record_list.go
Normal file
22
EdgeAPI/internal/dnsclients/dnsla/response_record_list.go
Normal file
@@ -0,0 +1,22 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package dnsla
|
||||
|
||||
type RecordListResponse struct {
|
||||
BaseResponse
|
||||
|
||||
Data struct {
|
||||
Total int `json:"total"`
|
||||
Results []struct {
|
||||
Id string `json:"id"`
|
||||
Host string `json:"host"`
|
||||
Data string `json:"data"`
|
||||
TTL int `json:"ttl"`
|
||||
Type int `json:"type"`
|
||||
LineId string `json:"lineId"`
|
||||
LineCode string `json:"lineCode"`
|
||||
LineName string `json:"lineName"`
|
||||
Weight int `json:"weight"`
|
||||
} `json:"results"`
|
||||
} `json:"data"`
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package dnsla
|
||||
|
||||
type RecordUpdateResponse struct {
|
||||
BaseResponse
|
||||
}
|
||||
Reference in New Issue
Block a user