Skip to content

Commit

Permalink
Merge pull request #25 from atlanhq/strongly-type-datacontract
Browse files Browse the repository at this point in the history
Strongly type DataContracts in sdk
  • Loading branch information
0xquark authored May 15, 2024
2 parents 871daaf + a767f17 commit 4c4c6fb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
8 changes: 5 additions & 3 deletions atlan/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,11 @@ func (ac *AtlanClient) CallAPI(api *API, queryParams map[string]string, requestO

response, err := ac.makeRequest(api.Method, path, params)
if err != nil {
fmt.Println(err)
errorMessage, _ := ioutil.ReadAll(response.Body)
return nil, handleApiError(response, string(errorMessage))
if response != nil && response.Body != nil {
errorMessage, _ := ioutil.ReadAll(response.Body)
return nil, handleApiError(response, string(errorMessage))
}
return nil, err
}

ac.logHTTPStatus(response)
Expand Down
13 changes: 10 additions & 3 deletions atlan/model/assets/datacontract.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package assets

type DataContract struct {
Catalog
DataContractJson *string `json:"dataContractJson,omitempty"`
Version *string `json:"dataContractVersion,omitempty"`
AssetGuid *string `json:"dataContractAssetGuid,omitempty"`
Version *string `json:"dataContractVersion,omitempty"`
AssetGuid *string `json:"dataContractAssetGuid,omitempty"`
Attributes *DataContractAttributes `json:"attributes,omitempty"`
// Relationships
LatestCertified *[]Asset `json:"dataContractLatestCertified,omitempty"`
ContractAssetCertified *[]DataContract `json:"dataContractAssetCertified,omitempty"`
Expand All @@ -14,6 +14,13 @@ type DataContract struct {
ContractNextVersion *[]DataContract `json:"dataContractNextVersion,omitempty"`
}

type DataContractAttributes struct {
Name *string `json:"name,omitempty"`
CertificateStatus *string `json:"certificateStatus,omitempty"`
QualifiedName *string `json:"qualifiedName,omitempty"`
DataContractJson *string `json:"dataContractJson,omitempty"`
}

/*
type DataContract struct {
Asset
Expand Down

0 comments on commit 4c4c6fb

Please sign in to comment.