<commit_before>package gomposer

type Package struct {
	Name        string       `json:"name"`
	Description string       `json:"description"`
	Time        string       `json:"time"`
	Maintainers []Maintainer `json:"maintainers"`
	Versions    []Version    `json:"versions"`
	Type        string       `json:"type"`
	Repository  string       `json:"repository"`
	Downloads   Downloads    `json:"downloads"`
	Favers      int          `json:"favers"`
}

type Maintainer struct {
	Name string `json:"name"`
}

type Author struct {
	Name  string `json:"name"`
	Email string `json:"email"`
	Role  string `json:"role"`
}

type Source struct {
	Type      string `json:"type"`
	Url       string `json:"url"`
	Reference string `json:"reference"`
	Shasum    string `json:"shasum"`
}

type Downloads struct {
	Total   int `json:"total"`
	Monthly int `json:"monthly"`
	Daily   int `json:daily`
}

type Autoload struct {
	ClassMap []string          `json:"classmap"`
	Files    []string          `json:"files"`
	Psr0     map[string]string `json:"psr-0"`
	Psr4     map[string]string `json:"psr-4"`
}

// TODO rename since this going to be the name composer.json
type Version struct {
	Name              string            `json:"name"`
	Description       string            `json:"description"`
	Keywords          []string          `json:"keywords"`
	Homepage          string            `json:"homepage"`
	Version           string            `json:"version"`
	VersionNormalized string            `json:version_normalized`
	License           []string          `json:"license"`
	Authors           Author            `json:"authors"`
	Source            Source            `json:"source"`
	Dist              Source            `json:"dist"`
	Type              string            `json:"string"`
	Time              string            `json:"time"`
	Autoload          Autoload          `json:"autoload"`
	Require           map[string]string `json:"require"`
	RequireDev        map[string]string `json:"require-dev"`
	Suggest           map[string]string `json:"suggest"`
}
<commit_msg>Add fint package<commit_after>package gomposer

import (
	"bytes"
	"encoding/json"
	"net/http"
	"net/url"
	"strings"
)

// TODO reanme
type PackageRepository struct {
	BaseURL *url.URL

	client *http.Client
}

func (r *PackageRepository) Find(packageName string) (*Packages, error) {
	u, err := url.Parse(strings.TrimRight(r.BaseURL.String(), "/") + "/" + packageName + ".json")

	if err != nil {
		return nil, err
	}

	buf := new(bytes.Buffer)
	req, err := http.NewRequest("GET", u.String(), buf)

	resp, err := r.client.Do(req)

	if err != nil {
		return nil, err
	}

	output := &Packages{}
	json.NewDecoder(resp.Body).Decode(output)

	return output, nil
}

type Packages struct {
	Name        string       `json:"name"`
	Description string       `json:"description"`
	Time        string       `json:"time"`
	Maintainers []Maintainer `json:"maintainers"`
	Versions    []Version    `json:"versions"`
	Type        string       `json:"type"`
	Repository  string       `json:"repository"`
	Downloads   Downloads    `json:"downloads"`
	Favers      int          `json:"favers"`
}

type Maintainer struct {
	Name string `json:"name"`
}

type Author struct {
	Name  string `json:"name"`
	Email string `json:"email"`
	Role  string `json:"role"`
}

type Source struct {
	Type      string `json:"type"`
	Url       string `json:"url"`
	Reference string `json:"reference"`
	Shasum    string `json:"shasum"`
}

type Downloads struct {
	Total   int `json:"total"`
	Monthly int `json:"monthly"`
	Daily   int `json:daily`
}

type Autoload struct {
	ClassMap []string          `json:"classmap"`
	Files    []string          `json:"files"`
	Psr0     map[string]string `json:"psr-0"`
	Psr4     map[string]string `json:"psr-4"`
}

// TODO rename since this going to be the name composer.json
type Version struct {
	Name              string            `json:"name"`
	Description       string            `json:"description"`
	Keywords          []string          `json:"keywords"`
	Homepage          string            `json:"homepage"`
	Version           string            `json:"version"`
	VersionNormalized string            `json:version_normalized`
	License           []string          `json:"license"`
	Authors           Author            `json:"authors"`
	Source            Source            `json:"source"`
	Dist              Source            `json:"dist"`
	Type              string            `json:"string"`
	Time              string            `json:"time"`
	Autoload          Autoload          `json:"autoload"`
	Require           map[string]string `json:"require"`
	RequireDev        map[string]string `json:"require-dev"`
	Suggest           map[string]string `json:"suggest"`
}

{'fraction_non_alphanumeric': 0.12494705633206268, 'fraction_numerical': 0.0016941973739940702, 'mean_word_length': 2.3520227111426544, '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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1109701', 'n_tokens_mistral': 1414, 'n_tokens_neox': 1383, 'n_words': 363}