{
  "info": {
    "_postman_id": "47011b35-adf0-433a-bf7b-fe7f9fe26b4d",
    "name": "Fiskil Data API Energy Collection",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "item": [
    {
      "name": "Authentication",
      "item": [
        {
          "name": "Generate Token",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "pm.test(\"Status code is 200\", function () {",
                  "    pm.response.to.have.status(200);",
                  "    const jsonData = pm.response.json();",
                  "    let token = jsonData.token",
                  "    pm.environment.set(\"token\", token);",
                  "});",
                  "",
                  "",
                  ""
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"client_id\": \"{{client_id}}\",\n  \"client_secret\": \"{{client_secret}}\"\n}",
              "options": {
                "raw": {
                  "language": "text"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/token",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "token"
              ]
            },
            "description": "Creates a new access token"
          }
        }
      ]
    },
    {
      "name": "End Users",
      "item": [
        {
          "name": "Generate End User",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "pm.test(\"Status code is 200\", function () {",
                  "    pm.response.to.have.status(200);",
                  "});",
                  "",
                  "const jsonData = pm.response.json();",
                  "let end_user_id = jsonData.end_user_id",
                  "pm.expect(end_user_id).to.be.a('string');",
                  "pm.environment.set(\"end_user_id\", end_user_id);",
                  ""
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"{{endUserEmail}}\",\n  \"name\": \"Example User\",\n  \"phone\": \"+61400000000\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/end-users",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "end-users"
              ]
            },
            "description": "Creates a new end user"
          }
        },
        {
          "name": "Get End User",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "pm.test(\"Status code is 200\", function () {",
                  "    pm.response.to.have.status(200);",
                  "    const jsonData = pm.response.json();",
                  "    let end_user_id = jsonData.id",
                  "    pm.expect(end_user_id).to.be.a('string');",
                  "    pm.environment.set(\"end_user_id\", end_user_id);",
                  "});",
                  "",
                  "",
                  ""
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/end-users?email={{endUserEmail}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "end-users"
              ],
              "query": [
                {
                  "key": "email",
                  "value": "{{endUserEmail}}"
                }
              ]
            },
            "description": "Creates a new end user"
          }
        },
        {
          "name": "Delete End User",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "pm.test(\"Status code is 200\", function () {",
                  "    pm.response.to.have.status(200);",
                  "    const jsonData = pm.response.json();",
                  "    let end_user_id = jsonData.id",
                  "    pm.expect(end_user_id).to.be.a('string');",
                  "    pm.environment.set(\"end_user_id\", end_user_id);",
                  "});",
                  "",
                  "",
                  ""
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            },
            "method": "DELETE",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/end-users/{{end_user_id}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "end-users",
                "{{end_user_id}}"
              ]
            },
            "description": "Creates a new end user"
          }
        }
      ]
    },
    {
      "name": "Institutions",
      "item": [
        {
          "name": "Get Institution for Client",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "pm.test(\"Status code is 200\", function () {",
                  "    pm.response.to.have.status(200);",
                  "    const jsonData = pm.response.json();",
                  "});",
                  "",
                  "",
                  ""
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/institutions?client_id={{client_id}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "institutions"
              ],
              "query": [
                {
                  "key": "client_id",
                  "value": "{{client_id}}"
                }
              ]
            },
            "description": "Creates a new end user"
          }
        }
      ]
    },
    {
      "name": "Auth Session",
      "item": [
        {
          "name": "create auth session",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            },
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "",
                "value": "",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"cancel_uri\": \"https://example.com/cancel\",\n  \"end_user_id\": \"{{end_user_id}}\",\n  \"redirect_uri\": \"https://www.example.com\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/auth/session",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "auth",
                "session"
              ]
            },
            "description": "Create an auth session before auth process."
          }
        }
      ]
    },
    {
      "name": "Consents",
      "item": [
        {
          "name": "List Consents",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/consent",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "consent"
              ]
            },
            "description": "List consents belonging to a client."
          }
        },
        {
          "name": "Revoke consent",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            },
            "method": "DELETE",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/consent/{{arrangement_id}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "consent",
                "{{arrangement_id}}"
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Energy APIs",
      "item": [
        {
          "name": "Get Accounts",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/energy/concessions?end_user_id={{end_user_id}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "energy",
                "concessions"
              ],
              "query": [
                {
                  "key": "page[size]",
                  "value": "{{page[size]}}",
                  "disabled": true
                },
                {
                  "key": "page[before]",
                  "value": "{{page[before]}}",
                  "disabled": true
                },
                {
                  "key": "page[after]",
                  "value": "{{page[after]}}",
                  "disabled": true
                },
                {
                  "key": "end_user_id",
                  "value": "{{end_user_id}}"
                }
              ]
            }
          }
        },
        {
          "name": "Get Concessions",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/concessions?end_user_id={{end_user_id}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "concessions"
              ],
              "query": [
                {
                  "key": "end_user_id",
                  "value": "{{end_user_id}}"
                }
              ]
            }
          }
        },
        {
          "name": "Get Billing",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/billing?end_user_id={{end_user_id}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "billing"
              ],
              "query": [
                {
                  "key": "page[before]",
                  "value": "{{page[before]}}",
                  "disabled": true
                },
                {
                  "key": "page[size]",
                  "value": "{{page[size]}}",
                  "disabled": true
                },
                {
                  "key": "newest-time",
                  "value": "{{newest-time}}",
                  "disabled": true
                },
                {
                  "key": "oldest-time",
                  "value": "{{oldest-time}}",
                  "disabled": true
                },
                {
                  "key": "page[after]",
                  "value": "{{page[before]}}",
                  "disabled": true
                },
                {
                  "key": "end_user_id",
                  "value": "{{end_user_id}}"
                }
              ]
            }
          }
        },
        {
          "name": "Get Invoices",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}",
                "disabled": true
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/invoice?end_user_id={{end_user_id}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "invoice"
              ],
              "query": [
                {
                  "key": "page[before]",
                  "value": "{{page[before]}}",
                  "disabled": true
                },
                {
                  "key": "page[size]",
                  "value": "{{page[size]}}",
                  "disabled": true
                },
                {
                  "key": "newest-date",
                  "value": "{{newest-date}}",
                  "disabled": true
                },
                {
                  "key": "oldest-date",
                  "value": "{{oldest-date}}",
                  "disabled": true
                },
                {
                  "key": "page[after]",
                  "value": "{{page[after]}}",
                  "disabled": true
                },
                {
                  "key": "end_user_id",
                  "value": "{{end_user_id}}"
                }
              ]
            }
          }
        },
        {
          "name": "Get Payment Schedules",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}",
                "disabled": true
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/payment-schedules?end_user_id={{end_user_id}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "payment-schedules"
              ],
              "query": [
                {
                  "key": "end_user_id",
                  "value": "{{end_user_id}}"
                }
              ]
            }
          }
        },
        {
          "name": "Get Usage",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}",
                "disabled": true
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/usage?end_user_id={{end_user_id}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "usage"
              ],
              "query": [
                {
                  "key": "end_user_id",
                  "value": "{{end_user_id}}"
                }
              ]
            }
          }
        },
        {
          "name": "GET Der",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}",
                "disabled": true
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/der?end_user_id={{end_user_id}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "der"
              ],
              "query": [
                {
                  "key": "end_user_id",
                  "value": "{{end_user_id}}"
                }
              ]
            }
          }
        },
        {
          "name": "Get Plans",
          "request": {
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            },
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}",
                "disabled": true
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/plans",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "plans"
              ]
            }
          }
        }
      ]
    }
  ]
}
