default offer flag
This commit is contained in:
parent
1f5c3041bd
commit
eba8ee75e0
5 changed files with 13 additions and 4 deletions
|
|
@ -1120,6 +1120,7 @@ The nostr server will send back a message response, and inside the body there wi
|
|||
|
||||
### OfferConfig
|
||||
- __callback_url__: _string_
|
||||
- __default_offer__: _boolean_
|
||||
- __expected_data__: MAP with key: _string_ and value: _[OfferDataType](#OfferDataType)_
|
||||
- __label__: _string_
|
||||
- __noffer__: _string_
|
||||
|
|
|
|||
|
|
@ -396,6 +396,7 @@ type NewInvoiceResponse struct {
|
|||
}
|
||||
type OfferConfig struct {
|
||||
Callback_url string `json:"callback_url"`
|
||||
Default_offer bool `json:"default_offer"`
|
||||
Expected_data map[string]OfferDataType `json:"expected_data"`
|
||||
Label string `json:"label"`
|
||||
Noffer string `json:"noffer"`
|
||||
|
|
|
|||
|
|
@ -2244,6 +2244,7 @@ export const NewInvoiceResponseValidate = (o?: NewInvoiceResponse, opts: NewInvo
|
|||
|
||||
export type OfferConfig = {
|
||||
callback_url: string
|
||||
default_offer: boolean
|
||||
expected_data: Record<string, OfferDataType>
|
||||
label: string
|
||||
noffer: string
|
||||
|
|
@ -2254,6 +2255,7 @@ export const OfferConfigOptionalFields: [] = []
|
|||
export type OfferConfigOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
callback_url_CustomCheck?: (v: string) => boolean
|
||||
default_offer_CustomCheck?: (v: boolean) => boolean
|
||||
expected_data_CustomCheck?: (v: Record<string, OfferDataType>) => boolean
|
||||
label_CustomCheck?: (v: string) => boolean
|
||||
noffer_CustomCheck?: (v: string) => boolean
|
||||
|
|
@ -2267,6 +2269,9 @@ export const OfferConfigValidate = (o?: OfferConfig, opts: OfferConfigOptions =
|
|||
if (typeof o.callback_url !== 'string') return new Error(`${path}.callback_url: is not a string`)
|
||||
if (opts.callback_url_CustomCheck && !opts.callback_url_CustomCheck(o.callback_url)) return new Error(`${path}.callback_url: custom check failed`)
|
||||
|
||||
if (typeof o.default_offer !== 'boolean') return new Error(`${path}.default_offer: is not a boolean`)
|
||||
if (opts.default_offer_CustomCheck && !opts.default_offer_CustomCheck(o.default_offer)) return new Error(`${path}.default_offer: custom check failed`)
|
||||
|
||||
if (typeof o.expected_data !== 'object' || o.expected_data === null) return new Error(`${path}.expected_data: is not an object or is null`)
|
||||
for (const key in o.expected_data) {
|
||||
if (!enumCheckOfferDataType(o.expected_data[key])) return new Error(`${path}.expected_data['${key}']: is not a OfferDataType`)
|
||||
|
|
|
|||
|
|
@ -636,6 +636,7 @@ message OfferConfig {
|
|||
string callback_url = 4;
|
||||
map<string, OfferDataType> expected_data = 5;
|
||||
string noffer = 6;
|
||||
bool default_offer = 7;
|
||||
}
|
||||
|
||||
message UserOffers {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue