MCPcopy Create free account
hub / github.com/algolia/cli / CreateAndFetchApplication

Function CreateAndFetchApplication

pkg/cmd/shared/apputil/create.go:113–130  ·  view source on GitHub ↗

CreateAndFetchApplication creates an application (with region retry) and generates an API key for it. It returns the region the application was actually created in, which may differ from the requested one.

(
	io *iostreams.IOStreams,
	client *dashboard.Client,
	accessToken, region, appName string,
	tracker *telemetry.FlowTracker,
)

Source from the content-addressed store, hash-verified

111// generates an API key for it. It returns the region the application was
112// actually created in, which may differ from the requested one.
113func CreateAndFetchApplication(
114 io *iostreams.IOStreams,
115 client *dashboard.Client,
116 accessToken, region, appName string,
117 tracker *telemetry.FlowTracker,
118) (*dashboard.Application, string, error) {
119 app, createdRegion, err := CreateApplicationWithRetry(io, client, accessToken, region, appName, tracker)
120 if err != nil {
121 return nil, "", err
122 }
123
124 tracker.SetStep(telemetry.StepAPIKey)
125 if err := EnsureAPIKey(io, client, accessToken, app); err != nil {
126 return nil, "", err
127 }
128
129 return app, createdRegion, nil
130}
131
132// EnsureAPIKey generates a write API key for the application.
133// Callers should skip this if the local profile already has a key.

Callers 2

runOAuthFlowStepsFunction · 0.92
createApplicationFunction · 0.92

Calls 3

EnsureAPIKeyFunction · 0.85
SetStepMethod · 0.80

Tested by

no test coverage detected