func RegisterResumeService() {
	service := &ResumeService{}

	api, err := endpoints.RegisterService(service, "resume", "v1", "Resume API", true)

	if err != nil {
		panic(err.Error())
	}

	info := api.MethodByName("Awaken").Info()
	info.Name, info.HTTPMethod, info.Path, info.Desc = "awaken", "GET", "api", "Awakens the resume service"

	info2 := api.MethodByName("Get").Info()
	info2.Name, info2.HTTPMethod, info2.Path, info2.Desc = "get", "GET", "resume", "Fetches a resume"
}
func init() {
	api, err := endpoints.RegisterService(&SwiftSampleApi{}, "swiftsampleapi", "v1", "Swift Sample API", true)

	if err != nil {
		panic(err.Error())
	}

	info := api.MethodByName("GetMessage").Info()
	info.Name, info.HttpMethod, info.Path, info.Desc = "message.get", "GET", "message", "Get greeting"

	info = api.MethodByName("PostMessage").Info()

	info.Name, info.HttpMethod, info.Path, info.Desc = "message.post", "POST", "message", "Post greeting"
	info.Scopes, info.Audiences, info.ClientIds = Scopes, Audiences, ClientIds

	endpoints.HandleHttp()
}
Exemple #3
0
// RegisterService exposes TicTacToeApi methods as API endpoints.
//
// The registration/initialization during startup is not performed here but
// in app package. It is separated from this package (tictactoe) so that the
// service and its methods defined here can be used in another app,
// e.g. http://github.com/crhym3/go-endpoints.appspot.com.
func RegisterService() (*endpoints.RpcService, error) {
	api := &TicTacToeApi{}
	rpcService, err := endpoints.RegisterService(api,
		"tictactoe", "v1", "Tic Tac Toe API", true)
	if err != nil {
		return nil, err
	}

	info := rpcService.MethodByName("BoardGetMove").Info()
	info.Path, info.HttpMethod, info.Name = "board", "POST", "board.getmove"
	info.Scopes, info.ClientIds, info.Audiences = scopes, clientIds, audiences

	info = rpcService.MethodByName("ScoresList").Info()
	info.Path, info.HttpMethod, info.Name = "scores", "GET", "scores.list"
	info.Scopes, info.ClientIds, info.Audiences = scopes, clientIds, audiences

	info = rpcService.MethodByName("ScoresInsert").Info()
	info.Path, info.HttpMethod, info.Name = "scores", "POST", "scores.insert"
	info.Scopes, info.ClientIds, info.Audiences = scopes, clientIds, audiences

	return rpcService, nil
}
Exemple #4
0
func init() {
	api := &TicTacToeApi{}
	rpcService, err := endpoints.RegisterService(api,
		"tictactoe", "v1", "Tic Tac Toe API", true)
	if err != nil {
		panic(err.Error())
	}

	info := rpcService.MethodByName("BoardGetMove").Info()
	info.Path, info.HttpMethod, info.Name, info.Scopes, info.ClientIds =
		"board", "POST", "board.getmove", defaultScopes, clientIds

	info = rpcService.MethodByName("ScoresList").Info()
	info.Path, info.HttpMethod, info.Name, info.Scopes, info.ClientIds =
		"scores", "GET", "scores.list", defaultScopes, clientIds

	info = rpcService.MethodByName("ScoresInsert").Info()
	info.Path, info.HttpMethod, info.Name, info.Scopes, info.ClientIds =
		"scores", "POST", "scores.insert", defaultScopes, clientIds

	endpoints.HandleHttp()
}
Exemple #5
0
func registerCloudEndpoints() {
	// Create instance of our service
	service := &MessengerService{}

	// Register our service as an endpoint service
	api, err := endpoints.RegisterService(service, "messenger", "v1", "Messenger API", true)
	if err != nil {
		panic(err.Error())
	}

	// Register Echo method
	info := api.MethodByName("Echo").Info()
	info.Name, info.HttpMethod, info.Path, info.Desc =
		"Echo", "POST", "Echo", "Echoes your message."

	// Register Send method
	info = api.MethodByName("Send").Info()
	info.Name, info.HttpMethod, info.Path, info.Desc =
		"Send", "POST", "Send", "Sends your message to the specified device."

	// Start handling requests
	endpoints.HandleHttp()
}