-
Notifications
You must be signed in to change notification settings - Fork 5
/
admin.go
73 lines (66 loc) · 2.02 KB
/
admin.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright (c) 2018 - 2021
// AccelByte Inc. All Rights Reserved.
// This is licensed software from AccelByte Inc, for limitations
// and restrictions contact your company contract manager.
package qosm
import (
"github.com/AccelByte/accelbyte-go-sdk/qosm-sdk/pkg/qosmclient"
"github.com/AccelByte/accelbyte-go-sdk/qosm-sdk/pkg/qosmclient/admin"
"github.com/AccelByte/accelbyte-go-sdk/services-api/pkg/repository"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/client"
)
type AdminService struct {
Client *qosmclient.JusticeQosmService
TokenRepository repository.TokenRepository
}
// Deprecated: Use DeleteServerShort instead
func (a *AdminService) DeleteServer(input *admin.DeleteServerParams) error {
accessToken, err := a.TokenRepository.GetToken()
if err != nil {
return err
}
_, internalServerError, err := a.Client.Admin.DeleteServer(input, client.BearerToken(*accessToken.AccessToken))
if internalServerError != nil {
return internalServerError
}
if err != nil {
return err
}
return nil
}
// Deprecated: Use SetServerAliasShort instead
func (a *AdminService) SetServerAlias(input *admin.SetServerAliasParams) error {
accessToken, err := a.TokenRepository.GetToken()
if err != nil {
return err
}
_, badRequest, notFound, internalServerError, err := a.Client.Admin.SetServerAlias(input, client.BearerToken(*accessToken.AccessToken))
if badRequest != nil {
return badRequest
}
if notFound != nil {
return notFound
}
if internalServerError != nil {
return internalServerError
}
if err != nil {
return err
}
return nil
}
func (a *AdminService) DeleteServerShort(input *admin.DeleteServerParams, authInfo runtime.ClientAuthInfoWriter) error {
_, err := a.Client.Admin.DeleteServerShort(input, authInfo)
if err != nil {
return err
}
return nil
}
func (a *AdminService) SetServerAliasShort(input *admin.SetServerAliasParams, authInfo runtime.ClientAuthInfoWriter) error {
_, err := a.Client.Admin.SetServerAliasShort(input, authInfo)
if err != nil {
return err
}
return nil
}