-- Generated by scripts/generate.mjs. Do not edit. module Dagger.Function ( args , deprecated , description , id , name , returnType , sourceMap , sourceModuleName , withAgent , withArg , withArgWith , WithArgOpts , defaultWithArgOpts , withCachePolicy , withCachePolicyWith , WithCachePolicyOpts , defaultWithCachePolicyOpts , withCheck , withDeprecated , withDeprecatedWith , WithDeprecatedOpts , defaultWithDeprecatedOpts , withDescription , withGenerator , withSourceMap , withUp ) where import Data.Maybe (Maybe(..)) import Effect.Aff (Aff) import Dagger.Internal.Runtime as R import Dagger.Types as T -- | Arguments accepted by the function, if any. args :: T.Function -> Aff (Array T.FunctionArg) args = R.objectList "FunctionArg" "args" [] -- | The reason this function is deprecated, if any. deprecated :: T.Function -> Aff (Maybe String) deprecated = R.scalar "deprecated" [] -- | A doc string for the function, if any. description :: T.Function -> Aff String description = R.scalar "description" [] -- | A unique identifier for this Function. id :: T.Function -> Aff T.ID id = R.scalar "id" [] -- | The name of the function. name :: T.Function -> Aff String name = R.scalar "name" [] -- | The type returned by the function. returnType :: T.Function -> T.TypeDef returnType = R.select "returnType" [] -- | The location of this function declaration. sourceMap :: T.Function -> Aff (Maybe T.SourceMap) sourceMap = R.nullableObject "SourceMap" "sourceMap" [] -- | If this function is provided by a module, the name of the module. Unset otherwise. sourceModuleName :: T.Function -> Aff String sourceModuleName = R.scalar "sourceModuleName" [] -- | Returns the function with a flag indicating it is a source of expertise. withAgent :: T.Function -> T.Function withAgent = R.select "withAgent" [] type WithArgOpts = { description :: Maybe String , defaultValue :: Maybe T.JSON , defaultPath :: Maybe String , ignore :: Maybe (Array String) , sourceMap :: Maybe T.SourceMap , deprecated :: Maybe String , defaultAddress :: Maybe String } defaultWithArgOpts :: WithArgOpts defaultWithArgOpts = { description: Nothing , defaultValue: Nothing , defaultPath: Nothing , ignore: Nothing , sourceMap: Nothing , deprecated: Nothing , defaultAddress: Nothing } -- | Returns the function with the provided argument withArg :: String -> T.TypeDef -> T.Function -> T.Function withArg argName argTypeDef = withArgWith argName argTypeDef defaultWithArgOpts -- | Returns the function with the provided argument withArgWith :: String -> T.TypeDef -> WithArgOpts -> T.Function -> T.Function withArgWith argName argTypeDef opts = R.select "withArg" [R.argument "name" "String!" argName, R.objectArgument "typeDef" "ID!" argTypeDef, R.optional (R.argument "description" "String") opts.description, R.optional (R.argument "defaultValue" "JSON") opts.defaultValue, R.optional (R.argument "defaultPath" "String") opts.defaultPath, R.optional (R.argument "ignore" "[String!]") opts.ignore, R.optional (R.objectArgument "sourceMap" "ID") opts.sourceMap, R.optional (R.argument "deprecated" "String") opts.deprecated, R.optional (R.argument "defaultAddress" "String") opts.defaultAddress] type WithCachePolicyOpts = { timeToLive :: Maybe String } defaultWithCachePolicyOpts :: WithCachePolicyOpts defaultWithCachePolicyOpts = { timeToLive: Nothing } -- | Returns the function updated to use the provided cache policy. withCachePolicy :: T.FunctionCachePolicy -> T.Function -> T.Function withCachePolicy argPolicy = withCachePolicyWith argPolicy defaultWithCachePolicyOpts -- | Returns the function updated to use the provided cache policy. withCachePolicyWith :: T.FunctionCachePolicy -> WithCachePolicyOpts -> T.Function -> T.Function withCachePolicyWith argPolicy opts = R.select "withCachePolicy" [R.argument "policy" "FunctionCachePolicy!" argPolicy, R.optional (R.argument "timeToLive" "String") opts.timeToLive] -- | Returns the function with a flag indicating it's a check. withCheck :: T.Function -> T.Function withCheck = R.select "withCheck" [] type WithDeprecatedOpts = { reason :: Maybe String } defaultWithDeprecatedOpts :: WithDeprecatedOpts defaultWithDeprecatedOpts = { reason: Nothing } -- | Returns the function with the provided deprecation reason. withDeprecated :: T.Function -> T.Function withDeprecated = withDeprecatedWith defaultWithDeprecatedOpts -- | Returns the function with the provided deprecation reason. withDeprecatedWith :: WithDeprecatedOpts -> T.Function -> T.Function withDeprecatedWith opts = R.select "withDeprecated" [R.optional (R.argument "reason" "String") opts.reason] -- | Returns the function with the given doc string. withDescription :: String -> T.Function -> T.Function withDescription argDescription = R.select "withDescription" [R.argument "description" "String!" argDescription] -- | Returns the function with a flag indicating it's a generator. withGenerator :: T.Function -> T.Function withGenerator = R.select "withGenerator" [] -- | Returns the function with the given source map. withSourceMap :: T.SourceMap -> T.Function -> T.Function withSourceMap argSourceMap = R.select "withSourceMap" [R.objectArgument "sourceMap" "ID!" argSourceMap] -- | Returns the function with a flag indicating it returns a service for dagger up. withUp :: T.Function -> T.Function withUp = R.select "withUp" []