Repository navigation
Support Carbone API v5 (SDK 3.0.0) - #18
Merged
Merged
Conversation
…-request render Requests now use the Carbone API version 5 by default (pass "4" to create() to keep the previous version), and the SDK version is bumped to 3.0.0. New ICarboneServices methods, existing ones are unchanged: - addTemplate(file, CarboneTemplateOptions): versioning, Template ID and metadata (name, comment, category, tags, sample, deployedAt, expireAt), returns a CarboneTemplate with the Template ID and Version ID. - updateTemplate(): PATCH /template/:id. - listTemplates() with filters and cursor pagination, listTemplateCategories(), listTemplateTags(). - renderAndDownload() (?download=true) and renderInline() (base64 template sent with the request, not stored). - CarboneRenderOptions: webhook and custom headers on render requests. The API ignores multipart text fields that have a Content-Type header, which feign-form adds by default: CarboneFormFieldWriter sends them without one. Tests: CarboneV5Test (service logic), CarboneHttpTest (requests built by Feign, against a local server) and CarboneLiveTest (real API, only when CARBONE_TOKEN is set).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for the Carbone API v5 and makes it the default. This is released as SDK 3.0.0. Existing
ICarboneServicesmethods are unchanged.Breaking changes
carbone-version: 5by default (was4). To keep v4, callcreate(token, "4").ICarboneServices,ICarboneTemplateClientandICarboneRenderClient. This only affects code that implements these interfaces itself.New features
addTemplate(file, CarboneTemplateOptions)returns aCarboneTemplate(Template IDid, Version IDversionId).CarboneTemplateOptions.DEPLOY_NOWdeploys a version when it is uploaded.updateTemplate(idOrVersionId, CarboneTemplateUpdate)sendsPATCH /template/:id.listTemplates(CarboneTemplateQuery)supports filters and cursor pagination.listTemplateCategories()andlistTemplateTags()list categories and tags.renderAndDownload()calls?download=true.renderInline()sends a base64 template with the request and does not store it.CarboneRenderOptionstakeswebhookUrl,webhookHeader(...)andheader(...).Fix found while testing against the real API
The API silently ignores multipart text fields that have a
Content-Typeheader. feign-form addstext/plainto every text field, soversioning,id,nameand the other fields were dropped, and uploads came back with the legacy response.CarboneFormFieldWriternow writes these fields without the header.Tests
CarboneV5Test: service logic, with Mockito.CarboneHttpTest: checks the requests Feign actually sends, against a localHttpServer. It covers paths, headers, field order in the upload form (idbeforetemplate), the absence ofContent-Typeon text fields, PATCH anddownload=true.CarboneLiveTest: runs against the real API, and only whenCARBONE_TOKENis set (CARBONE_TOKEN=... mvn test -Dtest=CarboneLiveTest). It covers the full lifecycle: versioned upload, second version, PATCH, listing, all render methods including the existingrender(path)on v5, and deletion. It passed against api.carbone.io (5.16.2) with a test key.