MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / toApinto

Method toApinto

gateway/apinto/application.go:55–94  ·  view source on GitHub ↗
(app *gateway.ApplicationRelease)

Source from the content-addressed store, hash-verified

53}
54
55func (a *ApplicationClient) toApinto(app *gateway.ApplicationRelease) interface{} {
56 auths := make([]*entity.Authorization, 0, len(app.Authorizations))
57 for _, info := range app.Authorizations {
58 driver, has := auth.Get(info.Type)
59 if !has {
60 continue
61 }
62 auths = append(auths, &entity.Authorization{
63 Type: info.Type,
64 Position: strings.ToLower(info.Position),
65 TokenName: info.TokenName,
66 Config: driver.ToConfig(info.Config),
67 Users: []*entity.AuthUser{
68 {
69 Expire: info.Expire,
70 Pattern: driver.ToPattern(info.Config),
71 HideCredential: info.HideCredential,
72 Labels: info.Label,
73 },
74 },
75 Labels: info.Label,
76 })
77 }
78 labels := make(map[string]string)
79 if app.Labels != nil {
80 labels = app.Labels
81 }
82 return &entity.Application{
83 BasicInfo: &entity.BasicInfo{
84 ID: genWorkerID(app.ID, gateway.ProfessionApplication),
85 Name: app.ID,
86 Description: app.Description,
87 Driver: "app",
88 Version: app.Version,
89 Matches: nil,
90 },
91 Labels: labels,
92 Authorizations: auths,
93 }
94}

Callers 1

OnlineMethod · 0.95

Calls 4

GetFunction · 0.92
genWorkerIDFunction · 0.85
ToConfigMethod · 0.65
ToPatternMethod · 0.65

Tested by

no test coverage detected