示例#1
0
 public PlatformInfoViewModel(Guid externalPlatformId, string name, string description, string logoUrl,
                              string websiteUrl,
                              bool isInactive, PlatformAuthenticationMechanism authMechanism) : base(externalPlatformId, name,
                                                                                                     description, logoUrl, websiteUrl, authMechanism)
 {
     IsInactive = isInactive;
 }
示例#2
0
 public PlatformViewModel(Guid externalId, string name, string description, string logoUrl, string websiteUrl,
                          PlatformAuthenticationMechanism authMechanism)
 {
     PlatformId    = externalId;
     Name          = name;
     Description   = description;
     LogoUrl       = logoUrl;
     AuthMechanism = authMechanism;
     WebsiteUrl    = websiteUrl;
 }
示例#3
0
 public PlatformUserConnectionInfoViewModel(Guid externalPlatformId, string name, string description,
                                            string logoUrl, string websiteUrl, bool isConnected,
                                            PlatformAuthenticationMechanism authMechanism, PlatformConnectionDeleteReason?disconnectedReason, DateTimeOffset?lastDataFetchTimeStamp) : base(externalPlatformId, name, description, logoUrl,
                                                                                                                                                                                            websiteUrl,
                                                                                                                                                                                            authMechanism)
 {
     IsConnected            = isConnected;
     DisconnectedReason     = disconnectedReason;
     LastDataFetchTimeStamp = lastDataFetchTimeStamp?.ToUnixTimeSeconds();
 }
 public Platform(string name, Guid externalId, PlatformAuthenticationMechanism authMechanism,
                 PlatformIntegrationType integrationType, RatingInfo ratingInfo, string description, string logoUrl,
                 string websiteUrl, int?dataPollIntervalInSeconds = null, bool isInactive = false) : this()
 {
     Name       = name;
     ExternalId = externalId;
     AuthenticationMechanism = authMechanism;
     IntegrationType         = integrationType;
     RatingInfo  = ratingInfo;
     Description = description;
     LogoUrl     = logoUrl;
     WebsiteUrl  = websiteUrl;
     DataPollIntervalInSeconds = dataPollIntervalInSeconds;
     IsInactive = isInactive;
 }
        public async Task <Platform> CreatePlatform(string name,
                                                    PlatformAuthenticationMechanism authMechanism, PlatformIntegrationType platformIntegrationType,
                                                    RatingInfo ratingInfo, int?dataPollIntervalInSeconds, Guid externalPlatformId, string description,
                                                    string logoUrl, string websiteUrl, IAsyncDocumentSession session, bool isInactive = false,
                                                    CancellationToken cancellationToken = default)
        {
            try
            {
                await GetPlatformByExternalId(externalPlatformId, session, cancellationToken);

                throw new PlatformAlreadyExistsException(
                          $"Platform with external id {externalPlatformId} already exists. Name: {name}");
            }
            catch (PlatformDoNotExistException)
            {
                var platform = new Platform(name, externalPlatformId, authMechanism, platformIntegrationType,
                                            ratingInfo, description, logoUrl, websiteUrl, dataPollIntervalInSeconds, isInactive);
                await session.StoreAsync(platform, cancellationToken);

                return(platform);
            }
        }