Пример #1
0
// New creates m.
func (c Client) New(m offer.Offer) (offer.Offer, error) {
	m.Interface = nil
	var argument = struct {
		Arguments struct {
			M offer.Offer
		}
		Context Context
	}{
		Arguments: struct {
			M offer.Offer
		}{
			M: m,
		},
		Context: c.Context,
	}
	var result struct {
		Offer offer.Offer
	}
	c.Configuration.OnCall("New", argument.Context, argument.Arguments)
	var err = c.Client.Call(c.Name+".New", argument, &result)
	c.Configuration.OnReturn("New", argument.Context, result, err)
	result.Offer.Interface = c
	return result.Offer, err
}
Пример #2
0
// Delete deletes m.
func (c Client) Delete(m offer.Offer) (offer.Offer, error) {
	m.Interface = nil // Avoid encoding the Service or Client
	var argument = struct {
		Arguments struct { // Method arguments
			M offer.Offer // m
		}
		Context Context // Call context
	}{
		Arguments: struct { // Method arguments
			M offer.Offer // m
		}{
			M: m, // m
		},
		Context: c.Context, // Call context
	}
	var result struct { // Method result
		Offer offer.Offer // Only one non-error result
	}
	c.Configuration.OnCall("Delete", argument.Context, argument.Arguments) // Called because Configuration implements it
	var err = c.Client.Call(c.Name+".Delete", argument, &result)
	c.Configuration.OnReturn("Delete", argument.Context, result, err) // Called because Configuration implements it
	result.Offer.Interface = c                                        // Enable method calls like m.Delete(). See offer.Offer.Delete.
	return result.Offer, err
}
Пример #3
0
func simplify(o offer.Offer) offer.Offer {
	o.Interface = nil
	return o
}