Network.GitLFS

git-lfs-1.2.3: git-lfs protocol

Safe Haskell | None
Language | Haskell2010

Network.GitLFS

Contents

- Transfer requests
- Responses to transfer requests
- Making transfers
- Endpoint discovery
- Errors
- Additional data types

Description

This implementation of the git-lfs API uses http Request and Response, but leaves actually connecting up the http client to the user.

You'll want to use a Manager that supports https, since the protocol uses http basic auth.

Some LFS servers, notably Github's, may require a User-Agent header in some of the requests, in order to allow eg, uploads. No such header is added by default, so be sure to add your own.

Synopsis

- data TransferRequest = TransferRequest {
  - req_operation :: TransferRequestOperation
  - req_transfers :: [TransferAdapter]
  - req_ref :: Maybe GitRef
  - req_objects :: [TransferRequestObject]
  }
- data TransferRequestOperation
  - = RequestDownload
  - | RequestUpload
- data TransferAdapter = Basic
- data TransferRequestObject = TransferRequestObject {
  - req_oid :: SHA256
  - req_size :: Integer
  }
- startTransferRequest :: Endpoint -> TransferRequest -> Request
- data TransferResponse op = TransferResponse {
  - transfer :: Maybe TransferAdapter
  - objects :: [TransferResponseOperation op]
  }
- data TransferResponseOperation op = TransferResponseOperation {
  - resp_oid :: SHA256
  - resp_size :: Integer
  - resp_authenticated :: Maybe Bool
  - resp_actions :: Maybe op
  - resp_error :: Maybe TransferResponseObjectError
  }
- class (FromJSON op, ToJSON op) => IsTransferResponseOperation op
- data DownloadOperation = DownloadOperation {
  - download :: OperationParams
  }
- data UploadOperation = UploadOperation {
  - upload :: OperationParams
  - verify :: Maybe OperationParams
  }
- data OperationParams = OperationParams {
  - href :: Url
  - header :: Maybe (Map HTTPHeader HTTPHeaderValue)
  - expires_in :: Maybe NumSeconds
  - expires_at :: Maybe Text
  }
- data ParsedTransferResponse op
  - = ParsedTransferResponse (TransferResponse op)
  - | ParsedTransferResponseError TransferResponseError
  - | ParseFailed String
- parseTransferResponse :: IsTransferResponseOperation op => ByteString -> ParsedTransferResponse op
- downloadOperationRequest :: DownloadOperation -> Maybe Request
- uploadOperationRequests :: UploadOperation -> (ServerSupportsChunks -> RequestBody) -> SHA256 -> Integer -> Maybe [Request]
- newtype ServerSupportsChunks = ServerSupportsChunks Bool
- data Endpoint
- guessEndpoint :: URI -> Maybe Endpoint
- modifyEndpointRequest :: Endpoint -> (Request -> Request) -> Endpoint
- sshDiscoverEndpointCommand :: FilePath -> TransferRequestOperation -> [String]
- parseSshDiscoverEndpointResponse :: ByteString -> Maybe Endpoint
- data TransferResponseError = TransferResponseError {
  - resperr_message :: Text
  - resperr_request_id :: Maybe Text
  - resperr_documentation_url :: Maybe Url
  }
- data TransferResponseObjectError = TransferResponseObjectError {
  - respobjerr_code :: Int
  - respobjerr_message :: Text
  }
- type Url = Text
- type SHA256 = Text
- data GitRef = GitRef {
  - name :: Text
  }
- type NumSeconds = Integer
- type HTTPHeader = Text
- type HTTPHeaderValue = Text

# Transfer requests

data TransferRequest #

Constructors

TransferRequest |
Fields req_operation :: TransferRequestOperation req_transfers :: [TransferAdapter] req_ref :: Maybe GitRef req_objects :: [TransferRequestObject]

#### Instances

Instances details

FromJSON TransferRequest # |
Instance details Defined in Network.GitLFS Methods parseJSON :: Value -> Parser TransferRequest # parseJSONList :: Value -> Parser [TransferRequest] # omittedField :: Maybe TransferRequest #
ToJSON TransferRequest # |
Instance details Defined in Network.GitLFS Methods toJSON :: TransferRequest -> Value # toEncoding :: TransferRequest -> Encoding # toJSONList :: [TransferRequest] -> Value # toEncodingList :: [TransferRequest] -> Encoding # omitField :: TransferRequest -> Bool #
Generic TransferRequest # |
Instance details Defined in Network.GitLFS Associated Types
type Rep TransferRequest |
Instance details Defined in Network.GitLFS type Rep TransferRequest = D1 ('MetaData "TransferRequest" "Network.GitLFS" "git-lfs-1.2.3-AfGQUmds5wXDx3ZGlsCvHO" 'False) (C1 ('MetaCons "TransferRequest" 'PrefixI 'True) ((S1 ('MetaSel ('Just "req_operation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TransferRequestOperation) :*: S1 ('MetaSel ('Just "req_transfers") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [TransferAdapter])) :*: (S1 ('MetaSel ('Just "req_ref") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe GitRef)) :*: S1 ('MetaSel ('Just "req_objects") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [TransferRequestObject]))))
Methods from :: TransferRequest -> Rep TransferRequest x # to :: Rep TransferRequest x -> TransferRequest #
Show TransferRequest # |
Instance details Defined in Network.GitLFS Methods showsPrec :: Int -> TransferRequest -> ShowS # show :: TransferRequest -> String # showList :: [TransferRequest] -> ShowS #
type Rep TransferRequest # |
Instance details Defined in Network.GitLFS type Rep TransferRequest = D1 ('MetaData "TransferRequest" "Network.GitLFS" "git-lfs-1.2.3-AfGQUmds5wXDx3ZGlsCvHO" 'False) (C1 ('MetaCons "TransferRequest" 'PrefixI 'True) ((S1 ('MetaSel ('Just "req_operation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TransferRequestOperation) :*: S1 ('MetaSel ('Just "req_transfers") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [TransferAdapter])) :*: (S1 ('MetaSel ('Just "req_ref") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe GitRef)) :*: S1 ('MetaSel ('Just "req_objects") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [TransferRequestObject]))))

data TransferRequestOperation #

Constructors

RequestDownload |
RequestUpload |

#### Instances

Instances details

FromJSON TransferRequestOperation # |
Instance details Defined in Network.GitLFS Methods parseJSON :: Value -> Parser TransferRequestOperation # parseJSONList :: Value -> Parser [TransferRequestOperation] # omittedField :: Maybe TransferRequestOperation #
ToJSON TransferRequestOperation # |
Instance details Defined in Network.GitLFS Methods toJSON :: TransferRequestOperation -> Value # toEncoding :: TransferRequestOperation -> Encoding # toJSONList :: [TransferRequestOperation] -> Value # toEncodingList :: [TransferRequestOperation] -> Encoding # omitField :: TransferRequestOperation -> Bool #
Show TransferRequestOperation # |
Instance details Defined in Network.GitLFS Methods showsPrec :: Int -> TransferRequestOperation -> ShowS # show :: TransferRequestOperation -> String # showList :: [TransferRequestOperation] -> ShowS #

data TransferAdapter #

Constructors

Basic |

#### Instances

Instances details

FromJSON TransferAdapter # |
Instance details Defined in Network.GitLFS Methods parseJSON :: Value -> Parser TransferAdapter # parseJSONList :: Value -> Parser [TransferAdapter] # omittedField :: Maybe TransferAdapter #
ToJSON TransferAdapter # |
Instance details Defined in Network.GitLFS Methods toJSON :: TransferAdapter -> Value # toEncoding :: TransferAdapter -> Encoding # toJSONList :: [TransferAdapter] -> Value # toEncodingList :: [TransferAdapter] -> Encoding # omitField :: TransferAdapter -> Bool #
Show TransferAdapter # |
Instance details Defined in Network.GitLFS Methods showsPrec :: Int -> TransferAdapter -> ShowS # show :: TransferAdapter -> String # showList :: [TransferAdapter] -> ShowS #

data TransferRequestObject #

Constructors

TransferRequestObject |
Fields req_oid :: SHA256 req_size :: Integer

#### Instances

Instances details

FromJSON TransferRequestObject # |
Instance details Defined in Network.GitLFS Methods parseJSON :: Value -> Parser TransferRequestObject # parseJSONList :: Value -> Parser [TransferRequestObject] # omittedField :: Maybe TransferRequestObject #
ToJSON TransferRequestObject # |
Instance details Defined in Network.GitLFS Methods toJSON :: TransferRequestObject -> Value # toEncoding :: TransferRequestObject -> Encoding # toJSONList :: [TransferRequestObject] -> Value # toEncodingList :: [TransferRequestObject] -> Encoding # omitField :: TransferRequestObject -> Bool #
Generic TransferRequestObject # |
Instance details Defined in Network.GitLFS Associated Types
type Rep TransferRequestObject |
Instance details Defined in Network.GitLFS type Rep TransferRequestObject = D1 ('MetaData "TransferRequestObject" "Network.GitLFS" "git-lfs-1.2.3-AfGQUmds5wXDx3ZGlsCvHO" 'False) (C1 ('MetaCons "TransferRequestObject" 'PrefixI 'True) (S1 ('MetaSel ('Just "req_oid") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SHA256) :*: S1 ('MetaSel ('Just "req_size") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)))
Methods from :: TransferRequestObject -> Rep TransferRequestObject x # to :: Rep TransferRequestObject x -> TransferRequestObject #
Show TransferRequestObject # |
Instance details Defined in Network.GitLFS Methods showsPrec :: Int -> TransferRequestObject -> ShowS # show :: TransferRequestObject -> String # showList :: [TransferRequestObject] -> ShowS #
type Rep TransferRequestObject # |
Instance details Defined in Network.GitLFS type Rep TransferRequestObject = D1 ('MetaData "TransferRequestObject" "Network.GitLFS" "git-lfs-1.2.3-AfGQUmds5wXDx3ZGlsCvHO" 'False) (C1 ('MetaCons "TransferRequestObject" 'PrefixI 'True) (S1 ('MetaSel ('Just "req_oid") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SHA256) :*: S1 ('MetaSel ('Just "req_size") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)))

startTransferRequest :: Endpoint -> TransferRequest -> Request #

Makes a Request that will start the process of making a transfer to or from the LFS endpoint.

# Responses to transfer requests

data TransferResponse op #

Constructors

TransferResponse |
Fields transfer :: Maybe TransferAdapter objects :: [TransferResponseOperation op]

#### Instances

Instances details

IsTransferResponseOperation op => FromJSON (TransferResponse op) # |
Instance details Defined in Network.GitLFS Methods parseJSON :: Value -> Parser (TransferResponse op) # parseJSONList :: Value -> Parser [TransferResponse op] # omittedField :: Maybe (TransferResponse op) #
IsTransferResponseOperation op => ToJSON (TransferResponse op) # |
Instance details Defined in Network.GitLFS Methods toJSON :: TransferResponse op -> Value # toEncoding :: TransferResponse op -> Encoding # toJSONList :: [TransferResponse op] -> Value # toEncodingList :: [TransferResponse op] -> Encoding # omitField :: TransferResponse op -> Bool #
Generic (TransferResponse op) # |
Instance details Defined in Network.GitLFS Associated Types
type Rep (TransferResponse op) |
Instance details Defined in Network.GitLFS type Rep (TransferResponse op) = D1 ('MetaData "TransferResponse" "Network.GitLFS" "git-lfs-1.2.3-AfGQUmds5wXDx3ZGlsCvHO" 'False) (C1 ('MetaCons "TransferResponse" 'PrefixI 'True) (S1 ('MetaSel ('Just "transfer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe TransferAdapter)) :*: S1 ('MetaSel ('Just "objects") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [TransferResponseOperation op])))
Methods from :: TransferResponse op -> Rep (TransferResponse op) x # to :: Rep (TransferResponse op) x -> TransferResponse op #
Show op => Show (TransferResponse op) # |
Instance details Defined in Network.GitLFS Methods showsPrec :: Int -> TransferResponse op -> ShowS # show :: TransferResponse op -> String # showList :: [TransferResponse op] -> ShowS #
type Rep (TransferResponse op) # |
Instance details Defined in Network.GitLFS type Rep (TransferResponse op) = D1 ('MetaData "TransferResponse" "Network.GitLFS" "git-lfs-1.2.3-AfGQUmds5wXDx3ZGlsCvHO" 'False) (C1 ('MetaCons "TransferResponse" 'PrefixI 'True) (S1 ('MetaSel ('Just "transfer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe TransferAdapter)) :*: S1 ('MetaSel ('Just "objects") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [TransferResponseOperation op])))

data TransferResponseOperation op #

Constructors

TransferResponseOperation |
Fields resp_oid :: SHA256 resp_size :: Integer resp_authenticated :: Maybe Bool resp_actions :: Maybe op resp_error :: Maybe TransferResponseObjectError

#### Instances

Instances details

FromJSON op => FromJSON (TransferResponseOperation op) # |
Instance details Defined in Network.GitLFS Methods parseJSON :: Value -> Parser (TransferResponseOperation op) # parseJSONList :: Value -> Parser [TransferResponseOperation op] # omittedField :: Maybe (TransferResponseOperation op) #
ToJSON op => ToJSON (TransferResponseOperation op) # |
Instance details Defined in Network.GitLFS Methods toJSON :: TransferResponseOperation op -> Value # toEncoding :: TransferResponseOperation op -> Encoding # toJSONList :: [TransferResponseOperation op] -> Value # toEncodingList :: [TransferResponseOperation op] -> Encoding # omitField :: TransferResponseOperation op -> Bool #
Generic (TransferResponseOperation op) # |
Instance details Defined in Network.GitLFS Associated Types
type Rep (TransferResponseOperation op) |
Instance details Defined in Network.GitLFS type Rep (TransferResponseOperation op) = D1 ('MetaData "TransferResponseOperation" "Network.GitLFS" "git-lfs-1.2.3-AfGQUmds5wXDx3ZGlsCvHO" 'False) (C1 ('MetaCons "TransferResponseOperation" 'PrefixI 'True) ((S1 ('MetaSel ('Just "resp_oid") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SHA256) :*: S1 ('MetaSel ('Just "resp_size") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)) :*: (S1 ('MetaSel ('Just "resp_authenticated") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Bool)) :*: (S1 ('MetaSel ('Just "resp_actions") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe op)) :*: S1 ('MetaSel ('Just "resp_error") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe TransferResponseObjectError))))))
Methods from :: TransferResponseOperation op -> Rep (TransferResponseOperation op) x # to :: Rep (TransferResponseOperation op) x -> TransferResponseOperation op #
Show op => Show (TransferResponseOperation op) # |
Instance details Defined in Network.GitLFS Methods showsPrec :: Int -> TransferResponseOperation op -> ShowS # show :: TransferResponseOperation op -> String # showList :: [TransferResponseOperation op] -> ShowS #
type Rep (TransferResponseOperation op) # |
Instance details Defined in Network.GitLFS type Rep (TransferResponseOperation op) = D1 ('MetaData "TransferResponseOperation" "Network.GitLFS" "git-lfs-1.2.3-AfGQUmds5wXDx3ZGlsCvHO" 'False) (C1 ('MetaCons "TransferResponseOperation" 'PrefixI 'True) ((S1 ('MetaSel ('Just "resp_oid") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SHA256) :*: S1 ('MetaSel ('Just "resp_size") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)) :*: (S1 ('MetaSel ('Just "resp_authenticated") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Bool)) :*: (S1 ('MetaSel ('Just "resp_actions") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe op)) :*: S1 ('MetaSel ('Just "resp_error") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe TransferResponseObjectError))))))

class (FromJSON op, ToJSON op) => IsTransferResponseOperation op #

Class of types that can be responses to a transfer request, that contain an operation to use to make the transfer.

#### Instances

Instances details

IsTransferResponseOperation DownloadOperation # |
Instance details Defined in Network.GitLFS
IsTransferResponseOperation UploadOperation # |
Instance details Defined in Network.GitLFS

data DownloadOperation #

Constructors

DownloadOperation |
Fields download :: OperationParams

#### Instances

Instances details

FromJSON DownloadOperation # |
Instance details Defined in Network.GitLFS Methods parseJSON :: Value -> Parser DownloadOperation # parseJSONList :: Value -> Parser [DownloadOperation] # omittedField :: Maybe DownloadOperation #
ToJSON DownloadOperation # |
Instance details Defined in Network.GitLFS Methods toJSON :: DownloadOperation -> Value # toEncoding :: DownloadOperation -> Encoding # toJSONList :: [DownloadOperation] -> Value # toEncodingList :: [DownloadOperation] -> Encoding # omitField :: DownloadOperation -> Bool #
Generic DownloadOperation # |
Instance details Defined in Network.GitLFS Associated Types
type Rep DownloadOperation |
Instance details Defined in Network.GitLFS type Rep DownloadOperation = D1 ('MetaData "DownloadOperation" "Network.GitLFS" "git-lfs-1.2.3-AfGQUmds5wXDx3ZGlsCvHO" 'False) (C1 ('MetaCons "DownloadOperation" 'PrefixI 'True) (S1 ('MetaSel ('Just "download") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 OperationParams)))
Methods from :: DownloadOperation -> Rep DownloadOperation x # to :: Rep DownloadOperation x -> DownloadOperation #
Show DownloadOperation # |
Instance details Defined in Network.GitLFS Methods showsPrec :: Int -> DownloadOperation -> ShowS # show :: DownloadOperation -> String # showList :: [DownloadOperation] -> ShowS #
IsTransferResponseOperation DownloadOperation # |
Instance details Defined in Network.GitLFS
type Rep DownloadOperation # |
Instance details Defined in Network.GitLFS type Rep DownloadOperation = D1 ('MetaData "DownloadOperation" "Network.GitLFS" "git-lfs-1.2.3-AfGQUmds5wXDx3ZGlsCvHO" 'False) (C1 ('MetaCons "DownloadOperation" 'PrefixI 'True) (S1 ('MetaSel ('Just "download") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 OperationParams)))

data UploadOperation #

Constructors

UploadOperation |
Fields upload :: OperationParams verify :: Maybe OperationParams

#### Instances

Instances details

FromJSON UploadOperation # |
Instance details Defined in Network.GitLFS Methods parseJSON :: Value -> Parser UploadOperation # parseJSONList :: Value -> Parser [UploadOperation] # omittedField :: Maybe UploadOperation #
ToJSON UploadOperation # |
Instance details Defined in Network.GitLFS Methods toJSON :: UploadOperation -> Value # toEncoding :: UploadOperation -> Encoding # toJSONList :: [UploadOperation] -> Value # toEncodingList :: [UploadOperation] -> Encoding # omitField :: UploadOperation -> Bool #
Generic UploadOperation # |
Instance details Defined in Network.GitLFS Associated Types
type Rep UploadOperation |
Instance details Defined in Network.GitLFS type Rep UploadOperation = D1 ('MetaData "UploadOperation" "Network.GitLFS" "git-lfs-1.2.3-AfGQUmds5wXDx3ZGlsCvHO" 'False) (C1 ('MetaCons "UploadOperation" 'PrefixI 'True) (S1 ('MetaSel ('Just "upload") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 OperationParams) :*: S1 ('MetaSel ('Just "verify") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe OperationParams))))
Methods from :: UploadOperation -> Rep UploadOperation x # to :: Rep UploadOperation x -> UploadOperation #
Show UploadOperation # |
Instance details Defined in Network.GitLFS Methods showsPrec :: Int -> UploadOperation -> ShowS # show :: UploadOperation -> String # showList :: [UploadOperation] -> ShowS #
IsTransferResponseOperation UploadOperation # |
Instance details Defined in Network.GitLFS
type Rep UploadOperation # |
Instance details Defined in Network.GitLFS type Rep UploadOperation = D1 ('MetaData "UploadOperation" "Network.GitLFS" "git-lfs-1.2.3-AfGQUmds5wXDx3ZGlsCvHO" 'False) (C1 ('MetaCons "UploadOperation" 'PrefixI 'True) (S1 ('MetaSel ('Just "upload") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 OperationParams) :*: S1 ('MetaSel ('Just "verify") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe OperationParams))))

data OperationParams #

Constructors

OperationParams |
Fields href :: Url header :: Maybe (Map HTTPHeader HTTPHeaderValue) expires_in :: Maybe NumSeconds expires_at :: Maybe Text

#### Instances

Instances details

FromJSON OperationParams # |
Instance details Defined in Network.GitLFS Methods parseJSON :: Value -> Parser OperationParams # parseJSONList :: Value -> Parser [OperationParams] # omittedField :: Maybe OperationParams #
ToJSON OperationParams # |
Instance details Defined in Network.GitLFS Methods toJSON :: OperationParams -> Value # toEncoding :: OperationParams -> Encoding # toJSONList :: [OperationParams] -> Value # toEncodingList :: [OperationParams] -> Encoding # omitField :: OperationParams -> Bool #
Generic OperationParams # |
Instance details Defined in Network.GitLFS Associated Types
type Rep OperationParams |
Instance details Defined in Network.GitLFS type Rep OperationParams = D1 ('MetaData "OperationParams" "Network.GitLFS" "git-lfs-1.2.3-AfGQUmds5wXDx3ZGlsCvHO" 'False) (C1 ('MetaCons "OperationParams" 'PrefixI 'True) ((S1 ('MetaSel ('Just "href") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Url) :*: S1 ('MetaSel ('Just "header") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Map HTTPHeader HTTPHeaderValue)))) :*: (S1 ('MetaSel ('Just "expires_in") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe NumSeconds)) :*: S1 ('MetaSel ('Just "expires_at") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)))))
Methods from :: OperationParams -> Rep OperationParams x # to :: Rep OperationParams x -> OperationParams #
Show OperationParams # |
Instance details Defined in Network.GitLFS Methods showsPrec :: Int -> OperationParams -> ShowS # show :: OperationParams -> String # showList :: [OperationParams] -> ShowS #
type Rep OperationParams # |
Instance details Defined in Network.GitLFS type Rep OperationParams = D1 ('MetaData "OperationParams" "Network.GitLFS" "git-lfs-1.2.3-AfGQUmds5wXDx3ZGlsCvHO" 'False) (C1 ('MetaCons "OperationParams" 'PrefixI 'True) ((S1 ('MetaSel ('Just "href") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Url) :*: S1 ('MetaSel ('Just "header") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Map HTTPHeader HTTPHeaderValue)))) :*: (S1 ('MetaSel ('Just "expires_in") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe NumSeconds)) :*: S1 ('MetaSel ('Just "expires_at") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)))))

data ParsedTransferResponse op #

Constructors

ParsedTransferResponse (TransferResponse op) |
ParsedTransferResponseError TransferResponseError |
ParseFailed String |

parseTransferResponse :: IsTransferResponseOperation op => ByteString -> ParsedTransferResponse op #

Parse the body of a response to a transfer request.

# Making transfers

downloadOperationRequest :: DownloadOperation -> Maybe Request #

Builds a http request to perform a download.

uploadOperationRequests :: UploadOperation -> (ServerSupportsChunks -> RequestBody) -> SHA256 -> Integer -> Maybe [Request] #

Builds http request to perform an upload. The content to upload is provided, along with its SHA256 and size.

When the LFS server requested verification, there will be a second Request that does that; it should be run only after the upload has succeeded.

When the LFS server already contains the object, an empty list may be returned.

newtype ServerSupportsChunks #

When the LFS server indicates that it supports Transfer-Encoding chunked, this will contain a true value, and the RequestBody provided to uploadOperationRequests may be created using RequestBodyStreamChunked. Otherwise, that should be avoided as the server may not support the chunked encoding.

Constructors

ServerSupportsChunks Bool |

# Endpoint discovery

data Endpoint #

The endpoint of a git-lfs server.

#### Instances

Instances details

Show Endpoint # |
Instance details Defined in Network.GitLFS Methods showsPrec :: Int -> Endpoint -> ShowS # show :: Endpoint -> String # showList :: [Endpoint] -> ShowS #

guessEndpoint :: URI -> Maybe Endpoint #

Guesses the LFS endpoint from the http url of a git remote.

https://github.com/git-lfs/git-lfs/blob/master/docs/api/server-discovery.md

modifyEndpointRequest :: Endpoint -> (Request -> Request) -> Endpoint #

When an Endpoint is used to generate a Request, this allows adjusting that Request.

This can be used to add http basic authentication to an Endpoint:

    modifyEndpointRequest (guessEndpoint u) (applyBasicAuth "user" "pass")

sshDiscoverEndpointCommand :: FilePath -> TransferRequestOperation -> [String] #

Command to run via ssh with to discover an endpoint. The FilePath is the location of the git repository on the ssh server.

Note that, when sshing to the server, you should take care that the hostname you pass to ssh is really a hostname and not something that ssh will parse an an option, such as -oProxyCommand=".

parseSshDiscoverEndpointResponse :: ByteString -> Maybe Endpoint #

Parse the json output when doing ssh endpoint discovery.

# Errors

data TransferResponseError #

This is an error with a TransferRequest as a whole. It's also possible for a TransferRequest to overall succeed, but fail for some objects; such failures use TransferResponseObjectError.

Constructors

TransferResponseError |
Fields resperr_message :: Text resperr_request_id :: Maybe Text resperr_documentation_url :: Maybe Url

#### Instances

Instances details

FromJSON TransferResponseError # |
Instance details Defined in Network.GitLFS Methods parseJSON :: Value -> Parser TransferResponseError # parseJSONList :: Value -> Parser [TransferResponseError] # omittedField :: Maybe TransferResponseError #
ToJSON TransferResponseError # |
Instance details Defined in Network.GitLFS Methods toJSON :: TransferResponseError -> Value # toEncoding :: TransferResponseError -> Encoding # toJSONList :: [TransferResponseError] -> Value # toEncodingList :: [TransferResponseError] -> Encoding # omitField :: TransferResponseError -> Bool #
Generic TransferResponseError # |
Instance details Defined in Network.GitLFS Associated Types
type Rep TransferResponseError |
Instance details Defined in Network.GitLFS type Rep TransferResponseError = D1 ('MetaData "TransferResponseError" "Network.GitLFS" "git-lfs-1.2.3-AfGQUmds5wXDx3ZGlsCvHO" 'False) (C1 ('MetaCons "TransferResponseError" 'PrefixI 'True) (S1 ('MetaSel ('Just "resperr_message") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "resperr_request_id") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "resperr_documentation_url") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Url)))))
Methods from :: TransferResponseError -> Rep TransferResponseError x # to :: Rep TransferResponseError x -> TransferResponseError #
Show TransferResponseError # |
Instance details Defined in Network.GitLFS Methods showsPrec :: Int -> TransferResponseError -> ShowS # show :: TransferResponseError -> String # showList :: [TransferResponseError] -> ShowS #
type Rep TransferResponseError # |
Instance details Defined in Network.GitLFS type Rep TransferResponseError = D1 ('MetaData "TransferResponseError" "Network.GitLFS" "git-lfs-1.2.3-AfGQUmds5wXDx3ZGlsCvHO" 'False) (C1 ('MetaCons "TransferResponseError" 'PrefixI 'True) (S1 ('MetaSel ('Just "resperr_message") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "resperr_request_id") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "resperr_documentation_url") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Url)))))

data TransferResponseObjectError #

An error with a single object within a TransferRequest.

Constructors

TransferResponseObjectError |
Fields respobjerr_code :: Int respobjerr_message :: Text

#### Instances

Instances details

FromJSON TransferResponseObjectError # |
Instance details Defined in Network.GitLFS Methods parseJSON :: Value -> Parser TransferResponseObjectError # parseJSONList :: Value -> Parser [TransferResponseObjectError] # omittedField :: Maybe TransferResponseObjectError #
ToJSON TransferResponseObjectError # |
Instance details Defined in Network.GitLFS Methods toJSON :: TransferResponseObjectError -> Value # toEncoding :: TransferResponseObjectError -> Encoding # toJSONList :: [TransferResponseObjectError] -> Value # toEncodingList :: [TransferResponseObjectError] -> Encoding # omitField :: TransferResponseObjectError -> Bool #
Generic TransferResponseObjectError # |
Instance details Defined in Network.GitLFS Associated Types
type Rep TransferResponseObjectError |
Instance details Defined in Network.GitLFS type Rep TransferResponseObjectError = D1 ('MetaData "TransferResponseObjectError" "Network.GitLFS" "git-lfs-1.2.3-AfGQUmds5wXDx3ZGlsCvHO" 'False) (C1 ('MetaCons "TransferResponseObjectError" 'PrefixI 'True) (S1 ('MetaSel ('Just "respobjerr_code") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "respobjerr_message") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))
Methods from :: TransferResponseObjectError -> Rep TransferResponseObjectError x # to :: Rep TransferResponseObjectError x -> TransferResponseObjectError #
Show TransferResponseObjectError # |
Instance details Defined in Network.GitLFS Methods showsPrec :: Int -> TransferResponseObjectError -> ShowS # show :: TransferResponseObjectError -> String # showList :: [TransferResponseObjectError] -> ShowS #
type Rep TransferResponseObjectError # |
Instance details Defined in Network.GitLFS type Rep TransferResponseObjectError = D1 ('MetaData "TransferResponseObjectError" "Network.GitLFS" "git-lfs-1.2.3-AfGQUmds5wXDx3ZGlsCvHO" 'False) (C1 ('MetaCons "TransferResponseObjectError" 'PrefixI 'True) (S1 ('MetaSel ('Just "respobjerr_code") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "respobjerr_message") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

# Additional data types

type Url = Text #

type SHA256 = Text #

data GitRef #

Constructors

GitRef |
Fields name :: Text

#### Instances

Instances details

FromJSON GitRef # |
Instance details Defined in Network.GitLFS Methods parseJSON :: Value -> Parser GitRef # parseJSONList :: Value -> Parser [GitRef] # omittedField :: Maybe GitRef #
ToJSON GitRef # |
Instance details Defined in Network.GitLFS Methods toJSON :: GitRef -> Value # toEncoding :: GitRef -> Encoding # toJSONList :: [GitRef] -> Value # toEncodingList :: [GitRef] -> Encoding # omitField :: GitRef -> Bool #
Generic GitRef # |
Instance details Defined in Network.GitLFS Associated Types
type Rep GitRef |
Instance details Defined in Network.GitLFS type Rep GitRef = D1 ('MetaData "GitRef" "Network.GitLFS" "git-lfs-1.2.3-AfGQUmds5wXDx3ZGlsCvHO" 'False) (C1 ('MetaCons "GitRef" 'PrefixI 'True) (S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))
Methods from :: GitRef -> Rep GitRef x # to :: Rep GitRef x -> GitRef #
Show GitRef # |
Instance details Defined in Network.GitLFS Methods showsPrec :: Int -> GitRef -> ShowS # show :: GitRef -> String # showList :: [GitRef] -> ShowS #
type Rep GitRef # |
Instance details Defined in Network.GitLFS type Rep GitRef = D1 ('MetaData "GitRef" "Network.GitLFS" "git-lfs-1.2.3-AfGQUmds5wXDx3ZGlsCvHO" 'False) (C1 ('MetaCons "GitRef" 'PrefixI 'True) (S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

type NumSeconds = Integer #

type HTTPHeader = Text #

type HTTPHeaderValue = Text #