Key Features • Usage • Testing • Example • Continuous Integration • Enhancements
- Create Account using FakeAPI
- Retrieve Account using FakeAPI
- Delete Account using FakeAPI
$ docker-compose up --build
import client "form3-api-client"
ctx := context.TODO()
accountService := client.NewAccountService(BaseUrlEnvVariable)
country := "GB"
account, res, err := accountService.Create(ctx, &client.AccountData{
ID: "ad27e265-9605-4b4b-a0e5-3003ea9cc4dc",
OrganisationID: "eb0bd6f5-c3f5-44b2-b677-acd23cdde73c",
Type: "accounts",
Attributes: &client.AccountAttributes{
BaseCurrency: "GBP",
Country: &country,
Name: []string{"Mahmoud Salem"},
},
})
if err != nil{
fmt.Println(err)
}
id := "ad27e265-9605-4b4b-a0e5-3003ea9cc4dc"
ctx := context.TODO()
accountService := client.NewAccountService(BaseUrlEnvVariable)
account, res, err := accountService.Fetch(ctx, id)
if err != nil{
fmt.Println(err)
}
id := "ad27e265-9605-4b4b-a0e5-3003ea9cc4dc"
ctx := context.TODO()
accountService := client.NewAccountService(BaseUrlEnvVariable)
version := int64(0)
res, err := accountService.Delete(ctx, id, &version)
if err != nil{
fmt.Println(err)
}
fmt.Println(res.Response.StatusCode)
204
I've included both unit tests and e2e tests. The current coverage is 85%.
$ go test
$ docker-compose logs accountapi-client
e2e_tests
will only pass when the docker-compose services are up and running. Currently I've added the docker-compose build to the workflow so the test cases passes on the CI pipeline.
I created a Github Action workflow to run docker-compose and the test cases with each push. This will make us alert to any faulty code being pushed.
Visit example folder to run key features directly.
- Add Validations
- Add List operation with paging