Skip to content

Commit

Permalink
feat: publish
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Jul 31, 2024
1 parent 142ecf3 commit 6ece986
Show file tree
Hide file tree
Showing 57 changed files with 8,191 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# syntax=docker/dockerfile:1
FROM debian:bookworm-slim

RUN apt-get update && apt-get install -y \
libxkbcommon0 \
ca-certificates \
git \
golang \
unzip \
libc++1 \
vim \
&& apt-get clean autoclean

# Ensure UTF-8 encoding
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8

ENV GOPATH=/go
ENV PATH=$GOPATH/bin:$PATH

WORKDIR /workspace

COPY . /workspace
20 changes: 20 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
{
"name": "Debian",
"build": {
"dockerfile": "Dockerfile"
}

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
- next

jobs:
lint:
name: lint
runs-on: ubuntu-latest
if: github.repository == 'anthropics/anthropic-sdk-go'

steps:
- uses: actions/checkout@v4

- name: Setup go
uses: actions/setup-go@v5

- name: Run lints
run: ./scripts/lint
test:
name: test
runs-on: ubuntu-latest
if: github.repository == 'anthropics/anthropic-sdk-go'

steps:
- uses: actions/checkout@v4

- name: Setup go
uses: actions/setup-go@v5

- name: Bootstrap
run: ./scripts/bootstrap

- name: Run tests
run: ./scripts/test

29 changes: 29 additions & 0 deletions .github/workflows/create-releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Create releases
on:
schedule:
- cron: '0 5 * * *' # every day at 5am UTC
push:
branches:
- main

jobs:
release:
name: release
if: github.ref == 'refs/heads/main' && github.repository == 'anthropics/anthropic-sdk-go'
runs-on: ubuntu-latest
environment: production-release

steps:
- uses: actions/checkout@v4

- uses: stainless-api/trigger-release-please@v1
id: release
with:
repo: ${{ github.event.repository.full_name }}
stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}

- name: Generate godocs
if: ${{ steps.release.outputs.releases_created }}
run: |
version=$(jq -r '. | to_entries[0] | .value' .release-please-manifest.json)
curl -X POST https://pkg.go.dev/fetch/github.com/anthropics/anthropic-sdk-go@v${version}
25 changes: 25 additions & 0 deletions .github/workflows/handle-release-pr-title-edit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Handle release PR title edits
on:
pull_request:
types:
- edited
- unlabeled

jobs:
update_pr_content:
name: Update pull request content
if: |
((github.event.action == 'edited' && github.event.changes.title.from != github.event.pull_request.title) ||
(github.event.action == 'unlabeled' && github.event.label.name == 'autorelease: custom version')) &&
startsWith(github.event.pull_request.head.ref, 'release-please--') &&
github.event.pull_request.state == 'open' &&
github.event.sender.login != 'stainless-bot' &&
github.event.sender.login != 'stainless-app' &&
github.repository == 'anthropics/anthropic-sdk-go'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: stainless-api/trigger-release-please@v1
with:
repo: ${{ github.event.repository.full_name }}
stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.prism.log
codegen.log
Brewfile.lock.json
.idea/
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.0.1-alpha.0"
}
2 changes: 2 additions & 0 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
configured_endpoints: 2
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-15089862b682046b13deff5bf5f09d786d9ec4aecc40b9f7ef40b84ef17d3348.yml
59 changes: 59 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
## Setting up the environment

### Install Go 1.18+

Install go by following relevant directions [here](https://go.dev/doc/install).

## Modifying/Adding code

Most of the SDK is generated code, and any modified code will be overridden on the next generation. The
`examples/` directory is an exception and will never be overridden.

## Adding and running examples

All files in the `examples/` directory are not modified by the Stainless generator and can be freely edited or
added to.

```bash
# add an example to examples/<your-example>/main.go

package main

func main() {
// ...
}
```

```bash
go run ./examples/<your-example>
```

## Using the repository from source

To use a local version of this library from source in another project, edit the `go.mod` with a replace
directive. This can be done through the CLI with the following:

```bash
go mod edit -replace github.com/anthropics/anthropic-sdk-go=/path/to/anthropic-sdk-go
```

## Running tests

Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.

```bash
# you will need npm installed
npx prism mock path/to/your/openapi.yml
```

```bash
go test ./...
```

## Formatting

This library uses the standard gofmt code formatter:

```bash
gofmt -s -w .
```
8 changes: 8 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Copyright 2023 Anthropic, PBC.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Loading

0 comments on commit 6ece986

Please sign in to comment.