circlehs-0.0.3: The CircleCI REST API for Haskell

Copyright(c) Denis Shevchenko, 2016
LicenseMIT
Maintainerme@dshevchenko.biz
Stabilityalpha
Safe HaskellNone
LanguageHaskell2010

Network.CircleCI.Environment

Contents

Description

API calls for work with Environment Variables used in project build.

For more info please see "Environment variables" section in your CircleCI project's Settings.

Synopsis

API calls

getEnvVars Source

Arguments

:: ProjectPoint

Names of GitHub user/project.

-> CircleCIResponse [EnvVar]

List of environment variables.

Shows list of environment variables for the single project. Based on https://circleci.com/docs/api/#list-environment-variables.

Usage example:

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE LambdaCase #-}

import Network.CircleCI

main :: IO ()
main = runCircleCI (getEnvVars $ ProjectPoint "denisshevchenko" "circlehs")
                   (AccountAPIToken "e64c674195b87d76e988e9fbcba2whatever")
    >>= \case
        Left problem  -> print problem
        Right envVars -> print envVars

getEnvVar Source

Arguments

:: ProjectPoint

Names of GitHub user/project.

-> EnvVarName

Environment variable name.

-> CircleCIResponse EnvVar

Environment variable.

Shows single environment variable. Based on https://circleci.com/docs/api/#get-environment-variable.

Usage example:

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE LambdaCase #-}

import Network.CircleCI

main :: IO ()
main = runCircleCI (getEnvVar project "GCC") token
    >>= \case
        Left problem -> print problem
        Right envVar -> print envVar
  where
    project = ProjectPoint "denisshevchenko" "circlehs"
    token   = AccountAPIToken "e64c674195b87d76e988e9fbcba2whatever"

addEnvVar Source

Arguments

:: ProjectPoint

Names of GitHub user/project.

-> EnvVar

Environment variable.

-> CircleCIResponse EnvVar

Added environment variable.

Adds environment variable. Based on https://circleci.com/docs/api/#add-environment-variable.

Usage example:

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE LambdaCase #-}

import Network.CircleCI

main :: IO ()
main = runCircleCI (addEnvVar project envVar) token
    >>= \case
        Left problem    -> print problem
        Right newEnvVar -> print newEnvVar
  where
    project = ProjectPoint "denisshevchenko" "circlehs"
    envVar  = EnvVar "GCC" "/usr/local/bin/gcc-4.8"
    token   = AccountAPIToken "e64c674195b87d76e988e9fbcba2whatever"

deleteEnvVar Source

Arguments

:: ProjectPoint

Names of GitHub user/project.

-> EnvVarName

Environment variable name.

-> CircleCIResponse EnvVarDeleted

Info about environment variable deleting.

Deletes single environment variable. Based on https://circleci.com/docs/api/#delete-environment-variable.

Usage example:

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE LambdaCase #-}

import Network.CircleCI

main :: IO ()
main = runCircleCI (deleteEnvVar project "GCC") token
    >>= \case
        Left problem    -> print problem
        Right isDeleted -> print isDeleted
  where
    project = ProjectPoint "denisshevchenko" "circlehs"
    token   = AccountAPIToken "e64c674195b87d76e988e9fbcba2whatever"

Types for calls and responses

data EnvVar Source

Environment variable, name/value.

Constructors

EnvVar 

Fields

name :: Text
 
value :: Text
 

type EnvVarName = Text Source

Name of environment variable.