forked from andersfylling/disgord
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
autogen restbuilder setter methods + WIP on user REST methods
- Loading branch information
1 parent
31e083e
commit d29a3b2
Showing
14 changed files
with
391 additions
and
138 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
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
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 |
---|---|---|
@@ -1,35 +1,42 @@ | ||
package disgord | ||
|
||
// Warning: This file has been automatically generated by generate/restbuilders/main.go | ||
// Do _NOT_ make changes here! | ||
// DO NOT EDIT! This file is overwritten at "go generate" | ||
// This file holds all the basic RESTBuilder methods a builder is expected to. | ||
|
||
{{ range . }} | ||
{{ range $builder := . }} | ||
|
||
// IgnoreCache will not fetch the data from the cache if available, and always execute a | ||
// a REST request. However, the response will always update the cache to keep it synced. | ||
func (b *{{.}}) IgnoreCache() *{{.}} { | ||
b.{{ .FieldName }}.IgnoreCache() | ||
func (b *{{$builder.Name}}) IgnoreCache() *{{$builder.Name}} { | ||
b.{{ $builder.FieldName }}.IgnoreCache() | ||
return b | ||
} | ||
|
||
// CancelOnRatelimit will disable waiting if the request is rate limited by Discord. | ||
func (b *{{.}}) CancelOnRatelimit() *{{.}} { | ||
b.{{ .FieldName }}.CancelOnRatelimit() | ||
func (b *{{$builder.Name}}) CancelOnRatelimit() *{{$builder.Name}} { | ||
b.{{ $builder.FieldName }}.CancelOnRatelimit() | ||
return b | ||
} | ||
|
||
// URLParam adds or updates an existing URL parameter. | ||
// eg. URLParam("age", 34) will cause the URL `/test` to become `/test?age=34` | ||
func (b *{{.}}) URLParam(name string, v interface{}) *{{.}} { | ||
b.{{ .FieldName }}.queryParam(name, v) | ||
func (b *{{$builder.Name}}) URLParam(name string, v interface{}) *{{$builder.Name}} { | ||
b.{{ $builder.FieldName }}.queryParam(name, v) | ||
return b | ||
} | ||
|
||
// Set adds or updates an existing a body parameter | ||
// eg. Set("age", 34) will cause the body `{}` to become `{"age":34}` | ||
func (b *{{.}}) Set(name string, v interface{}) *{{.}} { | ||
b.{{ .FieldName }}.body[name] = v | ||
func (b *{{$builder.Name}}) Set(name string, v interface{}) *{{$builder.Name}} { | ||
b.{{ $builder.FieldName }}.body[name] = v | ||
return b | ||
} | ||
{{end}} | ||
|
||
{{ range $i, $p := .Params }} | ||
func (b *{{$builder.Name}}) Set{{ $p.MethodName }}({{ $p.MethodName | Decapitalize }} {{ $p.Type }}) *{{$builder.Name}} { | ||
b.{{ $builder.FieldName }}.param("{{ $p.Name }}", {{ $p.MethodName | Decapitalize }}) | ||
return b | ||
} | ||
{{ end }} | ||
{{ end }} |
Oops, something went wrong.