<commit_before>package data

import (
	"fmt"
)

type Droplet struct {
	ID        int     `json:"id"`
	Name      string  `json:"name"`
	Memory    int     `json:"memory"`
	Disk      int     `json:"disk"`
	Locked    bool    `json:"locked"`
	Status    string  `json:"status"`
	DKernel   Kernel  `json:"kernel"`
	CreatedAt string  `json:"created_at"`
	DNetwork  Network `json:"networks"`
}

type Kernel struct {
	ID      int    `json:"id"`
	Name    string `json:"name"`
	Version string `json:"version"`
}

type SingleDroplet struct {
	SDroplet Droplet `json:"droplet"`
}

type Droplets struct {
	DropletsList []Droplet `json:"droplets"`
	// Links        string    `json:"links"`
}

type Network struct {
	V4Networks `json:"v4"`
}

type V4Network struct {
	IPAddress string `json:"ip_address"`
	Netmask   string `json:"netmask"`
	Gateway   string `json:"gateway"`
	Type      string `json:"type"`
}

type V4Networks []V4Network

func (d *Droplet) PrintInfo() {
	fmt.Println("=================================")
	fmt.Println("Name:    ", d.Name)
	fmt.Println("ID:      ", d.ID)
	fmt.Println("Created: ", d.CreatedAt)
	fmt.Println("Kernel:  ", d.DKernel.Name)
	fmt.Println("V4 IP:   ", d.DNetwork.V4Networks[0].IPAddress)
}

func (d Droplets) Len() int {
	return len(d.DropletsList)
}

func (d Droplets) Less(i, j int) bool {
	return d.DropletsList[i].Name < d.DropletsList[j].Name
}

func (d Droplets) Swap(i, j int) {
	d.DropletsList[i], d.DropletsList[j] = d.DropletsList[j], d.DropletsList[i]
}<commit_msg>Added data model for creating droplet<commit_after>package data

import (
	"fmt"
)

type Droplet struct {
	ID        int      `json:"id"`
	Name      string   `json:"name"`
	Memory    int      `json:"memory"`
	Disk      int      `json:"disk"`
	Locked    bool     `json:"locked"`
	Status    string   `json:"status"`
	DKernel   Kernel   `json:"kernel"`
	CreatedAt string   `json:"created_at"`
	DNetwork  Network  `json:"networks"`
	SSHKey    []string `json:"ss_keys"`
}

// DropletCreate to be used when creating a new droplet
type DropletCreate struct {
	Name              string   `json:"name"`
	Region            string   `json:"region"`
	Size              string   `json:"size"`
	Image             string   `json:"image"`
	SSHKeys           []string `json:"ssh_keys"`
	IPV6              bool     `json:"ipv6"`
	PrivateNetworking bool     `json:"private_networking"`
	Backups           bool     `json:"backups"`
}

type Kernel struct {
	ID      int    `json:"id"`
	Name    string `json:"name"`
	Version string `json:"version"`
}

type SingleDroplet struct {
	SDroplet Droplet `json:"droplet"`
}

type Droplets struct {
	DropletsList []Droplet `json:"droplets"`
	// Links        string    `json:"links"`
}

type Network struct {
	V4Networks `json:"v4"`
}

type V4Network struct {
	IPAddress string `json:"ip_address"`
	Netmask   string `json:"netmask"`
	Gateway   string `json:"gateway"`
	Type      string `json:"type"`
}

type V4Networks []V4Network

// PrintInfo displays info about the droplet
func (d *Droplet) PrintInfo() {
	fmt.Println("======================================")
	fmt.Println("Name:            ", d.Name)
	fmt.Println("ID:              ", d.ID)
	fmt.Println("Created:         ", d.CreatedAt)
	fmt.Println("Kernel:          ", d.DKernel.Name)
	// fmt.Println("V4 IP:   ", d.DNetwork.V4Networks[0].IPAddress)
}

func (d Droplets) Len() int {
	return len(d.DropletsList)
}

func (d Droplets) Less(i, j int) bool {
	return d.DropletsList[i].Name < d.DropletsList[j].Name
}

func (d Droplets) Swap(i, j int) {
	d.DropletsList[i], d.DropletsList[j] = d.DropletsList[j], d.DropletsList[i]
}
{'fraction_non_alphanumeric': 0.16259711431742507, 'fraction_numerical': 0.004994450610432853, 'mean_word_length': 3.281472684085511, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2172398', 'n_tokens_mistral': 1334, 'n_tokens_neox': 1285, 'n_words': 304}