<commit_before>local M = {}
local Spore = require('Spore')

-- For creating new containers the config object must contain certain fields
-- Example config contains:
local function config()
   local config = { Hostname = "",
		    User = "",
		    Memory = 0,
		    MemorySwap = 0,
		    AttachStdin = false,
		    AttachStdout = false,
		    AttachStderr = false,
		    PortSpecs = {},
		    Privileged = false,
		    Tty = false,
		    OpenStdin = false,
		    StdinOnce = false,
		    Env = {},
		    Cmd = {'/bin/bash'},
		    Dns = {},
		    Image = "base",
		    Volumes = {},
		    VolumesFrom = "",
		    WorkingDir = ""
		 }
   return config
end

M.config = config

local client = Spore.new_from_string [[{ "name" : "docker remote api",
					  "base_url" : 'http://127.0.0.1:65000',
					  "version" : '0.1.0',
					  "expected_status" : [
					     200,
					     204
					  ],
					  "formats" : "json",
					  "methods" : {
					     "list_containers" : { 
						"path" : "/containers/json",
						"method" : "GET",
						"optional_params" : [
						   'all',
						   'limit',
						   'since',
						   'before',
						   'size'
						]
					     },
					     "inspect_container" : { 
						"path" : "/containers/:id/json",
						"method" : "GET",
						"required_params" : [
						   "id"
						],
					     },
					     "fs_changes_container" : { 
						"path" : "/containers/:id/changes",
						"method" : "GET",
						"required_params" : [
						   "id"
						],
					     },
					     "create_container" : { 
						"path" : "/containers/create",
						"method" : "POST",
						"required_params" : [
						   "config"
						],
					     },
					     "start_container" : { 
						"path" : "/containers/:id/stop",
						"method" : "POST",
						"required_params" : [
						   "id"
						],
						"optional_params" : [
						   'hostConfig',
						]
					     },
					     "stop_container" : { 
						"path" : "/containers/:id/stop",
						"method" : "POST",
						"required_params" : [
						   "id"
						],
					     },
					     "restart_container" : { 
						"path" : "/containers/:id/restart",
						"method" : "POST",
						"required_params" : [
						   "id"
						],
					     },
					     "kill_container" : { 
						"path" : "/containers/:id/kill",
						"method" : "POST",
						"required_params" : [
						   "id"
						],
					     },
					     "delete_container" : { 
						"path" : "/containers/:id/kill",
						"method" : "GET",
						"required_params" : [
						   "id"
						],
					     },
					     "kill_container" : { 
						"path" : "/containers/:id/kill",
						"method" : "GET",
						"required_params" : [
						   "id"
						],
					     },
					     "list_processes_container" : { 
						"path" : "/containers/:id/top",
						"method" : "GET",
						"required_params" : [
						   "id"
						],
						"optional_params" : [
						   'ps_args',
						   ]
					     },
					     "list_images" : { 
						"path" : "/images/json",
						"method" : "GET",
						"optional_params" : [
						   'all',
						   'limit',
						   'since',
						   'before',
						   'size']
					     },
					     "inspect_image" : { 
						"path" : "/images/:name/json",
						"method" : "GET",
						"required_params" : [
						   "name"
						],
					     },
					     "history_image" : { 
						"path" : "/images/:name/history",
						"method" : "GET",
						"required_params" : [
						   "name"
						],
					     },
					     "info" : { 
						"path" : "/info",
						"method" : "GET",
					     },
					     "version" : { 
						"path" : "/info",
						"method" : "GET",
					     },
					     "search_images" : { 
						"path" : "/images/search",
						"method" : "GET",
						"required_params" : [
						   "term"
						],
					     },
					  }
				       }]]
M.client = client
--[[
local pretty = require('pl.pretty')<commit_msg>   Got the POST method working with Docker.<commit_after>local M = {}
local Spore = require('Spore')
local json = require('json')

-- For creating new containers the config object must contain certain fields
-- Example config contains:
local function config()
   local config = { Hostname = "",
		    User = "",
		    Memory = 0,
		    MemorySwap = 0,
		    AttachStdin = false,
		    AttachStdout = false,
		    AttachStderr = false,
		    PortSpecs = json.util.null,
		    Privileged = false,
		    Tty = false,
		    OpenStdin = false,
		    StdinOnce = false,
		    Env = json.util.null,
		    Cmd = {'/bin/bash'},
		    Dns = json.util.null,
		    Image = "base",
		    Volumes = {},
		    VolumesFrom = "",
		    WorkingDir = ""
		 }
   return config
end

M.config = config

local client = Spore.new_from_string [[{ "name" : "docker remote api",
					  "base_url" : 'http://127.0.0.1:65000',
					  "version" : '0.1.0',
					  "expected_status" : [
					     200,
					     204
					  ],
					  "formats" : ["json"],
					  "methods" : {
					     "list_containers" : { 
						"path" : "/containers/json",
						"method" : "GET",
						"optional_params" : [
						   'all',
						   'limit',
						   'since',
						   'before',
						   'size'
						]
					     },
					     "inspect_container" : { 
						"path" : "/containers/:id/json",
						"method" : "GET",
						"required_params" : [
						   "id"
						],
					     },
					     "fs_changes_container" : { 
						"path" : "/containers/:id/changes",
						"method" : "GET",
						"required_params" : [
						   "id"
						],
					     },
					     "create_container" : { 
						"path" : "/containers/create",
						"method" : "POST",
						"required_payload" : true,
					     },
					     "start_container" : { 
						"path" : "/containers/:id/stop",
						"method" : "POST",
						"required_params" : [
						   "id"
						],
						"optional_params" : [
						   'hostConfig',
						]
					     },
					     "stop_container" : { 
						"path" : "/containers/:id/stop",
						"method" : "POST",
						"required_params" : [
						   "id"
						],
					     },
					     "restart_container" : { 
						"path" : "/containers/:id/restart",
						"method" : "POST",
						"required_params" : [
						   "id"
						],
					     },
					     "kill_container" : { 
						"path" : "/containers/:id/kill",
						"method" : "POST",
						"required_params" : [
						   "id"
						],
					     },
					     "delete_container" : { 
						"path" : "/containers/:id/kill",
						"method" : "GET",
						"required_params" : [
						   "id"
						],
					     },
					     "kill_container" : { 
						"path" : "/containers/:id/kill",
						"method" : "GET",
						"required_params" : [
						   "id"
						],
					     },
					     "list_processes_container" : { 
						"path" : "/containers/:id/top",
						"method" : "GET",
						"required_params" : [
						   "id"
						],
						"optional_params" : [
						   'ps_args',
						   ]
					     },
					     "list_images" : { 
						"path" : "/images/json",
						"method" : "GET",
						"optional_params" : [
						   'all',
						   'limit',
						   'since',
						   'before',
						   'size']
					     },
					     "inspect_image" : { 
						"path" : "/images/:name/json",
						"method" : "GET",
						"required_params" : [
						   "name"
						],
					     },
					     "history_image" : { 
						"path" : "/images/:name/history",
						"method" : "GET",
						"required_params" : [
						   "name"
						],
					     },
					     "info" : { 
						"path" : "/info",
						"method" : "GET",
					     },
					     "version" : { 
						"path" : "/info",
						"method" : "GET",
					     },
					     "search_images" : { 
						"path" : "/images/search",
						"method" : "GET",
						"required_params" : [
						   "term"
						],
					     },
					  }
				       }]]
client:enable 'Format.JSON'

M.client = client
--[[
local pretty = require('pl.pretty')
{'fraction_non_alphanumeric': 0.17156737407312708, 'fraction_numerical': 0.005625159805676298, 'mean_word_length': 1.374924104432301, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '4355671', 'n_tokens_mistral': 4041, 'n_tokens_neox': 2553, 'n_words': 430}