Byron / google-apis-rs

A binding and CLI generator for all Google APIs
http://byron.github.io/google-apis-rs
Other
1.01k stars 131 forks source link

Can't set apns parameters with google-fcm1 #336

Closed pognibene closed 1 year ago

pognibene commented 2 years ago

Hi, In the generated code, ApnsConfig::payload is an Option<HashMap<String, String>>. However, according to Apple/fcm specs, this is the payload we should send:

"apns": {
    "fcmOptions": null,
    "headers": {
      "apns-priority": "10"
    },
    "payload": {
      "aps": {
           "sound":"sound.wav",
           "alert": {
               "loc-key": "my_loc_key"
           }
      }
    }
  }

I can't find a way to generate the proper apns payload with a String value. Is this a generation bug, or I overlooked a way to achieve the desired result? Thank you for your help!

Byron commented 2 years ago

I don't know. The generator generates according to the spec. Maybe it changed in the mean time. The +YYYY-MM-DD suffix of the crate reveals the time stamp of the spec that was used.

That said, I wouldn't bet on this not being a generation bug either. As workaround, you could consider vendoring the crate and adding the type that's needed here yourself.

tyranron commented 1 year ago

@Byron I guess this may be closed now, as should be fixed by #404.

Byron commented 1 year ago

Thanks for the hint! Done.