Repository navigation
Conversation
The create API accepts an optional `runtime` naming which runtime variant the sprite should be created on; the SDK had no way to send it, so callers were stuck with the default. Rather than grow the signature of CreateSpriteWithOrg again, this adds CreateSpriteWithOptions taking a CreateSpriteOptions struct, so the next optional setting is a field instead of another positional argument. The two existing constructors keep working and delegate to it. The runtime is passed through as an opaque string. Which names are valid is the API's business, not the SDK's, so a new runtime becomes usable without an SDK release and an unknown one comes back as a server error naming the set that is accepted. An empty runtime is omitted from the request body entirely: sending "" would ask for a variant named "" rather than for the default.
golangci-lint's nlreturn wants a blank line before a return that closes a block of more than three statements.
Member
Author
|
Closing: this is the wrong approach and not something we want to expose in the SDK. |
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.
The create API accepts an optional
runtimenaming which runtime variant a sprite should be created on. The SDK had no way to send it, so callers were stuck with the default.Shape
Rather than grow the signature of
CreateSpriteWithOrga third time, this addsCreateSpriteWithOptionstaking aCreateSpriteOptionsstruct, so the next optional setting is a field rather than another positional argument:CreateSpriteandCreateSpriteWithOrgare untouched at the call site and delegate to it, so this is additive — no existing caller has to change.The runtime is opaque on purpose
Which names are valid is the API's business, not the SDK's. Keeping it an unvalidated string means a new runtime works without an SDK release, and an unknown one comes back as a server error naming the set that is accepted — better than a client-side list that drifts out of date and rejects something the server would have taken.
An empty runtime is omitted from the request body entirely (
omitempty), since sending""would ask for a variant named""rather than for the default. There is a test pinning that, because it is the kind of thing a later refactor silently breaks.Tests
Three, driving a stub server and asserting on the JSON that actually goes out: the runtime is sent when set, omitted when empty, and
CreateSpriteWithOrgstill carries its config and labels through the new path.go test,go vetandgofmtare clean.