commit 5ca94389bbd608f88d9210d308ff341ed46c7b05
parent bfecf6b5d1ff272c8782c3a64caba1ec3cf64295
Author: Shivakumar <[email protected]>
Date: Sun, 2 Aug 2026 03:32:59 +0530
chore: move dto to seperate dir
- To avoid cycle import error
Signed-off-by: Shivakumar <[email protected]>
Diffstat:
| D | api/dto.go | | | 101 | ------------------------------------------------------------------------------- |
| A | api/dto/dto.go | | | 101 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2 files changed, 101 insertions(+), 101 deletions(-)
diff --git a/api/dto.go b/api/dto.go
@@ -1,101 +0,0 @@
-// Copyright 2026 Shivakumar (Certichain)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package api
-
-// Institution DTOs
-
-// RegisterInstitutionRequest is the request body for POST /v1/institutions.
-type RegisterInstitutionRequest struct {
- PublicKey string `json:"public_key"`
-}
-
-// RegisterInstitutionResponse is returned after a successful registration.
-type RegisterInstitutionResponse struct {
- DID string `json:"did"`
-}
-
-// GetInstitutionResponse is returned by GET /v1/institutions/{did}.
-type GetInstitutionResponse struct {
- DID string `json:"did"`
- Registered bool `json:"registered"`
-}
-
-// Transaction DTOs
-
-// SubmitTransactionRequest is the request body for POST /v1/transactions.
-type SubmitTransactionRequest struct {
- IssuerDID string `json:"issuer_did"`
- MerkleRoot string `json:"merkle_root"`
- Nonce string `json:"nonce"`
- Timestamp int64 `json:"timestamp"`
- Signature string `json:"signature"`
-}
-
-// SubmitTransactionResponse is returned after a transaction is accepted into the mempool.
-// Status is always "pending" at this point.
-type SubmitTransactionResponse struct {
- TxID string `json:"tx_id"`
- Status string `json:"status"`
-}
-
-// GetTransactionResponse is returned by GET /v1/transactions/{tx_id}.
-type GetTransactionResponse struct {
- TxID string `json:"tx_id"`
- IssuerDID string `json:"issuer_did"`
- MerkleRoot string `json:"merkle_root"`
- Timestamp int64 `json:"timestamp"`
- Status string `json:"status"` // "pending" or "confirmed"
- BlockHash *string `json:"block_hash,omitempty"` // only persent if "confirmed"
-}
-
-// Block DTO
-
-// BlockResponse is returned by the block query endpoints.
-// (GET /v1/blocks/{hash}, /v1/blocks/height/{height}, /v1/blocks/latest).
-type BlockResponse struct {
- Height uint64 `json:"height"`
- Hash string `json:"hash"`
- PrevHash string `json:"prev_hash"`
- MerkleRoot string `json:"merkle_root"`
- Timestamp int64 `json:"timestamp"`
- Transactions []GetTransactionResponse `json:"transactions"`
-}
-
-// Verify DTO
-
-// VerifyResponse is returned by GET /v1/verify/{tx_id}.
-type VerifyResponse struct {
- TxID string `json:"tx_id"`
- IssuerDID string `json:"issuer_did"`
- IssuerPublicKey string `json:"issuer_public_key"`
- MerkleRoot string `json:"merkle_root"`
- BlockHash string `json:"block_hash"`
- BlockHeight uint64 `json:"block_height"`
- BlockMerkleRoot string `json:"block_merkle_root"`
- Timestamp int64 `json:"timestamp"`
-}
-
-// Shared Error Envelope
-
-// ErrorDetail carries error code and readable message string.
-type ErrorDetail struct {
- Code string `json:"code"`
- Message string `json:"message"`
-}
-
-// ErrorResponse is the JSON Envelop for every NON-2XX http response.
-type ErrorResponse struct {
- Error ErrorDetail `json:"error"`
-}
diff --git a/api/dto/dto.go b/api/dto/dto.go
@@ -0,0 +1,101 @@
+// Copyright 2026 Shivakumar (Certichain)
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package dto
+
+// Institution DTOs
+
+// RegisterInstitutionRequest is the request body for POST /v1/institutions.
+type RegisterInstitutionRequest struct {
+ PublicKey string `json:"public_key"`
+}
+
+// RegisterInstitutionResponse is returned after a successful registration.
+type RegisterInstitutionResponse struct {
+ DID string `json:"did"`
+}
+
+// GetInstitutionResponse is returned by GET /v1/institutions/{did}.
+type GetInstitutionResponse struct {
+ DID string `json:"did"`
+ Registered bool `json:"registered"`
+}
+
+// Transaction DTOs
+
+// SubmitTransactionRequest is the request body for POST /v1/transactions.
+type SubmitTransactionRequest struct {
+ IssuerDID string `json:"issuer_did"`
+ MerkleRoot string `json:"merkle_root"`
+ Nonce string `json:"nonce"`
+ Timestamp int64 `json:"timestamp"`
+ Signature string `json:"signature"`
+}
+
+// SubmitTransactionResponse is returned after a transaction is accepted into the mempool.
+// Status is always "pending" at this point.
+type SubmitTransactionResponse struct {
+ TxID string `json:"tx_id"`
+ Status string `json:"status"`
+}
+
+// GetTransactionResponse is returned by GET /v1/transactions/{tx_id}.
+type GetTransactionResponse struct {
+ TxID string `json:"tx_id"`
+ IssuerDID string `json:"issuer_did"`
+ MerkleRoot string `json:"merkle_root"`
+ Timestamp int64 `json:"timestamp"`
+ Status string `json:"status"` // "pending" or "confirmed"
+ BlockHash *string `json:"block_hash,omitempty"` // only persent if "confirmed"
+}
+
+// Block DTO
+
+// BlockResponse is returned by the block query endpoints.
+// (GET /v1/blocks/{hash}, /v1/blocks/height/{height}, /v1/blocks/latest).
+type BlockResponse struct {
+ Height uint64 `json:"height"`
+ Hash string `json:"hash"`
+ PrevHash string `json:"prev_hash"`
+ MerkleRoot string `json:"merkle_root"`
+ Timestamp int64 `json:"timestamp"`
+ Transactions []GetTransactionResponse `json:"transactions"`
+}
+
+// Verify DTO
+
+// VerifyResponse is returned by GET /v1/verify/{tx_id}.
+type VerifyResponse struct {
+ TxID string `json:"tx_id"`
+ IssuerDID string `json:"issuer_did"`
+ IssuerPublicKey string `json:"issuer_public_key"`
+ MerkleRoot string `json:"merkle_root"`
+ BlockHash string `json:"block_hash"`
+ BlockHeight uint64 `json:"block_height"`
+ BlockMerkleRoot string `json:"block_merkle_root"`
+ Timestamp int64 `json:"timestamp"`
+}
+
+// Shared Error Envelope
+
+// ErrorDetail carries error code and readable message string.
+type ErrorDetail struct {
+ Code string `json:"code"`
+ Message string `json:"message"`
+}
+
+// ErrorResponse is the JSON Envelop for every NON-2XX http response.
+type ErrorResponse struct {
+ Error ErrorDetail `json:"error"`
+}