-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from neandertech/aliases
Add aliases for common hints
- Loading branch information
Showing
5 changed files
with
132 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
93 changes: 93 additions & 0 deletions
93
modules/core/shared/src/main/scala/smithy4s/deriving/aliases/aliases.scala
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,93 @@ | ||
/* | ||
* Copyright 2024 Neandertech | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package smithy4s.deriving.aliases | ||
|
||
import smithy4s.Hints | ||
import smithy4s.deriving.HintsProvider | ||
import smithy.api.* | ||
import alloy.Discriminated | ||
import alloy.Untagged | ||
import alloy.SimpleRestJson | ||
import alloy.proto.ProtoIndex | ||
|
||
case class httpGet(uri: String, code: Int = 200) extends HintsProvider { | ||
def hints = Hints(Http(NonEmptyString("GET"), NonEmptyString(uri), code)) | ||
} | ||
|
||
case class httpPost(uri: String, code: Int = 200) extends HintsProvider { | ||
def hints = Hints(Http(NonEmptyString("POST"), NonEmptyString(uri), code)) | ||
} | ||
|
||
case class httpPatch(uri: String, code: Int = 200) extends HintsProvider { | ||
def hints = Hints(Http(NonEmptyString("PATCH"), NonEmptyString(uri), code)) | ||
} | ||
|
||
case class httpDelete(uri: String, code: Int = 200) extends HintsProvider { | ||
def hints = Hints(Http(NonEmptyString("DELETE"), NonEmptyString(uri), code)) | ||
} | ||
|
||
case class httpPut(uri: String, code: Int = 200) extends HintsProvider { | ||
def hints = Hints(Http(NonEmptyString("PUT"), NonEmptyString(uri), code)) | ||
} | ||
|
||
case class httpLabel() extends HintsProvider { | ||
def hints = Hints(HttpLabel()) | ||
} | ||
|
||
case class httpQuery(name: String) extends HintsProvider { | ||
def hints = Hints(HttpQuery(name)) | ||
} | ||
|
||
case class httpHeader(name: String) extends HintsProvider { | ||
def hints = Hints(HttpHeader(name)) | ||
} | ||
|
||
case class httpPayload() extends HintsProvider { | ||
def hints = Hints(HttpPayload()) | ||
} | ||
|
||
case class httpError(code: Int) extends HintsProvider { | ||
def hints = Hints(HttpError(code)) | ||
} | ||
|
||
case class readonly() extends HintsProvider { | ||
def hints = Hints(Readonly()) | ||
} | ||
|
||
case class idempotent() extends HintsProvider { | ||
def hints = Hints(Idempotent()) | ||
} | ||
|
||
case class jsonName(name: String) extends HintsProvider { | ||
def hints = Hints(JsonName(name)) | ||
} | ||
|
||
case class simpleRestJson() extends HintsProvider { | ||
def hints = Hints(SimpleRestJson()) | ||
} | ||
|
||
case class discriminated(fieldName: String) extends HintsProvider { | ||
def hints = Hints(Discriminated(fieldName)) | ||
} | ||
|
||
case class untagged() extends HintsProvider { | ||
def hints = Hints(Untagged()) | ||
} | ||
|
||
case class protoIndex(value: Int) extends HintsProvider { | ||
def hints = Hints(ProtoIndex(value)) | ||
} |
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