<commit_before>package espsdk

import "encoding/json"

// A DeserializedObject contains JSON struct tags that map object properties
// to JSON fields.
type DeserializedObject struct {
	Batch
	BatchList
	Contribution
	Release
	ContributionList `json:",omitempty"`
}

func Deserialize(payload []byte, dest *DeserializedObject) *DeserializedObject {
	err := json.Unmarshal(payload, &dest)
	check(err)
	return dest
}

// Unmarshal attempts to deserialize the provided JSON payload
// into an object.
func (do DeserializedObject) Unmarshal(payload []byte) DeserializedObject {
	return Unmarshal(payload)
}

// Create uses the provided path and data to ask the API to create a new
// object and returns the deserialized response.
func Create(path string, object interface{}, client *Client) DeserializedObject {
	marshaledObject := client.post(object, path)
	return Unmarshal(marshaledObject)
}<commit_msg>remove BatchList fields when absent ('meta', etc.)<commit_after>package espsdk

import "encoding/json"

// A DeserializedObject contains JSON struct tags that map object properties
// to JSON fields.
type DeserializedObject struct {
	Batch
	*BatchList
	Contribution
	Release
	ContributionList `json:",omitempty"`
}

func Deserialize(payload []byte, dest *DeserializedObject) *DeserializedObject {
	err := json.Unmarshal(payload, &dest)
	check(err)
	return dest
}

// Unmarshal attempts to deserialize the provided JSON payload
// into an object.
func (do DeserializedObject) Unmarshal(payload []byte) DeserializedObject {
	return Unmarshal(payload)
}

// Create uses the provided path and data to ask the API to create a new
// object and returns the deserialized response.
func Create(path string, object interface{}, client *Client) DeserializedObject {
	marshaledObject := client.post(object, path)
	return Unmarshal(marshaledObject)
}
{'fraction_non_alphanumeric': 0.08433079434167573, 'fraction_numerical': 0.0, 'mean_word_length': 5.385416666666667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '703043', 'n_tokens_mistral': 527, 'n_tokens_neox': 511, 'n_words': 188}