gitlab.com/evatix-go/core@v1.3.55/reqtype/Request.go (about)

     1  package reqtype
     2  
     3  import (
     4  	"errors"
     5  	"strings"
     6  
     7  	"gitlab.com/evatix-go/core/constants"
     8  	"gitlab.com/evatix-go/core/coredata/corejson"
     9  	"gitlab.com/evatix-go/core/coreinterface/enuminf"
    10  	"gitlab.com/evatix-go/core/errcore"
    11  )
    12  
    13  type Request byte
    14  
    15  // https://www.restapitutorial.com/lessons/httpmethods.html
    16  const (
    17  	Invalid Request = iota
    18  	Create
    19  	Read
    20  	Update
    21  	Delete
    22  	Drop
    23  	CreateOrUpdate
    24  	ExistCheck
    25  	SkipOnExist
    26  	CreateOrSkipOnExist
    27  	UpdateOrSkipOnNonExist
    28  	DeleteOrSkipOnNonExist
    29  	DropOrSkipOnNonExist
    30  	UpdateOnExist
    31  	DropOnExist
    32  	DropCreate
    33  	Append
    34  	AppendByCompare
    35  	AppendByCompareWhereCommentFound
    36  	AppendLinesByCompare
    37  	AppendLines
    38  	CreateOrAppend
    39  	Prepend
    40  	CreateOrPrepend
    41  	PrependLines
    42  	Rename
    43  	Change
    44  	Merge
    45  	MergeLines
    46  	GetHttp
    47  	PutHttp
    48  	PostHttp
    49  	DeleteHttp
    50  	PatchHttp
    51  	Touch
    52  	Start
    53  	Stop
    54  	Restart
    55  	Reload
    56  	StopSleepStart
    57  	Suspend
    58  	Pause
    59  	Resumed
    60  	TryRestart3Times
    61  	TryRestart5Times
    62  	TryStart3Times
    63  	TryStart5Times
    64  	TryStop3Times
    65  	TryStop5Times
    66  	InheritOnly
    67  	InheritPlusOverride
    68  	DynamicAction
    69  	Overwrite
    70  	Override
    71  	Enforce
    72  )
    73  
    74  func (it Request) IsStopEnableStart() bool {
    75  	return false
    76  }
    77  
    78  func (it Request) IsStopDisable() bool {
    79  	return false
    80  }
    81  
    82  func (it Request) IsUndefined() bool {
    83  	return it == Invalid
    84  }
    85  
    86  func (it Request) AllNameValues() []string {
    87  	return BasicEnumImpl.AllNameValues()
    88  }
    89  
    90  func (it Request) OnlySupportedErr(names ...string) error {
    91  	return BasicEnumImpl.OnlySupportedErr(names...)
    92  }
    93  
    94  func (it Request) OnlySupportedMsgErr(message string, names ...string) error {
    95  	return BasicEnumImpl.OnlySupportedMsgErr(message, names...)
    96  }
    97  
    98  func (it Request) ValueUInt16() uint16 {
    99  	return uint16(it)
   100  }
   101  
   102  func (it Request) IntegerEnumRanges() []int {
   103  	return BasicEnumImpl.IntegerEnumRanges()
   104  }
   105  
   106  func (it Request) MinMaxAny() (min, max interface{}) {
   107  	return BasicEnumImpl.MinMaxAny()
   108  }
   109  
   110  func (it Request) MinValueString() string {
   111  	return BasicEnumImpl.MinValueString()
   112  }
   113  
   114  func (it Request) MaxValueString() string {
   115  	return BasicEnumImpl.MaxValueString()
   116  }
   117  
   118  func (it Request) MaxInt() int {
   119  	return BasicEnumImpl.MaxInt()
   120  }
   121  
   122  func (it Request) MinInt() int {
   123  	return BasicEnumImpl.MinInt()
   124  }
   125  
   126  func (it Request) RangesDynamicMap() map[string]interface{} {
   127  	return BasicEnumImpl.RangesDynamicMap()
   128  }
   129  
   130  func (it Request) IsNone() bool {
   131  	return it == Invalid
   132  }
   133  
   134  func (it Request) IsCreateLogically() bool {
   135  	return createMap[it]
   136  }
   137  
   138  func (it Request) IsCreateOrUpdateLogically() bool {
   139  	return createUpdateMap[it]
   140  }
   141  
   142  func (it Request) IsDropLogically() bool {
   143  	return dropMap[it]
   144  }
   145  
   146  func (it Request) IsCrudOnlyLogically() bool {
   147  	return crudMap[it]
   148  }
   149  
   150  func (it Request) IsNotCrudOnlyLogically() bool {
   151  	return !crudMap[it]
   152  }
   153  
   154  func (it Request) IsReadOrEditLogically() bool {
   155  	return readOrEditMap[it]
   156  }
   157  
   158  func (it Request) IsReadOrUpdateLogically() bool {
   159  	return readOrEditMap[it]
   160  }
   161  
   162  func (it Request) IsEditOrUpdateLogically() bool {
   163  	return editOrUpdateMap[it]
   164  }
   165  
   166  func (it Request) IsOnExistCheckLogically() bool {
   167  	return isExistOrSkipOnExistMap[it]
   168  }
   169  
   170  func (it Request) IsOnExistOrSkipOnNonExistLogically() bool {
   171  	return isExistOrSkipOnExistMap[it]
   172  }
   173  
   174  func (it Request) IsUpdateOrRemoveLogically() bool {
   175  	return updateOrRemoveMap[it]
   176  }
   177  
   178  func (it Request) IsOverwrite() bool {
   179  	return it == Overwrite
   180  }
   181  
   182  func (it Request) IsOverride() bool {
   183  	return it == Override
   184  }
   185  
   186  func (it Request) IsEnforce() bool {
   187  	return it == Enforce
   188  }
   189  
   190  func (it Request) IsOverrideOrOverwriteOrEnforce() bool {
   191  	return overrideLogicallyMap[it]
   192  }
   193  
   194  func (it Request) Format(format string) (compiled string) {
   195  	return BasicEnumImpl.Format(format, it)
   196  }
   197  
   198  func (it Request) IsEnumEqual(enum enuminf.BasicEnumer) bool {
   199  	return it.Value() == enum.ValueByte()
   200  }
   201  
   202  func (it Request) IsByteValueEqual(value byte) bool {
   203  	return byte(it) == value
   204  }
   205  
   206  func (it *Request) IsAnyEnumsEqual(enums ...enuminf.BasicEnumer) bool {
   207  	for _, enum := range enums {
   208  		if it.IsEnumEqual(enum) {
   209  			return true
   210  		}
   211  	}
   212  
   213  	return false
   214  }
   215  
   216  func (it Request) IsNameEqual(name string) bool {
   217  	return it.Name() == name
   218  }
   219  
   220  func (it Request) IsAnyNamesOf(names ...string) bool {
   221  	for _, name := range names {
   222  		if it.IsNameEqual(name) {
   223  			return true
   224  		}
   225  	}
   226  
   227  	return false
   228  }
   229  
   230  func (it Request) IsValueEqual(value byte) bool {
   231  	return it.ValueByte() == value
   232  }
   233  
   234  func (it Request) IsAnyValuesEqual(anyByteValues ...byte) bool {
   235  	for _, currentVal := range anyByteValues {
   236  		if it.IsValueEqual(currentVal) {
   237  			return true
   238  		}
   239  	}
   240  
   241  	return false
   242  }
   243  
   244  func (it Request) ValueInt8() int8 {
   245  	return int8(it)
   246  }
   247  
   248  func (it Request) ValueInt16() int16 {
   249  	return int16(it)
   250  }
   251  
   252  func (it Request) ValueInt32() int32 {
   253  	return int32(it)
   254  }
   255  
   256  func (it Request) ValueString() string {
   257  	return it.ToNumberString()
   258  }
   259  
   260  func (it Request) IsValid() bool {
   261  	return it != Invalid
   262  }
   263  
   264  func (it Request) IsInvalid() bool {
   265  	return it == Invalid
   266  }
   267  
   268  func (it Request) NameValue() string {
   269  	return BasicEnumImpl.NameWithValue(it)
   270  }
   271  
   272  func (it Request) IsUninitialized() bool {
   273  	return it == Invalid
   274  }
   275  
   276  func (it Request) RangeNamesCsv() string {
   277  	return BasicEnumImpl.RangeNamesCsv()
   278  }
   279  
   280  func (it Request) TypeName() string {
   281  	return BasicEnumImpl.TypeName()
   282  }
   283  
   284  func (it Request) IsCreate() bool {
   285  	return it == Create
   286  }
   287  
   288  func (it Request) IsRead() bool {
   289  	return it == Read
   290  }
   291  
   292  func (it Request) IsUpdate() bool {
   293  	return it == Update
   294  }
   295  
   296  func (it Request) IsDelete() bool {
   297  	return it == Delete
   298  }
   299  
   300  func (it Request) IsDrop() bool {
   301  	return it == Drop
   302  }
   303  
   304  func (it Request) IsCreateOrUpdate() bool {
   305  	return it == CreateOrUpdate
   306  }
   307  
   308  func (it Request) IsExistCheck() bool {
   309  	return it == ExistCheck
   310  }
   311  
   312  func (it Request) IsSkipOnExist() bool {
   313  	return it == SkipOnExist
   314  }
   315  
   316  func (it Request) IsCreateOrSkipOnExist() bool {
   317  	return it == CreateOrSkipOnExist
   318  }
   319  
   320  func (it Request) IsUpdateOrSkipOnNonExist() bool {
   321  	return it == UpdateOrSkipOnNonExist
   322  }
   323  
   324  func (it Request) IsDeleteOrSkipOnNonExist() bool {
   325  	return it == DeleteOrSkipOnNonExist
   326  }
   327  
   328  func (it Request) IsDropOrSkipOnNonExist() bool {
   329  	return it == DropOrSkipOnNonExist
   330  }
   331  
   332  func (it Request) IsUpdateOnExist() bool {
   333  	return it == UpdateOnExist
   334  }
   335  
   336  func (it Request) IsDropOnExist() bool {
   337  	return it == DropOnExist
   338  }
   339  
   340  func (it Request) IsDropCreate() bool {
   341  	return it == DropCreate
   342  }
   343  
   344  func (it Request) IsAppend() bool {
   345  	return it == Append
   346  }
   347  
   348  func (it Request) IsAppendByCompare() bool {
   349  	return it == AppendByCompare
   350  }
   351  
   352  func (it Request) IsAppendByCompareWhereCommentFound() bool {
   353  	return it == AppendByCompareWhereCommentFound
   354  }
   355  
   356  func (it Request) IsAppendLinesByCompare() bool {
   357  	return it == AppendLinesByCompare
   358  }
   359  
   360  func (it Request) IsAppendLines() bool {
   361  	return it == AppendLines
   362  }
   363  
   364  func (it Request) IsCreateOrAppend() bool {
   365  	return it == CreateOrAppend
   366  }
   367  
   368  func (it Request) IsPrepend() bool {
   369  	return it == Prepend
   370  }
   371  
   372  func (it Request) IsCreateOrPrepend() bool {
   373  	return it == CreateOrPrepend
   374  }
   375  
   376  func (it Request) IsPrependLines() bool {
   377  	return it == PrependLines
   378  }
   379  
   380  func (it Request) IsRename() bool {
   381  	return it == Rename
   382  }
   383  
   384  func (it Request) IsChange() bool {
   385  	return it == Change
   386  }
   387  
   388  func (it Request) IsMerge() bool {
   389  	return it == Merge
   390  }
   391  
   392  func (it Request) IsMergeLines() bool {
   393  	return it == MergeLines
   394  }
   395  
   396  func (it Request) IsGetHttp() bool {
   397  	return it == GetHttp
   398  }
   399  
   400  func (it Request) IsPutHttp() bool {
   401  	return it == PutHttp
   402  }
   403  
   404  func (it Request) IsPostHttp() bool {
   405  	return it == PostHttp
   406  }
   407  
   408  func (it Request) IsDeleteHttp() bool {
   409  	return it == DeleteHttp
   410  }
   411  
   412  func (it Request) IsPatchHttp() bool {
   413  	return it == PatchHttp
   414  }
   415  
   416  func (it Request) IsTouch() bool {
   417  	return it == Touch
   418  }
   419  
   420  func (it Request) IsStart() bool {
   421  	return it == Start
   422  }
   423  
   424  func (it Request) IsStop() bool {
   425  	return it == Stop
   426  }
   427  
   428  func (it Request) IsRestart() bool {
   429  	return it == Restart
   430  }
   431  
   432  func (it Request) IsReload() bool {
   433  	return it == Reload
   434  }
   435  
   436  func (it Request) IsStopSleepStart() bool {
   437  	return it == StopSleepStart
   438  }
   439  
   440  func (it Request) IsSuspend() bool {
   441  	return it == Suspend
   442  }
   443  
   444  func (it Request) IsPause() bool {
   445  	return it == Pause
   446  }
   447  
   448  func (it Request) IsResumed() bool {
   449  	return it == Resumed
   450  }
   451  
   452  func (it Request) IsTryRestart3Times() bool {
   453  	return it == TryRestart3Times
   454  }
   455  
   456  func (it Request) IsTryRestart5Times() bool {
   457  	return it == TryRestart5Times
   458  }
   459  
   460  func (it Request) IsTryStart3Times() bool {
   461  	return it == TryStart3Times
   462  }
   463  
   464  func (it Request) IsTryStart5Times() bool {
   465  	return it == TryStart5Times
   466  }
   467  
   468  func (it Request) IsTryStop3Times() bool {
   469  	return it == TryStop3Times
   470  }
   471  
   472  func (it Request) IsTryStop5Times() bool {
   473  	return it == TryStop5Times
   474  }
   475  
   476  func (it Request) IsInheritOnly() bool {
   477  	return it == InheritOnly
   478  }
   479  
   480  func (it Request) IsInheritPlusOverride() bool {
   481  	return it == InheritPlusOverride
   482  }
   483  
   484  // IsRestartOrReload
   485  //
   486  //  Request. IsRestart() || Request. IsReload()
   487  func (it Request) IsRestartOrReload() bool {
   488  	return it.IsRestart() || it.IsReload()
   489  }
   490  
   491  // IsAnySkipOnExist =>
   492  // IsSkipOnExist, IsCreateOrSkipOnExist,
   493  // IsUpdateOrSkipOnNonExist, IsDeleteOrSkipOnNonExist,
   494  // IsDeleteOrSkipOnNonExist, IsDropOrSkipOnNonExist
   495  func (it Request) IsAnySkipOnExist() bool {
   496  	return it.IsSkipOnExist() ||
   497  		it.IsCreateOrSkipOnExist() ||
   498  		it.IsUpdateOrSkipOnNonExist() ||
   499  		it.IsDeleteOrSkipOnNonExist() ||
   500  		it.IsDropOrSkipOnNonExist()
   501  }
   502  
   503  // IsAnyApplyOnExist =>
   504  // IsUpdateOnExist, IsDropOnExist,
   505  func (it Request) IsAnyApplyOnExist() bool {
   506  	return it.IsUpdateOnExist() ||
   507  		it.IsDropOnExist()
   508  }
   509  
   510  // IsCrud
   511  //
   512  //  returns true if
   513  //      Read,
   514  //      Update,
   515  //      Create,
   516  //      Delete,
   517  //      IsCreateOrUpdate
   518  func (it Request) IsCrud() bool {
   519  	return it.IsRead() ||
   520  		it.IsCreate() ||
   521  		it.IsCreateOrUpdate() ||
   522  		it.IsUpdate() ||
   523  		it.IsDelete()
   524  }
   525  
   526  // IsCrudSkip
   527  //
   528  // returns true if
   529  // IsCreateOrSkipOnExist, IsUpdateOrSkipOnNonExist, IsDeleteOrSkipOnNonExist,
   530  // IsDropOnExist, IsDropOrSkipOnNonExist,
   531  func (it Request) IsCrudSkip() bool {
   532  	return it.IsCreateOrSkipOnExist() ||
   533  		it.IsUpdateOrSkipOnNonExist() ||
   534  		it.IsDeleteOrSkipOnNonExist() ||
   535  		it.IsDropOnExist() ||
   536  		it.IsDropOrSkipOnNonExist()
   537  }
   538  
   539  // IsCrudOrSkip
   540  //
   541  // returns true if
   542  // IsCrud || IsCrudSkip
   543  func (it Request) IsCrudOrSkip() bool {
   544  	return it.IsCrud() ||
   545  		it.IsCrudSkip()
   546  }
   547  
   548  // IsAnyDrop
   549  //
   550  // returns true if
   551  // IsDrop, IsDelete, IsDeleteOrSkipOnNonExist,
   552  // IsDropOnExist, IsDropCreate, IsDropOrSkipOnNonExist
   553  func (it Request) IsAnyDrop() bool {
   554  	return it.IsDrop() ||
   555  		it.IsDelete() ||
   556  		it.IsDeleteOrSkipOnNonExist() ||
   557  		it.IsDropOnExist() ||
   558  		it.IsDropCreate() ||
   559  		it.IsDropOrSkipOnNonExist()
   560  }
   561  
   562  // IsDropSafe
   563  //
   564  // returns true if
   565  // IsDeleteOrSkipOnNonExist, IsDropOnExist,
   566  // IsDropOrSkipOnNonExist
   567  func (it Request) IsDropSafe() bool {
   568  	return it.IsDeleteOrSkipOnNonExist() ||
   569  		it.IsDropOnExist() ||
   570  		it.IsDropOrSkipOnNonExist()
   571  }
   572  
   573  // IsAnyCreate
   574  //
   575  // returns true if
   576  // IsCreate, IsCreateOrUpdate, IsCreateOrAppend,
   577  // IsCreateOrPrepend, IsCreateOrSkipOnExist, IsDropCreate
   578  func (it Request) IsAnyCreate() bool {
   579  	return it.IsCreate() ||
   580  		it.IsCreateOrUpdate() ||
   581  		it.IsCreateOrAppend() ||
   582  		it.IsCreateOrPrepend() ||
   583  		it.IsCreateOrSkipOnExist() ||
   584  		it.IsDropCreate()
   585  }
   586  
   587  // IsAnyHttp
   588  //
   589  // returns true if
   590  // IsGetHttp, IsPostHttp, IsPutHttp,
   591  // IsDeleteHttp, IsPatchHttp
   592  func (it Request) IsAnyHttp() bool {
   593  	return httpRequests[it]
   594  }
   595  
   596  func (it Request) IsAnyAction() bool {
   597  	return actionRequests[it]
   598  }
   599  
   600  func (it Request) IsNotAnyAction() bool {
   601  	return !it.IsAnyAction()
   602  }
   603  
   604  func (it Request) IsAnyHttpMethod(methodNames ...string) bool {
   605  	return it.IsAnyHttp() && it.IsAnyNamesOf(methodNames...)
   606  }
   607  
   608  func (it Request) IsNotHttpMethod() bool {
   609  	return !it.IsAnyHttp()
   610  }
   611  
   612  func (it Request) IsNotOverrideOrOverwriteOrEnforce() bool {
   613  	return !it.IsOverrideOrOverwriteOrEnforce()
   614  }
   615  
   616  func (it Request) Name() string {
   617  	return BasicEnumImpl.ToEnumString(it.Value())
   618  }
   619  
   620  func (it Request) ToNumberString() string {
   621  	return BasicEnumImpl.ToNumberString(it.Value())
   622  }
   623  
   624  func (it Request) UnmarshallEnumToValue(
   625  	jsonUnmarshallingValue []byte,
   626  ) (byte, error) {
   627  	return BasicEnumImpl.UnmarshallToValue(true, jsonUnmarshallingValue)
   628  }
   629  
   630  func (it Request) IsValidRange() bool {
   631  	return BasicEnumImpl.IsValidRange(it.Value())
   632  }
   633  
   634  // IsInBetween edge case including the start, end
   635  func (it Request) IsInBetween(
   636  	start, end Request,
   637  ) bool {
   638  	val := it.Value()
   639  
   640  	return val >= start.Value() && val <= end.Value()
   641  }
   642  
   643  func (it Request) CurrentNotImpl(
   644  	reference interface{},
   645  	messages ...string,
   646  ) error {
   647  	compiledMessage := strings.Join(messages, constants.Space)
   648  	fullCompiled := it.String() +
   649  		" : is not implemented. " +
   650  		compiledMessage
   651  
   652  	if reference == nil {
   653  		return errcore.NotImplementedType.ErrorNoRefs(fullCompiled)
   654  	}
   655  
   656  	return errcore.NotImplementedType.Error(fullCompiled, reference)
   657  }
   658  
   659  func (it Request) NotSupportedErr(
   660  	message string,
   661  	reference interface{},
   662  ) error {
   663  	return errcore.NotSupportedType.Error(
   664  		message,
   665  		reference)
   666  }
   667  
   668  // IsNotAnyOfReqs returns true only if none of these matches
   669  func (it Request) IsNotAnyOfReqs(reqs ...Request) bool {
   670  	if len(reqs) == 0 {
   671  		return true
   672  	}
   673  
   674  	for _, req := range reqs {
   675  		if req == it {
   676  			return false
   677  		}
   678  	}
   679  
   680  	return true
   681  }
   682  
   683  // IsAnyOfReqs returns true if current one is matching with any of it
   684  func (it Request) IsAnyOfReqs(reqs ...Request) bool {
   685  	if len(reqs) == 0 {
   686  		return true
   687  	}
   688  
   689  	for _, req := range reqs {
   690  		if req == it {
   691  			return true
   692  		}
   693  	}
   694  
   695  	return false
   696  }
   697  
   698  // GetStatusAnyOf returns status success true if current one is any of the given values.
   699  func (it Request) GetStatusAnyOf(reqs ...Request) *ResultStatus {
   700  	if len(reqs) == 0 {
   701  		return &ResultStatus{
   702  			IsSuccess:  true,
   703  			IndexMatch: constants.InvalidNotFoundCase,
   704  			Ranges:     reqs,
   705  		}
   706  	}
   707  
   708  	for i, req := range reqs {
   709  		if req == it {
   710  			return &ResultStatus{
   711  				IsSuccess:  true,
   712  				IndexMatch: i,
   713  				Ranges:     reqs,
   714  			}
   715  		}
   716  	}
   717  
   718  	errMsg := errcore.RangeNotMeet(
   719  		"Failed GetStatusAnyOf",
   720  		start(reqs),
   721  		end(reqs),
   722  		reqs)
   723  
   724  	return &ResultStatus{
   725  		IsSuccess:  true,
   726  		IndexMatch: constants.InvalidNotFoundCase,
   727  		Ranges:     reqs,
   728  		Error:      errors.New(errMsg),
   729  	}
   730  }
   731  
   732  // GetInBetweenStatus edge case including the start, end
   733  func (it Request) GetInBetweenStatus(start, end Request) *ResultStatus {
   734  	isInBetween := it.IsInBetween(start, end)
   735  	ranges := RangesInBetween(start, end)
   736  
   737  	if isInBetween {
   738  		return &ResultStatus{
   739  			IsSuccess:  isInBetween,
   740  			IndexMatch: it.ValueInt(),
   741  			Ranges:     ranges,
   742  			Error:      nil,
   743  		}
   744  	}
   745  
   746  	errMsg := errcore.RangeNotMeet(
   747  		"Failed GetInBetweenStatus",
   748  		start,
   749  		end,
   750  		ranges)
   751  
   752  	return &ResultStatus{
   753  		IsSuccess:  false,
   754  		IndexMatch: constants.InvalidNotFoundCase,
   755  		Ranges:     ranges,
   756  		Error:      errors.New(errMsg),
   757  	}
   758  }
   759  
   760  func (it Request) MaxByte() byte {
   761  	return BasicEnumImpl.Max()
   762  }
   763  
   764  func (it Request) MinByte() byte {
   765  	return BasicEnumImpl.Min()
   766  }
   767  
   768  func (it Request) ValueByte() byte {
   769  	return it.Value()
   770  }
   771  
   772  func (it Request) RangesByte() []byte {
   773  	return BasicEnumImpl.Ranges()
   774  }
   775  
   776  func (it Request) Value() byte {
   777  	return byte(it)
   778  }
   779  
   780  func (it Request) ValueInt() int {
   781  	return int(it)
   782  }
   783  
   784  func (it Request) IsAnyOf(checkingItems ...byte) bool {
   785  	return BasicEnumImpl.IsAnyOf(it.Value(), checkingItems...)
   786  }
   787  
   788  func (it Request) String() string {
   789  	return BasicEnumImpl.ToEnumString(it.Value())
   790  }
   791  
   792  func (it *Request) UnmarshalJSON(data []byte) error {
   793  	dataConv, err := it.UnmarshallEnumToValue(data)
   794  
   795  	if err == nil {
   796  		*it = Request(dataConv)
   797  	}
   798  
   799  	return err
   800  }
   801  
   802  func (it Request) ToPtr() *Request {
   803  	return &it
   804  }
   805  
   806  func (it *Request) ToSimple() Request {
   807  	if it == nil {
   808  		return Invalid
   809  	}
   810  
   811  	return *it
   812  }
   813  
   814  func (it Request) MarshalJSON() ([]byte, error) {
   815  	return BasicEnumImpl.ToEnumJsonBytes(it.Value())
   816  }
   817  
   818  func (it Request) EnumType() enuminf.EnumTyper {
   819  	return BasicEnumImpl.EnumType()
   820  }
   821  
   822  func (it Request) AsBasicEnumContractsBinder() enuminf.BasicEnumContractsBinder {
   823  	return &it
   824  }
   825  
   826  func (it *Request) AsJsonMarshaller() corejson.JsonMarshaller {
   827  	return it
   828  }
   829  
   830  func (it Request) AsBasicByteEnumContractsBinder() enuminf.BasicByteEnumContractsBinder {
   831  	return &it
   832  }
   833  
   834  func (it Request) AsCrudTyper() enuminf.CrudTyper {
   835  	return &it
   836  }
   837  
   838  func (it Request) AsOverwriteOrRideOrEnforcer() enuminf.OverwriteOrRideOrEnforcer {
   839  	return &it
   840  }
   841  
   842  func (it Request) AsHttpMethodTyper() enuminf.HttpMethodTyper {
   843  	return &it
   844  }
   845  
   846  func (it Request) AsActionTyper() enuminf.ActionTyper {
   847  	return &it
   848  }