-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: setOptions / setEndpointOptions + Api.Options rename (#600)
* feat: setOptions / setEndpointOptions functions * refactor: rename `Api.ApiOptions` to `Api.Options`
- Loading branch information
Showing
13 changed files
with
130 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"effect-http": patch | ||
--- | ||
|
||
Add `Api.setOptions`, `Api.setEndpointOptions`, `ApiGroup.setOptions`, `ApiGroup.setEndpointOptions` and `ApiEndpoint.setOptions`. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"effect-http": minor | ||
--- | ||
|
||
Rename `Api.ApiOptions` to `Api.Options`. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Api } from "effect-http" | ||
|
||
// $ExpectType Api<never> | ||
Api.make().pipe( | ||
Api.setOptions({ title: "My API" }) | ||
) | ||
|
||
// $ExpectType Api<Default<"hello">> | ||
Api.make().pipe( | ||
Api.addEndpoint(Api.get("hello", "/hello")), | ||
Api.setOptions({ title: "My API" }) | ||
) | ||
|
||
// $ExpectType Api<Default<"hello">> | ||
Api.make().pipe( | ||
Api.addEndpoint( | ||
Api.get("hello", "/hello").pipe( | ||
Api.setEndpointOptions({ description: "My endpoint" }) | ||
) | ||
), | ||
Api.setOptions({ title: "My API" }) | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { ApiEndpoint } from "effect-http" | ||
|
||
// $ExpectType Default<"hello"> | ||
ApiEndpoint.get("hello", "/hello").pipe( | ||
ApiEndpoint.setOptions({ description: "my endpoint" }) | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { ApiGroup } from "effect-http" | ||
|
||
// $ExpectType ApiGroup<never> | ||
ApiGroup.make("myGroup").pipe( | ||
ApiGroup.setOptions({ description: "My group" }) | ||
) | ||
|
||
// $ExpectType ApiGroup<Default<"hello">> | ||
ApiGroup.make("myGroup").pipe( | ||
ApiGroup.addEndpoint( | ||
ApiGroup.get("hello", "/hello").pipe( | ||
ApiGroup.setEndpointOptions({ description: "My endpoint" }) | ||
) | ||
), | ||
ApiGroup.setOptions({ description: "My group" }) | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "../../../tsconfig.base.json", | ||
"include": ["."], | ||
"compilerOptions": { | ||
"incremental": false, | ||
"composite": false, | ||
"noUnusedLocals": false | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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