Exemple #1
0
// create client resource's method
func newGoClientMethod(r *raml.Resource, rd *resource.Resource, m *raml.Method, methodName string) (resource.MethodInterface, error) {
	method := resource.NewMethod(r, rd, m, methodName, setBodyName)

	method.ResourcePath = commons.ParamizingURI(method.Endpoint, "+")

	name := commons.NormalizeURITitle(method.Endpoint)

	method.ReqBody = setBodyName(m.Bodies, name+methodName, "ReqBody")

	gcm := clientMethod{Method: &method}
	err := gcm.setup(methodName)
	return gcm, err
}
Exemple #2
0
func newMethod(r *raml.Resource, rd *cr.Resource, m *raml.Method,
	methodName string) (cr.MethodInterface, error) {

	rm := cr.NewMethod(r, rd, m, methodName, setBodyName)

	// set method name
	if len(rm.DisplayName) > 0 {
		rm.MethodName = strings.Replace(rm.DisplayName, " ", "", -1)
	} else {
		rm.MethodName = commons.NormalizeURI(formatProcName(r.FullURI())) + methodName
	}
	rm.ResourcePath = commons.ParamizingURI(rm.Endpoint, "&")
	return method{Method: &rm}, nil
}