@@ -20,7 +20,7 @@ import (
2020 "google.golang.org/protobuf/proto"
2121
2222 "github.com/dgraph-io/dgo/v250/protos/api"
23- apiv25 "github.com/dgraph-io/dgo/v250/protos/api.v25 "
23+ apiv2 "github.com/dgraph-io/dgo/v250/protos/api.v2 "
2424 "github.com/hypermodeinc/dgraph/v25/schema"
2525 "github.com/hypermodeinc/dgraph/v25/x"
2626)
@@ -61,7 +61,7 @@ type resultNamespaces struct {
6161}
6262
6363func (s * ServerV25 ) SignInUser (ctx context.Context ,
64- request * apiv25 .SignInUserRequest ) (* apiv25 .SignInUserResponse , error ) {
64+ request * apiv2 .SignInUserRequest ) (* apiv2 .SignInUserResponse , error ) {
6565
6666 req := & api.LoginRequest {Userid : request .UserId , Password : request .Password , Namespace : 0 }
6767 resp , err := (& Server {}).Login (ctx , req )
@@ -73,11 +73,11 @@ func (s *ServerV25) SignInUser(ctx context.Context,
7373 return nil , err
7474 }
7575
76- return & apiv25 .SignInUserResponse {AccessJwt : jwt .AccessJwt , RefreshJwt : jwt .RefreshJwt }, nil
76+ return & apiv2 .SignInUserResponse {AccessJwt : jwt .AccessJwt , RefreshJwt : jwt .RefreshJwt }, nil
7777}
7878
79- func (s * ServerV25 ) CreateNamespace (ctx context.Context , in * apiv25 .CreateNamespaceRequest ) (
80- * apiv25 .CreateNamespaceResponse , error ) {
79+ func (s * ServerV25 ) CreateNamespace (ctx context.Context , in * apiv2 .CreateNamespaceRequest ) (
80+ * apiv2 .CreateNamespaceResponse , error ) {
8181
8282 if err := AuthSuperAdmin (ctx ); err != nil {
8383 s := status .Convert (err )
@@ -112,11 +112,11 @@ func (s *ServerV25) CreateNamespace(ctx context.Context, in *apiv25.CreateNamesp
112112 }
113113
114114 glog .Infof ("Created namespace [%v] with id [%d]" , in .NsName , ns )
115- return & apiv25 .CreateNamespaceResponse {}, nil
115+ return & apiv2 .CreateNamespaceResponse {}, nil
116116}
117117
118- func (s * ServerV25 ) DropNamespace (ctx context.Context , in * apiv25 .DropNamespaceRequest ) (
119- * apiv25 .DropNamespaceResponse , error ) {
118+ func (s * ServerV25 ) DropNamespace (ctx context.Context , in * apiv2 .DropNamespaceRequest ) (
119+ * apiv2 .DropNamespaceResponse , error ) {
120120
121121 if err := AuthSuperAdmin (ctx ); err != nil {
122122 s := status .Convert (err )
@@ -152,7 +152,7 @@ func (s *ServerV25) DropNamespace(ctx context.Context, in *apiv25.DropNamespaceR
152152
153153 if nsID == 0 {
154154 glog .Infof ("Namespace [%v] not found" , in .NsName )
155- return & apiv25 .DropNamespaceResponse {}, nil
155+ return & apiv2 .DropNamespaceResponse {}, nil
156156 }
157157
158158 // If we crash at this point, it is possible that namespace is deleted
@@ -167,11 +167,11 @@ func (s *ServerV25) DropNamespace(ctx context.Context, in *apiv25.DropNamespaceR
167167 }
168168
169169 glog .Infof ("Dropped namespace [%v] with id [%d]" , in .NsName , nsID )
170- return & apiv25 .DropNamespaceResponse {}, nil
170+ return & apiv2 .DropNamespaceResponse {}, nil
171171}
172172
173- func (s * ServerV25 ) UpdateNamespace (ctx context.Context , in * apiv25 .UpdateNamespaceRequest ) (
174- * apiv25 .UpdateNamespaceResponse , error ) {
173+ func (s * ServerV25 ) UpdateNamespace (ctx context.Context , in * apiv2 .UpdateNamespaceRequest ) (
174+ * apiv2 .UpdateNamespaceResponse , error ) {
175175
176176 if err := AuthSuperAdmin (ctx ); err != nil {
177177 s := status .Convert (err )
@@ -188,19 +188,19 @@ func (s *ServerV25) UpdateNamespace(ctx context.Context, in *apiv25.UpdateNamesp
188188
189189 if isLgacyNamespace (in .NsName ) {
190190 err := renameLeagcyNamespace (ctx , in .NsName , in .RenameToNs )
191- return & apiv25 .UpdateNamespaceResponse {}, err
191+ return & apiv2 .UpdateNamespaceResponse {}, err
192192 }
193193
194194 if err := renameNamespace (x .AttachJWTNamespace (ctx ), in .NsName , in .RenameToNs ); err != nil {
195195 return nil , err
196196 }
197197
198198 glog .Infof ("Renamed namespace [%v] to [%v]" , in .NsName , in .RenameToNs )
199- return & apiv25 .UpdateNamespaceResponse {}, nil
199+ return & apiv2 .UpdateNamespaceResponse {}, nil
200200}
201201
202- func (s * ServerV25 ) ListNamespaces (ctx context.Context , in * apiv25 .ListNamespacesRequest ) (
203- * apiv25 .ListNamespacesResponse , error ) {
202+ func (s * ServerV25 ) ListNamespaces (ctx context.Context , in * apiv2 .ListNamespacesRequest ) (
203+ * apiv2 .ListNamespacesResponse , error ) {
204204
205205 if err := AuthSuperAdmin (ctx ); err != nil {
206206 s := status .Convert (err )
@@ -224,13 +224,13 @@ func (s *ServerV25) ListNamespaces(ctx context.Context, in *apiv25.ListNamespace
224224 }
225225
226226 schNsList := schema .State ().Namespaces ()
227- result := & apiv25 .ListNamespacesResponse {NsList : make (map [string ]* apiv25 .Namespace )}
227+ result := & apiv2 .ListNamespacesResponse {NsList : make (map [string ]* apiv2 .Namespace )}
228228 for id := range schNsList {
229229 if name , ok := dataNsList [id ]; ! ok {
230230 name = fmt .Sprintf ("dgraph-%d" , id )
231- result .NsList [name ] = & apiv25 .Namespace {Name : name , Id : id }
231+ result .NsList [name ] = & apiv2 .Namespace {Name : name , Id : id }
232232 } else {
233- result .NsList [name ] = & apiv25 .Namespace {Name : name , Id : id }
233+ result .NsList [name ] = & apiv2 .Namespace {Name : name , Id : id }
234234 }
235235 }
236236
0 commit comments