protected override async Task <int> ExecuteAsync(CommandContext context, CancellationToken cancellationToken)
        {
            var request = new CreateDeviceTypeRequest
            {
                Name = Name
            };

            var deviceType = await context.Client.DeviceTypes.CreateDeviceTypeAsync(request, cancellationToken);

            Console.WriteLine($"DeviceType {deviceType.Id} created.");

            return(0);
        }
        public DeviceType Post([FromBody] CreateDeviceTypeRequest request)
        {
            using (var connection = _connectionFactory.CreateAndOpen())
            {
                DeviceType deviceType = new DeviceType()
                {
                    Name = request.Name
                }.SetNew();

                connection.Insert(deviceType);

                return(deviceType);
            }
        }
 public Task <DeviceType> CreateDeviceTypeAsync(CreateDeviceTypeRequest request,
                                                CancellationToken cancellationToken = new CancellationToken())
 {
     return(_client.MakeJsonRequestAsync <DeviceType>(cancellationToken, HttpMethod.Post,
                                                      ResourceUrls.DeviceTypes, request: request));
 }