MCPcopy Create free account
hub / github.com/elimity-com/scim / Get

Method Get

resource_handler_test.go:69–90  ·  view source on GitHub ↗
(r *http.Request, id string)

Source from the content-addressed store, hash-verified

67}
68
69func (h testResourceHandler) Get(r *http.Request, id string) (Resource, error) {
70 // check if resource exists
71 data, ok := h.data[id]
72 if !ok {
73 return Resource{}, errors.ScimErrorResourceNotFound(id)
74 }
75
76 created, _ := time.ParseInLocation(time.RFC3339, fmt.Sprintf("%v", data.meta["created"]), time.UTC)
77 lastModified, _ := time.Parse(time.RFC3339, fmt.Sprintf("%v", data.meta["lastModified"]))
78
79 // return resource with given identifier
80 return Resource{
81 ID: id,
82 ExternalID: h.externalID(data.resourceAttributes),
83 Attributes: data.resourceAttributes,
84 Meta: Meta{
85 Created: &created,
86 LastModified: &lastModified,
87 Version: fmt.Sprintf("%v", data.meta["version"]),
88 },
89 }, nil
90}
91
92func (h testResourceHandler) GetAll(r *http.Request, params ListRequestParams) (Page, error) {
93 if params.Count == 0 {

Callers

nothing calls this directly

Calls 2

externalIDMethod · 0.95

Tested by

no test coverage detected