github.com/primecitizens/pcz/std@v0.2.1/plat/js/webext/echoprivate/apis_js_wasm.go (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  
     4  package echoprivate
     5  
     6  import (
     7  	"github.com/primecitizens/pcz/std/ffi/js"
     8  	"github.com/primecitizens/pcz/std/plat/js/webext/echoprivate/bindings"
     9  )
    10  
    11  type GetUserConsentArgConsentRequester struct {
    12  	// Origin is "GetUserConsentArgConsentRequester.origin"
    13  	//
    14  	// Required
    15  	Origin js.String
    16  	// ServiceName is "GetUserConsentArgConsentRequester.serviceName"
    17  	//
    18  	// Required
    19  	ServiceName js.String
    20  	// TabId is "GetUserConsentArgConsentRequester.tabId"
    21  	//
    22  	// Optional
    23  	//
    24  	// NOTE: FFI_USE_TabId MUST be set to true to make this field effective.
    25  	TabId int64
    26  
    27  	FFI_USE_TabId bool // for TabId.
    28  
    29  	FFI_USE bool
    30  }
    31  
    32  // FromRef calls UpdateFrom and returns a GetUserConsentArgConsentRequester with all fields set.
    33  func (p GetUserConsentArgConsentRequester) FromRef(ref js.Ref) GetUserConsentArgConsentRequester {
    34  	p.UpdateFrom(ref)
    35  	return p
    36  }
    37  
    38  // New creates a new GetUserConsentArgConsentRequester in the application heap.
    39  func (p GetUserConsentArgConsentRequester) New() js.Ref {
    40  	return bindings.GetUserConsentArgConsentRequesterJSLoad(
    41  		js.Pointer(&p), js.True, 0,
    42  	)
    43  }
    44  
    45  // UpdateFrom copies value of all fields of the heap object to p.
    46  func (p *GetUserConsentArgConsentRequester) UpdateFrom(ref js.Ref) {
    47  	bindings.GetUserConsentArgConsentRequesterJSStore(
    48  		js.Pointer(p), ref,
    49  	)
    50  }
    51  
    52  // Update writes all fields of the p to the heap object referenced by ref.
    53  func (p *GetUserConsentArgConsentRequester) Update(ref js.Ref) {
    54  	bindings.GetUserConsentArgConsentRequesterJSLoad(
    55  		js.Pointer(p), js.False, ref,
    56  	)
    57  }
    58  
    59  // FreeMembers frees fields with heap reference, if recursive is true
    60  // free all heap references reachable from p.
    61  func (p *GetUserConsentArgConsentRequester) FreeMembers(recursive bool) {
    62  	js.Free(
    63  		p.Origin.Ref(),
    64  		p.ServiceName.Ref(),
    65  	)
    66  	p.Origin = p.Origin.FromRef(js.Undefined)
    67  	p.ServiceName = p.ServiceName.FromRef(js.Undefined)
    68  }
    69  
    70  // HasFuncGetOfferInfo returns true if the function "WEBEXT.echoPrivate.getOfferInfo" exists.
    71  func HasFuncGetOfferInfo() bool {
    72  	return js.True == bindings.HasFuncGetOfferInfo()
    73  }
    74  
    75  // FuncGetOfferInfo returns the function "WEBEXT.echoPrivate.getOfferInfo".
    76  func FuncGetOfferInfo() (fn js.Func[func(id js.String) js.Promise[js.Any]]) {
    77  	bindings.FuncGetOfferInfo(
    78  		js.Pointer(&fn),
    79  	)
    80  	return
    81  }
    82  
    83  // GetOfferInfo calls the function "WEBEXT.echoPrivate.getOfferInfo" directly.
    84  func GetOfferInfo(id js.String) (ret js.Promise[js.Any]) {
    85  	bindings.CallGetOfferInfo(
    86  		js.Pointer(&ret),
    87  		id.Ref(),
    88  	)
    89  
    90  	return
    91  }
    92  
    93  // TryGetOfferInfo calls the function "WEBEXT.echoPrivate.getOfferInfo"
    94  // in a try/catch block and returns (_, err, ok = false) when it went through
    95  // the catch clause.
    96  func TryGetOfferInfo(id js.String) (ret js.Promise[js.Any], exception js.Any, ok bool) {
    97  	ok = js.True == bindings.TryGetOfferInfo(
    98  		js.Pointer(&ret), js.Pointer(&exception),
    99  		id.Ref(),
   100  	)
   101  
   102  	return
   103  }
   104  
   105  // HasFuncGetOobeTimestamp returns true if the function "WEBEXT.echoPrivate.getOobeTimestamp" exists.
   106  func HasFuncGetOobeTimestamp() bool {
   107  	return js.True == bindings.HasFuncGetOobeTimestamp()
   108  }
   109  
   110  // FuncGetOobeTimestamp returns the function "WEBEXT.echoPrivate.getOobeTimestamp".
   111  func FuncGetOobeTimestamp() (fn js.Func[func() js.Promise[js.String]]) {
   112  	bindings.FuncGetOobeTimestamp(
   113  		js.Pointer(&fn),
   114  	)
   115  	return
   116  }
   117  
   118  // GetOobeTimestamp calls the function "WEBEXT.echoPrivate.getOobeTimestamp" directly.
   119  func GetOobeTimestamp() (ret js.Promise[js.String]) {
   120  	bindings.CallGetOobeTimestamp(
   121  		js.Pointer(&ret),
   122  	)
   123  
   124  	return
   125  }
   126  
   127  // TryGetOobeTimestamp calls the function "WEBEXT.echoPrivate.getOobeTimestamp"
   128  // in a try/catch block and returns (_, err, ok = false) when it went through
   129  // the catch clause.
   130  func TryGetOobeTimestamp() (ret js.Promise[js.String], exception js.Any, ok bool) {
   131  	ok = js.True == bindings.TryGetOobeTimestamp(
   132  		js.Pointer(&ret), js.Pointer(&exception),
   133  	)
   134  
   135  	return
   136  }
   137  
   138  // HasFuncGetRegistrationCode returns true if the function "WEBEXT.echoPrivate.getRegistrationCode" exists.
   139  func HasFuncGetRegistrationCode() bool {
   140  	return js.True == bindings.HasFuncGetRegistrationCode()
   141  }
   142  
   143  // FuncGetRegistrationCode returns the function "WEBEXT.echoPrivate.getRegistrationCode".
   144  func FuncGetRegistrationCode() (fn js.Func[func(typ js.String) js.Promise[js.String]]) {
   145  	bindings.FuncGetRegistrationCode(
   146  		js.Pointer(&fn),
   147  	)
   148  	return
   149  }
   150  
   151  // GetRegistrationCode calls the function "WEBEXT.echoPrivate.getRegistrationCode" directly.
   152  func GetRegistrationCode(typ js.String) (ret js.Promise[js.String]) {
   153  	bindings.CallGetRegistrationCode(
   154  		js.Pointer(&ret),
   155  		typ.Ref(),
   156  	)
   157  
   158  	return
   159  }
   160  
   161  // TryGetRegistrationCode calls the function "WEBEXT.echoPrivate.getRegistrationCode"
   162  // in a try/catch block and returns (_, err, ok = false) when it went through
   163  // the catch clause.
   164  func TryGetRegistrationCode(typ js.String) (ret js.Promise[js.String], exception js.Any, ok bool) {
   165  	ok = js.True == bindings.TryGetRegistrationCode(
   166  		js.Pointer(&ret), js.Pointer(&exception),
   167  		typ.Ref(),
   168  	)
   169  
   170  	return
   171  }
   172  
   173  // HasFuncGetUserConsent returns true if the function "WEBEXT.echoPrivate.getUserConsent" exists.
   174  func HasFuncGetUserConsent() bool {
   175  	return js.True == bindings.HasFuncGetUserConsent()
   176  }
   177  
   178  // FuncGetUserConsent returns the function "WEBEXT.echoPrivate.getUserConsent".
   179  func FuncGetUserConsent() (fn js.Func[func(consentRequester GetUserConsentArgConsentRequester) js.Promise[js.Boolean]]) {
   180  	bindings.FuncGetUserConsent(
   181  		js.Pointer(&fn),
   182  	)
   183  	return
   184  }
   185  
   186  // GetUserConsent calls the function "WEBEXT.echoPrivate.getUserConsent" directly.
   187  func GetUserConsent(consentRequester GetUserConsentArgConsentRequester) (ret js.Promise[js.Boolean]) {
   188  	bindings.CallGetUserConsent(
   189  		js.Pointer(&ret),
   190  		js.Pointer(&consentRequester),
   191  	)
   192  
   193  	return
   194  }
   195  
   196  // TryGetUserConsent calls the function "WEBEXT.echoPrivate.getUserConsent"
   197  // in a try/catch block and returns (_, err, ok = false) when it went through
   198  // the catch clause.
   199  func TryGetUserConsent(consentRequester GetUserConsentArgConsentRequester) (ret js.Promise[js.Boolean], exception js.Any, ok bool) {
   200  	ok = js.True == bindings.TryGetUserConsent(
   201  		js.Pointer(&ret), js.Pointer(&exception),
   202  		js.Pointer(&consentRequester),
   203  	)
   204  
   205  	return
   206  }
   207  
   208  // HasFuncSetOfferInfo returns true if the function "WEBEXT.echoPrivate.setOfferInfo" exists.
   209  func HasFuncSetOfferInfo() bool {
   210  	return js.True == bindings.HasFuncSetOfferInfo()
   211  }
   212  
   213  // FuncSetOfferInfo returns the function "WEBEXT.echoPrivate.setOfferInfo".
   214  func FuncSetOfferInfo() (fn js.Func[func(id js.String, offerInfo js.Any)]) {
   215  	bindings.FuncSetOfferInfo(
   216  		js.Pointer(&fn),
   217  	)
   218  	return
   219  }
   220  
   221  // SetOfferInfo calls the function "WEBEXT.echoPrivate.setOfferInfo" directly.
   222  func SetOfferInfo(id js.String, offerInfo js.Any) (ret js.Void) {
   223  	bindings.CallSetOfferInfo(
   224  		js.Pointer(&ret),
   225  		id.Ref(),
   226  		offerInfo.Ref(),
   227  	)
   228  
   229  	return
   230  }
   231  
   232  // TrySetOfferInfo calls the function "WEBEXT.echoPrivate.setOfferInfo"
   233  // in a try/catch block and returns (_, err, ok = false) when it went through
   234  // the catch clause.
   235  func TrySetOfferInfo(id js.String, offerInfo js.Any) (ret js.Void, exception js.Any, ok bool) {
   236  	ok = js.True == bindings.TrySetOfferInfo(
   237  		js.Pointer(&ret), js.Pointer(&exception),
   238  		id.Ref(),
   239  		offerInfo.Ref(),
   240  	)
   241  
   242  	return
   243  }