// Code generated by go-swagger; DO NOT EDIT. package restapi // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command import ( "encoding/json" ) var ( // SwaggerJSON embedded version of the swagger document used at generation time SwaggerJSON json.RawMessage // FlatSwaggerJSON embedded flattened version of the swagger document used at generation time FlatSwaggerJSON json.RawMessage ) func init() { SwaggerJSON = json.RawMessage([]byte(`{ "schemes": [ "http", "https" ], "swagger": "2.0", "info": { "description": "An API which supports creation, deletion, listing etc of Billing", "title": "Billing Management API", "contact": { "email": "diego@cyclops-labs.io" }, "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.html" }, "version": "1.0.0" }, "host": "localhost:8000", "basePath": "/api/v1.0", "paths": { "/billrun": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "bulkManagement" ], "summary": "Show the status report of the billruns present in the system", "operationId": "ListBillRuns", "parameters": [ { "type": "integer", "description": "Amount of months to have in the report", "name": "months", "in": "query" } ], "responses": { "200": { "description": "Description of a successfully operation", "schema": { "type": "array", "items": { "$ref": "#/definitions/BillRunList" } } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } }, "put": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "bulkManagement" ], "summary": "Try to re-run the failed invoices in all the billruns.", "operationId": "ReRunAllBillRuns", "parameters": [ { "type": "integer", "description": "Amount of months to check for failed invoices.", "name": "months", "in": "query" } ], "responses": { "202": { "description": "The request for processing had been added to the queue", "schema": { "$ref": "#/definitions/ItemCreatedResponse" } }, "404": { "description": "The invoice id provided doesn't exist", "schema": { "$ref": "#/definitions/ErrorResponse" } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } } }, "/billrun/organization/{id}": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "bulkManagement" ], "summary": "Show the status report of the billruns present in the system", "operationId": "ListBillRunsByOrganization", "parameters": [ { "type": "string", "description": "Id of the billrun to be re-run.", "name": "id", "in": "path", "required": true }, { "type": "integer", "description": "Amount of months to have in the report", "name": "months", "in": "query" } ], "responses": { "200": { "description": "Description of a successfully operation", "schema": { "type": "array", "items": { "$ref": "#/definitions/BillRunList" } } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } } }, "/billrun/{id}": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "bulkManagement" ], "summary": "Get the status report of the billrun requested", "operationId": "GetBillRun", "parameters": [ { "type": "string", "format": "uuid", "description": "Id of the invoice to be checked", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "Description of a successfully operation", "schema": { "$ref": "#/definitions/BillRunReport" } }, "404": { "description": "The invoice id provided doesn't exist", "schema": { "$ref": "#/definitions/ErrorResponse" } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } }, "put": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "bulkManagement" ], "summary": "Try to re-run the failed invoices in the billrun.", "operationId": "ReRunBillRun", "parameters": [ { "type": "string", "format": "uuid", "description": "Id of the billrun to be re-run.", "name": "id", "in": "path", "required": true } ], "responses": { "202": { "description": "The request for processing had been added to the queue", "schema": { "$ref": "#/definitions/ItemCreatedResponse" } }, "404": { "description": "The invoice id provided doesn't exist", "schema": { "$ref": "#/definitions/ErrorResponse" } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } } }, "/invoice": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "invoiceManagement" ], "summary": "Summary for this endpoint", "operationId": "ListInvoices", "parameters": [ { "description": "Invoice model partially filled to use for the filtering of the invoices", "name": "model", "in": "body", "schema": { "$ref": "#/definitions/Invoice" } } ], "responses": { "200": { "description": "Description of a successfully operation", "schema": { "type": "array", "items": { "$ref": "#/definitions/Invoice" } } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } } }, "/invoice/customer": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "invoiceManagement" ], "summary": "Retrieve customers' invoices", "operationId": "ListCustomerInvoices", "responses": { "200": { "description": "Description of a successfully operation", "schema": { "type": "array", "items": { "$ref": "#/definitions/Invoice" } } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } } }, "/invoice/customer/{id}": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "invoiceManagement" ], "summary": "Retrieve invoices by customer id", "operationId": "GetInvoicesByCustomer", "parameters": [ { "type": "string", "description": "Id of the account to be checked", "name": "id", "in": "path", "required": true }, { "type": "integer", "description": "Amount of months to have in the report", "name": "months", "in": "query" } ], "responses": { "200": { "description": "Description of a successfully operation", "schema": { "type": "array", "items": { "$ref": "#/definitions/Invoice" } } }, "404": { "description": "The invoice id provided doesn't exist", "schema": { "$ref": "#/definitions/ErrorResponse" } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } }, "post": { "security": [ { "Keycloak": [ "admin" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "invoiceManagement" ], "summary": "Generate invoice for the provided customer for the provided time window or last period", "operationId": "GenerateInvoiceForCustomer", "parameters": [ { "type": "string", "description": "Id of the account to be checked", "name": "id", "in": "path", "required": true }, { "type": "string", "format": "datetime", "description": "Datetime from which to generate the invoice", "name": "from", "in": "query" }, { "type": "string", "format": "datetime", "description": "Datetime until which to generate the invoice", "name": "to", "in": "query" } ], "responses": { "202": { "description": "The request for processing had been added to the queue", "schema": { "$ref": "#/definitions/ItemCreatedResponse" } }, "400": { "description": "Invalid input, object invalid", "schema": { "$ref": "#/definitions/ErrorResponse" } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } } }, "/invoice/reseller": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "invoiceManagement" ], "summary": "Retrieve resellers' invoices", "operationId": "ListResellerInvoices", "responses": { "200": { "description": "Description of a successfully operation", "schema": { "type": "array", "items": { "$ref": "#/definitions/Invoice" } } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } } }, "/invoice/reseller/{id}": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "invoiceManagement" ], "summary": "Retrieve invoices by reseller id", "operationId": "GetInvoicesByReseller", "parameters": [ { "type": "string", "description": "Id of the account to be checked", "name": "id", "in": "path", "required": true }, { "type": "integer", "description": "Amount of months to have in the report", "name": "months", "in": "query" } ], "responses": { "200": { "description": "Description of a successfully operation", "schema": { "type": "array", "items": { "$ref": "#/definitions/Invoice" } } }, "404": { "description": "The invoice id provided doesn't exist", "schema": { "$ref": "#/definitions/ErrorResponse" } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } }, "post": { "security": [ { "Keycloak": [ "admin" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "invoiceManagement" ], "summary": "Generate invoice for the provided reseller for the provided time window or last period", "operationId": "GenerateInvoiceForReseller", "parameters": [ { "type": "string", "description": "Id of the account to be checked", "name": "id", "in": "path", "required": true }, { "type": "string", "format": "datetime", "description": "Datetime from which to generate the invoice", "name": "from", "in": "query" }, { "type": "string", "format": "datetime", "description": "Datetime until which to generate the invoice", "name": "to", "in": "query" } ], "responses": { "202": { "description": "The request for processing had been added to the queue", "schema": { "$ref": "#/definitions/ItemCreatedResponse" } }, "400": { "description": "Invalid input, object invalid", "schema": { "$ref": "#/definitions/ErrorResponse" } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } } }, "/invoice/{id}": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "invoiceManagement" ], "summary": "Summary for this endpoint", "operationId": "GetInvoice", "parameters": [ { "type": "string", "format": "uuid", "description": "Id of the invoice to be checked", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "Description of a successfully operation", "schema": { "$ref": "#/definitions/Invoice" } }, "404": { "description": "The invoice id provided doesn't exist", "schema": { "$ref": "#/definitions/ErrorResponse" } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } } }, "/status": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "statusManagement" ], "summary": "Basic status of the system", "operationId": "showStatus", "responses": { "200": { "description": "Status information of the system", "schema": { "$ref": "#/definitions/Status" } } } } }, "/status/{id}": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "statusManagement" ], "summary": "Basic status of the system", "operationId": "getStatus", "parameters": [ { "enum": [ "kafka-receiver", "kafka-sender", "status", "trigger", "bulk", "invoice" ], "type": "string", "description": "Id of the endpoint to be checked", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "Status information of the system", "schema": { "$ref": "#/definitions/Status" } }, "404": { "description": "The endpoint provided doesn't exist", "schema": { "$ref": "#/definitions/ErrorResponse" } } } } }, "/trigger/periodicrun": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "triggerManagement" ], "summary": "Periodic run of the bulk generation of invoices", "operationId": "periodicRun", "parameters": [ { "type": "string", "format": "datetime", "description": "Datetime to override the time.now() to simulate other days", "name": "today", "in": "query" } ], "responses": { "202": { "description": "The request for processing the periodic run had been added to the queue", "schema": { "$ref": "#/definitions/ItemCreatedResponse" } } } } } }, "definitions": { "BillRun": { "type": "object", "properties": { "AmountInvoiced": { "type": "number", "format": "double", "default": 0, "x-go-custom-tag": "gorm:\"type:numeric(23,13)\"" }, "CreationTimestamp": { "type": "string", "format": "date-time", "x-go-custom-tag": "gorm:\"type:timestamptz\"" }, "ExecutionType": { "type": "string" }, "ID": { "type": "string", "format": "uuid", "x-go-custom-tag": "gorm:\"type:uuid;primary_key;unique;default:md5(random()::text || clock_timestamp()::text)::uuid\"" }, "InvoicesCount": { "type": "integer" }, "InvoicesErrorCount": { "type": "integer" }, "InvoicesErrorList": { "x-go-custom-tag": "gorm:\"type:text[]\"", "$ref": "#/definitions/StringArray" }, "InvoicesList": { "type": "array", "items": { "$ref": "#/definitions/InvoiceMetadata" }, "x-go-custom-tag": "gorm:\"-\"" }, "InvoicesProcessedCount": { "type": "integer" }, "OrganizationsInvolved": { "x-go-custom-tag": "gorm:\"type:text[]\"", "$ref": "#/definitions/StringArray" }, "Status": { "type": "string", "default": "QUEUED", "enum": [ "ERROR", "FINISHED", "PROCESSING", "QUEUED" ], "x-go-custom-tag": "gorm:\"default:QUEUED\"" } } }, "BillRunList": { "type": "object", "properties": { "AmountInvoiced": { "type": "number", "format": "double", "default": 0 }, "CreationTimestamp": { "type": "string", "format": "date-time" }, "ID": { "type": "string", "format": "uuid" }, "InvoicesCount": { "type": "integer" }, "InvoicesErrorCount": { "type": "integer" }, "InvoicesErrorList": { "x-go-custom-tag": "gorm:\"type:text[]\"", "$ref": "#/definitions/StringArray" }, "InvoicesProcessedCount": { "type": "integer" }, "OrganizationsInvolved": { "x-go-custom-tag": "gorm:\"type:text[]\"", "$ref": "#/definitions/StringArray" }, "Status": { "type": "string", "default": "QUEUED", "enum": [ "ERROR", "FINISHED", "PROCESSING", "QUEUED" ] } } }, "BillRunReport": { "type": "object", "properties": { "AmountInvoiced": { "type": "number", "format": "double", "default": 0 }, "CreationTimestamp": { "type": "string", "format": "date-time" }, "ID": { "type": "string", "format": "uuid" }, "InvoicesCount": { "type": "integer" }, "InvoicesErrorCount": { "type": "integer" }, "InvoicesErrorList": { "x-go-custom-tag": "gorm:\"type:text[]\"", "$ref": "#/definitions/StringArray" }, "InvoicesList": { "type": "array", "items": { "$ref": "#/definitions/InvoiceMetadata" }, "x-go-custom-tag": "gorm:\"-\"" }, "InvoicesProcessedCount": { "type": "integer" }, "Status": { "type": "string", "default": "QUEUED", "enum": [ "ERROR", "FINISHED", "PROCESSING", "QUEUED" ] } } }, "ErrorResponse": { "type": "object", "required": [ "errorString" ], "properties": { "errorString": { "type": "string" } } }, "Invoice": { "type": "object", "properties": { "AmountInvoiced": { "type": "number", "format": "double", "default": 0, "x-go-custom-tag": "gorm:\"type:numeric(23,13)\"" }, "BillRunID": { "type": "string", "format": "uuid" }, "BillingContact": { "type": "string" }, "Currency": { "type": "string", "default": "CHF", "enum": [ "CHF", "EUR", "USD" ] }, "GenerationTimestamp": { "type": "string", "format": "date-time", "x-go-custom-tag": "gorm:\"type:timestamptz\"" }, "ID": { "type": "string", "format": "uuid", "x-go-custom-tag": "gorm:\"type:uuid;primary_key;unique;default:md5(random()::text || clock_timestamp()::text)::uuid\"" }, "Items": { "x-go-custom-tag": "gorm:\"type:jsonb\"", "$ref": "#/definitions/Metadata" }, "OrganizationID": { "type": "string" }, "OrganizationName": { "type": "string" }, "OrganizationType": { "type": "string" }, "PaymentDeadline": { "type": "string", "format": "date", "x-go-custom-tag": "gorm:\"type:date\"" }, "PaymentStatus": { "type": "string", "default": "UNPAID", "enum": [ "CANCELLED", "PAID", "UNPAID" ] }, "PeriodEndDate": { "type": "string", "format": "date", "x-go-custom-tag": "gorm:\"type:date\"" }, "PeriodStartDate": { "type": "string", "format": "date", "x-go-custom-tag": "gorm:\"type:date\"" }, "Status": { "type": "string", "default": "NOT_PROCESSED", "enum": [ "ERROR", "FINISHED", "NOT_PROCESSED", "PROCESSING" ], "x-go-custom-tag": "gorm:\"default:NOT_PROCESSED\"" } } }, "InvoiceMetadata": { "type": "object", "properties": { "AmountInvoiced": { "type": "number", "format": "double", "default": 0 }, "Currency": { "type": "string", "default": "CHF", "enum": [ "CHF", "EUR", "USD" ] }, "ID": { "type": "string", "format": "uuid" }, "OrganizationID": { "type": "string" }, "OrganizationName": { "type": "string" }, "PaymentDeadline": { "type": "string", "format": "date" }, "PaymentStatus": { "type": "string", "default": "UNPAID", "enum": [ "CANCELLED", "PAID", "UNPAID" ] }, "PeriodEndDate": { "type": "string", "format": "date" }, "PeriodStartDate": { "type": "string", "format": "date" }, "Status": { "type": "string", "default": "NOT_PROCESSED", "enum": [ "ERROR", "FINISHED", "NOT_PROCESSED", "PROCESSING" ] } } }, "ItemCreatedResponse": { "properties": { "ApiLink": { "type": "string" }, "Message": { "type": "string" } } }, "Metadata": { "type": "object", "x-go-type": { "import": { "package": "gitlab.com/cyclops-utilities/datamodels" }, "type": "JSONdb" } }, "Status": { "type": "object", "required": [ "SystemState" ], "properties": { "AverageResponseTime": { "type": "number", "format": "double" }, "DBState": { "type": "string" }, "LastRequest": { "type": "string" }, "RequestsBoT": { "type": "integer" }, "RequestsLastHour": { "type": "integer" }, "RequestsToday": { "type": "integer" }, "SystemState": { "type": "string" } } }, "StringArray": { "x-go-type": { "import": { "package": "github.com/lib/pq" }, "type": "StringArray" } } }, "securityDefinitions": { "APIKeyHeader": { "type": "apiKey", "name": "X-API-KEY", "in": "header" }, "APIKeyParam": { "type": "apiKey", "name": "api_key", "in": "query" }, "Keycloak": { "type": "oauth2", "flow": "accessCode", "authorizationUrl": "http://localhost:8080/auth/realms/Dev/protocol/openid-connect/auth", "tokenUrl": "http://localhost:8080/auth/realms/Dev/protocol/openid-connect/token", "scopes": { "admin": "Admin scope", "user": "User scope" } } }, "security": [ { "Keycloak": [ "user", "admin" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "tags": [ { "description": "Actions relating to the reporting of the state of the service", "name": "statusManagement" }, { "description": "Actions relating to the periodics actions to be triggered in the system", "name": "triggerManagement" }, { "description": "Actions relating to the bulk generations/retrieval of invoices.", "name": "bulkManagement" }, { "description": "Actions relating to the generation and retrieval of invoices.", "name": "invoiceManagement" } ] }`)) FlatSwaggerJSON = json.RawMessage([]byte(`{ "schemes": [ "http", "https" ], "swagger": "2.0", "info": { "description": "An API which supports creation, deletion, listing etc of Billing", "title": "Billing Management API", "contact": { "email": "diego@cyclops-labs.io" }, "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.html" }, "version": "1.0.0" }, "host": "localhost:8000", "basePath": "/api/v1.0", "paths": { "/billrun": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "bulkManagement" ], "summary": "Show the status report of the billruns present in the system", "operationId": "ListBillRuns", "parameters": [ { "type": "integer", "description": "Amount of months to have in the report", "name": "months", "in": "query" } ], "responses": { "200": { "description": "Description of a successfully operation", "schema": { "type": "array", "items": { "$ref": "#/definitions/BillRunList" } } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } }, "put": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "bulkManagement" ], "summary": "Try to re-run the failed invoices in all the billruns.", "operationId": "ReRunAllBillRuns", "parameters": [ { "type": "integer", "description": "Amount of months to check for failed invoices.", "name": "months", "in": "query" } ], "responses": { "202": { "description": "The request for processing had been added to the queue", "schema": { "$ref": "#/definitions/ItemCreatedResponse" } }, "404": { "description": "The invoice id provided doesn't exist", "schema": { "$ref": "#/definitions/ErrorResponse" } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } } }, "/billrun/organization/{id}": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "bulkManagement" ], "summary": "Show the status report of the billruns present in the system", "operationId": "ListBillRunsByOrganization", "parameters": [ { "type": "string", "description": "Id of the billrun to be re-run.", "name": "id", "in": "path", "required": true }, { "type": "integer", "description": "Amount of months to have in the report", "name": "months", "in": "query" } ], "responses": { "200": { "description": "Description of a successfully operation", "schema": { "type": "array", "items": { "$ref": "#/definitions/BillRunList" } } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } } }, "/billrun/{id}": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "bulkManagement" ], "summary": "Get the status report of the billrun requested", "operationId": "GetBillRun", "parameters": [ { "type": "string", "format": "uuid", "description": "Id of the invoice to be checked", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "Description of a successfully operation", "schema": { "$ref": "#/definitions/BillRunReport" } }, "404": { "description": "The invoice id provided doesn't exist", "schema": { "$ref": "#/definitions/ErrorResponse" } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } }, "put": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "bulkManagement" ], "summary": "Try to re-run the failed invoices in the billrun.", "operationId": "ReRunBillRun", "parameters": [ { "type": "string", "format": "uuid", "description": "Id of the billrun to be re-run.", "name": "id", "in": "path", "required": true } ], "responses": { "202": { "description": "The request for processing had been added to the queue", "schema": { "$ref": "#/definitions/ItemCreatedResponse" } }, "404": { "description": "The invoice id provided doesn't exist", "schema": { "$ref": "#/definitions/ErrorResponse" } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } } }, "/invoice": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "invoiceManagement" ], "summary": "Summary for this endpoint", "operationId": "ListInvoices", "parameters": [ { "description": "Invoice model partially filled to use for the filtering of the invoices", "name": "model", "in": "body", "schema": { "$ref": "#/definitions/Invoice" } } ], "responses": { "200": { "description": "Description of a successfully operation", "schema": { "type": "array", "items": { "$ref": "#/definitions/Invoice" } } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } } }, "/invoice/customer": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "invoiceManagement" ], "summary": "Retrieve customers' invoices", "operationId": "ListCustomerInvoices", "responses": { "200": { "description": "Description of a successfully operation", "schema": { "type": "array", "items": { "$ref": "#/definitions/Invoice" } } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } } }, "/invoice/customer/{id}": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "invoiceManagement" ], "summary": "Retrieve invoices by customer id", "operationId": "GetInvoicesByCustomer", "parameters": [ { "type": "string", "description": "Id of the account to be checked", "name": "id", "in": "path", "required": true }, { "type": "integer", "description": "Amount of months to have in the report", "name": "months", "in": "query" } ], "responses": { "200": { "description": "Description of a successfully operation", "schema": { "type": "array", "items": { "$ref": "#/definitions/Invoice" } } }, "404": { "description": "The invoice id provided doesn't exist", "schema": { "$ref": "#/definitions/ErrorResponse" } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } }, "post": { "security": [ { "Keycloak": [ "admin" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "invoiceManagement" ], "summary": "Generate invoice for the provided customer for the provided time window or last period", "operationId": "GenerateInvoiceForCustomer", "parameters": [ { "type": "string", "description": "Id of the account to be checked", "name": "id", "in": "path", "required": true }, { "type": "string", "format": "datetime", "description": "Datetime from which to generate the invoice", "name": "from", "in": "query" }, { "type": "string", "format": "datetime", "description": "Datetime until which to generate the invoice", "name": "to", "in": "query" } ], "responses": { "202": { "description": "The request for processing had been added to the queue", "schema": { "$ref": "#/definitions/ItemCreatedResponse" } }, "400": { "description": "Invalid input, object invalid", "schema": { "$ref": "#/definitions/ErrorResponse" } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } } }, "/invoice/reseller": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "invoiceManagement" ], "summary": "Retrieve resellers' invoices", "operationId": "ListResellerInvoices", "responses": { "200": { "description": "Description of a successfully operation", "schema": { "type": "array", "items": { "$ref": "#/definitions/Invoice" } } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } } }, "/invoice/reseller/{id}": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "invoiceManagement" ], "summary": "Retrieve invoices by reseller id", "operationId": "GetInvoicesByReseller", "parameters": [ { "type": "string", "description": "Id of the account to be checked", "name": "id", "in": "path", "required": true }, { "type": "integer", "description": "Amount of months to have in the report", "name": "months", "in": "query" } ], "responses": { "200": { "description": "Description of a successfully operation", "schema": { "type": "array", "items": { "$ref": "#/definitions/Invoice" } } }, "404": { "description": "The invoice id provided doesn't exist", "schema": { "$ref": "#/definitions/ErrorResponse" } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } }, "post": { "security": [ { "Keycloak": [ "admin" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "invoiceManagement" ], "summary": "Generate invoice for the provided reseller for the provided time window or last period", "operationId": "GenerateInvoiceForReseller", "parameters": [ { "type": "string", "description": "Id of the account to be checked", "name": "id", "in": "path", "required": true }, { "type": "string", "format": "datetime", "description": "Datetime from which to generate the invoice", "name": "from", "in": "query" }, { "type": "string", "format": "datetime", "description": "Datetime until which to generate the invoice", "name": "to", "in": "query" } ], "responses": { "202": { "description": "The request for processing had been added to the queue", "schema": { "$ref": "#/definitions/ItemCreatedResponse" } }, "400": { "description": "Invalid input, object invalid", "schema": { "$ref": "#/definitions/ErrorResponse" } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } } }, "/invoice/{id}": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "invoiceManagement" ], "summary": "Summary for this endpoint", "operationId": "GetInvoice", "parameters": [ { "type": "string", "format": "uuid", "description": "Id of the invoice to be checked", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "Description of a successfully operation", "schema": { "$ref": "#/definitions/Invoice" } }, "404": { "description": "The invoice id provided doesn't exist", "schema": { "$ref": "#/definitions/ErrorResponse" } }, "500": { "description": "Something unexpected happend, error raised", "schema": { "$ref": "#/definitions/ErrorResponse" } } } } }, "/status": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "statusManagement" ], "summary": "Basic status of the system", "operationId": "showStatus", "responses": { "200": { "description": "Status information of the system", "schema": { "$ref": "#/definitions/Status" } } } } }, "/status/{id}": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "statusManagement" ], "summary": "Basic status of the system", "operationId": "getStatus", "parameters": [ { "enum": [ "kafka-receiver", "kafka-sender", "status", "trigger", "bulk", "invoice" ], "type": "string", "description": "Id of the endpoint to be checked", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "Status information of the system", "schema": { "$ref": "#/definitions/Status" } }, "404": { "description": "The endpoint provided doesn't exist", "schema": { "$ref": "#/definitions/ErrorResponse" } } } } }, "/trigger/periodicrun": { "get": { "security": [ { "Keycloak": [ "user" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "produces": [ "application/json" ], "tags": [ "triggerManagement" ], "summary": "Periodic run of the bulk generation of invoices", "operationId": "periodicRun", "parameters": [ { "type": "string", "format": "datetime", "description": "Datetime to override the time.now() to simulate other days", "name": "today", "in": "query" } ], "responses": { "202": { "description": "The request for processing the periodic run had been added to the queue", "schema": { "$ref": "#/definitions/ItemCreatedResponse" } } } } } }, "definitions": { "BillRun": { "type": "object", "properties": { "AmountInvoiced": { "type": "number", "format": "double", "default": 0, "x-go-custom-tag": "gorm:\"type:numeric(23,13)\"" }, "CreationTimestamp": { "type": "string", "format": "date-time", "x-go-custom-tag": "gorm:\"type:timestamptz\"" }, "ExecutionType": { "type": "string" }, "ID": { "type": "string", "format": "uuid", "x-go-custom-tag": "gorm:\"type:uuid;primary_key;unique;default:md5(random()::text || clock_timestamp()::text)::uuid\"" }, "InvoicesCount": { "type": "integer" }, "InvoicesErrorCount": { "type": "integer" }, "InvoicesErrorList": { "x-go-custom-tag": "gorm:\"type:text[]\"", "$ref": "#/definitions/StringArray" }, "InvoicesList": { "type": "array", "items": { "$ref": "#/definitions/InvoiceMetadata" }, "x-go-custom-tag": "gorm:\"-\"" }, "InvoicesProcessedCount": { "type": "integer" }, "OrganizationsInvolved": { "x-go-custom-tag": "gorm:\"type:text[]\"", "$ref": "#/definitions/StringArray" }, "Status": { "type": "string", "default": "QUEUED", "enum": [ "ERROR", "FINISHED", "PROCESSING", "QUEUED" ], "x-go-custom-tag": "gorm:\"default:QUEUED\"" } } }, "BillRunList": { "type": "object", "properties": { "AmountInvoiced": { "type": "number", "format": "double", "default": 0 }, "CreationTimestamp": { "type": "string", "format": "date-time" }, "ID": { "type": "string", "format": "uuid" }, "InvoicesCount": { "type": "integer" }, "InvoicesErrorCount": { "type": "integer" }, "InvoicesErrorList": { "x-go-custom-tag": "gorm:\"type:text[]\"", "$ref": "#/definitions/StringArray" }, "InvoicesProcessedCount": { "type": "integer" }, "OrganizationsInvolved": { "x-go-custom-tag": "gorm:\"type:text[]\"", "$ref": "#/definitions/StringArray" }, "Status": { "type": "string", "default": "QUEUED", "enum": [ "ERROR", "FINISHED", "PROCESSING", "QUEUED" ] } } }, "BillRunReport": { "type": "object", "properties": { "AmountInvoiced": { "type": "number", "format": "double", "default": 0 }, "CreationTimestamp": { "type": "string", "format": "date-time" }, "ID": { "type": "string", "format": "uuid" }, "InvoicesCount": { "type": "integer" }, "InvoicesErrorCount": { "type": "integer" }, "InvoicesErrorList": { "x-go-custom-tag": "gorm:\"type:text[]\"", "$ref": "#/definitions/StringArray" }, "InvoicesList": { "type": "array", "items": { "$ref": "#/definitions/InvoiceMetadata" }, "x-go-custom-tag": "gorm:\"-\"" }, "InvoicesProcessedCount": { "type": "integer" }, "Status": { "type": "string", "default": "QUEUED", "enum": [ "ERROR", "FINISHED", "PROCESSING", "QUEUED" ] } } }, "ErrorResponse": { "type": "object", "required": [ "errorString" ], "properties": { "errorString": { "type": "string" } } }, "Invoice": { "type": "object", "properties": { "AmountInvoiced": { "type": "number", "format": "double", "default": 0, "x-go-custom-tag": "gorm:\"type:numeric(23,13)\"" }, "BillRunID": { "type": "string", "format": "uuid" }, "BillingContact": { "type": "string" }, "Currency": { "type": "string", "default": "CHF", "enum": [ "CHF", "EUR", "USD" ] }, "GenerationTimestamp": { "type": "string", "format": "date-time", "x-go-custom-tag": "gorm:\"type:timestamptz\"" }, "ID": { "type": "string", "format": "uuid", "x-go-custom-tag": "gorm:\"type:uuid;primary_key;unique;default:md5(random()::text || clock_timestamp()::text)::uuid\"" }, "Items": { "x-go-custom-tag": "gorm:\"type:jsonb\"", "$ref": "#/definitions/Metadata" }, "OrganizationID": { "type": "string" }, "OrganizationName": { "type": "string" }, "OrganizationType": { "type": "string" }, "PaymentDeadline": { "type": "string", "format": "date", "x-go-custom-tag": "gorm:\"type:date\"" }, "PaymentStatus": { "type": "string", "default": "UNPAID", "enum": [ "CANCELLED", "PAID", "UNPAID" ] }, "PeriodEndDate": { "type": "string", "format": "date", "x-go-custom-tag": "gorm:\"type:date\"" }, "PeriodStartDate": { "type": "string", "format": "date", "x-go-custom-tag": "gorm:\"type:date\"" }, "Status": { "type": "string", "default": "NOT_PROCESSED", "enum": [ "ERROR", "FINISHED", "NOT_PROCESSED", "PROCESSING" ], "x-go-custom-tag": "gorm:\"default:NOT_PROCESSED\"" } } }, "InvoiceMetadata": { "type": "object", "properties": { "AmountInvoiced": { "type": "number", "format": "double", "default": 0 }, "Currency": { "type": "string", "default": "CHF", "enum": [ "CHF", "EUR", "USD" ] }, "ID": { "type": "string", "format": "uuid" }, "OrganizationID": { "type": "string" }, "OrganizationName": { "type": "string" }, "PaymentDeadline": { "type": "string", "format": "date" }, "PaymentStatus": { "type": "string", "default": "UNPAID", "enum": [ "CANCELLED", "PAID", "UNPAID" ] }, "PeriodEndDate": { "type": "string", "format": "date" }, "PeriodStartDate": { "type": "string", "format": "date" }, "Status": { "type": "string", "default": "NOT_PROCESSED", "enum": [ "ERROR", "FINISHED", "NOT_PROCESSED", "PROCESSING" ] } } }, "ItemCreatedResponse": { "properties": { "ApiLink": { "type": "string" }, "Message": { "type": "string" } } }, "Metadata": { "type": "object", "x-go-type": { "import": { "package": "gitlab.com/cyclops-utilities/datamodels" }, "type": "JSONdb" } }, "Status": { "type": "object", "required": [ "SystemState" ], "properties": { "AverageResponseTime": { "type": "number", "format": "double" }, "DBState": { "type": "string" }, "LastRequest": { "type": "string" }, "RequestsBoT": { "type": "integer" }, "RequestsLastHour": { "type": "integer" }, "RequestsToday": { "type": "integer" }, "SystemState": { "type": "string" } } }, "StringArray": { "x-go-type": { "import": { "package": "github.com/lib/pq" }, "type": "StringArray" } } }, "securityDefinitions": { "APIKeyHeader": { "type": "apiKey", "name": "X-API-KEY", "in": "header" }, "APIKeyParam": { "type": "apiKey", "name": "api_key", "in": "query" }, "Keycloak": { "type": "oauth2", "flow": "accessCode", "authorizationUrl": "http://localhost:8080/auth/realms/Dev/protocol/openid-connect/auth", "tokenUrl": "http://localhost:8080/auth/realms/Dev/protocol/openid-connect/token", "scopes": { "admin": "Admin scope", "user": "User scope" } } }, "security": [ { "Keycloak": [ "user", "admin" ] }, { "APIKeyHeader": [] }, { "APIKeyParam": [] } ], "tags": [ { "description": "Actions relating to the reporting of the state of the service", "name": "statusManagement" }, { "description": "Actions relating to the periodics actions to be triggered in the system", "name": "triggerManagement" }, { "description": "Actions relating to the bulk generations/retrieval of invoices.", "name": "bulkManagement" }, { "description": "Actions relating to the generation and retrieval of invoices.", "name": "invoiceManagement" } ] }`)) }