1.4.5.2
This commit is contained in:
21
EdgeAPI/internal/dnsclients/edgeapi/response_base.go
Normal file
21
EdgeAPI/internal/dnsclients/edgeapi/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 edgeapi
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/iwind/TeaGo/types"
|
||||
)
|
||||
|
||||
type BaseResponse struct {
|
||||
Code int `json:"code"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
func (this *BaseResponse) IsValid() bool {
|
||||
return this.Code == 200
|
||||
}
|
||||
|
||||
func (this *BaseResponse) Error() error {
|
||||
return errors.New("code: " + types.String(this.Code) + ", message: " + this.Message)
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package edgeapi
|
||||
|
||||
type CreateNSRecordResponse struct {
|
||||
BaseResponse
|
||||
|
||||
Data struct {
|
||||
NSRecordId int64 `json:"nsRecordId"`
|
||||
} `json:"data"`
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package edgeapi
|
||||
|
||||
type FindAllNSRoutesResponse struct {
|
||||
BaseResponse
|
||||
|
||||
Data struct {
|
||||
NSRoutes []struct {
|
||||
Name string `json:"name"`
|
||||
Code string `json:"code"`
|
||||
} `json:"nsRoutes"`
|
||||
} `json:"data"`
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package edgeapi
|
||||
|
||||
type FindDomainWithNameResponse struct {
|
||||
BaseResponse
|
||||
|
||||
Data struct {
|
||||
NSDomain struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
} `json:"data"`
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package edgeapi
|
||||
|
||||
type FindNSRecordWithNameAndTypeResponse struct {
|
||||
BaseResponse
|
||||
|
||||
Data struct {
|
||||
NSRecord struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Value string `json:"value"`
|
||||
TTL int32 `json:"ttl"`
|
||||
NSRoutes []struct {
|
||||
Name string `json:"name"`
|
||||
Code string `json:"code"`
|
||||
} `json:"nsRoutes"`
|
||||
} `json:"nsRecord"`
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package edgeapi
|
||||
|
||||
type FindNSRecordsWithNameAndTypeResponse struct {
|
||||
BaseResponse
|
||||
|
||||
Data struct {
|
||||
NSRecords []struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Value string `json:"value"`
|
||||
TTL int32 `json:"ttl"`
|
||||
NSRoutes []struct {
|
||||
Name string `json:"name"`
|
||||
Code string `json:"code"`
|
||||
} `json:"nsRoutes"`
|
||||
} `json:"nsRecords"`
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package edgeapi
|
||||
|
||||
type GetAPIAccessToken struct {
|
||||
BaseResponse
|
||||
|
||||
Data struct {
|
||||
Token string `json:"token"`
|
||||
ExpiresAt int64 `json:"expiresAt"`
|
||||
} `json:"data"`
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package edgeapi
|
||||
|
||||
type ResponseInterface interface {
|
||||
IsValid() bool
|
||||
Error() error
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package edgeapi
|
||||
|
||||
type ListNSDomainsResponse struct {
|
||||
BaseResponse
|
||||
|
||||
Data struct {
|
||||
NSDomains []struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
IsOn bool `json:"isOn"`
|
||||
IsDeleted bool `json:"isDeleted"`
|
||||
} `json:"nsDomains"`
|
||||
} `json:"data"`
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package edgeapi
|
||||
|
||||
type ListNSRecordsResponse struct {
|
||||
BaseResponse
|
||||
|
||||
Data struct {
|
||||
NSRecords []struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Value string `json:"value"`
|
||||
TTL int32 `json:"ttl"`
|
||||
Type string `json:"type"`
|
||||
NSRoutes []struct {
|
||||
Name string `json:"name"`
|
||||
Code string `json:"code"`
|
||||
} `json:"nsRoutes"`
|
||||
} `json:"nsRecords"`
|
||||
} `json:"data"`
|
||||
}
|
||||
7
EdgeAPI/internal/dnsclients/edgeapi/response_success.go
Normal file
7
EdgeAPI/internal/dnsclients/edgeapi/response_success.go
Normal file
@@ -0,0 +1,7 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package edgeapi
|
||||
|
||||
type SuccessResponse struct {
|
||||
BaseResponse
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package edgeapi
|
||||
|
||||
type UpdateNSRecordResponse struct {
|
||||
BaseResponse
|
||||
}
|
||||
Reference in New Issue
Block a user