     }
 }
 
-
-internal func toContentType(_ string: String) -> Decoded<Content.File.ContentType> {
-    if let content = Content.File.ContentType(rawValue: string) {
-        return .success(content)
-    } else {
-        return .failure(.custom("Content type is invalid"))
-    }
-}
-
 extension Content.File: ResourceType {
     public static func decode(_ j: JSON) -> Decoded<Content.File> {
         let f = curry(Content.File.init)
 
         return f
-            <^> (j <| "type" >>- toContentType)
-            <*> j <|? "target"
-            <*> j <| "size"
+            <^> Content.File.ContentType.decode(j)
             <*> j <| "name"
             <*> j <| "path"
             <*> j <| "sha"


    case file(File)
    case directory([File])
}

extension Content: Hashable {


public enum Content {
    public struct File: CustomStringConvertible {
        public enum ContentType {
            case file(size: Int)
            case directory
            case symlink(target: String)
            case submodule(url: String)
        }

        /// The type of content
        public let content: ContentType

        /// Name of the file
        public let name: String
