How to use offset in DateHistogram.Builder from new java api client

in old implementation of DateHistogramAggregationBuilder we could pass offset as string,
dateHistogramAggregationBuilder.offset(configurationManagementProxy.getStartDayOfWeek() - 1) + "d");

now it requires the offset value in time so how can we do the above change as i checked there is no way to set the Time from co.elastic.clients.elasticsearch._types to integer or string value as i am using java api client, for same i checked documentation of datehistogram.builder it only showed usage via curl command and not via java api client.
IF Possible could you show examples of new java api clients with different types of requests and aggregation as it is difficult to try multiple things manually