Class PortalService
Exposes data access services required by Sentinet Development Portal.
Implements
Inherited Members
Namespace: Nevatech.Vsb.Repository.Services
Assembly: Nevatech.Vsb.Repository.dll
Syntax
public sealed class PortalService : IDisposable
Constructors
PortalService()
Initializes a new instance of the PortalService.
Declaration
public PortalService()
PortalService(Nullable<Int32>, Nullable<Int32>)
Initializes a new instance of the PortalService.
Declaration
public PortalService(int? consumerId, int? userId)
Parameters
Type | Name | Description |
---|---|---|
Nullable<Int32> | consumerId | The current consumer id or null if user is not yet authenticated. |
Nullable<Int32> | userId | The current Sentinet user id or null if user is not yet authenticated. |
Properties
ConsumerId
Gets the consumer id of the currently authenticated Sentinet user or null if the user is anonymous.
Declaration
public int? ConsumerId { get; }
Property Value
Type | Description |
---|---|
Nullable<Int32> |
UserId
Gets the currently authenticated Sentinet user id or null if the user is anonymous.
Declaration
public int? UserId { get; }
Property Value
Type | Description |
---|---|
Nullable<Int32> |
Methods
CreateConsumer(Consumer, UserDefinition, String)
Registers a new portal consumer with administrator account.
Declaration
public void CreateConsumer(Consumer consumer, UserDefinition administrator, string password)
Parameters
Type | Name | Description |
---|---|---|
Consumer | consumer | The new consumer that is being registered. |
UserDefinition | administrator | The consumer administrator account. |
String | password | A temporary password in clear text for alert purposes. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if the specified |
CreateEmptyServiceVersion()
Gets an empty product service version for preview.
Declaration
public static ProductServiceVersion CreateEmptyServiceVersion()
Returns
Type | Description |
---|---|
ProductServiceVersion | The empty product service version. |
CreateOrUpdate(UserDefinition, String)
Creates a new or updates an existing portal user.
Declaration
public void CreateOrUpdate(UserDefinition user, string password = null)
Parameters
Type | Name | Description |
---|---|---|
UserDefinition | user | The user to create or update. |
String | password | An optional temporary password in clear text for alert purposes. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if the specified |
Delete(UserDefinition)
Deletes an existing portal user.
Declaration
public void Delete(UserDefinition user)
Parameters
Type | Name | Description |
---|---|---|
UserDefinition | user | The user to delete. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if the specified |
Dispose()
Disposes of resources held by this service instance.
Declaration
public void Dispose()
GenerateMessageContent(Int32, Int32, MessageGenerationSettings)
Generates a sample message content for requested service message. This method can only be called for strongly-typed messages (SOAP).
Declaration
public MessageContent GenerateMessageContent(int productId, int messageId, MessageGenerationSettings settings)
Parameters
Type | Name | Description |
---|---|---|
Int32 | productId | Identifier of the product this message belongs to. |
Int32 | messageId | Identifier of the message which sample needs to be generated. |
MessageGenerationSettings | settings | Parameters to be used for message generation. |
Returns
Type | Description |
---|---|
MessageContent | Generated sample message content. |
GenerateMessageSchema(Int32, Int32)
Generates XSD schema for requested service message. This method can only be called for strongly-typed request or response messages (SOAP, no faults).
Declaration
public MessageSchema GenerateMessageSchema(int productId, int messageId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | productId | Identifier of the product this message belongs to. |
Int32 | messageId | Identifier of the message which schema needs to be generated. |
Returns
Type | Description |
---|---|
MessageSchema | Generated XSD schema describing the requested service message. |
GeneratePassword(Int32, Int32)
Generates a new random password.
Declaration
public static string GeneratePassword(int minLength, int minSpecialChars)
Parameters
Type | Name | Description |
---|---|---|
Int32 | minLength | The minimum password length. |
Int32 | minSpecialChars | The minimum number of special characters. |
Returns
Type | Description |
---|---|
String | The generated random password. |
GetBackOfficeUser(String)
Gets an Umbraco back-office UserDefinition by name.
Declaration
public UserDefinition GetBackOfficeUser(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The back-office user name. |
Returns
Type | Description |
---|---|
UserDefinition | A UserDefinition instance if found, null otherwise. |
GetConsumerApplicationKeys()
Gets the list of consumer's application keys.
Declaration
public IEnumerable<ApplicationKey> GetConsumerApplicationKeys()
Returns
Type | Description |
---|---|
IEnumerable<ApplicationKey> | The collection of consumer application keys. |
GetConsumerById(Int32)
Returns the consumer corresponding to provided identifier.
Declaration
public Consumer GetConsumerById(int consumerId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | consumerId | Consumer database identifier. |
Returns
Type | Description |
---|---|
Consumer | Consumer corresponding to provided identifier. |
GetConsumerProducts()
Gets the list of products this consumer has access to.
Declaration
public IEnumerable<ConsumerProduct> GetConsumerProducts()
Returns
Type | Description |
---|---|
IEnumerable<ConsumerProduct> | The collection of consumer products. |
GetConsumerProductSubtree()
Returns collection of product subtrees populated with products subscribed by the specified consumer. This list may include private and not-active (obsolete and retired) products, if customer is or was subscribed to them.
Declaration
public Collection<ProductSubtree> GetConsumerProductSubtree()
Returns
Type | Description |
---|---|
Collection<ProductSubtree> | Collection of product subtrees populated with products subscribed by the specified consumer. |
GetConsumerSubscriptions()
Gets the list of this consumer's subscriptions.
Declaration
public IEnumerable<Subscription> GetConsumerSubscriptions()
Returns
Type | Description |
---|---|
IEnumerable<Subscription> | The collection of consumer subscriptions. |
GetConsumerUsageSummary(UsageSummaryRequest)
Gets analytics data for consumer usage summary report.
Declaration
public ConsumerUsageSummary GetConsumerUsageSummary(UsageSummaryRequest request)
Parameters
Type | Name | Description |
---|---|---|
UsageSummaryRequest | request | The report parameters. |
Returns
Type | Description |
---|---|
ConsumerUsageSummary | ConsumerUsageSummary instance that represents report data. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if the specified |
GetCustomAttributeTypes(EntityType)
Gets the list of custom attribute types available for the provided entity type.
Declaration
public IEnumerable<CustomAttributeType> GetCustomAttributeTypes(EntityType entityType)
Parameters
Type | Name | Description |
---|---|---|
EntityType | entityType |
Returns
Type | Description |
---|---|
IEnumerable<CustomAttributeType> | The collection of custom attribute types. |
GetMetadata(Int32, Int32, String, String, String)
Gets the service metadata.
Declaration
public ContentMemoryStream GetMetadata(int productId, int productServiceVersionId, string format, string sectionKey = null, string token = null)
Parameters
Type | Name | Description |
---|---|---|
Int32 | productId | The product id. |
Int32 | productServiceVersionId | The service version id. |
String | format | The client may request a specific metadata format by using the "format" query parameter. The possible values are:
|
String | sectionKey | The optional metadata section key if multi-part. |
String | token | The optional authentication token to use for multi-part metadata references. |
Returns
Type | Description |
---|---|
ContentMemoryStream | A ContentMemoryStream that contains the service metadata, either WASL or OpenAPI document. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if the specified parameters are invalid. |
GetMonitoringData(TransactionSummaryRequest)
Gets monitoring data that matches the specified request.
Declaration
public IEnumerable<MonitoringTransactionSummary> GetMonitoringData(TransactionSummaryRequest request)
Parameters
Type | Name | Description |
---|---|---|
TransactionSummaryRequest | request | The monitoring data request that contains additional filtering parameters. |
Returns
Type | Description |
---|---|
IEnumerable<MonitoringTransactionSummary> | The collection of MonitoringTransactionSummary records. |
GetPortalSummary()
Returns the cumulative information about Consumer Account in Developer Portal.
Declaration
public ConsumerPortalSummary GetPortalSummary()
Returns
Type | Description |
---|---|
ConsumerPortalSummary | Cumulative information about Consumer Account in Developer Portal. |
GetProduct(Int32)
Gets the product by id.
Declaration
public Product GetProduct(int id)
Parameters
Type | Name | Description |
---|---|---|
Int32 | id | The product id. |
Returns
Type | Description |
---|---|
Product | The Product or null if product doesn't exist or is not active. |
GetProductAttachment(Int32, Int32)
Gets the content of a product attachment by id.
Declaration
public ContentMemoryStream GetProductAttachment(int productId, int id)
Parameters
Type | Name | Description |
---|---|---|
Int32 | productId | The product id. |
Int32 | id | The product attachment id. |
Returns
Type | Description |
---|---|
ContentMemoryStream | The ContentMemoryStream with attachment content or null if not found. |
GetProductAttachments(Int32)
Gets the list of attachments for the specified product.
Declaration
public IEnumerable<Property> GetProductAttachments(int id)
Parameters
Type | Name | Description |
---|---|---|
Int32 | id | The product id. |
Returns
Type | Description |
---|---|
IEnumerable<Property> | The collection of product attachments. |
GetProducts()
Returns products matching the provided search criteria.
Declaration
public IEnumerable<ProductDefinition> GetProducts()
Returns
Type | Description |
---|---|
IEnumerable<ProductDefinition> | Collection of products matching the provided search criteria. |
GetProductService(Int32, Int32)
Gets the product's service.
Declaration
public ProductServiceVersion GetProductService(int productId, int id)
Parameters
Type | Name | Description |
---|---|---|
Int32 | productId | The product id. |
Int32 | id | The product service version id. |
Returns
Type | Description |
---|---|
ProductServiceVersion | The ProductServiceVersion instance or null if not found. |
GetProductServices(Int32)
Gets the list of services in the specified product.
Declaration
public IEnumerable<ProductServiceVersion> GetProductServices(int id)
Parameters
Type | Name | Description |
---|---|---|
Int32 | id | The product id. |
Returns
Type | Description |
---|---|
IEnumerable<ProductServiceVersion> | The services included in the specified product. |
GetProductSubtree()
Returns collection of product subtrees according to current user authentication status. If user id exists - it means user is authenticated and public products must be shown with products current consumer subscribed to. If not - user is anonymous and only public products must be shown.
Declaration
public Collection<ProductSubtree> GetProductSubtree()
Returns
Type | Description |
---|---|
Collection<ProductSubtree> | Collection of product subtrees populated according to current user authentication status. |
GetPublicProductSubtree()
Returns collection of product subtrees populated with public and active products.
Declaration
public Collection<ProductSubtree> GetPublicProductSubtree()
Returns
Type | Description |
---|---|
Collection<ProductSubtree> | Collection of product subtrees populated with public and active products. |
GetServiceAttachment(Int32, Int32, Int32)
Gets the content of a product service version attachment by id.
Declaration
public ContentMemoryStream GetServiceAttachment(int productId, int productServiceVersionId, int id)
Parameters
Type | Name | Description |
---|---|---|
Int32 | productId | The product id. |
Int32 | productServiceVersionId | The product service version id. |
Int32 | id | The attachment id. |
Returns
Type | Description |
---|---|
ContentMemoryStream | The ContentMemoryStream with attachment content or null if not found. |
GetServiceAttachments(Int32, Int32)
Gets the list of attachments for the specified product service version.
Declaration
public IEnumerable<Property> GetServiceAttachments(int productId, int id)
Parameters
Type | Name | Description |
---|---|---|
Int32 | productId | The product id. |
Int32 | id | The product service version id. |
Returns
Type | Description |
---|---|
IEnumerable<Property> | The collection of service attachments. |
GetServiceVersion(Int32)
Gets the service version by id.
Declaration
public ServiceVersion GetServiceVersion(int id)
Parameters
Type | Name | Description |
---|---|---|
Int32 | id | The service version id. |
Returns
Type | Description |
---|---|
ServiceVersion | The ServiceVersion instance or null if not found. |
GetServiceVersionDefinition(Int32)
Returns hierarchy of objects composing the service version corresponding to provided identifier.
Declaration
public ServiceVersionDefinition GetServiceVersionDefinition(int serviceVersionId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | serviceVersionId | Service version unique identifier. |
Returns
Type | Description |
---|---|
ServiceVersionDefinition | Fully populated hierarchy of objects composing the service version. |
GetSubscription(Int32)
Gets a single subscription by id and ensures it belong to the current consumer.
Declaration
public SubscriptionDefinition GetSubscription(int id)
Parameters
Type | Name | Description |
---|---|---|
Int32 | id | The subscription id. |
Returns
Type | Description |
---|---|
SubscriptionDefinition | The SubscriptionDefinition instance with the specified id if found or null. |
GetSubscriptions(Nullable<Int32>)
Gets the list of all current consumer subscriptions.
Declaration
public IEnumerable<Subscription> GetSubscriptions(int? productId)
Parameters
Type | Name | Description |
---|---|---|
Nullable<Int32> | productId | The optional product id to get subscriptions just to a single product or null to get all consumer subscriptions. The default value is null. |
Returns
Type | Description |
---|---|
IEnumerable<Subscription> | The product subscriptions. |
GetTopServices(ServiceVersionUsageSummaryRequest)
Gets analytics data for the top services report.
Declaration
public IEnumerable<ServiceVersionUsageSummary> GetTopServices(ServiceVersionUsageSummaryRequest request)
Parameters
Type | Name | Description |
---|---|---|
ServiceVersionUsageSummaryRequest | request | The report parameters. |
Returns
Type | Description |
---|---|
IEnumerable<ServiceVersionUsageSummary> | A collection of ServiceVersionUsageSummary records that represent report data. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if the specified |
GetTopSubscriptions(UsageSummaryRequest)
Gets analytics data for the top subscriptions report.
Declaration
public IEnumerable<SubscriptionUsageSummary> GetTopSubscriptions(UsageSummaryRequest request)
Parameters
Type | Name | Description |
---|---|---|
UsageSummaryRequest | request | The report parameters. |
Returns
Type | Description |
---|---|
IEnumerable<SubscriptionUsageSummary> | A collection of SubscriptionUsageSummary records that represent report data. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if the specified |
GetTransactionDetails(Int64)
Returns full information about endpoint transaction specified by provided database identifier.
Declaration
public MonitoringTransactionDetails GetTransactionDetails(long monitoringTransactionId)
Parameters
Type | Name | Description |
---|---|---|
Int64 | monitoringTransactionId | Database identifier of the transaction which details needs to be returned. |
Returns
Type | Description |
---|---|
MonitoringTransactionDetails | Full information about endpoint transaction specified by provided database identifier. |
GetTransactionHeaders(TransactionHeadersRequest)
Returns collection of transactions recorded in the specified time interval with basic information about transaction.
Declaration
public IEnumerable<MonitoringTransactionHeader> GetTransactionHeaders(TransactionHeadersRequest request)
Parameters
Type | Name | Description |
---|---|---|
TransactionHeadersRequest | request | Provides search and sort parameters. |
Returns
Type | Description |
---|---|
IEnumerable<MonitoringTransactionHeader> | Collection of transactions recorded in the specified time interval with basic information about transaction. |
GetUser(Int32)
Gets a portal UserDefinition by id.
Declaration
public UserDefinition GetUser(int id)
Parameters
Type | Name | Description |
---|---|---|
Int32 | id | The user id. |
Returns
Type | Description |
---|---|
UserDefinition | A UserDefinition instance if found, null otherwise. |
GetUser(String)
Gets a portal UserDefinition by name.
Declaration
public UserDefinition GetUser(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The user name. |
Returns
Type | Description |
---|---|
UserDefinition | A UserDefinition instance if found, null otherwise. |
GetUserByEmail(String)
Gets a portal UserDefinition by email address.
Declaration
public UserDefinition GetUserByEmail(string email)
Parameters
Type | Name | Description |
---|---|---|
String | The email address. |
Returns
Type | Description |
---|---|
UserDefinition | A UserDefinition instance if found, null otherwise. |
GetUsers(Int32, String, SortOrder)
Gets all consumer users.
Declaration
public IEnumerable<UserDefinition> GetUsers(int consumerId, string orderBy = null, SortOrder sortOrder = SortOrder.None)
Parameters
Type | Name | Description |
---|---|---|
Int32 | consumerId | The consumer id. |
String | orderBy | The optional property to sort by. |
SortOrder | sortOrder | The optional sort order. |
Returns
Type | Description |
---|---|
IEnumerable<UserDefinition> | The collection of users for the specified |
IdentityExpired(String)
Checks whether the specified user name identity has expired.
Declaration
public static bool? IdentityExpired(string userName)
Parameters
Type | Name | Description |
---|---|---|
String | userName | The user name to check. |
Returns
Type | Description |
---|---|
Nullable<Boolean> | True if user name identity has expired, false otherwise. This method returns null if the specified user name identity is not found. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if the specified |
ResetPassword(String, Int32, Int32)
Resets the user password.
Declaration
public void ResetPassword(string userName, int minLength, int minSpecialChars)
Parameters
Type | Name | Description |
---|---|---|
String | userName | The user name for which the password is being reset. |
Int32 | minLength | The minimum length of the temporary password. |
Int32 | minSpecialChars | The minimum number of special characters in the temporary password. |
SendUserName(String)
Sends forgotten user name.
Declaration
public void SendUserName(string email)
Parameters
Type | Name | Description |
---|---|---|
String | A valid email address to which the portal user name will be sent. |
Subscribe(Int32, CustomAttributeDictionary)
Creates a product subscription.
Declaration
public SubscriptionDefinition Subscribe(int productId, CustomAttributeDictionary customAttributes)
Parameters
Type | Name | Description |
---|---|---|
Int32 | productId | The id of the product being subscribed to. |
CustomAttributeDictionary | customAttributes | The custom attributes added upon subscribing to the product. |
Returns
Type | Description |
---|---|
SubscriptionDefinition | The new subscription id or null if product does not exist. |
SystemInfo()
Returns security-related information about currently logged user as well as current application configuration settings.
Declaration
public static SystemInfo SystemInfo()
Returns
Type | Description |
---|---|
SystemInfo | Security-related information about currently logged user and system configuration settings. |
Unsubscribe(Int32)
Deletes an existing subscription.
Declaration
public bool Unsubscribe(int id)
Parameters
Type | Name | Description |
---|---|---|
Int32 | id | The subscription id. |
Returns
Type | Description |
---|---|
Boolean | True if unsubscribe is successful, false otherwise. |
UpdateConsumer(Consumer)
Updates consumer data
Declaration
public void UpdateConsumer(Consumer consumer)
Parameters
Type | Name | Description |
---|---|---|
Consumer | consumer |
UpdateProfile(String, UserDefinition)
Updates the portal user profile.
Declaration
public void UpdateProfile(string consumerName, UserDefinition user)
Parameters
Type | Name | Description |
---|---|---|
String | consumerName | The updated consumer name or null if no changes. |
UserDefinition | user | The user who's profile is being updated. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if the specified |
UpdateSubscriptionWithResult(SubscriptionDefinition, Boolean)
Updates an existing product subscription.
Declaration
public SubscriptionDefinition UpdateSubscriptionWithResult(SubscriptionDefinition subscription, bool updateCustomAttributes = false)
Parameters
Type | Name | Description |
---|---|---|
SubscriptionDefinition | subscription | The subscription to update. |
Boolean | updateCustomAttributes | Flag indicates whether custom attributes should be updated or not. |
Returns
Type | Description |
---|---|
SubscriptionDefinition | Updated subscription definition object. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if subscription argument is null. |
ArgumentException | Thrown if subscription not found. |