github.com/companieshouse/insolvency-api@v0.0.0-20231024103413-440c973d9e9b/models/response_entities.go (about) 1 package models 2 3 // CreatedInsolvencyResource is the entity returned in a successful creation of an insolvency resource 4 type CreatedInsolvencyResource struct { 5 CompanyNumber string `json:"company_number"` 6 CaseType string `json:"case_type"` 7 Etag string `json:"etag"` 8 Kind string `json:"kind"` 9 CompanyName string `json:"company_name"` 10 Links CreatedInsolvencyResourceLinks `json:"links"` 11 } 12 13 // CreatedInsolvencyResourceLinks contains the links for the created insolvency resource 14 type CreatedInsolvencyResourceLinks struct { 15 Self string `json:"self"` 16 Transaction string `json:"transaction"` 17 ValidationStatus string `json:"validation_status"` 18 } 19 20 // CreatedPractitionerResource is the entity returned in a successful creation of an practitioner resource 21 type CreatedPractitionerResource struct { 22 IPCode string `json:"ip_code"` 23 FirstName string `json:"first_name"` 24 LastName string `json:"last_name"` 25 TelephoneNumber string `json:"telephone_number"` 26 Email string `json:"email"` 27 Address CreatedAddressResource `json:"address"` 28 Role string `json:"role"` 29 Links CreatedPractitionerLinksResource `json:"links"` 30 } 31 32 // CreatedAddressResource contains the address fields for the created practitioner resource 33 type CreatedAddressResource struct { 34 Premises string `json:"premises"` 35 AddressLine1 string `json:"address_line_1"` 36 AddressLine2 string `json:"address_line_2"` 37 Country string `json:"country"` 38 Locality string `json:"locality"` 39 Region string `json:"region"` 40 PostalCode string `json:"postal_code"` 41 POBox string `json:"po_box"` 42 } 43 44 // CreatedPractitionerLinksResource contains the links details for a practitioner 45 type CreatedPractitionerLinksResource struct { 46 Self string `json:"self"` 47 } 48 49 // AppointedPractitionerResource contains the details of an appointed practitioner 50 type AppointedPractitionerResource struct { 51 AppointedOn string `json:"appointed_on"` 52 MadeBy string `json:"made_by"` 53 Links AppointedPractitionerLinksResource `json:"links"` 54 } 55 56 // AppointedPractitionerLinksResource contains the links details for a practitioner appointment 57 type AppointedPractitionerLinksResource struct { 58 Self string `json:"self"` 59 } 60 61 // AttachmentResource contains the details of an attachment 62 type AttachmentResource struct { 63 AttachmentType string `json:"attachment_type"` 64 File AttachmentFile `json:"file"` 65 Etag string `json:"etag"` 66 Kind string `json:"kind"` 67 Status string `json:"status"` 68 Links AttachmentLinksResource `json:"links"` 69 } 70 71 // AttachmentFile contains the details of an attachment file 72 type AttachmentFile struct { 73 Name string `json:"name"` 74 Size int64 `json:"size"` 75 ContentType string `json:"content_type"` 76 AVStatus string `json:"av_status,omitempty"` 77 } 78 79 // AttachmentLinksResource contains the details of the links associated with an attachment 80 type AttachmentLinksResource struct { 81 Self string `json:"self"` 82 Download string `json:"download"` 83 } 84 85 // ResolutionResource contains the details of the resolution resource 86 type ResolutionResource struct { 87 DateOfResolution string `json:"date_of_resolution"` 88 Attachments []string `json:"attachments"` 89 Etag string `json:"etag"` 90 Kind string `json:"kind"` 91 Links ResolutionResourceLinks `json:"links"` 92 } 93 94 // ResolutionResourceLinks contains the links details for a resolution 95 type ResolutionResourceLinks struct { 96 Self string `json:"self"` 97 } 98 99 // StatementOfAffairsResource contains the details of the statement of affairs resource 100 101 type StatementOfAffairsResource struct { 102 StatementDate string `json:"statement_date"` 103 Attachments []string `json:"attachments"` 104 Etag string `json:"etag"` 105 Kind string `json:"kind"` 106 Links StatementOfAffairsResourceLinks `json:"links"` 107 } 108 109 // StatementOfAffairsResourceLinks contains the links details for a statement of affairs 110 type StatementOfAffairsResourceLinks struct { 111 Self string `json:"self"` 112 } 113 114 // ProgressReportResource contains the details of the progress report resource 115 type ProgressReportResource struct { 116 FromDate string `json:"from_date"` 117 ToDate string `json:"to_date"` 118 Attachments []string `json:"attachments"` 119 Etag string `json:"etag"` 120 Kind string `json:"kind"` 121 Links ProgressReportResourceLinks `json:"links"` 122 } 123 124 // ProgressReportResourceLinks contains the link details associated with a progress report 125 type ProgressReportResourceLinks struct { 126 Self string `json:"self"` 127 } 128 129 // ValidationStatusResponse is the object returned when checking the validation of a case 130 type ValidationStatusResponse struct { 131 IsValid bool `json:"is_valid"` 132 Errors []ValidationErrorResponseResource `json:"errors"` 133 } 134 135 // NewValidationStatusResponse - convenience function for creating a validation response resource 136 func NewValidationStatusResponse(isValid bool, errors *[]ValidationErrorResponseResource) *ValidationStatusResponse { 137 return &ValidationStatusResponse{IsValid: isValid, Errors: *errors} 138 } 139 140 // ValidationErrorResponseResource contains the details of an error when checking the validation for closing a case - as expected by transaction api 141 type ValidationErrorResponseResource struct { 142 Error string `json:"error"` 143 Location string `json:"location"` 144 LocationType string `json:"location_type"` 145 Type string `json:"type"` 146 } 147 148 // NewValidationErrorResponse - convenience function for creating validation error responses 149 func NewValidationErrorResponse(validationError, location string) *ValidationErrorResponseResource { 150 return &ValidationErrorResponseResource{ 151 Error: validationError, 152 Location: location, 153 LocationType: "json-path", 154 Type: "ch:validation", 155 } 156 } 157 158 // Filing represents filing details to be returned to the filing resource handler 159 type Filing struct { 160 Data map[string]interface{} `json:"data"` 161 Description string `json:"description"` 162 DescriptionIdentifier string `json:"description_identifier"` 163 DescriptionValues map[string]string `json:"description_values"` 164 Kind string `json:"kind"` 165 } 166 167 // NewFiling - convenience function for creating a filing resource 168 func NewFiling(data map[string]interface{}, description, descriptionIdentifier, kind string) *Filing { 169 return &Filing{ 170 Data: data, 171 Description: description, 172 DescriptionIdentifier: descriptionIdentifier, 173 DescriptionValues: nil, 174 Kind: kind, 175 } 176 } 177 178 // ResponseResource is the object returned in an error case 179 type ResponseResource struct { 180 Message string `json:"message"` 181 } 182 183 // NewMessageResponse - convenience function for creating a response resource 184 func NewMessageResponse(message string) *ResponseResource { 185 return &ResponseResource{Message: message} 186 }