1+ /*
2+ * Copyright (c) 2024. Devtron Inc.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
117package api
218
319import (
@@ -7,7 +23,7 @@ import (
723 "net/http"
824)
925
10- //use of writeJsonRespStructured is preferable. it api exists due to historical reason
26+ // use of writeJsonRespStructured is preferable. it api exists due to historical reason
1127// err.message is used as internal message for ApiError object in resp
1228func writeJsonResp (w http.ResponseWriter , err error , respBody interface {}, status int ) {
1329 response := ResponseV2 {}
@@ -68,7 +84,7 @@ func writeJsonResp(w http.ResponseWriter, err error, respBody interface{}, statu
6884 w .Write (b )
6985}
7086
71- //use this method when we have specific api error to be conveyed to api User
87+ // use this method when we have specific api error to be conveyed to api User
7288func writeJsonRespStructured (w http.ResponseWriter , err error , respBody interface {}, status int , apiErrors []* util.ApiError ) {
7389 response := ResponseV2 {}
7490 response .Code = status
@@ -88,7 +104,7 @@ func writeJsonRespStructured(w http.ResponseWriter, err error, respBody interfac
88104 w .Write (b )
89105}
90106
91- //global response body used across api
107+ // global response body used across api
92108type ResponseV2 struct {
93109 Code int `json:"code,omitempty"`
94110 Status string `json:"status,omitempty"`
0 commit comments