Skip to content

Commit

Permalink
♻️ refactor: refactor codebase #2
Browse files Browse the repository at this point in the history
  • Loading branch information
pnguyen215 committed Dec 14, 2024
1 parent 8bdf203 commit 03a7d63
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions init.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ func (h *header) WithText(v string) *header {
// Returns:
// - The updated `header` instance with the `Type` field set to the provided value.
func (h *header) WithType(v string) *header {
h.Type = v
h.typez = v
return h
}

Expand Down Expand Up @@ -1202,7 +1202,7 @@ func (h *header) Respond() map[string]interface{} {
m["text"] = h.text
}
if h.IsTypePresent() {
m["type"] = h.Type
m["type"] = h.typez
}
if h.IsDescriptionPresent() {
m["description"] = h.description
Expand Down Expand Up @@ -1273,7 +1273,7 @@ func Parse(json string) (w *wrapper, err error) {
header.text = value
}
if value, exists := values["Type"].(string); exists {
header.Type = value
header.typez = value
}
if value, exists := values["description"].(string); exists {
header.description = value
Expand Down
2 changes: 1 addition & 1 deletion types.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ type meta struct {
type header struct {
code int // Application-specific status code.
text string // Human-readable status text.
Type string // Type or category of the status, e.g., "info", "error".
typez string // Type or category of the status, e.g., "info", "error".
description string // Detailed description of the status.
}

Expand Down
4 changes: 2 additions & 2 deletions wrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ func (h *header) IsTextPresent() bool {
// - `true` if the `Type` field is non-empty.
// - `false` if the `Type` field is either not present (nil) or empty.
func (h *header) IsTypePresent() bool {
return h.Available() && unify4g.IsNotEmpty(h.Type)
return h.Available() && unify4g.IsNotEmpty(h.typez)
}

// IsDescriptionPresent checks if the `description` field in the `header` instance is present and not empty.
Expand Down Expand Up @@ -771,7 +771,7 @@ func (h *header) TypeN() string {
if !h.Available() {
return ""
}
return h.Type
return h.typez
}

// Description retrieves the description value from the `header` instance.
Expand Down

0 comments on commit 03a7d63

Please sign in to comment.