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();
        }
示例#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;
        }
示例#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);
示例#9
0
 public PersonsInOrganizationEntityService(IPipeDriveClient client) : base(client, "organizations/{Id}/persons")
 {
 }
示例#10
0
 public OrganizationFoundEntityService(IPipeDriveClient client) : base(client, "organizations/find")
 {
 }
示例#11
0
 public PagingEntityService(IPipeDriveClient client, string resource) : base(client)
 {
     _Resource = resource;
 }
示例#12
0
 protected EntityService(IPipeDriveClient client, string resource) : base(client)
 {
     Resource = resource;
 }
示例#13
0
 public DealFieldEntityService(IPipeDriveClient client) : base(client, "dealFields")
 {
 }
示例#14
0
 public ActivityFieldEntityService(IPipeDriveClient client) : base(client, "activityFields")
 {
 }
示例#15
0
 public UserEntityService(IPipeDriveClient client) : base(client, "users")
 {
 }
示例#16
0
 public ActivityEntityService(IPipeDriveClient client) : base(client, "activities")
 {
 }
示例#17
0
 public OrganizationRelationshipEntityService(IPipeDriveClient client) : base(client)
 {
     _resource = "organizationRelationships";
 }
示例#18
0
 public NoteEntityService(IPipeDriveClient client) : base(client, "notes")
 {
 }
示例#19
0
 public OrganizationEntityService(IPipeDriveClient client) : base(client, "organizations")
 {
 }
示例#20
0
 public ProductEntityService(IPipeDriveClient client) : base(client, "products")
 {
 }
示例#21
0
 public EntityServiceBase(IPipeDriveClient client)
 {
     _client = client;
 }