git-lfs-1.2.5: 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
- mkEndpoint :: 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 Source #

Constructors

TransferRequest |

Fields

- req_operation :: TransferRequestOperation
- req_transfers :: [TransferAdapter]
- req_ref :: Maybe GitRef
- req_objects :: [TransferRequestObject]

#### Instances

Instances details

FromJSON TransferRequest Source # |
Instance details Defined in Network.GitLFS Methods parseJSON :: Value -> Parser TransferRequest Source # parseJSONList :: Value -> Parser [TransferRequest] Source # omittedField :: Maybe TransferRequest Source #
ToJSON TransferRequest Source # |
Instance details Defined in Network.GitLFS Methods toJSON :: TransferRequest -> Value Source # toEncoding :: TransferRequest -> Encoding Source # toJSONList :: [TransferRequest] -> Value Source # toEncodingList :: [TransferRequest] -> Encoding Source # omitField :: TransferRequest -> Bool Source #
Generic TransferRequest Source # |

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.5-32tbRKDDIPmLhn6OLMhHHn" '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 Source #

to :: Rep TransferRequest x -> TransferRequest Source #

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

Instance details

Defined in Network.GitLFS

type Rep TransferRequest = D1 ('MetaData "TransferRequest" "Network.GitLFS" "git-lfs-1.2.5-32tbRKDDIPmLhn6OLMhHHn" '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 Source #

Constructors

RequestDownload |
RequestUpload |

#### Instances

Instances details

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

data TransferAdapter Source #

Constructors

Basic |

#### Instances

Instances details

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

data TransferRequestObject Source #

Constructors

TransferRequestObject |

Fields

- req_oid :: SHA256
- req_size :: Integer

#### Instances

Instances details

FromJSON TransferRequestObject Source # |
Instance details Defined in Network.GitLFS Methods parseJSON :: Value -> Parser TransferRequestObject Source # parseJSONList :: Value -> Parser [TransferRequestObject] Source # omittedField :: Maybe TransferRequestObject Source #
ToJSON TransferRequestObject Source # |
Instance details Defined in Network.GitLFS Methods toJSON :: TransferRequestObject -> Value Source # toEncoding :: TransferRequestObject -> Encoding Source # toJSONList :: [TransferRequestObject] -> Value Source # toEncodingList :: [TransferRequestObject] -> Encoding Source # omitField :: TransferRequestObject -> Bool Source #
Generic TransferRequestObject Source # |

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.5-32tbRKDDIPmLhn6OLMhHHn" '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 Source #

to :: Rep TransferRequestObject x -> TransferRequestObject Source #

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

Instance details

Defined in Network.GitLFS

type Rep TransferRequestObject = D1 ('MetaData "TransferRequestObject" "Network.GitLFS" "git-lfs-1.2.5-32tbRKDDIPmLhn6OLMhHHn" '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 Source #

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 Source #

Constructors

TransferResponse |

Fields

- transfer :: Maybe TransferAdapter
- objects :: [TransferResponseOperation op]

#### Instances

Instances details

IsTransferResponseOperation op => FromJSON (TransferResponse op) Source # |
Instance details Defined in Network.GitLFS Methods parseJSON :: Value -> Parser (TransferResponse op) Source # parseJSONList :: Value -> Parser [TransferResponse op] Source # omittedField :: Maybe (TransferResponse op) Source #
IsTransferResponseOperation op => ToJSON (TransferResponse op) Source # |
Instance details Defined in Network.GitLFS Methods toJSON :: TransferResponse op -> Value Source # toEncoding :: TransferResponse op -> Encoding Source # toJSONList :: [TransferResponse op] -> Value Source # toEncodingList :: [TransferResponse op] -> Encoding Source # omitField :: TransferResponse op -> Bool Source #
Generic (TransferResponse op) Source # |

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.5-32tbRKDDIPmLhn6OLMhHHn" '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 Source #

to :: Rep (TransferResponse op) x -> TransferResponse op Source #

Show op => Show (TransferResponse op) Source # |
Instance details Defined in Network.GitLFS Methods showsPrec :: Int -> TransferResponse op -> ShowS Source # show :: TransferResponse op -> String Source # showList :: [TransferResponse op] -> ShowS Source #
type Rep (TransferResponse op) Source # |

Instance details

Defined in Network.GitLFS

type Rep (TransferResponse op) = D1 ('MetaData "TransferResponse" "Network.GitLFS" "git-lfs-1.2.5-32tbRKDDIPmLhn6OLMhHHn" '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 Source #

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) Source # |
Instance details Defined in Network.GitLFS Methods parseJSON :: Value -> Parser (TransferResponseOperation op) Source # parseJSONList :: Value -> Parser [TransferResponseOperation op] Source # omittedField :: Maybe (TransferResponseOperation op) Source #
ToJSON op => ToJSON (TransferResponseOperation op) Source # |
Instance details Defined in Network.GitLFS Methods toJSON :: TransferResponseOperation op -> Value Source # toEncoding :: TransferResponseOperation op -> Encoding Source # toJSONList :: [TransferResponseOperation op] -> Value Source # toEncodingList :: [TransferResponseOperation op] -> Encoding Source # omitField :: TransferResponseOperation op -> Bool Source #
Generic (TransferResponseOperation op) Source # |

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.5-32tbRKDDIPmLhn6OLMhHHn" '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 Source #

to :: Rep (TransferResponseOperation op) x -> TransferResponseOperation op Source #

Show op => Show (TransferResponseOperation op) Source # |
Instance details Defined in Network.GitLFS Methods showsPrec :: Int -> TransferResponseOperation op -> ShowS Source # show :: TransferResponseOperation op -> String Source # showList :: [TransferResponseOperation op] -> ShowS Source #
type Rep (TransferResponseOperation op) Source # |

Instance details

Defined in Network.GitLFS

type Rep (TransferResponseOperation op) = D1 ('MetaData "TransferResponseOperation" "Network.GitLFS" "git-lfs-1.2.5-32tbRKDDIPmLhn6OLMhHHn" '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 Source #

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 Source # |
Instance details Defined in Network.GitLFS
IsTransferResponseOperation UploadOperation Source # |
Instance details Defined in Network.GitLFS

data DownloadOperation Source #

Constructors

DownloadOperation |

Fields

- download :: OperationParams

#### Instances

Instances details

FromJSON DownloadOperation Source # |
Instance details Defined in Network.GitLFS Methods parseJSON :: Value -> Parser DownloadOperation Source # parseJSONList :: Value -> Parser [DownloadOperation] Source # omittedField :: Maybe DownloadOperation Source #
ToJSON DownloadOperation Source # |
Instance details Defined in Network.GitLFS Methods toJSON :: DownloadOperation -> Value Source # toEncoding :: DownloadOperation -> Encoding Source # toJSONList :: [DownloadOperation] -> Value Source # toEncodingList :: [DownloadOperation] -> Encoding Source # omitField :: DownloadOperation -> Bool Source #
Generic DownloadOperation Source # |

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.5-32tbRKDDIPmLhn6OLMhHHn" 'False) (C1 ('MetaCons "DownloadOperation" 'PrefixI 'True) (S1 ('MetaSel ('Just "download") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 OperationParams)))

Methods

from :: DownloadOperation -> Rep DownloadOperation x Source #

to :: Rep DownloadOperation x -> DownloadOperation Source #

Show DownloadOperation Source # |
Instance details Defined in Network.GitLFS Methods showsPrec :: Int -> DownloadOperation -> ShowS Source # show :: DownloadOperation -> String Source # showList :: [DownloadOperation] -> ShowS Source #
IsTransferResponseOperation DownloadOperation Source # |
Instance details Defined in Network.GitLFS
type Rep DownloadOperation Source # |
Instance details Defined in Network.GitLFS type Rep DownloadOperation = D1 ('MetaData "DownloadOperation" "Network.GitLFS" "git-lfs-1.2.5-32tbRKDDIPmLhn6OLMhHHn" 'False) (C1 ('MetaCons "DownloadOperation" 'PrefixI 'True) (S1 ('MetaSel ('Just "download") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 OperationParams)))

data UploadOperation Source #

Constructors

UploadOperation |

Fields

- upload :: OperationParams
- verify :: Maybe OperationParams

#### Instances

Instances details

FromJSON UploadOperation Source # |
Instance details Defined in Network.GitLFS Methods parseJSON :: Value -> Parser UploadOperation Source # parseJSONList :: Value -> Parser [UploadOperation] Source # omittedField :: Maybe UploadOperation Source #
ToJSON UploadOperation Source # |
Instance details Defined in Network.GitLFS Methods toJSON :: UploadOperation -> Value Source # toEncoding :: UploadOperation -> Encoding Source # toJSONList :: [UploadOperation] -> Value Source # toEncodingList :: [UploadOperation] -> Encoding Source # omitField :: UploadOperation -> Bool Source #
Generic UploadOperation Source # |

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.5-32tbRKDDIPmLhn6OLMhHHn" '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 Source #

to :: Rep UploadOperation x -> UploadOperation Source #

Show UploadOperation Source # |
Instance details Defined in Network.GitLFS Methods showsPrec :: Int -> UploadOperation -> ShowS Source # show :: UploadOperation -> String Source # showList :: [UploadOperation] -> ShowS Source #
IsTransferResponseOperation UploadOperation Source # |
Instance details Defined in Network.GitLFS
type Rep UploadOperation Source # |

Instance details

Defined in Network.GitLFS

type Rep UploadOperation = D1 ('MetaData "UploadOperation" "Network.GitLFS" "git-lfs-1.2.5-32tbRKDDIPmLhn6OLMhHHn" '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 Source #

Constructors

OperationParams |

Fields

- href :: Url
- header :: Maybe (Map HTTPHeader HTTPHeaderValue)
- expires_in :: Maybe NumSeconds
- expires_at :: Maybe Text

#### Instances

Instances details

FromJSON OperationParams Source # |
Instance details Defined in Network.GitLFS Methods parseJSON :: Value -> Parser OperationParams Source # parseJSONList :: Value -> Parser [OperationParams] Source # omittedField :: Maybe OperationParams Source #
ToJSON OperationParams Source # |
Instance details Defined in Network.GitLFS Methods toJSON :: OperationParams -> Value Source # toEncoding :: OperationParams -> Encoding Source # toJSONList :: [OperationParams] -> Value Source # toEncodingList :: [OperationParams] -> Encoding Source # omitField :: OperationParams -> Bool Source #
Generic OperationParams Source # |

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.5-32tbRKDDIPmLhn6OLMhHHn" '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 Source #

to :: Rep OperationParams x -> OperationParams Source #

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

Instance details

Defined in Network.GitLFS

type Rep OperationParams = D1 ('MetaData "OperationParams" "Network.GitLFS" "git-lfs-1.2.5-32tbRKDDIPmLhn6OLMhHHn" '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 Source #

Constructors

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

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

Parse the body of a response to a transfer request.

# Making transfers

downloadOperationRequest :: DownloadOperation -> Maybe Request Source #

Builds a http request to perform a download.

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

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 Source #

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 Source #

The endpoint of a git-lfs server.

#### Instances

Instances details

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

guessEndpoint :: URI -> Maybe Endpoint Source #

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

mkEndpoint :: URI -> Maybe Endpoint Source #

Smart constructor for an Endpoint, given the API URL.

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

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] Source #

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 Source #

Parse the json output when doing ssh endpoint discovery.

# Errors

data TransferResponseError Source #

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 Source # |
Instance details Defined in Network.GitLFS Methods parseJSON :: Value -> Parser TransferResponseError Source # parseJSONList :: Value -> Parser [TransferResponseError] Source # omittedField :: Maybe TransferResponseError Source #
ToJSON TransferResponseError Source # |
Instance details Defined in Network.GitLFS Methods toJSON :: TransferResponseError -> Value Source # toEncoding :: TransferResponseError -> Encoding Source # toJSONList :: [TransferResponseError] -> Value Source # toEncodingList :: [TransferResponseError] -> Encoding Source # omitField :: TransferResponseError -> Bool Source #
Generic TransferResponseError Source # |

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.5-32tbRKDDIPmLhn6OLMhHHn" '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 Source #

to :: Rep TransferResponseError x -> TransferResponseError Source #

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

Instance details

Defined in Network.GitLFS

type Rep TransferResponseError = D1 ('MetaData "TransferResponseError" "Network.GitLFS" "git-lfs-1.2.5-32tbRKDDIPmLhn6OLMhHHn" '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 Source #

An error with a single object within a TransferRequest.

Constructors

TransferResponseObjectError |

Fields

- respobjerr_code :: Int
- respobjerr_message :: Text

#### Instances

Instances details

FromJSON TransferResponseObjectError Source # |
Instance details Defined in Network.GitLFS Methods parseJSON :: Value -> Parser TransferResponseObjectError Source # parseJSONList :: Value -> Parser [TransferResponseObjectError] Source # omittedField :: Maybe TransferResponseObjectError Source #
ToJSON TransferResponseObjectError Source # |
Instance details Defined in Network.GitLFS Methods toJSON :: TransferResponseObjectError -> Value Source # toEncoding :: TransferResponseObjectError -> Encoding Source # toJSONList :: [TransferResponseObjectError] -> Value Source # toEncodingList :: [TransferResponseObjectError] -> Encoding Source # omitField :: TransferResponseObjectError -> Bool Source #
Generic TransferResponseObjectError Source # |

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.5-32tbRKDDIPmLhn6OLMhHHn" '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 Source #

to :: Rep TransferResponseObjectError x -> TransferResponseObjectError Source #

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

Instance details

Defined in Network.GitLFS

type Rep TransferResponseObjectError = D1 ('MetaData "TransferResponseObjectError" "Network.GitLFS" "git-lfs-1.2.5-32tbRKDDIPmLhn6OLMhHHn" '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 Source #

type SHA256 = Text Source #

data GitRef Source #

Constructors

GitRef |

Fields

- name :: Text

#### Instances

Instances details

FromJSON GitRef Source # |
Instance details Defined in Network.GitLFS Methods parseJSON :: Value -> Parser GitRef Source # parseJSONList :: Value -> Parser [GitRef] Source # omittedField :: Maybe GitRef Source #
ToJSON GitRef Source # |
Instance details Defined in Network.GitLFS Methods toJSON :: GitRef -> Value Source # toEncoding :: GitRef -> Encoding Source # toJSONList :: [GitRef] -> Value Source # toEncodingList :: [GitRef] -> Encoding Source # omitField :: GitRef -> Bool Source #
Generic GitRef Source # |

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.5-32tbRKDDIPmLhn6OLMhHHn" 'False) (C1 ('MetaCons "GitRef" 'PrefixI 'True) (S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

Methods

from :: GitRef -> Rep GitRef x Source #

to :: Rep GitRef x -> GitRef Source #

Show GitRef Source # |
Instance details Defined in Network.GitLFS Methods showsPrec :: Int -> GitRef -> ShowS Source # show :: GitRef -> String Source # showList :: [GitRef] -> ShowS Source #
type Rep GitRef Source # |
Instance details Defined in Network.GitLFS type Rep GitRef = D1 ('MetaData "GitRef" "Network.GitLFS" "git-lfs-1.2.5-32tbRKDDIPmLhn6OLMhHHn" 'False) (C1 ('MetaCons "GitRef" 'PrefixI 'True) (S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

type NumSeconds = Integer Source #

type HTTPHeader = Text Source #

type HTTPHeaderValue = Text Source #