Esempio n. 1
0
        public async Task Fetch(IPipeDriveClient client)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            _logger.Info("Loading users...");
            Entities = await new UserEntityService <DbUser>(client).GetAllAsync();
        }
        public override async Task Fetch(IPipeDriveClient client)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            _logger.Info("Loading person fields...");
            Entities = await new PersonFieldEntityService <DbPersonField>(client).GetAllAsync();
        }
Esempio n. 3
0
        public async Task Fetch(IPipeDriveClient client)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            _logger.Info("Loading deals...");
            Entities = await new DynamicEntityService <DbDeal>(
                client, typeof(DealEntityService <>), _dealType)
                       .GetAllAsync();

            _entityTypeBuilder.FillIdsForComplexTypes(Entities, _customFields);
        }
        public DynamicEntityService(IPipeDriveClient client, Type serviceType, Type entityType)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }
            if (serviceType == null)
            {
                throw new ArgumentNullException(nameof(serviceType));
            }
            if (entityType == null)
            {
                throw new ArgumentNullException(nameof(entityType));
            }

            _client      = client;
            _serviceType = serviceType;
            _entityType  = entityType;
        }
Esempio n. 5
0
        public async Task <DynamicEntityConfiguration> ConstructType(IPipeDriveClient client)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            var service = new DealFieldEntityService <Field>(client);

            _logger?.Info("Loading deal fields...");
            var fields = await service.GetAllAsync();

            _logger?.Info("Constructing deals data type...");
            _customFields = fields
                            .Where(field => Regex.IsMatch(field.Key ?? "", "^[0-9A-Fa-f]{40}")); // custom field's Key starts with 40 hex chars

            _dealType = _entityTypeBuilder.Build(typeof(DbDeal), _customFields);

            return(new DynamicEntityConfiguration(typeof(DealEntityConfiguration <>), _dealType));
        }
        public async Task Fetch(IPipeDriveClient client)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            _logger.Info("Loading organizations relationships...");
            var service  = new OrganizationRelationshipEntityService <DbOrganizationRelationship>(client);
            var entities = new List <DbOrganizationRelationship>();

            foreach (var organization in _orgService.Entities)
            {
                var relationships = await service.GetAllForOrganizationAsync(organization.Id);

                var unique = relationships.Where(rel => entities.All(ent => ent.Id != rel.Id));
                entities.AddRange(unique);
            }
            Entities = entities.ToArray();
        }
 public PersonEntityService(IPipeDriveClient client) : base(client, "persons")
 {
 }
 public abstract Task Fetch(IPipeDriveClient client);
Esempio n. 9
0
 public PersonsInOrganizationEntityService(IPipeDriveClient client) : base(client, "organizations/{Id}/persons")
 {
 }
Esempio n. 10
0
 public OrganizationFoundEntityService(IPipeDriveClient client) : base(client, "organizations/find")
 {
 }
Esempio n. 11
0
 public PagingEntityService(IPipeDriveClient client, string resource) : base(client)
 {
     _Resource = resource;
 }
Esempio n. 12
0
 protected EntityService(IPipeDriveClient client, string resource) : base(client)
 {
     Resource = resource;
 }
Esempio n. 13
0
 public DealFieldEntityService(IPipeDriveClient client) : base(client, "dealFields")
 {
 }
Esempio n. 14
0
 public ActivityFieldEntityService(IPipeDriveClient client) : base(client, "activityFields")
 {
 }
Esempio n. 15
0
 public UserEntityService(IPipeDriveClient client) : base(client, "users")
 {
 }
Esempio n. 16
0
 public ActivityEntityService(IPipeDriveClient client) : base(client, "activities")
 {
 }
Esempio n. 17
0
 public OrganizationRelationshipEntityService(IPipeDriveClient client) : base(client)
 {
     _resource = "organizationRelationships";
 }
Esempio n. 18
0
 public NoteEntityService(IPipeDriveClient client) : base(client, "notes")
 {
 }
Esempio n. 19
0
 public OrganizationEntityService(IPipeDriveClient client) : base(client, "organizations")
 {
 }
Esempio n. 20
0
 public ProductEntityService(IPipeDriveClient client) : base(client, "products")
 {
 }
Esempio n. 21
0
 public EntityServiceBase(IPipeDriveClient client)
 {
     _client = client;
 }