@@ -29,7 +29,7 @@ import Servant.API
29-- customize the output
29-- customize the output
30data CommonGeneratorOptions = CommonGeneratorOptions
30data CommonGeneratorOptions = CommonGeneratorOptions
32− functionRenamer :: FunctionName -> String -- ^ function transforming function names
32+ functionNameBuilder :: FunctionName -> String -- ^ function generating function names
33 , requestBody :: String -- ^ name used when a user want to send the request body (to let you redefine it)
33 , requestBody :: String -- ^ name used when a user want to send the request body (to let you redefine it)
34 , successCallback :: String -- ^ name of the callback parameter when the request was successful
34 , successCallback :: String -- ^ name of the callback parameter when the request was successful
35 , errorCallback :: String -- ^ name of the callback parameter when the request reported an error
35 , errorCallback :: String -- ^ name of the callback parameter when the request reported an error
@@ -40,7 +40,7 @@ data CommonGeneratorOptions = CommonGeneratorOptions
42-- > defCommonGeneratorOptions = CommonGeneratorOptions
42-- > defCommonGeneratorOptions = CommonGeneratorOptions
43−-- > { functionRenamer = concatRenamer
43+-- > { functionNameBuilder = camelCase
44-- > , requestBody = "body"
44-- > , requestBody = "body"
45-- > , successCallback = "onSuccess"
45-- > , successCallback = "onSuccess"
46-- > , errorCallback = "onError"
46-- > , errorCallback = "onError"
@@ -50,29 +50,29 @@ data CommonGeneratorOptions = CommonGeneratorOptions
50defCommonGeneratorOptions :: CommonGeneratorOptions
50defCommonGeneratorOptions :: CommonGeneratorOptions
51defCommonGeneratorOptions = CommonGeneratorOptions
51defCommonGeneratorOptions = CommonGeneratorOptions
53− functionRenamer = concatRenamer
53+ functionNameBuilder = camelCase
54 , requestBody = "body"
54 , requestBody = "body"
55 , successCallback = "onSuccess"
55 , successCallback = "onSuccess"
56 , errorCallback = "onError"
56 , errorCallback = "onError"
57 , moduleName = ""
57 , moduleName = ""
60−-- | Function renamer that simply concat each part together
60+-- | Function name builder that simply concat each part together
61−concatRenamer :: FunctionName -> String
61+concatCase :: FunctionName -> String
62−concatRenamer = concat
62+concatCase = concat
64−-- | Function renamer using the snake_case convention.
64+-- | Function name builder using the snake_case convention.
65-- each part is separated by a single underscore character.
65-- each part is separated by a single underscore character.
66−snakeCaseRenamer :: FunctionName -> String
66+snakeCase :: FunctionName -> String
67−snakeCaseRenamer = intercalate "_"
67+snakeCase = intercalate "_"
69−-- | Function renamer using the CamelCase convention.
69+-- | Function name builder using the CamelCase convention.
70-- each part begins with an upper case character.
70-- each part begins with an upper case character.
71−camelCaseRenamer :: FunctionName -> String
71+camelCase :: FunctionName -> String
72−camelCaseRenamer [] = ""
72+camelCase [] = ""
73−camelCaseRenamer (p:ps) = concat $ p : camelCaseRenamer' ps
73+camelCase (p:ps) = concat $ p : camelCase' ps
74− where camelCaseRenamer' [] = []
74+ where camelCase' [] = []
75− camelCaseRenamer' (r:rs) = capitalize r : camelCaseRenamer' rs
75+ camelCase' (r:rs) = capitalize r : camelCase' rs
76 capitalize [] = []
76 capitalize [] = []
77 capitalize (x:xs) = toUpper x : xs
77 capitalize (x:xs) = toUpper x : xs