launchdarkly / api-client-php

LaunchDarkly API Client for PHP
Other
2 stars 4 forks source link

End of life? #6

Closed ChrisLightfootWild closed 1 year ago

ChrisLightfootWild commented 1 year ago

Hello 👋

Is this project stale? I've tried to use it locally but it seems quite outdated compared to some of the documented API behaviour, namely, semantic patch support.

I appreciate that it is just a generated package using OpenAPI tooling, but the actual generated code is very low quality.

I may well well resort to using a Guzzle client directly and crafting the requests myself, rather than fighting this API client.

bwoskow-ld commented 1 year ago

Hi @ChrisLightfootWild,

Thanks for the feedback!

Yes, this project is still maintained. This project - along with our other API client libraries - is auto-generated based on our OpenAPI spec. This comes with both upsides and downsides. One of the biggest benefits is that we can release updates to all of our API clients at the same time and to support the same changes across all of them. However, one of the downsides is that it can be more difficult than normal to directly update the client libraries in terms of feature support and developer ergonomics. You mentioned support for semantic patch - we're aware of this particular limitation. For historical context, this particular issue is tricky because of some of our endpoint semantics. Specifically, some endpoints support both semantic patch and JSON patch - but the client generator currently only supports a single response type per endpoint. The current workaround for this limitation is to craft these requests directly based on what's documented rather than using the client libraries.

If there are other pieces of feedback that you'd like to call out, we're open to hearing.

Thanks, @bwoskow-ld

ChrisLightfootWild commented 1 year ago

Thanks @bwoskow-ld for the followup & explanation around complexities of current solution.

I had gone down that suggested route, so I'm glad I just hadn't overlooked anything obvious.

Essentially:

$patchSegmentRequest = new PatchSegmentRequest([
    'comment' => $comment,
    'instructions' => [
        [
            'kind' => 'addIncludedTargets',
            'contextKind' => $contextKind,
            'values' => $values,
        ],
    ],
]);

$request = $segmentsApi->patchSegmentRequest(
    $project,
    $environment,
    $segment,
    $patchSegmentRequest,
);

$guzzle->send($request, [
  'headers' => [
      'Content-Type' => 'application/json; domain-model=launchdarkly.semanticpatch',
  ],
]);