Skip to content

Commit

Permalink
Merge branch 'main' into burke/fer-3212-php-undiscriminated-unions
Browse files Browse the repository at this point in the history
  • Loading branch information
dcb6 committed Sep 30, 2024
2 parents 4e4e491 + 854efd5 commit 0a330a4
Show file tree
Hide file tree
Showing 950 changed files with 61,018 additions and 862 deletions.
72 changes: 72 additions & 0 deletions a.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@

> @fern-api/[email protected] test /Users/dsinghvi/Git/fern/packages/cli/docs-importers/mintlify
> vitest --run


RUN v2.0.5 /Users/dsinghvi/Git/fern/packages/cli/docs-importers/mintlify

stdout | src/__test__/migrateFromMintlify.test.ts > add-generator-groups > bland
Converted logo
Converted color configuration

Bland is a platform for AI phone calling. Using our API, you can easily send or receive phone calls with a programmable voice agent.

We really care about making our phone calls...

1. **Fast**: sub-second latency from person speaking to AI responding.
2. **Reliable**: it's our responsibility, day in and day out, to make sure your phone calls work. No exceptions.
3. **Ultra flexible**: configure all aspects of your agent's behavior, by settings it's voice, creating transfer scenarios, configuring the initial greeting, etc.

# What you can do with Bland

<CardGroup cols={2}>
<Card title="Send phone calls" icon="phone-arrow-up-right" href="/api-v1/post/calls">
Dispatch AI phone calls to call customers, leads, and to streamline operations.
</Card>
<Card title="Set up inbound numbers" icon="phone-arrow-down-left" href="/api-v1/post/inbound-purchase">
Create inbound phone numbers for customer support, etc.
</Card>
<Card title="Do live function calling" icon="bolt" href="/tutorials/custom-tools">
Connect external APIs and take live actions during phone calls.
</Card>
<Card title="Extract structured data from calls" icon="brackets-curly" href="/api-v1/post/calls-id-analyze">
Extract JSON data to answer questions about your calls.
</Card>
<Card title="Create call campaigns" icon="megaphone" href="/api-v1/post/batches">
Simultaneously send thousands of calls at once.
</Card>
<Card title="Fine-tune a custom LLM" icon="microchip-ai" href="https://forms.default.com/361589">
Fine-tune a custom LLM using your enterprise' call recordings and transcripts.
</Card>
</CardGroup>

# Getting started

<CardGroup cols={2}>
<Card title="API Reference" icon="code" href="/api-v1">
Read the API reference.
</Card>
<Card title="Starter guide" icon="rocket-launch" href="/starter-guide">
Learn to send your first phone call and test your agents.
</Card>
<Card title="Get your keys" icon="key" href="https://app.bland.ai">
Sign up on the developer portal.
</Card>
<Card title="Enterprise" icon="building" href="https://forms.default.com/361589">
Learn about enterprise features & meet with a member of the Bland AI team.
</Card>
</CardGroup>


❯ src/__test__/migrateFromMintlify.test.ts (1 test | 1 failed) 6ms
× add-generator-groups > bland
→ Filepath is not relative: /developerportal.png

Test Files 1 failed (1)
Tests 1 failed (1)
Start at 22:15:44
Duration 1.34s (transform 447ms, setup 0ms, collect 1.15s, tests 6ms, environment 0ms, prepare 51ms)

/Users/dsinghvi/Git/fern/packages/cli/docs-importers/mintlify:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  @fern-api/[email protected] test: `vitest --run`
Exit status 1
5 changes: 4 additions & 1 deletion fern.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,13 @@
{
"type": "object",
"properties": {
"type": { "type": "string" },
"docs": {
"$ref": "#/properties/types/additionalProperties/anyOf/1/anyOf/0/properties/docs"
},
"type": { "type": "string" }
"display-name": {
"$ref": "#/properties/types/additionalProperties/anyOf/2/properties/union/additionalProperties/anyOf/1/properties/display-name"
}
},
"required": ["type"],
"additionalProperties": false
Expand Down
2 changes: 1 addition & 1 deletion fern/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ navigation:
title: Go
slug: go
- changelog: ./pages/changelogs/csharp-sdk
title: .Net
title: .NET
slug: csharp
- changelog: ./pages/changelogs/java-sdk
title: Java
Expand Down
6 changes: 6 additions & 0 deletions fern/pages/changelogs/cli/2024-09-27.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## 0.43.6
**`(fix):`** The OpenAPI importer now appropriately brings in responses that are under the `text/event-stream`
Content-Type if your endpoint is annotated with `x-fern-streaming`.
If your endpoint is not annotated with `x-fern-streaming`, then the response will be ignored.


6 changes: 6 additions & 0 deletions fern/pages/changelogs/cli/2024-09-28.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## 0.43.7
**`(fix):`** The `valid-markdown` rule has been updated to try and parse the markdown file into a
valid AST. If the file fails to parse, `fern check` will log an error as well
as the path to the markdown.


3 changes: 3 additions & 0 deletions fern/pages/changelogs/go-sdk/2024-09-27.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.27.0
**`(feat):`** Add support for SSE (Server-Sent Events) streaming responses. The user-facing interface for streaming responses remains the same between standard HTTP streaming and SSE.

6 changes: 5 additions & 1 deletion fern/pages/changelogs/java-sdk/2024-09-26.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## 1.2.0
## 2.2.0
**`(feat):`** We now provide endpoint methods for streaming byte array requests in addition to the previous methods accepting
byte array directly.


**`(chore):`** Bump Jackson version to latest (2.17.2)


11 changes: 11 additions & 0 deletions fern/pages/changelogs/python-sdk/2024-09-28.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## 4.2.7
**`(fix):`** The generated README will now have a section that links to the generated
SDK Reference (in `reference.md`).

```md
## Reference

A full reference for this library can be found [here](./reference.md).
```


2 changes: 1 addition & 1 deletion generators/commons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@fern-api/fs-utils": "workspace:*",
"@fern-api/logger": "workspace:*",
"@fern-api/logging-execa": "workspace:*",
"@fern-fern/generator-cli-sdk": "0.0.56",
"@fern-fern/generator-cli-sdk": "0.0.17",
"@fern-fern/generator-exec-sdk": "^0.0.898",
"js-yaml": "^4.1.0",
"lodash-es": "^4.17.21",
Expand Down
2 changes: 1 addition & 1 deletion generators/csharp/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@fern-api/fs-utils": "workspace:*",
"@fern-api/generator-commons": "workspace:*",
"@fern-api/logger": "workspace:*",
"@fern-fern/generator-cli-sdk": "0.0.56",
"@fern-fern/generator-cli-sdk": "0.0.17",
"@fern-fern/generator-exec-sdk": "^0.0.898",
"url-join": "^5.0.0",
"@fern-fern/ir-sdk": "^53.7.0",
Expand Down
9 changes: 9 additions & 0 deletions generators/go/internal/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1547,3 +1547,12 @@ var pointerFunctionNames = map[string]struct{}{
"Uintptr": struct{}{},
"Time": struct{}{},
}

// valueOf dereferences the given value, or returns the zero value if nil.
func valueOf[T any](value *T) T {
var result T
if value == nil {
return result
}
return *value
}
91 changes: 73 additions & 18 deletions generators/go/internal/generator/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,9 @@ func (f *fileWriter) WriteClient(
}
}
}
if endpoint.Accept != "" {
f.P(fmt.Sprintf(`%s.Set("Accept", %q)`, headersParameter, endpoint.Accept))
}
if endpoint.ContentType != "" {
f.P(fmt.Sprintf(`%s.Set("Content-Type", %q)`, headersParameter, endpoint.ContentType))
}
Expand Down Expand Up @@ -1114,7 +1117,7 @@ func (f *fileWriter) WriteClient(
}

// Prepare a response variable.
if endpoint.ResponseType != "" && !endpoint.IsStreaming && endpoint.PaginationInfo == nil {
if endpoint.ResponseType != "" && endpoint.StreamingInfo == nil && endpoint.PaginationInfo == nil {
f.P(fmt.Sprintf(endpoint.ResponseInitializerFormat, endpoint.ResponseType))
}

Expand Down Expand Up @@ -1208,13 +1211,23 @@ func (f *fileWriter) WriteClient(
}

// Issue the request.
if endpoint.IsStreaming {
if endpoint.StreamingInfo != nil {
streamingInfo := endpoint.StreamingInfo
f.P("streamer := core.NewStreamer[", endpoint.ResponseType, "](", receiver, ".caller)")
f.P("return streamer.Stream(")
f.P("ctx,")
f.P("&core.StreamParams{")
f.P("URL: endpointURL, ")
f.P("Method:", endpoint.Method, ",")
if streamingInfo.Delimiter != "" {
f.P("Delimiter: ", streamingInfo.Delimiter, ",")
}
if streamingInfo.Prefix != "" {
f.P("Prefix:", streamingInfo.Prefix, ",")
}
if streamingInfo.Terminator != "" {
f.P("Terminator:", streamingInfo.Terminator, ",")
}
f.P("MaxAttempts: options.MaxAttempts,")
f.P("BodyProperties: options.BodyProperties,")
f.P("QueryParameters: options.QueryParameters,")
Expand All @@ -1226,9 +1239,6 @@ func (f *fileWriter) WriteClient(
if endpoint.ErrorDecoderParameterName != "" {
f.P("ErrorDecoder:", endpoint.ErrorDecoderParameterName, ",")
}
if endpoint.StreamDelimiter != "" {
f.P("Delimiter: ", endpoint.StreamDelimiter, ",")
}
f.P("},")
f.P(")")
f.P("}")
Expand Down Expand Up @@ -1390,6 +1400,48 @@ func (f *fileWriter) WriteClient(
)
}

type streamingInfo struct {
Delimiter string
Prefix string
Terminator string
AcceptHeader string
}

func getStreamingInfo(
irEndpoint *ir.HttpEndpoint,
) (*streamingInfo, error) {
if irEndpoint == nil || irEndpoint.Response == nil || irEndpoint.Response.Streaming == nil {
return nil, nil
}
streamingResponse := irEndpoint.Response.Streaming
switch streamingResponse.Type {
case "text":
return &streamingInfo{}, nil
case "json":
var terminator string
if value := valueOf(streamingResponse.Json.Terminator); value != "" {
terminator = fmt.Sprintf("%q", value)
}
return &streamingInfo{
Terminator: terminator,
}, nil
case "sse":
terminator := valueOf(streamingResponse.Sse.Terminator)
if terminator != "" {
terminator = fmt.Sprintf("%q", terminator)
} else {
terminator = "core.DefaultSSETerminator"
}
return &streamingInfo{
Prefix: "core.DefaultSSEDataPrefix",
Terminator: terminator,
AcceptHeader: "text/event-stream",
}, nil
default:
return nil, fmt.Errorf("stream response type %q is not supported", streamingResponse.Type)
}
}

type paginationInfo struct {
Type string
Page *ir.QueryParameter
Expand Down Expand Up @@ -1996,10 +2048,9 @@ type endpoint struct {
OptionConstructor string
PathSuffix string
Method string
IsStreaming bool
StreamDelimiter string
ErrorDecoderParameterName string
Idempotent bool
Accept string
ContentType string
Errors ir.ResponseErrors
QueryParameters []*ir.QueryParameter
Expand All @@ -2008,6 +2059,7 @@ type endpoint struct {
FilePropertyInfo *filePropertyInfo
FileProperties []*ir.FileProperty
FileBodyProperties []*ir.InlinedRequestBodyProperty
StreamingInfo *streamingInfo
PaginationInfo *paginationInfo
}

Expand Down Expand Up @@ -2172,6 +2224,11 @@ func (f *fileWriter) endpointFromIR(
},
)

streamingInfo, err := getStreamingInfo(irEndpoint)
if err != nil {
return nil, err
}

paginationInfo, err := f.getPaginationInfo(irEndpoint, scope, requestParameterName)
if err != nil {
return nil, err
Expand All @@ -2185,8 +2242,6 @@ func (f *fileWriter) endpointFromIR(
signatureReturnValues string
successfulReturnValues string
errorReturnValues string
streamDelimiter string
isStreaming bool
)
var responseIsOptionalParameter bool
if irEndpoint.Response != nil {
Expand Down Expand Up @@ -2234,12 +2289,6 @@ func (f *fileWriter) endpointFromIR(
successfulReturnValues = "response.String(), nil"
errorReturnValues = `"", err`
case "streaming":
if irEndpoint.Response.Streaming.Json == nil && irEndpoint.Response.Streaming.Text == nil {
return nil, fmt.Errorf("unsupported streaming response type: %s", irEndpoint.Response.Streaming.Type)
}
if irEndpoint.Response.Streaming.Json != nil && irEndpoint.Response.Streaming.Json.Terminator != nil {
streamDelimiter = *irEndpoint.Response.Streaming.Json.Terminator
}
typeReference, err := typeReferenceFromStreamingResponse(irEndpoint.Response.Streaming)
if err != nil {
return nil, err
Expand All @@ -2248,7 +2297,6 @@ func (f *fileWriter) endpointFromIR(
responseParameterName = "response"
signatureReturnValues = fmt.Sprintf("(*core.Stream[%s], error)", responseType)
errorReturnValues = "nil, err"
isStreaming = true
default:
return nil, fmt.Errorf("%s requests are not supported yet", irEndpoint.Response.Type)
}
Expand Down Expand Up @@ -2308,6 +2356,11 @@ func (f *fileWriter) endpointFromIR(
optionConstructor = "core.NewIdempotentRequestOptions(opts...)"
}

var accept string
if streamingInfo != nil && streamingInfo.AcceptHeader != "" {
accept = streamingInfo.AcceptHeader
}

contentTypeOverride := contentTypeFromRequestBody(irEndpoint.RequestBody)
if contentTypeOverride != "" {
contentType = contentTypeOverride
Expand Down Expand Up @@ -2336,9 +2389,8 @@ func (f *fileWriter) endpointFromIR(
BaseURL: baseURL,
PathSuffix: pathSuffix,
Method: irMethodToMethodEnum(irEndpoint.Method),
IsStreaming: isStreaming,
StreamDelimiter: streamDelimiter,
ErrorDecoderParameterName: errorDecoderParameterName,
Accept: accept,
ContentType: contentType,
Idempotent: irEndpoint.Idempotent,
Errors: irEndpoint.Errors,
Expand All @@ -2348,6 +2400,7 @@ func (f *fileWriter) endpointFromIR(
FilePropertyInfo: filePropertyInfo,
FileProperties: fileProperties,
FileBodyProperties: fileBodyProperties,
StreamingInfo: streamingInfo,
PaginationInfo: paginationInfo,
}, nil
}
Expand Down Expand Up @@ -3109,6 +3162,8 @@ func typeReferenceFromStreamingResponse(
switch streamingResponse.Type {
case "json":
return streamingResponse.Json.Payload, nil
case "sse":
return streamingResponse.Sse.Payload, nil
case "text":
return ir.NewTypeReferenceFromPrimitive(ir.PrimitiveTypeString), nil
}
Expand Down
Loading

0 comments on commit 0a330a4

Please sign in to comment.