Esempio n. 1
0
func (h *testServiceHandler) _http_TestService_List(ctx golang_org_x_net_context.Context, rw net_http.ResponseWriter, req *net_http.Request) error {
	if req.Method != "GET" {
		return github_com_juju_errors.MethodNotAllowedf("expected GET request")
	}

	var (
		input ListOptions
	)

	ctx = github_com_limbo_services_core_runtime_limbo.AnnotateContext(ctx, req)

	// populate after=after
	{
		var msg0 = &input
		val := req.URL.Query().Get("after")
		intVal, _ := strconv.ParseInt(val, 10, 64)
		msg0.After = int64(intVal)
	}

	{ // call
		ss, err := github_com_limbo_services_core_runtime_limbo.NewPagedServerStream(ctx, rw, 0)
		if err != nil {
			return github_com_juju_errors.Trace(err)
		}
		defer ss.Close()
		stream := &testServiceListServer{ss}
		err = h.ss.List(&input, stream)
	}

	return nil
}
Esempio n. 2
0
func (h *testServiceHandler) _http_TestService_FetchPerson(ctx golang_org_x_net_context.Context, rw net_http.ResponseWriter, req *net_http.Request) error {
	if req.Method != "GET" {
		return github_com_juju_errors.MethodNotAllowedf("expected GET request")
	}

	var (
		input  FetchOptions
		params = github_com_limbo_services_core_runtime_router.P(ctx)
	)

	ctx = github_com_limbo_services_core_runtime_limbo.AnnotateContext(ctx, req)

	// populate id
	{
		var msg0 = &input
		val := params.Get("id")
		intVal, _ := strconv.ParseInt(val, 10, 64)
		msg0.Id = int64(intVal)
	}

	{ // call
		output, err := h.ss.FetchPerson(ctx, &input)
		if err != nil {
			return github_com_juju_errors.Trace(err)
		}
		github_com_limbo_services_core_runtime_limbo.RenderMessageJSON(rw, 200, output)
		return nil
	}

	return nil
}
Esempio n. 3
0
func (h *testServiceHandler) _http_TestService_Greet(ctx golang_org_x_net_context.Context, rw net_http.ResponseWriter, req *net_http.Request) error {
	if req.Method != "POST" {
		return github_com_juju_errors.MethodNotAllowedf("expected POST request")
	}

	var (
		input Person
	)

	ctx = github_com_limbo_services_core_runtime_limbo.AnnotateContext(ctx, req)

	{ // from body
		err := encoding_json.NewDecoder(req.Body).Decode(&input)
		if err != nil {
			return github_com_juju_errors.Trace(err)
		}
	}

	{ // call
		output, err := h.ss.Greet(ctx, &input)
		if err != nil {
			return github_com_juju_errors.Trace(err)
		}
		github_com_limbo_services_core_runtime_limbo.RenderMessageJSON(rw, 200, output)
		return nil
	}

	return nil
}