func main() {
	var accessToken string

	flag.StringVar(&accessToken, "token", "", "Access Token")

	flag.Parse()

	if accessToken == "" {
		fmt.Println("\nPlease provide an access_token, one can be found at https://oauth.yandex.ru")

		flag.PrintDefaults()
		os.Exit(1)
	}

	client := src.NewClient(accessToken)

	fmt.Printf("Fetching disk info...\n")
	info, err := client.NewDiskInfoRequest().Exec()

	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}

	fmt.Printf("\tTrash size: %d\n", info.Trash_size)
	fmt.Printf("\tTotal space: %d\n", info.Total_space)
	fmt.Printf("\tUsed space: %d\n", info.Used_space)
	sys_folders, err := json.Marshal(info.System_folders)
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	fmt.Printf("\tSystem folders: %s\n", sys_folders)
	// TODO format map info.System_folders
}
func NewStubResponseClient(content string, statusCode ...int) *client.Client {
	c := client.NewClient("")
	t := &stubResponseTransport{content: content}

	if len(statusCode) != 0 {
		t.statusCode = statusCode[0]
	}

	c.HttpClient = &http.Client{Transport: t}

	return c
}
func main() {
	var accessToken string
	var path string

	flag.StringVar(&accessToken, "token", "", "Access Token")
	flag.StringVar(&path, "path", "/", "Path to resource")

	flag.Parse()

	if accessToken == "" {
		fmt.Println("\nPlease provide an access_token, one can be found at https://oauth.yandex.ru")

		flag.PrintDefaults()
		os.Exit(1)
	}

	client := src.NewClient(accessToken)

	fmt.Printf("Fetching resource info...\n")
	info, err := client.NewResourceInfoRequest(path).Exec()

	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}

	custom_properties, err := json.Marshal(info.Custom_properties)
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}

	embedded, err := json.Marshal(info.Embedded)
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}

	fmt.Printf("\tPublic key: %s\n", info.Public_key)
	fmt.Printf("\tEmbedded: %s\n", embedded)
	fmt.Printf("\tName: %s\n", info.Name)
	fmt.Printf("\tCreated: %s\n", info.Created)
	fmt.Printf("\tCustom_properties: %s\n", custom_properties)
	fmt.Printf("\tPublic url: %s\n", info.Public_url)
	fmt.Printf("\tOrigin path: %s\n", info.Origin_path)
	fmt.Printf("\tModified: %s\n", info.Modified)
	fmt.Printf("\tPath: %s\n", info.Path)
	fmt.Printf("\tMd5: %s\n", info.Md5)
	fmt.Printf("\tType: %s\n", info.Resource_type)
	fmt.Printf("\tMime type: %s\n", info.Mime_type)
	fmt.Printf("\tSize: %d\n", info.Size)
}
func main() {
	var accessToken string
	var path string

	flag.StringVar(&accessToken, "token", "", "Access Token")
	flag.StringVar(&path, "path", "/", "Path to resource")

	flag.Parse()

	if accessToken == "" {
		fmt.Println("\nPlease provide an access_token, one can be found at https://oauth.yandex.ru")

		flag.PrintDefaults()
		os.Exit(1)
	}

	client := src.NewClient(accessToken)

	fmt.Printf("Fetching flat file list ...\n")
	info, err := client.NewFlatFileListRequest().Exec()

	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}

	items, err := json.Marshal(info.Items)
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}

	fmt.Printf("\tItems: %s\n", items)
	if info.Limit != nil {
		fmt.Printf("\tLimit: %d\n", info.Limit)
	}
	if info.Offset != nil {
		fmt.Printf("\tOffset: %d\n", *info.Offset)
	}
}