Fourier series of an arbitrary piecewise periodic function

Take a switching function as an example:
$
u (t) =
begin {cases}
1, & text {$ 0 <t <dT_s $} \
0, & text {$ dT_s <t <T_s $}
end {cases}
$

How can I get the Fourier series in Mathematica?
Is there a way to obtain Fourier series of arbitrary periodic functions in pieces?