Get Linear Gradient degrees from REST API

How do I calculate degrees from

  blendMode: 'NORMAL',
  type: 'GRADIENT_LINEAR',
  gradientHandlePositions: [
    { x: 0.10377359887399257, y: 0.10839155070127782 },
    { x: 0.8773584995799657, y: 0.7972027680769633 },
    { x: -0.24063200981385013, y: 2.02115013525101 }
  ],
  gradientStops: [
    { color: [Object], position: 0 },
    { color: [Object], position: 1 }
  ]
}

My goal is to generate

background: linear-gradient(108.43deg, #003362 0.13%, #002F76 100.65%);

Thank you!