<commit_before>package pili

import (
	"fmt"
	"net/http"
)

type API_Client struct {
	Conn RPC_Client
}

func NewClient(mac *Mac) API_Client {
	t := NewTransport(mac, nil)
	client := &http.Client{Transport: t}
	return API_Client{RPC_Client{client}}
}

// -----------------------------------------------------------------------------------------------------------

var API_BASE_URL = "http://api.pili.qiniu.com/v1"

func URI_NewStream() string {
	return fmt.Sprintf("%s/streams", API_BASE_URL)
}

func URI_ListStreams() string {
	return fmt.Sprintf("%s/streams", API_BASE_URL)
}

func URI_GetStream(id string) string {
	return fmt.Sprintf("%s/streams/%s", API_BASE_URL, id)
}

func URI_SetStream(id string) string {
	return fmt.Sprintf("%s/streams/%s", API_BASE_URL, id)
}

func URI_DelStream(id string) string {
	return fmt.Sprintf("%s/streams/%s", API_BASE_URL, id)
}

func URI_GetStreamStatus(id string) string {
	return fmt.Sprintf("%s/streams/%s/status", API_BASE_URL, id)
}

func URI_GetStreamSegments(id string, starttime, endtime int64) string {
	return fmt.Sprintf("%s/streams/%s/segments?starttime=%d&endtime=%d", API_BASE_URL, id, starttime, endtime)
}

func URI_DelStreamSegments(id string, starttime, endtime int64) string {
	return fmt.Sprintf("%s/streams/%s/segments?starttime=%d&endtime=%d", API_BASE_URL, id, starttime, endtime)
}

func URI_PlayStreamSegments(id string, starttime, endtime int64) string {
	return fmt.Sprintf("%s/streams/%s/segments/play?starttime=%d&endtime=%d", API_BASE_URL, id, starttime, endtime)
}

// -----------------------------------------------------------------------------------------------------------

type StreamUrl struct {
	RTMP string `json:"RTMP"`
	HLS  string `json:"HLS"`
}

type LivePlayUrl struct {
	*StreamUrl `json:"[original]"`
}

type Stream struct {
	Id          string       `json:"id"`
	CreatedAt   string       `json:"created_at"`
	UpdatedAt   string       `json:"updated_at"`
	Application string       `json:"application"`
	IsPrivate   bool         `json:"is_private"`
	Key         string       `json:"key"`
	Comment     string       `json:"comment"`
	PushUrl     []*StreamUrl `json:"push_url"`
	LiveUrl     *LivePlayUrl `json:"live_url"`
}

type StreamStatus struct {
	Status string `json:"status"`
}

type StreamList struct {
	Total   uint32    `json:"total"`
	Streams []*Stream `json:"streams"`
}
<commit_msg>CreatedAt/UpdatedAt time.Time<commit_after>package pili

import (
	"fmt"
	"net/http"
	"time"
)

type API_Client struct {
	Conn RPC_Client
}

func NewClient(mac *Mac) API_Client {
	t := NewTransport(mac, nil)
	client := &http.Client{Transport: t}
	return API_Client{RPC_Client{client}}
}

// -----------------------------------------------------------------------------------------------------------

var API_BASE_URL = "http://api.pili.qiniu.com/v1"

func URI_NewStream() string {
	return fmt.Sprintf("%s/streams", API_BASE_URL)
}

func URI_ListStreams() string {
	return fmt.Sprintf("%s/streams", API_BASE_URL)
}

func URI_GetStream(id string) string {
	return fmt.Sprintf("%s/streams/%s", API_BASE_URL, id)
}

func URI_SetStream(id string) string {
	return fmt.Sprintf("%s/streams/%s", API_BASE_URL, id)
}

func URI_DelStream(id string) string {
	return fmt.Sprintf("%s/streams/%s", API_BASE_URL, id)
}

func URI_GetStreamStatus(id string) string {
	return fmt.Sprintf("%s/streams/%s/status", API_BASE_URL, id)
}

func URI_GetStreamSegments(id string, starttime, endtime int64) string {
	return fmt.Sprintf("%s/streams/%s/segments?starttime=%d&endtime=%d", API_BASE_URL, id, starttime, endtime)
}

func URI_DelStreamSegments(id string, starttime, endtime int64) string {
	return fmt.Sprintf("%s/streams/%s/segments?starttime=%d&endtime=%d", API_BASE_URL, id, starttime, endtime)
}

func URI_PlayStreamSegments(id string, starttime, endtime int64) string {
	return fmt.Sprintf("%s/streams/%s/segments/play?starttime=%d&endtime=%d", API_BASE_URL, id, starttime, endtime)
}

// -----------------------------------------------------------------------------------------------------------

type StreamUrl struct {
	RTMP string `json:"RTMP"`
	HLS  string `json:"HLS"`
}

type LivePlayUrl struct {
	*StreamUrl `json:"[original]"`
}

type Stream struct {
	Id          string       `json:"id"`
	CreatedAt   time.Time    `json:"created_at"`
	UpdatedAt   time.Time    `json:"updated_at"`
	Application string       `json:"application"`
	IsPrivate   bool         `json:"is_private"`
	Key         string       `json:"key"`
	Comment     string       `json:"comment"`
	PushUrl     []*StreamUrl `json:"push_url"`
	LiveUrl     *LivePlayUrl `json:"live_url"`
}

type StreamStatus struct {
	Status string `json:"status"`
}

type StreamList struct {
	Total   uint32    `json:"total"`
	Streams []*Stream `json:"streams"`
}

{'fraction_non_alphanumeric': 0.2188284518828452, 'fraction_numerical': 0.0037656903765690376, 'mean_word_length': 2.984166666666667, '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': '6904372', 'n_tokens_mistral': 1579, 'n_tokens_neox': 1570, 'n_words': 336}