<commit_before>package ari

import "fmt"

// LiveRecording describes a recording which is in progress
type LiveRecording struct {
	Cause            string  `json:"cause,omitempty"`            // If failed, the cause of the failure
	Duration         int     `json:"duration,omitempty"`         // Length of recording in seconds
	Format           string  `json:"format"`                     // Format of recording (wav, gsm, etc)
	Name             string  `json:"name"`                       // (base) name for the recording
	Silence_duration int     `json:"silence_duration,omitempty"` // If silence was detected in the recording, the duration in seconds of that silence (requires that maxSilenceSeconds be non-zero)
	State            string  `json:"state"`                      // Current state of the recording
	Talking_duration int     `json:"talking_duration,omitempty"` // Duration of talking, in seconds, that has been detected in the recording (requires that maxSilenceSeconds be non-zero)
	Target_uri       string  `json:"target_uri"`                 // URI for the channel or bridge which is being recorded (TODO: figure out format for this)
	client           *Client // Reference to the client which created or returned this LiveRecording
}

// StoredRecording describes a past recording which may be played back (via GetStoredRecording)
type StoredRecording struct {
	Format string `json:"format"`
	Name   string `json:"name"`

	client *Client // Reference to the client which created or returned this StoredRecording
}

//List all completed recordings
//Equivalent to GET /recordings/stored
func (c *Client) ListStoredRecordings() ([]StoredRecording, error) {
	var m []StoredRecording
	err := c.AriGet("/recordings/stored", &m)
	if err != nil {
		return m, err
	}
	return m, nil
}

//Get a stored recording's details
//Equivalent to GET /recordings/stored/{recordingName}
func (c *Client) GetStoredRecording(recordingName string) (StoredRecording, error) {
	var m StoredRecording
	err := c.AriGet("/recordings/stored/"+recordingName, &m)
	if err != nil {
		return m, err
	}
	return m, nil
}

//Get a specific live recording
//Equivalent to GET /recordings/live/{recordingName}
func (c *Client) GetLiveRecording(recordingName string) (LiveRecording, error) {
	var m LiveRecording
	err := c.AriGet("/recordings/live/"+recordingName, &m)
	if err != nil {
		return m, err
	}
	return m, nil
}

//Copy current StoredRecording
func (s *StoredRecording) Copy(recordingName string, destination string) (StoredRecording, error) {
	if s.client == nil {
		return fmt.Errorf("No client found in StoredRecording")
	}
	return s.client.CopyLiveRecording(recordingName, destination)
}

// No method for getting the current LiveRecording--you have it.

//Stop and store current LiveRecording
func (l *LiveRecording) Stop(recordingName string) error {
	if l.client == nil {
		return fmt.Errorf("No client found in LiveRecording")
	}
	return l.client.StopLiveRecording(recordingName)
}

//Pause current LiveRecording
func (l *LiveRecording) Pause(recordingName string) error {
	if l.client == nil {
		return fmt.Errorf("No client found in LiveRecording")
	}
	return l.client.PauseLiveRecording(recordingName)
}

//Mute current LiveRecording
func (l *LiveRecording) Mute(recordingName string) error {
	if l.client == nil {
		return fmt.Errorf("No client found in LiveRecording")
	}
	return l.client.MuteLiveRecording(recordingName)
}

//Delete current LiveRecording
func (l *LiveRecording) Delete(recordingName string) error {
	if l.client == nil {
		return fmt.Errorf("No client found in LiveRecording")
	}
	return l.client.DeleteStoredRecording(recordingName)
}

//TODO reproduce this error in isolation: does not delete. Cannot delete any recording produced by this.
//Stop and delete current LiveRecording
func (l *LiveRecording) Scrap(recordingName string) error {
	if l.client == nil {
		return fmt.Errorf("No client found in LiveRecording")
	}
	return l.client.ScrapLiveRecording(recordingName)
}

//Unpause current LiveRecording
func (l *LiveRecording) Resume(recordingName string) error {
	if l.client == nil {
		return fmt.Errorf("No client found in LiveRecording")
	}
	return l.client.ResumeLiveRecording(recordingName)
}

//Unmute current LiveRecording
func (l *LiveRecording) Unmute(recordingName string) error {
	if l.client == nil {
		return fmt.Errorf("No client found in LiveRecording")
	}
	return l.client.UnmuteLiveRecording(recordingName)
}

//Copy a stored recording
//Equivalent to Post /recordings/stored/{recordingName}/copy
func (c *Client) CopyStoredRecording(recordingName string, destination string) (StoredRecording, error) {
	var m StoredRecording

	//Request structure to copy a stored recording. DestinationRecordingName is required.
	type request struct {
		DestinationRecordingName string `json:"destinationRecordingName"`
	}

	req := request{destination}

	//Make the request
	err := c.AriPost("/recordings/stored/"+recordingName+"/copy", &m, &req)<commit_msg>Fixed the recording wrapper. No more redundant arguments or return failures<commit_after>package ari

import "fmt"

// LiveRecording describes a recording which is in progress
type LiveRecording struct {
	Cause            string  `json:"cause,omitempty"`            // If failed, the cause of the failure
	Duration         int     `json:"duration,omitempty"`         // Length of recording in seconds
	Format           string  `json:"format"`                     // Format of recording (wav, gsm, etc)
	Name             string  `json:"name"`                       // (base) name for the recording
	Silence_duration int     `json:"silence_duration,omitempty"` // If silence was detected in the recording, the duration in seconds of that silence (requires that maxSilenceSeconds be non-zero)
	State            string  `json:"state"`                      // Current state of the recording
	Talking_duration int     `json:"talking_duration,omitempty"` // Duration of talking, in seconds, that has been detected in the recording (requires that maxSilenceSeconds be non-zero)
	Target_uri       string  `json:"target_uri"`                 // URI for the channel or bridge which is being recorded (TODO: figure out format for this)
	client           *Client // Reference to the client which created or returned this LiveRecording
}

// StoredRecording describes a past recording which may be played back (via GetStoredRecording)
type StoredRecording struct {
	Format string `json:"format"`
	Name   string `json:"name"`

	client *Client // Reference to the client which created or returned this StoredRecording
}

//List all completed recordings
//Equivalent to GET /recordings/stored
func (c *Client) ListStoredRecordings() ([]StoredRecording, error) {
	var m []StoredRecording
	err := c.AriGet("/recordings/stored", &m)
	if err != nil {
		return m, err
	}
	return m, nil
}

//Get a stored recording's details
//Equivalent to GET /recordings/stored/{recordingName}
func (c *Client) GetStoredRecording(recordingName string) (StoredRecording, error) {
	var m StoredRecording
	err := c.AriGet("/recordings/stored/"+recordingName, &m)
	if err != nil {
		return m, err
	}
	return m, nil
}

//Get a specific live recording
//Equivalent to GET /recordings/live/{recordingName}
func (c *Client) GetLiveRecording(recordingName string) (LiveRecording, error) {
	var m LiveRecording
	err := c.AriGet("/recordings/live/"+recordingName, &m)
	if err != nil {
		return m, err
	}
	return m, nil
}

//Copy current StoredRecording
func (s *StoredRecording) Copy(destination string) (StoredRecording, error) {
	var sRet StoredRecording
	if s.client == nil {
		return sRet, fmt.Errorf("No client found in StoredRecording")
	}
	return s.client.CopyStoredRecording(s.Name, destination)
}

// No method for getting the current LiveRecording--you have it.

//Stop and store current LiveRecording
func (l *LiveRecording) Stop() error {
	if l.client == nil {
		return fmt.Errorf("No client found in LiveRecording")
	}
	return l.client.StopLiveRecording(l.Name)
}

//Pause current LiveRecording
func (l *LiveRecording) Pause() error {
	if l.client == nil {
		return fmt.Errorf("No client found in LiveRecording")
	}
	return l.client.PauseLiveRecording(l.Name)
}

//Mute current LiveRecording
func (l *LiveRecording) Mute() error {
	if l.client == nil {
		return fmt.Errorf("No client found in LiveRecording")
	}
	return l.client.MuteLiveRecording(l.Name)
}

//Delete current LiveRecording
func (l *LiveRecording) Delete() error {
	if l.client == nil {
		return fmt.Errorf("No client found in LiveRecording")
	}
	return l.client.DeleteStoredRecording(l.Name)
}

//TODO reproduce this error in isolation: does not delete. Cannot delete any recording produced by this.
//Stop and delete current LiveRecording
func (l *LiveRecording) Scrap() error {
	if l.client == nil {
		return fmt.Errorf("No client found in LiveRecording")
	}
	return l.client.ScrapLiveRecording(l.Name)
}

//Unpause current LiveRecording
func (l *LiveRecording) Resume() error {
	if l.client == nil {
		return fmt.Errorf("No client found in LiveRecording")
	}
	return l.client.ResumeLiveRecording(l.Name)
}

//Unmute current LiveRecording
func (l *LiveRecording) Unmute() error {
	if l.client == nil {
		return fmt.Errorf("No client found in LiveRecording")
	}
	return l.client.UnmuteLiveRecording(l.Name)
}

//Copy a stored recording
//Equivalent to Post /recordings/stored/{recordingName}/copy
func (c *Client) CopyStoredRecording(recordingName string, destination string) (StoredRecording, error) {
	var m StoredRecording

	//Request structure to copy a stored recording. DestinationRecordingName is required.
	type request struct {
		DestinationRecordingName string `json:"destinationRecordingName"`
	}

	req := request{destination}

	//Make the request
	err := c.AriPost("/recordings/stored/"+recordingName+"/copy", &m, &req)
{'fraction_non_alphanumeric': 0.09819252640129976, 'fraction_numerical': 0.0, 'mean_word_length': 3.9245, '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': '3042420', 'n_tokens_mistral': 2971, 'n_tokens_neox': 2905, 'n_words': 992}