fix: update go sdk code examples to the current sdk version#2200
fix: update go sdk code examples to the current sdk version#2200chronark merged 3 commits intounkeyed:mainfrom
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
@geraldmaboshe is attempting to deploy a commit to the Unkey Team on Vercel. A member of the Team first needs to authorize it. |
📝 Walkthrough📝 Walkthrough📝 WalkthroughWalkthroughThe changes in this pull request focus on enhancing the Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Thank you for following the naming conventions for pull request titles! 🙏 |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (3)
apps/www/app/code-examples.tsx (3)
Line range hint
275-283: Set correcteditorLanguagefor Java code blocksIn the
languagesList, the Java code blocks have theireditorLanguageproperty set to"ts", but they should be set to"java"to ensure proper syntax highlighting for Java code. Please update theeditorLanguageproperty to"java"for the Java code blocks.Apply this diff to fix the issue:
Java: [ { name: "Verify key", Icon: JavaIcon, codeBlock: javaVerifyKeyCodeBlock, - editorLanguage: "ts", + editorLanguage: "java", }, { name: "Create key", Icon: JavaIcon, codeBlock: javaCreateKeyCodeBlock, - editorLanguage: "ts", + editorLanguage: "java", }, ],
Line range hint
284-288: Set correcteditorLanguagefor Elixir code blockIn the
languagesList, the Elixir code block has itseditorLanguageproperty set to"ts", but it should be set to"elixir"to ensure proper syntax highlighting for Elixir code. Please update theeditorLanguageproperty accordingly.Apply this diff to fix the issue:
Elixir: [ { name: "Verify key", Icon: ElixirIcon, codeBlock: elixirCodeBlock, - editorLanguage: "ts", + editorLanguage: "elixir", }, ],
Line range hint
289-299: Set correcteditorLanguagefor Curl code blocksIn the
languagesList, the Curl code blocks have theireditorLanguageproperty set to"tsx", but they should be set to"shell"to ensure proper syntax highlighting for shell scripts. Please update theeditorLanguageproperty to"shell"for the Curl code blocks.Apply this diff to fix the issue:
Curl: [ { name: "Verify key", Icon: CurlIcon, codeBlock: curlVerifyCodeBlock, - editorLanguage: "tsx", + editorLanguage: "shell", }, { name: "Create key", Icon: CurlIcon, codeBlock: curlCreateKeyCodeBlock, - editorLanguage: "tsx", + editorLanguage: "shell", }, { name: "Ratelimit", Icon: CurlIcon, codeBlock: curlRatelimitCodeBlock, - editorLanguage: "tsx", + editorLanguage: "shell", }, ],
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- apps/www/app/code-examples.tsx (1 hunks)
🔇 Additional comments (2)
apps/www/app/code-examples.tsx (2)
357-404:⚠️ Potential issueRemove unintended line numbers from
goCreateKeyCodeBlockThe
goCreateKeyCodeBlockincludes line numbers (e.g.,357~,358~, etc.) within the code string. These line numbers are not part of the Go code and will cause syntax errors when the code is executed or displayed. Please remove these line numbers from the code string to ensure the code example is valid Go code.Apply this diff to fix the issue:
const goCreateKeyCodeBlock = `package main import( unkeygo "github.com/unkeyed/unkey-go" "context" "github.com/unkeyed/unkey-go/models/operations" "log" ) func main() { s := unkeygo.New( unkeygo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"), ) ctx := context.Background() res, err := s.Keys.CreateKey(ctx, operations.CreateKeyRequestBody{ APIID: "api_123", Name: unkeygo.String("my key"), ExternalID: unkeygo.String("team_123"), Meta: map[string]any{ "billingTier": "PRO", "trialEnds": "2023-06-16T17:16:37.161Z", }, Roles: []string{ "admin", "finance", }, Permissions: []string{ "domains.create_record", "say_hello", }, Expires: unkeygo.Int64(1623869797161), Remaining: unkeygo.Int64(1000), Refill: &operations.Refill{ Interval: operations.IntervalDaily, Amount: 100, }, Ratelimit: &operations.Ratelimit{ Type: operations.TypeFast.ToPointer(), Limit: 10, Duration: unkeygo.Int64(60000), }, Enabled: unkeygo.Bool(false), }) if err != nil { log.Fatal(err) } if res.Object != nil { // handle response } } `;Likely invalid or redundant comment.
317-350:⚠️ Potential issueRemove unintended line numbers from
goVerifyKeyCodeBlockThe
goVerifyKeyCodeBlockincludes line numbers (e.g.,317~,318~, etc.) within the code string. These line numbers are not part of the Go code and will cause syntax errors when the code is executed or displayed. Please remove these line numbers from the code string to ensure the code example is valid Go code.Apply this diff to fix the issue:
const goVerifyKeyCodeBlock = `package main - -import( - unkeygo "github.com/unkeyed/unkey-go" - "context" - "github.com/unkeyed/unkey-go/models/components" - "log" -) +import( + unkeygo "github.com/unkeyed/unkey-go" + "context" + "github.com/unkeyed/unkey-go/models/components" + "log" +) func main() { s := unkeygo.New( unkeygo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"), ) ctx := context.Background() res, err := s.Keys.VerifyKey(ctx, components.V1KeysVerifyKeyRequest{ APIID: unkeygo.String("api_1234"), Key: "sk_1234", Ratelimits: []components.Ratelimits{ components.Ratelimits{ Name: "tokens", Limit: unkeygo.Int64(500), Duration: unkeygo.Int64(3600000), }, components.Ratelimits{ Name: "tokens", Limit: unkeygo.Int64(20000), Duration: unkeygo.Int64(86400000), }, }, }) if err != nil { log.Fatal(err) } if res.V1KeysVerifyKeyResponse != nil { // handle response } } `;Likely invalid or redundant comment.
|
Awarding geraldmaboshe: 150 points 🕹️ Well done! Check out your new contribution on oss.gg/geraldmaboshe |
…2200) * fix: update go sdk code examples to the current sdk version * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Andreas Thomas <dev@chronark.com>
* Add default bytes and prefix * adding bytes and prefix columns in harness * fmt * Await * Resolved changes * typo * Capital and Extra bracket * [autofix.ci] apply automated fixes * feat: mobile-sidbar-sync-with-desktop (#2180) * feat/mobile-sidbar-sync-with-desktop * fix(billing): add missing subscription fields and audit logging to upgrade flow (#2179) * fix(billing): add missing subscription fields and audit logging to upgrade flow * fix context properties * refactor: query audit logs from planetscale (#2181) * refactor: query audit logs from planetscale * fix: sort logs * [autofix.ci] apply automated fixes * chore: remove csv export * Update apps/dashboard/app/(app)/audit/[bucket]/page.tsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fmt: add comma * ci: remove wrong lint command --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * chore: Unkey PDF Viewer template [SIDE QUEST] (#2191) * chore: Unkey PDF Viewer template * feat: add template --------- Co-authored-by: chronark <dev@chronark.com> * perf: add database indices (#2192) * fix: add header again * docs: Removing pnpm test:routes (#2184) * fix: revalidate /apis after creating new API (#2183) * fix: revalidate /apis after creating new API key * fix: show success message after revalidate suceeds * fix: revalidate cache before routing * chore(deps-dev): bump @types/react-dom from 18.2.25 to 18.3.0 (#2187) Bumps [@types/react-dom](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react-dom) from 18.2.25 to 18.3.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react-dom) --- updated-dependencies: - dependency-name: "@types/react-dom" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Refactor/workspace-navigation * ran fmt --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Meg Stepp <mcstepp@users.noreply.github.com> Co-authored-by: Andreas Thomas <dev@chronark.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Nazar Poshtarenko <32395926+unrenamed@users.noreply.github.com> Co-authored-by: Harsh Shrikant Bhat <90265455+harshsbhat@users.noreply.github.com> Co-authored-by: Gerald Maboshe <maboshegerald1@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix: update go sdk code examples to the current sdk version (#2200) * fix: update go sdk code examples to the current sdk version * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Andreas Thomas <dev@chronark.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Akshay <100031493+AkshayBandi027@users.noreply.github.com> Co-authored-by: Meg Stepp <mcstepp@users.noreply.github.com> Co-authored-by: Andreas Thomas <dev@chronark.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Nazar Poshtarenko <32395926+unrenamed@users.noreply.github.com> Co-authored-by: Gerald Maboshe <maboshegerald1@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
What does this PR do?
Fixes #2189
This PR updates the code examples for golang on the landing page to use the up to date code examples for the golang sdk
Type of change
How should this be tested?
Checklist
Required
pnpm buildpnpm fmtconsole.logsgit pull origin mainAppreciated
Summary by CodeRabbit
New Features
FrameworkSwitcherfor users to select frameworks within programming languages.UI Enhancements