github.com/stripe/stripe-go/v76@v76.25.0/application.go (about)

     1  //
     2  //
     3  // File generated from our OpenAPI spec
     4  //
     5  //
     6  
     7  package stripe
     8  
     9  import "encoding/json"
    10  
    11  type Application struct {
    12  	Deleted bool `json:"deleted"`
    13  	// Unique identifier for the object.
    14  	ID string `json:"id"`
    15  	// The name of the application.
    16  	Name string `json:"name"`
    17  	// String representing the object's type. Objects of the same type share the same value.
    18  	Object string `json:"object"`
    19  }
    20  
    21  // UnmarshalJSON handles deserialization of an Application.
    22  // This custom unmarshaling is needed because the resulting
    23  // property may be an id or the full struct if it was expanded.
    24  func (a *Application) UnmarshalJSON(data []byte) error {
    25  	if id, ok := ParseID(data); ok {
    26  		a.ID = id
    27  		return nil
    28  	}
    29  
    30  	type application Application
    31  	var v application
    32  	if err := json.Unmarshal(data, &v); err != nil {
    33  		return err
    34  	}
    35  
    36  	*a = Application(v)
    37  	return nil
    38  }