From ee6443dd7c81172f2bc4cdc0722b4f9c7efd0cdd Mon Sep 17 00:00:00 2001 From: Sumanth Kanakala Date: Mon, 16 Dec 2024 21:28:49 +0530 Subject: [PATCH] Implementing sso for portal client --- clients/customer-portal-client/package.json | 2 +- .../src/openapi-runtime.json | 89 ++ .../customer-portal-client/src/openapi.d.ts | 634 ++++++++++--- .../customer-portal-client/src/openapi.json | 859 ++++++++++++++---- 4 files changed, 1296 insertions(+), 288 deletions(-) diff --git a/clients/customer-portal-client/package.json b/clients/customer-portal-client/package.json index 067e24dc..842c015f 100644 --- a/clients/customer-portal-client/package.json +++ b/clients/customer-portal-client/package.json @@ -1,6 +1,6 @@ { "name": "@epilot/customer-portal-client", - "version": "0.18.0", + "version": "0.19.0-rc.4", "description": "API Client for epilot portal API", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/clients/customer-portal-client/src/openapi-runtime.json b/clients/customer-portal-client/src/openapi-runtime.json index d4554af4..f4e6a48c 100644 --- a/clients/customer-portal-client/src/openapi-runtime.json +++ b/clients/customer-portal-client/src/openapi-runtime.json @@ -130,10 +130,43 @@ "responses": {} } }, + "/v2/portal/public/extensions": { + "get": { + "operationId": "getPublicPortalExtensionDetails", + "parameters": [ + { + "in": "query", + "name": "org_id", + "required": true + }, + { + "in": "query", + "name": "origin", + "required": true + } + ], + "responses": {} + } + }, "/v2/portal/consumption": { "get": { "operationId": "getConsumption", "parameters": [ + { + "in": "query", + "name": "extensionId", + "required": true + }, + { + "in": "query", + "name": "hookId", + "required": true + }, + { + "in": "query", + "name": "meter_id", + "required": true + }, { "in": "query", "name": "from", @@ -157,6 +190,21 @@ "get": { "operationId": "getCosts", "parameters": [ + { + "in": "query", + "name": "extensionId", + "required": true + }, + { + "in": "query", + "name": "hookId", + "required": true + }, + { + "in": "query", + "name": "meter_id", + "required": true + }, { "in": "query", "name": "from", @@ -180,6 +228,21 @@ "get": { "operationId": "getPrices", "parameters": [ + { + "in": "query", + "name": "extensionId", + "required": true + }, + { + "in": "query", + "name": "hookId", + "required": true + }, + { + "in": "query", + "name": "meter_id", + "required": true + }, { "in": "query", "name": "from", @@ -1156,6 +1219,32 @@ }, "responses": {} } + }, + "/v2/portal/public/sso/login": { + "parameters": [ + { + "in": "query", + "name": "origin", + "required": true, + "description": "Origin of the Portal" + } + ], + "post": { + "operationId": "ssoLogin", + "parameters": [ + { + "in": "query", + "name": "org_id", + "required": true + } + ], + "requestBody": { + "content": { + "application/json": {} + } + }, + "responses": {} + } } }, "components": { diff --git a/clients/customer-portal-client/src/openapi.d.ts b/clients/customer-portal-client/src/openapi.d.ts index 5209df15..a3cbb651 100644 --- a/clients/customer-portal-client/src/openapi.d.ts +++ b/clients/customer-portal-client/src/openapi.d.ts @@ -274,6 +274,31 @@ declare namespace Components { calendar?: string[]; other?: string[]; } + /** + * Dictionary of epilot user attributes to claims + */ + export interface AttributeMappingConfig { + /** + * example: + * email + */ + email: string; + /** + * example: + * name + */ + display_name?: string; + /** + * example: + * phone + */ + phone?: string; + /** + * example: + * language + */ + preferred_language?: string; + } export interface AuthConfig { /** * AWS Cognito User Pool ID @@ -1117,6 +1142,10 @@ declare namespace Components { * EUR */ export type Currency = string; + export interface DataRetrievalItem { + extension?: PublicExtensionDetails; + hook?: PublicDataRetrievalHookDetails; + } export interface DeleteEntityFile { entity_id: /** * Entity ID @@ -1706,6 +1735,12 @@ declare namespace Components { [name: string]: string; }; }; + resolved?: { + /** + * Optional path to the data (array) in the response. If omitted, the data is assumed to be on the top level. + */ + dataPath?: string; + }; } /** * Hook that replaces the built-in contract identification for self-assignment. This hook makes a POST call whenever a user is trying to self-assign a contract to find the corresponding contract(s). The expected response to the call is: @@ -1770,6 +1805,18 @@ declare namespace Components { * represents_contact */ contact_relation_attribute?: string; + /** + * Explanation of the hook. + */ + explanation?: { + [name: string]: string; + /** + * Explanation of the functionality shown to the end user. + * example: + * This process will give you access to all Contracts kept + */ + en: string; + }; } /** * Hook that will allow using the specified source as data for consumption visualizations. This hook is triggered to fetch the data. Format of the request and response has to follow the following specification: TBD. The expected response to the call is: @@ -1828,6 +1875,12 @@ declare namespace Components { [name: string]: string; }; }; + resolved?: { + /** + * Optional path to the data (array) in the response. If omitted, the data is assumed to be on the top level. + */ + dataPath?: string; + }; } /** * Hook that checks the plausibility of meter readings before they are saved. This hook makes a POST call whenever a user is trying to save a meter reading. The expected response to the call is: @@ -1955,6 +2008,12 @@ declare namespace Components { [name: string]: string; }; }; + resolved?: { + /** + * Optional path to the data (array) in the response. If omitted, the data is assumed to be on the top level. + */ + dataPath?: string; + }; } /** * Hook that replaces the built-in registration identifiers check. This hook makes a POST call whenever a user is trying to register to find the corresponding contact. The expected response to the call is: @@ -2575,6 +2634,51 @@ declare namespace Components { }; schema?: string; } + export interface OIDCProviderConfig { + /** + * Issuing Authority URL + * example: + * https://login.microsoftonline.com/33d4f3e5-3df2-421e-b92e-a63cfa680a88/v2.0 + */ + oidc_issuer: string; + /** + * example: + * ab81daf8-8b1f-42d6-94ca-c51621054c75 + */ + client_id: string; + /** + * example: + * 7BIUnn~6shh.7fNtXb..3k1Mp3s6k6WK3B + */ + client_secret?: string; + /** + * Space-separated list of OAuth 2.0 scopes to request from OpenID Connect + * example: + * openid email + */ + scope: string; + metadata?: OIDCProviderMetadata; + } + export interface OIDCProviderMetadata { + /** + * URL of the authorization endpoint + * example: + * https://www.facebook.com/v12.0/dialog/oauth + */ + authorization_endpoint?: string; + /** + * URL of the token endpoint + * example: + * https://graph.facebook.com/v12.0/oauth/access_token + */ + token_endpoint?: string; + /** + * URL of the userinfo endpoint + * example: + * https://graph.facebook.com/me + */ + userinfo_endpoint?: string; + } /** * The opportunity entity */ @@ -3134,6 +3238,7 @@ declare namespace Components { * Permissions granted to a portal user while accessing entities */ grants?: Grant[]; + identity_providers?: ProviderPublicConfig[]; } /** * The portal user entity @@ -3228,6 +3333,103 @@ declare namespace Components { _updated_at: string; // date-time _schema: "product"; } + export interface ProviderConfig { + slug?: /** + * URL-friendly slug to use as organization-unique identifier for Provider + * example: + * office-365-login + */ + ProviderSlug /* [0-9a-z-]+ */; + display_name: /** + * Human-readable display name for identity provider shown in login + * example: + * Office 365 Login + */ + ProviderDisplayName; + provider_type: "OIDC"; + attribute_mappings?: /* Dictionary of epilot user attributes to claims */ AttributeMappingConfig; + oidc_config?: OIDCProviderConfig; + } + /** + * Human-readable display name for identity provider shown in login + * example: + * Office 365 Login + */ + export type ProviderDisplayName = string; + export interface ProviderPublicConfig { + slug: /** + * URL-friendly slug to use as organization-unique identifier for Provider + * example: + * office-365-login + */ + ProviderSlug /* [0-9a-z-]+ */; + display_name: /** + * Human-readable display name for identity provider shown in login + * example: + * Office 365 Login + */ + ProviderDisplayName; + oidc_config?: OIDCProviderConfig; + } + /** + * URL-friendly slug to use as organization-unique identifier for Provider + * example: + * office-365-login + */ + export type ProviderSlug = string; // [0-9a-z-]+ + export interface PublicContractIdentificationDetails { + /** + * Explanation of the hook. + */ + explanation?: { + [name: string]: string; + /** + * Explanation of the functionality shown to the end user. + * example: + * This process will give you access to all Contracts kept + */ + en: string; + }; + } + export interface PublicDataRetrievalHookDetails { + /** + * Identifier of the hook. + */ + id?: string; + name?: { + [name: string]: string; + /** + * Name of the extension in English. + */ + en: string; + }; + /** + * The intervals associated with the hook. + */ + intervals?: string[]; + } + export interface PublicExtensionCapabilities { + consumptionDataRetrieval?: DataRetrievalItem[]; + priceDataRetrieval?: DataRetrievalItem[]; + costDataRetrieval?: DataRetrievalItem[]; + contractIdentification?: { + extension?: PublicExtensionDetails; + hook?: PublicContractIdentificationDetails; + }; + } + export interface PublicExtensionDetails { + /** + * Identifier of the extension. + */ + id?: string; + name?: { + [name: string]: string; + /** + * Name of the extension in English. + */ + en: string; + }; + } /** * The person who recorded the reading * example: @@ -3351,6 +3553,9 @@ declare namespace Components { attribute?: string | null; attribute_value?: string | null; } + export interface SAMLProviderConfig { + } + export type SSOLoginToken = string; export interface SaveEntityFile { entity_id: /** * Entity ID @@ -3479,6 +3684,15 @@ declare namespace Components { * Indicate whether the file is shared with the end customer */ shared_with_end_customer?: boolean; + /** + * Array of entity tags + * example: + * [ + * "example", + * "mock" + * ] + */ + _tags?: string[]; }; }; } @@ -4862,30 +5076,38 @@ declare namespace Paths { } namespace GetConsumption { namespace Parameters { + export type ExtensionId = string; export type From = string; // date-time + export type HookId = string; export type Interval = "PT15M" | "PT1H" | "P1D" | "P1M"; + export type MeterId = string; export type To = string; // date-time } export interface QueryParameters { + extensionId: Parameters.ExtensionId; + hookId: Parameters.HookId; + meter_id: Parameters.MeterId; from: Parameters.From /* date-time */; to: Parameters.To /* date-time */; interval: Parameters.Interval; } namespace Responses { - export type $200 = { - /** - * ISO 8601 timestamp of the consumption record. - */ - timestamp: string; // date-time - /** - * The consumption value. - */ - value: number; - /** - * Optional type of the consumption, such as 'nt' (night time) or 'ht' (high time). - */ - type?: string; - }[]; + export interface $200 { + consumptions?: { + /** + * ISO 8601 timestamp of the consumption record. + */ + timestamp: string; // date-time + /** + * The consumption value. + */ + value: number; + /** + * Optional type of the consumption, such as 'nt' (night time) or 'ht' (high time). + */ + type?: string; + }[]; + } export type $401 = Components.Responses.Unauthorized; export type $403 = Components.Responses.Forbidden; export type $404 = Components.Responses.NotFound; @@ -4996,52 +5218,60 @@ declare namespace Paths { } namespace GetCosts { namespace Parameters { + export type ExtensionId = string; export type From = string; // date-time + export type HookId = string; export type Interval = "PT15M" | "PT1H" | "P1D" | "P1M"; + export type MeterId = string; export type To = string; // date-time } export interface QueryParameters { + extensionId: Parameters.ExtensionId; + hookId: Parameters.HookId; + meter_id: Parameters.MeterId; from: Parameters.From /* date-time */; to: Parameters.To /* date-time */; interval: Parameters.Interval; } namespace Responses { - export type $200 = { - /** - * ISO 8601 timestamp of the cost record. - */ - timestamp: string; // date-time - /** - * Cost in cents, e.g. 1234 for 12,34 €. - * example: - * 1234 - */ - unit_amount: number; - /** - * ISO 4217:2015 currency. - * example: - * EUR - */ - unit_amount_currency: string; - /** - * Cost in decimal format, e.g. "12.34". - * example: - * 12.34 - */ - unit_amount_decimal: string; - /** - * Is the tax (typically Value Added Tax) included in the amounts. Typically should NOT be included - exclusive of tax. - * example: - * exclusive - */ - tax_behavior: "inclusive" | "exclusive"; - /** - * Tax rate in percent, e.g. 19 for 19%. - * example: - * 19 - */ - tax_rate: number; - }[]; + export interface $200 { + costs?: { + /** + * ISO 8601 timestamp of the cost record. + */ + timestamp: string; // date-time + /** + * Cost in cents, e.g. 1234 for 12,34 €. + * example: + * 1234 + */ + unit_amount: number; + /** + * ISO 4217:2015 currency. + * example: + * EUR + */ + unit_amount_currency: string; + /** + * Cost in decimal format, e.g. "12.34". + * example: + * 12.34 + */ + unit_amount_decimal: string; + /** + * Is the tax (typically Value Added Tax) included in the amounts. Typically should NOT be included - exclusive of tax. + * example: + * exclusive + */ + tax_behavior: "inclusive" | "exclusive"; + /** + * Tax rate in percent, e.g. 19 for 19%. + * example: + * 19 + */ + tax_rate: number; + }[]; + } export type $401 = Components.Responses.Unauthorized; export type $403 = Components.Responses.Forbidden; export type $404 = Components.Responses.NotFound; @@ -5744,6 +5974,7 @@ declare namespace Paths { * Permissions granted to a portal user while accessing entities */ grants?: Components.Schemas.Grant[]; + identity_providers?: Components.Schemas.ProviderPublicConfig[]; certificate_details?: { /** * Status of the certificate @@ -5846,117 +6077,125 @@ declare namespace Paths { } namespace GetPrices { namespace Parameters { + export type ExtensionId = string; export type From = string; // date-time + export type HookId = string; export type Interval = "PT15M" | "PT1H" | "P1D" | "P1M"; + export type MeterId = string; export type To = string; // date-time } export interface QueryParameters { + extensionId: Parameters.ExtensionId; + hookId: Parameters.HookId; + meter_id: Parameters.MeterId; from: Parameters.From /* date-time */; to: Parameters.To /* date-time */; interval: Parameters.Interval; } namespace Responses { - export type $200 = { - /** - * ISO 8601 timestamp of the price record. - */ - timestamp: string; // date-time - /** - * Cost in cents, e.g. 1234 for 12,34 €. - * example: - * 1234 - */ - unit_amount: number; - /** - * ISO 4217:2015 currency. - * example: - * EUR - */ - unit_amount_currency: string; - /** - * Cost in decimal format, e.g. "12.34". - * example: - * 12.34 - */ - unit_amount_decimal: string; - /** - * Optional price components. - */ - components?: { - /** - * Market price in cents, e.g. 1000 for 10,00 €. - * example: - * 1000 - */ - auction_price_amount?: number; - /** - * Market price in decimal format, e.g. "10.00". - * example: - * 10.00 - */ - auction_price_amount_decimal?: string; - /** - * Taxes/Levies other than tax specified on the price level in cents, e.g. 50 for 00,50 €. - * example: - * 50 - */ - taxes_levies_amount?: number; + export interface $200 { + prices?: { /** - * Taxes/Levies other than tax specified on the price level in decimal format, e.g. "0.50". - * example: - * 0.50 + * ISO 8601 timestamp of the price record. */ - taxes_levies_amount_decimal?: string; + timestamp: string; // date-time /** - * Fee associated with the source, e.g. Green Energy Certificate fee in cents, e.g. 50 for 00,50 €. + * Cost in cents, e.g. 1234 for 12,34 €. * example: - * 50 + * 1234 */ - source_fee_amount?: number; + unit_amount: number; /** - * Fee associated with the source, e.g. Green Energy Certificate fee in decimal format, e.g. "0.50". + * ISO 4217:2015 currency. * example: - * 0.50 + * EUR */ - source_fee_amount_decimal?: string; + unit_amount_currency: string; /** - * Fee associated with the transmission/distribution in cents, e.g. 100 for 1,00 €. + * Cost in decimal format, e.g. "12.34". * example: - * 100 + * 12.34 */ - grid_fee_amount?: number; + unit_amount_decimal: string; /** - * Fee associated with the transmission/distribution in decimal format, e.g. "1.00". - * example: - * 1.00 + * Optional price components. */ - grid_fee_amount_decimal?: string; + components?: { + /** + * Market price in cents, e.g. 1000 for 10,00 €. + * example: + * 1000 + */ + auction_price_amount?: number; + /** + * Market price in decimal format, e.g. "10.00". + * example: + * 10.00 + */ + auction_price_amount_decimal?: string; + /** + * Taxes/Levies other than tax specified on the price level in cents, e.g. 50 for 00,50 €. + * example: + * 50 + */ + taxes_levies_amount?: number; + /** + * Taxes/Levies other than tax specified on the price level in decimal format, e.g. "0.50". + * example: + * 0.50 + */ + taxes_levies_amount_decimal?: string; + /** + * Fee associated with the source, e.g. Green Energy Certificate fee in cents, e.g. 50 for 00,50 €. + * example: + * 50 + */ + source_fee_amount?: number; + /** + * Fee associated with the source, e.g. Green Energy Certificate fee in decimal format, e.g. "0.50". + * example: + * 0.50 + */ + source_fee_amount_decimal?: string; + /** + * Fee associated with the transmission/distribution in cents, e.g. 100 for 1,00 €. + * example: + * 100 + */ + grid_fee_amount?: number; + /** + * Fee associated with the transmission/distribution in decimal format, e.g. "1.00". + * example: + * 1.00 + */ + grid_fee_amount_decimal?: string; + /** + * Margin in cents, e.g. 34 for 0,34 €. + * example: + * 34 + */ + margin_amount?: number; + /** + * Margin in decimal format, e.g. "0.34". + * example: + * 0.34 + */ + margin_amount_decimal?: string; + }; /** - * Margin in cents, e.g. 34 for 0,34 €. + * Is the tax (typically Value Added Tax) included in the amounts. Typically should NOT be included - exclusive of tax. * example: - * 34 + * exclusive */ - margin_amount?: number; + tax_behavior: "inclusive" | "exclusive"; /** - * Margin in decimal format, e.g. "0.34". + * Tax rate in percent, e.g. 19 for 19%. * example: - * 0.34 + * 19 */ - margin_amount_decimal?: string; - }; - /** - * Is the tax (typically Value Added Tax) included in the amounts. Typically should NOT be included - exclusive of tax. - * example: - * exclusive - */ - tax_behavior: "inclusive" | "exclusive"; - /** - * Tax rate in percent, e.g. 19 for 19%. - * example: - * 19 - */ - tax_rate: number; - }[]; + tax_rate: number; + }[]; + } export type $401 = Components.Responses.Unauthorized; export type $403 = Components.Responses.Forbidden; export type $404 = Components.Responses.NotFound; @@ -5987,6 +6226,32 @@ declare namespace Paths { export type $500 = Components.Responses.InternalServerError; } } + namespace GetPublicPortalExtensionDetails { + namespace Parameters { + /** + * Organization ID + * example: + * 12324 + */ + export type OrgId = string; + export type Origin = /* Origin of the portal */ Components.Schemas.Origin; + } + export interface QueryParameters { + org_id: /** + * Organization ID + * example: + * 12324 + */ + Parameters.OrgId; + origin: Parameters.Origin; + } + namespace Responses { + export type $200 = Components.Schemas.PublicExtensionCapabilities; + export type $401 = Components.Responses.Unauthorized; + export type $403 = Components.Responses.Forbidden; + export type $500 = Components.Responses.InternalServerError; + } + } namespace GetPublicPortalWidgets { namespace Parameters { /** @@ -6467,6 +6732,35 @@ declare namespace Paths { export type $500 = Components.Responses.InternalServerError; } } + namespace SsoLogin { + namespace Parameters { + /** + * example: + * 123 + */ + export type OrgId = string; + } + export interface QueryParameters { + org_id: /** + * example: + * 123 + */ + Parameters.OrgId; + } + export interface RequestBody { + provider_slug?: /** + * URL-friendly slug to use as organization-unique identifier for Provider + * example: + * office-365-login + */ + Components.Schemas.ProviderSlug /* [0-9a-z-]+ */; + } + namespace Responses { + export interface $200 { + token?: Components.Schemas.SSOLoginToken; + } + } + } namespace TrackFileDownloaded { namespace Parameters { export type Id = /** @@ -6792,6 +7086,14 @@ declare namespace Paths { export type $500 = Components.Responses.InternalServerError; } } + namespace V2PortalPublicSsoLogin { + namespace Parameters { + export type Origin = /* Origin of the portal */ Components.Schemas.Origin; + } + export interface QueryParameters { + origin: Parameters.Origin; + } + } namespace ValidateCadenceEntityEditRules { namespace Parameters { export type Attribute = string; @@ -6927,6 +7229,16 @@ export interface OperationMethods { data?: any, config?: AxiosRequestConfig ): OperationResponse + /** + * getPublicPortalExtensionDetails - getPublicPortalExtensionDetails + * + * Get public extension details shown to end customers and configuring users. + */ + 'getPublicPortalExtensionDetails'( + parameters?: Parameters | null, + data?: any, + config?: AxiosRequestConfig + ): OperationResponse /** * getConsumption - Get Consumption * @@ -7603,6 +7915,21 @@ export interface OperationMethods { data?: Paths.CreateMeterReading.RequestBody, config?: AxiosRequestConfig ): OperationResponse + /** + * ssoLogin - ssoLogin + * + * Initiate login using external SSO identity. + * + * Verifies the user with the issuer and matches the identity to an epilot user (or creates a new user). + * + * Returns parameters to be used with CUSTOM_AUTH flow against Cognito + * + */ + 'ssoLogin'( + parameters?: Parameters | null, + data?: Paths.SsoLogin.RequestBody, + config?: AxiosRequestConfig + ): OperationResponse } export interface PathsDictionary { @@ -7712,6 +8039,18 @@ export interface PathsDictionary { config?: AxiosRequestConfig ): OperationResponse } + ['/v2/portal/public/extensions']: { + /** + * getPublicPortalExtensionDetails - getPublicPortalExtensionDetails + * + * Get public extension details shown to end customers and configuring users. + */ + 'get'( + parameters?: Parameters | null, + data?: any, + config?: AxiosRequestConfig + ): OperationResponse + } ['/v2/portal/consumption']: { /** * getConsumption - Get Consumption @@ -8504,6 +8843,23 @@ export interface PathsDictionary { config?: AxiosRequestConfig ): OperationResponse } + ['/v2/portal/public/sso/login']: { + /** + * ssoLogin - ssoLogin + * + * Initiate login using external SSO identity. + * + * Verifies the user with the issuer and matches the identity to an epilot user (or creates a new user). + * + * Returns parameters to be used with CUSTOM_AUTH flow against Cognito + * + */ + 'post'( + parameters?: Parameters | null, + data?: Paths.SsoLogin.RequestBody, + config?: AxiosRequestConfig + ): OperationResponse + } } export type Client = OpenAPIClient @@ -8517,6 +8873,7 @@ export type ActivityId = Components.Schemas.ActivityId; export type ActivityItem = Components.Schemas.ActivityItem; export type AdminUser = Components.Schemas.AdminUser; export type AllowedFileExtensions = Components.Schemas.AllowedFileExtensions; +export type AttributeMappingConfig = Components.Schemas.AttributeMappingConfig; export type AuthConfig = Components.Schemas.AuthConfig; export type Balance = Components.Schemas.Balance; export type BaseBillingEvent = Components.Schemas.BaseBillingEvent; @@ -8532,6 +8889,7 @@ export type ContractIdentifier = Components.Schemas.ContractIdentifier; export type CreateSSOUserRequest = Components.Schemas.CreateSSOUserRequest; export type CreateUserRequest = Components.Schemas.CreateUserRequest; export type Currency = Components.Schemas.Currency; +export type DataRetrievalItem = Components.Schemas.DataRetrievalItem; export type DeleteEntityFile = Components.Schemas.DeleteEntityFile; export type Direction = Components.Schemas.Direction; export type DocumentWidget = Components.Schemas.DocumentWidget; @@ -8569,6 +8927,8 @@ export type Meter = Components.Schemas.Meter; export type MeterChartWidget = Components.Schemas.MeterChartWidget; export type MeterReading = Components.Schemas.MeterReading; export type MeterReadingWidget = Components.Schemas.MeterReadingWidget; +export type OIDCProviderConfig = Components.Schemas.OIDCProviderConfig; +export type OIDCProviderMetadata = Components.Schemas.OIDCProviderMetadata; export type Opportunity = Components.Schemas.Opportunity; export type Order = Components.Schemas.Order; export type OrganizationSettings = Components.Schemas.OrganizationSettings; @@ -8578,12 +8938,22 @@ export type PortalConfig = Components.Schemas.PortalConfig; export type PortalUser = Components.Schemas.PortalUser; export type PortalWidget = Components.Schemas.PortalWidget; export type Product = Components.Schemas.Product; +export type ProviderConfig = Components.Schemas.ProviderConfig; +export type ProviderDisplayName = Components.Schemas.ProviderDisplayName; +export type ProviderPublicConfig = Components.Schemas.ProviderPublicConfig; +export type ProviderSlug = Components.Schemas.ProviderSlug; +export type PublicContractIdentificationDetails = Components.Schemas.PublicContractIdentificationDetails; +export type PublicDataRetrievalHookDetails = Components.Schemas.PublicDataRetrievalHookDetails; +export type PublicExtensionCapabilities = Components.Schemas.PublicExtensionCapabilities; +export type PublicExtensionDetails = Components.Schemas.PublicExtensionDetails; export type ReadBy = Components.Schemas.ReadBy; export type ReadingStatus = Components.Schemas.ReadingStatus; export type Reason = Components.Schemas.Reason; export type RegistrationIdentifier = Components.Schemas.RegistrationIdentifier; export type ReimbursementEvent = Components.Schemas.ReimbursementEvent; export type Rule = Components.Schemas.Rule; +export type SAMLProviderConfig = Components.Schemas.SAMLProviderConfig; +export type SSOLoginToken = Components.Schemas.SSOLoginToken; export type SaveEntityFile = Components.Schemas.SaveEntityFile; export type SavePortalFile = Components.Schemas.SavePortalFile; export type Schema = Components.Schemas.Schema; diff --git a/clients/customer-portal-client/src/openapi.json b/clients/customer-portal-client/src/openapi.json index 9fc19727..b6ab559b 100644 --- a/clients/customer-portal-client/src/openapi.json +++ b/clients/customer-portal-client/src/openapi.json @@ -501,6 +501,59 @@ } } }, + "/v2/portal/public/extensions": { + "get": { + "operationId": "getPublicPortalExtensionDetails", + "summary": "getPublicPortalExtensionDetails", + "description": "Get public extension details shown to end customers and configuring users.", + "tags": [ + "Public" + ], + "security": [], + "parameters": [ + { + "in": "query", + "name": "org_id", + "required": true, + "schema": { + "type": "string", + "example": 12324, + "description": "Organization ID" + } + }, + { + "in": "query", + "name": "origin", + "required": true, + "schema": { + "$ref": "#/components/schemas/Origin" + }, + "description": "Origin of the portal" + } + ], + "responses": { + "200": { + "description": "Public details of extensions.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PublicExtensionCapabilities" + } + } + } + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + } + } + }, "/v2/portal/consumption": { "get": { "operationId": "getConsumption", @@ -515,6 +568,33 @@ } ], "parameters": [ + { + "in": "query", + "name": "extensionId", + "schema": { + "type": "string" + }, + "required": true, + "description": "Extension ID for consumption data." + }, + { + "in": "query", + "name": "hookId", + "schema": { + "type": "string" + }, + "required": true, + "description": "Hook ID for consumption data." + }, + { + "in": "query", + "name": "meter_id", + "schema": { + "type": "string" + }, + "required": true, + "description": "Meter ID for consumption data." + }, { "in": "query", "name": "from", @@ -557,29 +637,34 @@ "content": { "application/json": { "schema": { - "type": "array", - "items": { - "type": "object", - "properties": { - "timestamp": { - "type": "string", - "format": "date-time", - "description": "ISO 8601 timestamp of the consumption record." - }, - "value": { - "type": "number", - "description": "The consumption value." - }, - "type": { - "type": "string", - "description": "Optional type of the consumption, such as 'nt' (night time) or 'ht' (high time)." + "type": "object", + "properties": { + "consumptions": { + "type": "array", + "items": { + "type": "object", + "properties": { + "timestamp": { + "type": "string", + "format": "date-time", + "description": "ISO 8601 timestamp of the consumption record." + }, + "value": { + "type": "number", + "description": "The consumption value." + }, + "type": { + "type": "string", + "description": "Optional type of the consumption, such as 'nt' (night time) or 'ht' (high time)." + } + }, + "required": [ + "value", + "unit", + "timestamp" + ] } - }, - "required": [ - "value", - "unit", - "timestamp" - ] + } } } } @@ -614,6 +699,33 @@ } ], "parameters": [ + { + "in": "query", + "name": "extensionId", + "schema": { + "type": "string" + }, + "required": true, + "description": "Extension ID for cost data." + }, + { + "in": "query", + "name": "hookId", + "schema": { + "type": "string" + }, + "required": true, + "description": "Hook ID for cost data." + }, + { + "in": "query", + "name": "meter_id", + "schema": { + "type": "string" + }, + "required": true, + "description": "Meter ID for cost data." + }, { "in": "query", "name": "from", @@ -656,53 +768,58 @@ "content": { "application/json": { "schema": { - "type": "array", - "items": { - "type": "object", - "properties": { - "timestamp": { - "type": "string", - "format": "date-time", - "description": "ISO 8601 timestamp of the cost record." - }, - "unit_amount": { - "type": "integer", - "description": "Cost in cents, e.g. 1234 for 12,34 €.", - "example": 1234 - }, - "unit_amount_currency": { - "type": "string", - "description": "ISO 4217:2015 currency.", - "example": "EUR" - }, - "unit_amount_decimal": { - "type": "string", - "description": "Cost in decimal format, e.g. \"12.34\".", - "example": "12.34" - }, - "tax_behavior": { - "type": "string", - "description": "Is the tax (typically Value Added Tax) included in the amounts. Typically should NOT be included - exclusive of tax.", - "enum": [ - "inclusive", - "exclusive" - ], - "example": "exclusive" - }, - "tax_rate": { - "type": "integer", - "description": "Tax rate in percent, e.g. 19 for 19%.", - "example": 19 + "type": "object", + "properties": { + "costs": { + "type": "array", + "items": { + "type": "object", + "properties": { + "timestamp": { + "type": "string", + "format": "date-time", + "description": "ISO 8601 timestamp of the cost record." + }, + "unit_amount": { + "type": "integer", + "description": "Cost in cents, e.g. 1234 for 12,34 €.", + "example": 1234 + }, + "unit_amount_currency": { + "type": "string", + "description": "ISO 4217:2015 currency.", + "example": "EUR" + }, + "unit_amount_decimal": { + "type": "string", + "description": "Cost in decimal format, e.g. \"12.34\".", + "example": "12.34" + }, + "tax_behavior": { + "type": "string", + "description": "Is the tax (typically Value Added Tax) included in the amounts. Typically should NOT be included - exclusive of tax.", + "enum": [ + "inclusive", + "exclusive" + ], + "example": "exclusive" + }, + "tax_rate": { + "type": "integer", + "description": "Tax rate in percent, e.g. 19 for 19%.", + "example": 19 + } + }, + "required": [ + "timestamp", + "unit_amount", + "unit_amount_currency", + "unit_amount_decimal", + "tax_behavior", + "tax_rate" + ] } - }, - "required": [ - "timestamp", - "unit_amount", - "unit_amount_currency", - "unit_amount_decimal", - "tax_behavior", - "tax_rate" - ] + } } } } @@ -737,6 +854,33 @@ } ], "parameters": [ + { + "in": "query", + "name": "extensionId", + "schema": { + "type": "string" + }, + "required": true, + "description": "Extension ID for price data." + }, + { + "in": "query", + "name": "hookId", + "schema": { + "type": "string" + }, + "required": true, + "description": "Hook ID for price data." + }, + { + "in": "query", + "name": "meter_id", + "schema": { + "type": "string" + }, + "required": true, + "description": "Meter ID for price data." + }, { "in": "query", "name": "from", @@ -779,109 +923,114 @@ "content": { "application/json": { "schema": { - "type": "array", - "items": { - "type": "object", - "properties": { - "timestamp": { - "type": "string", - "format": "date-time", - "description": "ISO 8601 timestamp of the price record." - }, - "unit_amount": { - "type": "integer", - "description": "Cost in cents, e.g. 1234 for 12,34 €.", - "example": 1234 - }, - "unit_amount_currency": { - "type": "string", - "description": "ISO 4217:2015 currency.", - "example": "EUR" - }, - "unit_amount_decimal": { - "type": "string", - "description": "Cost in decimal format, e.g. \"12.34\".", - "example": "12.34" - }, - "components": { + "type": "object", + "properties": { + "prices": { + "type": "array", + "items": { "type": "object", - "description": "Optional price components.", "properties": { - "auction_price_amount": { - "type": "integer", - "description": "Market price in cents, e.g. 1000 for 10,00 €.", - "example": 1000 - }, - "auction_price_amount_decimal": { + "timestamp": { "type": "string", - "description": "Market price in decimal format, e.g. \"10.00\".", - "example": "10.00" + "format": "date-time", + "description": "ISO 8601 timestamp of the price record." }, - "taxes_levies_amount": { + "unit_amount": { "type": "integer", - "description": "Taxes/Levies other than tax specified on the price level in cents, e.g. 50 for 00,50 €.", - "example": 50 + "description": "Cost in cents, e.g. 1234 for 12,34 €.", + "example": 1234 }, - "taxes_levies_amount_decimal": { + "unit_amount_currency": { "type": "string", - "description": "Taxes/Levies other than tax specified on the price level in decimal format, e.g. \"0.50\".", - "example": "0.50" - }, - "source_fee_amount": { - "type": "integer", - "description": "Fee associated with the source, e.g. Green Energy Certificate fee in cents, e.g. 50 for 00,50 €.", - "example": 50 + "description": "ISO 4217:2015 currency.", + "example": "EUR" }, - "source_fee_amount_decimal": { + "unit_amount_decimal": { "type": "string", - "description": "Fee associated with the source, e.g. Green Energy Certificate fee in decimal format, e.g. \"0.50\".", - "example": "0.50" + "description": "Cost in decimal format, e.g. \"12.34\".", + "example": "12.34" }, - "grid_fee_amount": { - "type": "integer", - "description": "Fee associated with the transmission/distribution in cents, e.g. 100 for 1,00 €.", - "example": 100 + "components": { + "type": "object", + "description": "Optional price components.", + "properties": { + "auction_price_amount": { + "type": "integer", + "description": "Market price in cents, e.g. 1000 for 10,00 €.", + "example": 1000 + }, + "auction_price_amount_decimal": { + "type": "string", + "description": "Market price in decimal format, e.g. \"10.00\".", + "example": "10.00" + }, + "taxes_levies_amount": { + "type": "integer", + "description": "Taxes/Levies other than tax specified on the price level in cents, e.g. 50 for 00,50 €.", + "example": 50 + }, + "taxes_levies_amount_decimal": { + "type": "string", + "description": "Taxes/Levies other than tax specified on the price level in decimal format, e.g. \"0.50\".", + "example": "0.50" + }, + "source_fee_amount": { + "type": "integer", + "description": "Fee associated with the source, e.g. Green Energy Certificate fee in cents, e.g. 50 for 00,50 €.", + "example": 50 + }, + "source_fee_amount_decimal": { + "type": "string", + "description": "Fee associated with the source, e.g. Green Energy Certificate fee in decimal format, e.g. \"0.50\".", + "example": "0.50" + }, + "grid_fee_amount": { + "type": "integer", + "description": "Fee associated with the transmission/distribution in cents, e.g. 100 for 1,00 €.", + "example": 100 + }, + "grid_fee_amount_decimal": { + "type": "string", + "description": "Fee associated with the transmission/distribution in decimal format, e.g. \"1.00\".", + "example": "1.00" + }, + "margin_amount": { + "type": "integer", + "description": "Margin in cents, e.g. 34 for 0,34 €.", + "example": 34 + }, + "margin_amount_decimal": { + "type": "string", + "description": "Margin in decimal format, e.g. \"0.34\".", + "example": "0.34" + } + } }, - "grid_fee_amount_decimal": { + "tax_behavior": { "type": "string", - "description": "Fee associated with the transmission/distribution in decimal format, e.g. \"1.00\".", - "example": "1.00" + "description": "Is the tax (typically Value Added Tax) included in the amounts. Typically should NOT be included - exclusive of tax.", + "enum": [ + "inclusive", + "exclusive" + ], + "example": "exclusive" }, - "margin_amount": { + "tax_rate": { "type": "integer", - "description": "Margin in cents, e.g. 34 for 0,34 €.", - "example": 34 - }, - "margin_amount_decimal": { - "type": "string", - "description": "Margin in decimal format, e.g. \"0.34\".", - "example": "0.34" + "description": "Tax rate in percent, e.g. 19 for 19%.", + "example": 19 } - } - }, - "tax_behavior": { - "type": "string", - "description": "Is the tax (typically Value Added Tax) included in the amounts. Typically should NOT be included - exclusive of tax.", - "enum": [ - "inclusive", - "exclusive" - ], - "example": "exclusive" - }, - "tax_rate": { - "type": "integer", - "description": "Tax rate in percent, e.g. 19 for 19%.", - "example": 19 + }, + "required": [ + "timestamp", + "unit_amount", + "unit_amount_currency", + "unit_amount_decimal", + "tax_behavior", + "tax_rate" + ] } - }, - "required": [ - "timestamp", - "unit_amount", - "unit_amount_currency", - "unit_amount_decimal", - "tax_behavior", - "tax_rate" - ] + } } } } @@ -5039,6 +5188,75 @@ } } } + }, + "/v2/portal/public/sso/login": { + "parameters": [ + { + "in": "query", + "name": "origin", + "required": true, + "description": "Origin of the Portal", + "schema": { + "$ref": "#/components/schemas/Origin" + } + } + ], + "post": { + "operationId": "ssoLogin", + "summary": "ssoLogin", + "description": "Initiate login using external SSO identity.\n\nVerifies the user with the issuer and matches the identity to an epilot user (or creates a new user).\n\nReturns parameters to be used with CUSTOM_AUTH flow against Cognito\n", + "security": [ + { + "ExternalOIDCAuth": [] + } + ], + "parameters": [ + { + "in": "query", + "name": "org_id", + "description": "epilot organization id", + "required": true, + "schema": { + "type": "string", + "example": 123 + } + } + ], + "tags": [ + "Login" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "provider_slug": { + "$ref": "#/components/schemas/ProviderSlug" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Cognito login parameters to use with the CUSTOM_AUTH_FLOW", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "token": { + "$ref": "#/components/schemas/SSOLoginToken" + } + } + } + } + } + } + } + } } }, "components": { @@ -5229,6 +5447,12 @@ "in": "header", "name": "x-ivy-org-id", "description": "Set organization id as internal user" + }, + "ExternalOIDCAuth": { + "type": "http", + "scheme": "bearer", + "description": "Authorization header with id token from external OIDC provider", + "bearerFormat": "JWT" } }, "schemas": { @@ -6018,6 +6242,12 @@ "items": { "$ref": "#/components/schemas/Grant" } + }, + "identity_providers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProviderPublicConfig" + } } } } @@ -7990,6 +8220,17 @@ "shared_with_end_customer": { "type": "boolean", "description": "Indicate whether the file is shared with the end customer" + }, + "_tags": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Array of entity tags", + "example": [ + "example", + "mock" + ] } } } @@ -8027,6 +8268,131 @@ "status" ] }, + "PublicExtensionCapabilities": { + "type": "object", + "properties": { + "consumptionDataRetrieval": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DataRetrievalItem" + } + }, + "priceDataRetrieval": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DataRetrievalItem" + } + }, + "costDataRetrieval": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DataRetrievalItem" + } + }, + "contractIdentification": { + "type": "object", + "properties": { + "extension": { + "$ref": "#/components/schemas/PublicExtensionDetails" + }, + "hook": { + "$ref": "#/components/schemas/PublicContractIdentificationDetails" + } + } + } + } + }, + "DataRetrievalItem": { + "type": "object", + "properties": { + "extension": { + "$ref": "#/components/schemas/PublicExtensionDetails" + }, + "hook": { + "$ref": "#/components/schemas/PublicDataRetrievalHookDetails" + } + } + }, + "PublicExtensionDetails": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Identifier of the extension." + }, + "name": { + "type": "object", + "properties": { + "en": { + "type": "string", + "description": "Name of the extension in English." + } + }, + "additionalProperties": { + "type": "string", + "description": "Name of the extension in some other language denoted by ISO 3166-1 alpha-2 code." + }, + "required": [ + "en" + ] + } + } + }, + "PublicDataRetrievalHookDetails": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Identifier of the hook." + }, + "name": { + "type": "object", + "properties": { + "en": { + "type": "string", + "description": "Name of the extension in English." + } + }, + "additionalProperties": { + "type": "string", + "description": "Name of the extension in some other language denoted by ISO 3166-1 alpha-2 code." + }, + "required": [ + "en" + ] + }, + "intervals": { + "type": "array", + "items": { + "type": "string" + }, + "description": "The intervals associated with the hook." + } + } + }, + "PublicContractIdentificationDetails": { + "type": "object", + "properties": { + "explanation": { + "type": "object", + "properties": { + "en": { + "type": "string", + "description": "Explanation of the functionality shown to the end user.", + "example": "This process will give you access to all Contracts kept" + } + }, + "additionalProperties": { + "type": "string", + "description": "Explanation of the functionality in language denoted by ISO 3166-1 alpha-2 code." + }, + "required": [ + "en" + ], + "description": "Explanation of the hook." + } + } + }, "Extension": { "type": "object", "properties": { @@ -8495,6 +8861,24 @@ "type": "string", "description": "Name of the Contact attribute to update with the matched Contact ID. Must be a Contact relation attribute supporting multiple entities.", "example": "represents_contact" + }, + "explanation": { + "type": "object", + "properties": { + "en": { + "type": "string", + "description": "Explanation of the functionality shown to the end user.", + "example": "This process will give you access to all Contracts kept" + } + }, + "additionalProperties": { + "type": "string", + "description": "Explanation of the functionality in language denoted by ISO 3166-1 alpha-2 code." + }, + "required": [ + "en" + ], + "description": "Explanation of the hook." } }, "required": [ @@ -8685,6 +9069,15 @@ "required": [ "url" ] + }, + "resolved": { + "type": "object", + "properties": { + "dataPath": { + "type": "string", + "description": "Optional path to the data (array) in the response. If omitted, the data is assumed to be on the top level." + } + } } }, "required": [ @@ -8775,6 +9168,15 @@ "required": [ "url" ] + }, + "resolved": { + "type": "object", + "properties": { + "dataPath": { + "type": "string", + "description": "Optional path to the data (array) in the response. If omitted, the data is assumed to be on the top level." + } + } } }, "required": [ @@ -8865,6 +9267,15 @@ "required": [ "url" ] + }, + "resolved": { + "type": "object", + "properties": { + "dataPath": { + "type": "string", + "description": "Optional path to the data (array) in the response. If omitted, the data is assumed to be on the top level." + } + } } }, "required": [ @@ -8963,6 +9374,144 @@ "description": "The status of the reading" } } + }, + "SSOLoginToken": { + "type": "string" + }, + "ProviderSlug": { + "type": "string", + "example": "office-365-login", + "description": "URL-friendly slug to use as organization-unique identifier for Provider", + "pattern": "[0-9a-z-]+" + }, + "ProviderDisplayName": { + "type": "string", + "example": "Office 365 Login", + "description": "Human-readable display name for identity provider shown in login" + }, + "ProviderConfig": { + "type": "object", + "properties": { + "slug": { + "$ref": "#/components/schemas/ProviderSlug" + }, + "display_name": { + "$ref": "#/components/schemas/ProviderDisplayName" + }, + "provider_type": { + "type": "string", + "enum": [ + "OIDC" + ] + }, + "attribute_mappings": { + "$ref": "#/components/schemas/AttributeMappingConfig" + }, + "oidc_config": { + "$ref": "#/components/schemas/OIDCProviderConfig" + } + }, + "required": [ + "display_name", + "provider_type" + ] + }, + "ProviderPublicConfig": { + "type": "object", + "properties": { + "slug": { + "$ref": "#/components/schemas/ProviderSlug" + }, + "display_name": { + "$ref": "#/components/schemas/ProviderDisplayName" + }, + "oidc_config": { + "$ref": "#/components/schemas/OIDCProviderConfig" + } + }, + "required": [ + "slug", + "display_name" + ] + }, + "AttributeMappingConfig": { + "type": "object", + "description": "Dictionary of epilot user attributes to claims", + "properties": { + "email": { + "type": "string", + "example": "email" + }, + "display_name": { + "type": "string", + "example": "name" + }, + "phone": { + "type": "string", + "example": "phone" + }, + "preferred_language": { + "type": "string", + "example": "language" + } + }, + "required": [ + "email" + ] + }, + "OIDCProviderConfig": { + "type": "object", + "properties": { + "oidc_issuer": { + "type": "string", + "description": "Issuing Authority URL", + "example": "https://login.microsoftonline.com/33d4f3e5-3df2-421e-b92e-a63cfa680a88/v2.0" + }, + "client_id": { + "type": "string", + "example": "ab81daf8-8b1f-42d6-94ca-c51621054c75" + }, + "client_secret": { + "type": "string", + "example": "7BIUnn~6shh.7fNtXb..3k1Mp3s6k6WK3B" + }, + "scope": { + "type": "string", + "description": "Space-separated list of OAuth 2.0 scopes to request from OpenID Connect", + "example": "openid email" + }, + "metadata": { + "$ref": "#/components/schemas/OIDCProviderMetadata" + } + }, + "required": [ + "oidc_issuer", + "client_id", + "scope" + ] + }, + "OIDCProviderMetadata": { + "type": "object", + "properties": { + "authorization_endpoint": { + "type": "string", + "description": "URL of the authorization endpoint", + "example": "https://www.facebook.com/v12.0/dialog/oauth" + }, + "token_endpoint": { + "type": "string", + "description": "URL of the token endpoint", + "example": "https://graph.facebook.com/v12.0/oauth/access_token" + }, + "userinfo_endpoint": { + "type": "string", + "description": "URL of the userinfo endpoint", + "example": "https://graph.facebook.com/me" + } + } + }, + "SAMLProviderConfig": { + "type": "object" } } },