<commit_before>package api

func (c *Sys) GenerateShareStatus() (*GenerateShareStatusResponse, error) {
	r := c.c.NewRequest("GET", "/v1/sys/generate-share/attempt")
	resp, err := c.c.RawRequest(r)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	var result GenerateShareStatusResponse
	err = resp.DecodeJSON(&result)
	return &result, err
}

func (c *Sys) GenerateShareInit(pgpKey string) (*GenerateShareStatusResponse, error) {
	body := map[string]interface{}{
		"pgp_key": pgpKey,
	}

	r := c.c.NewRequest("PUT", "/v1/sys/generate-share/attempt")
	if err := r.SetJSONBody(body); err != nil {
		return nil, err
	}

	resp, err := c.c.RawRequest(r)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	var result GenerateShareStatusResponse
	err = resp.DecodeJSON(&result)
	return &result, err
}

func (c *Sys) GenerateShareCancel() error {
	r := c.c.NewRequest("DELETE", "/v1/sys/generate-share/attempt")
	resp, err := c.c.RawRequest(r)
	if err == nil {
		defer resp.Body.Close()
	}
	return err
}

func (c *Sys) GenerateShareUpdate(share string) (*GenerateShareStatusResponse, error) {
	body := map[string]interface{}{
		"key": share,
	}

	r := c.c.NewRequest("PUT", "/v1/sys/generate-share/update")
	if err := r.SetJSONBody(body); err != nil {
		return nil, err
	}

	resp, err := c.c.RawRequest(r)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	var result GenerateShareStatusResponse
	err = resp.DecodeJSON(&result)
	return &result, err
}

type GenerateShareStatusResponse struct {
	Started        bool
	Progress       int
	Required       int
	Complete       bool
	Key            string `json:"key"`
	PGPFingerprint string `json:"pgp_fingerprint"`
}
<commit_msg>rename share to key<commit_after>package api

func (c *Sys) GenerateShareStatus() (*GenerateShareStatusResponse, error) {
	r := c.c.NewRequest("GET", "/v1/sys/generate-share/attempt")
	resp, err := c.c.RawRequest(r)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	var result GenerateShareStatusResponse
	err = resp.DecodeJSON(&result)
	return &result, err
}

func (c *Sys) GenerateShareInit(pgpKey string) (*GenerateShareStatusResponse, error) {
	body := map[string]interface{}{
		"pgp_key": pgpKey,
	}

	r := c.c.NewRequest("PUT", "/v1/sys/generate-share/attempt")
	if err := r.SetJSONBody(body); err != nil {
		return nil, err
	}

	resp, err := c.c.RawRequest(r)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	var result GenerateShareStatusResponse
	err = resp.DecodeJSON(&result)
	return &result, err
}

func (c *Sys) GenerateShareCancel() error {
	r := c.c.NewRequest("DELETE", "/v1/sys/generate-share/attempt")
	resp, err := c.c.RawRequest(r)
	if err == nil {
		defer resp.Body.Close()
	}
	return err
}

func (c *Sys) GenerateShareUpdate(key string) (*GenerateShareStatusResponse, error) {
	body := map[string]interface{}{
		"key": key,
	}

	r := c.c.NewRequest("PUT", "/v1/sys/generate-share/update")
	if err := r.SetJSONBody(body); err != nil {
		return nil, err
	}

	resp, err := c.c.RawRequest(r)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	var result GenerateShareStatusResponse
	err = resp.DecodeJSON(&result)
	return &result, err
}

type GenerateShareStatusResponse struct {
	Started        bool
	Progress       int
	Required       int
	Complete       bool
	Key            string `json:"key"`
	PGPFingerprint string `json:"pgp_fingerprint"`
}

{'fraction_non_alphanumeric': 0.1456140350877193, 'fraction_numerical': 0.0023391812865497076, 'mean_word_length': 3.887142857142857, 'pattern_counts': {'":': 4, '<': 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': '2454638', 'n_tokens_mistral': 1232, 'n_tokens_neox': 1194, 'n_words': 297}