rsapi/http.go
func writeMultipartParams(w *multipart.Writer, payload APIParams, prefix string) error {
	for k, v := range payload {
		fieldName := k
		if prefix != "" {
			fieldName = fmt.Sprintf("%s[%s]", prefix, k)
		}
		// Add more types as needed. These two cover both CM15 and SS.
		switch v.(type) {
		case string:
			err := w.WriteField(fieldName, v.(string))
			if err != nil {
				return err
			}
		case APIParams:
			err := writeMultipartParams(w, v.(APIParams), fieldName)
			if err != nil {
				return err
			}
		default:
			return fmt.Errorf("Unknown type for multipart form section %s: %#v", fieldName, v)
		}
	}
	return nil
}
func writeMultipartParams(w *multipart.Writer, payload APIParams, prefix string) error {
	for k, v := range payload {
		fieldName := k
		if prefix != "" {
			fieldName = fmt.Sprintf("%s[%s]", prefix, k)
		}
		// Add more types as needed. These two cover both CM15 and SS.
		switch v.(type) {
		case string:
			err := w.WriteField(fieldName, v.(string))
			if err != nil {
				return err
			}
		case APIParams:
			err := writeMultipartParams(w, v.(APIParams), fieldName)
			if err != nil {
				return err
			}
		default:
			return fmt.Errorf("Unknown type for multipart form section %s: %#v", fieldName, v)
		}
	}
	return nil
}
// Handle payload params. Each payload param gets its own multipart
// form section with the section name being the variable name and
// section contents being the variable contents. Handle recursion as well.