Skip to content

Commit

Permalink
docs: Re-org examples
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyxiao committed Dec 9, 2023
1 parent d5d8831 commit adc1749
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 33 deletions.
5 changes: 1 addition & 4 deletions examples/example.ts → examples/example-kitchensink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ import {veniceSdkDef} from '@opensdks/sdk-venice'

// Comparison between GitHub vanilla octokit client and openSDKs client
const github = initSDK(githubSdkDef, {
headers: {
authorization: `Bearer ${process.env['GITHUB_TOKEN']}`,
'x-github-api-version': '2022-11-28',
},
headers: {authorization: `Bearer ${process.env['GITHUB_TOKEN']}`},
})

void github
Expand Down
18 changes: 0 additions & 18 deletions examples/example-openai.ts

This file was deleted.

17 changes: 7 additions & 10 deletions examples/summarize-pr.ts → examples/example-summarize-pr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ import {initSDK} from '@opensdks/core'
import {githubSdkDef, type githubTypes} from '@opensdks/sdk-github'
import {openaiSdkDef} from '@opensdks/sdk-openai'

type Commit = githubTypes['components']['schemas']['commit']
const github = initSDK(githubSdkDef, {
headers: {authorization: `Bearer ${process.env['GITHUB_TOKEN']}`},
})

const github = initSDK(githubSdkDef, {})
const openai = initSDK(openaiSdkDef, {
headers: {authorization: `Bearer ${process.env['OPENAI_API_KEY']}`},
})

export async function fetchCommits(prLink: string) {
const prUrl = new URL(prLink)
Expand All @@ -22,14 +26,7 @@ export async function fetchCommits(prLink: string) {
.then((r) => r.data)
}

const apiKey = process.env['OPENAI_API_KEY']
// ^?
const openai = initSDK(openaiSdkDef, {
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${apiKey}`,
},
})
type Commit = githubTypes['components']['schemas']['commit']

export const summarizeCommits = async (commits: Commit[]) => {
const messages = commits.map((commit) => commit.commit.message).join('\n')
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {createClient} from './createClient'
export * from './HTTPError'
export type OpenAPISpec = oas30.OpenAPIObject | oas31.OpenAPIObject
export {oas30, oas31}
export * from './links'

// MARK: - defineSdk

Expand Down
2 changes: 1 addition & 1 deletion sdks/sdk-slack/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {OpenAPISpec, SdkDefinition, SDKTypes} from '@opensdks/core'
import {ClientOptions} from '@opensdks/core/createClient'
import type {ClientOptions} from '@opensdks/core/createClient'
import type {
components,
external,
Expand Down

1 comment on commit adc1749

@vercel
Copy link

@vercel vercel bot commented on adc1749 Dec 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

opensdks – ./

opensdks-git-main-venice.vercel.app
opensdks.vercel.app
opensdks-venice.vercel.app
opensdks.org

Please sign in to comment.