{"modulePath":"github.com/beeper/desktop-api-cli","version":"v0.3.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package requestflag\n\n## Functions\n\n```go\nfunc CheckInnerFlags(cmd cli.Command) error\n```\nHelper function to verify that all inner flags have an outer flag set and follow the --foo.baz prefix format\n\n```go\nfunc GetMissingRequiredFlags(cmd *cli.Command, body any) []cli.Flag\n```\n\n```go\nfunc WithInnerFlags(cmd cli.Command, innerFlagMap map[string][]HasOuterFlag) cli.Command\n```\nWithInnerFlags takes a command and a map of flag names to inner flags, and returns a modified command with the appropriate inner flags set.\n\n## Types\n\n```go\ntype DateTimeValue string\n```\n\n```go\nfunc (d *DateTimeValue) Parse(s string) error\n```\n\n```go\nfunc (d DateTimeValue) String() string\n```\n\n```go\ntype DateValue string\n```\nTime-related value types\n\n```go\nfunc (d *DateValue) Parse(s string) error\n```\nParse methods for time-related types\n\n```go\nfunc (d DateValue) String() string\n```\nString methods for time-related types\n\n```go\ntype Flag[\n\tT []any | []map[string]any | []DateTimeValue | []DateValue | []TimeValue | []string |\n\t\t[]float64 | []int64 | []bool | any | map[string]any | DateTimeValue | DateValue | TimeValue |\n\t\tstring | float64 | int64 | bool,\n] struct {\n\tName        string               // name of the flag\n\tCategory    string               // category of the flag, if any\n\tDefaultText string               // default text of the flag for usage purposes\n\tHideDefault bool                 // whether to hide the default value in output\n\tUsage       string               // usage string for help output\n\tSources     cli.ValueSourceChain // sources to load flag value from\n\tRequired    bool                 // whether the flag is required or not\n\tHidden      bool                 // whether to hide the flag in help output\n\tDefault     T                    // default value for this flag if not set by from any source\n\tAliases     []string             // aliases that are allowed for this flag\n\tValidator   func(T) error        // custom function to validate this flag value\n\n\tQueryPath  string // location in the request query string to put this flag's value\n\tHeaderPath string // location in the request header to put this flag's value\n\tBodyPath   string // location in the request body to put this flag's value\n\tBodyRoot   bool   // if true, then use this value as the entire request body\n\t// contains filtered or unexported fields\n}\n```\nFlag \\[T] is a generic flag base which can be used to implement the most common interfaces used by urfave/cli. Additionally, it allows specifying where in an HTTP request the flag values should be placed (e.g. query, body, etc.).\n\n```go\nfunc (f *Flag[T]) Count() int\n```\n\n```go\nfunc (f *Flag[T]) Get() any\n```\n\n```go\nfunc (f Flag[T]) GetBodyPath() string\n```\n\n```go\nfunc (f *Flag[T]) GetCategory() string\n```\n\n```go\nfunc (f *Flag[T]) GetDefaultText() string\n```\n\n```go\nfunc (f *Flag[T]) GetEnvVars() []string\n```\nGetEnvVars returns the env vars for this flag\n\n```go\nfunc (f Flag[T]) GetHeaderPath() string\n```\n\n```go\nfunc (f Flag[T]) GetQueryPath() string\n```\n\n```go\nfunc (f *Flag[T]) GetUsage() string\n```\n\n```go\nfunc (f *Flag[T]) GetValue() string\n```\n\n```go\nfunc (f Flag[T]) IsBodyRoot() bool\n```\n\n```go\nfunc (f *Flag[T]) IsBoolFlag() bool\n```\n\n```go\nfunc (f *Flag[T]) IsDefaultVisible() bool\n```\n\n```go\nfunc (f Flag[T]) IsLocal() bool\n```\n\n```go\nfunc (f *Flag[T]) IsMultiValueFlag() bool\n```\n\n```go\nfunc (f *Flag[T]) IsRequired() bool\n```\n\n```go\nfunc (f *Flag[T]) IsRequiredAsFlagOrStdin() bool\n```\n\n```go\nfunc (f *Flag[T]) IsSet() bool\n```\n\n```go\nfunc (f *Flag[T]) IsVisible() bool\n```\n\n```go\nfunc (f *Flag[T]) Names() []string\n```\n\n```go\nfunc (f *Flag[T]) PostParse() error\n```\n\n```go\nfunc (f *Flag[T]) PreParse() error\n```\n\n```go\nfunc (f *Flag[T]) Set(name string, val string) error\n```\n\n```go\nfunc (f *Flag[T]) SetCategory(c string)\n```\n\n```go\nfunc (f *Flag[T]) SetInnerField(field string, val any)\n```\n\n```go\nfunc (f *Flag[T]) String() string\n```\n\n```go\nfunc (f *Flag[T]) TakesValue() bool\n```\n\n```go\nfunc (f *Flag[T]) TypeName() string\n```\n\n```go\ntype HasOuterFlag interface {\n\tcli.Flag\n\tSetOuterFlag(cli.Flag)\n\tGetOuterFlag() cli.Flag\n}\n```\n\n```go\ntype InRequest interface {\n\tGetQueryPath() string\n\tGetHeaderPath() string\n\tGetBodyPath() string\n\tIsBodyRoot() bool\n}\n```\nInRequest interface for flags that should be included in HTTP requests\n\n```go\ntype InnerFlag[\n\tT []any | []map[string]any | []DateTimeValue | []DateValue | []TimeValue | []string |\n\t\t[]float64 | []int64 | []bool | any | map[string]any | DateTimeValue | DateValue | TimeValue |\n\t\tstring | float64 | int64 | bool,\n] struct {\n\tName        string        // name of the flag\n\tDefaultText string        // default text of the flag for usage purposes\n\tUsage       string        // usage string for help output\n\tAliases     []string      // aliases that are allowed for this flag\n\tValidator   func(T) error // custom function to validate this flag value\n\n\tOuterFlag  cli.Flag // The flag on which this inner flag will set values\n\tInnerField string   // The inner field which this flag will set\n}\n```\nInnerFlag\\[T] represents a CLI flag for the urfave/cli package that allows setting nested fields within other flags. For example, using \\`--foo.baz\\` will set the \"baz\" field on a parent flag named \\`--foo\\`.\n\n```go\nfunc (f *InnerFlag[T]) Get() any\n```\n\n```go\nfunc (f *InnerFlag[T]) GetDefaultText() string\n```\n\n```go\nfunc (f *InnerFlag[T]) GetEnvVars() []string\n```\n\n```go\nfunc (f *InnerFlag[T]) GetOuterFlag() cli.Flag\n```\n\n```go\nfunc (f *InnerFlag[T]) GetUsage() string\n```\n\n```go\nfunc (f *InnerFlag[T]) GetValue() string\n```\n\n```go\nfunc (f *InnerFlag[T]) IsBoolFlag() bool\n```\n\n```go\nfunc (f *InnerFlag[T]) IsDefaultVisible() bool\n```\n\n```go\nfunc (f *InnerFlag[T]) IsMultiValueFlag() bool\n```\n\n```go\nfunc (f *InnerFlag[T]) IsSet() bool\n```\n\n```go\nfunc (f *InnerFlag[T]) Names() []string\n```\n\n```go\nfunc (f *InnerFlag[T]) PostParse() error\n```\n\n```go\nfunc (f *InnerFlag[T]) PreParse() error\n```\n\n```go\nfunc (f *InnerFlag[T]) Set(name string, rawVal string) error\n```\n\n```go\nfunc (f *InnerFlag[T]) SetOuterFlag(flag cli.Flag)\n```\n\n```go\nfunc (f *InnerFlag[T]) String() string\n```\n\n```go\nfunc (f *InnerFlag[T]) TakesValue() bool\n```\n\n```go\nfunc (f *InnerFlag[T]) TypeName() string\n```\n\n```go\ntype RequestContents struct {\n\tQueries map[string]any\n\tHeaders map[string]any\n\tBody    any\n}\n```\nThe values that will be sent in different parts of a request.\n\n```go\nfunc ExtractRequestContents(cmd *cli.Command) RequestContents\n```\nExtract query parameters, headers, and body values from command flags.\n\n```go\ntype RequiredFlagOrStdin interface {\n\tIsRequiredAsFlagOrStdin() bool\n}\n```\n\n```go\ntype SettableInnerField interface {\n\tSetInnerField(string, any)\n}\n```\nAllow setting inner fields on other flags (e.g. --foo.baz can set the \"baz\" field on the --foo flag)\n\n```go\ntype TimeValue string\n```\n\n```go\nfunc (t *TimeValue) Parse(s string) error\n```\n\n```go\nfunc (t TimeValue) String() string\n```\n\n","path":"github.com/beeper/desktop-api-cli/internal/requestflag","name":"requestflag","synopsis":"","isRedistributable":true}
