Returns the requested resource object or list of resource objects

@param string Resource location, e.g. "basket"
@param string Related resource, e.g. "product"
@return string Generated output
760260
public function getAction( $resource, $related )
	{
		$response = $this->createClient( $resource, $related )->get( $this->getPsrRequest(), new Response() );
		return $this->setPsrResponse( $response );
	}
1300997
public function get($resource = null, $data = array())
    {
        return $this->call($resource, AnHttpRequest::GET, $data);
    }
1100009
private static function mapResource($resource, $object)
    {
        if ($object == false || is_string($object)) {
            return $object;
        }

        $baseResource = __NAMESPACE__ . '\\' . $resource;
        $class = (class_exists($baseResource)) ? $baseResource : 'Bigcommerce\\Api\\Resources\\' . $resource;
        return new $class($object);
    }
760734
public static Collection<URL> findResources(final String resource) {
        final Collection<UrlResource> urlResources = findUrlResources(resource);
        final Collection<URL> resources = new LinkedHashSet<>(urlResources.size());
        for (final UrlResource urlResource : urlResources) {
            resources.add(urlResource.getUrl());
        }
        return resources;
    }
221801
public function getRecipientOrganizerFromEntity(array $related_entity, array $data) {
    $recipients = [];

    // Don't return recipients if user comments on own content.
    $original_related_object = $data['related_object'][0];
    if (isset($original_related_object['target_type'])
      && $original_related_object['target_type'] === 'event_enrollment'
      && $related_entity !== NULL) {
      $storage = \Drupal::entityTypeManager()->getStorage($related_entity['target_type']);
      $event = $storage->load($related_entity['target_id']);

      if ($event === NULL) {
        return $recipients;
      }

      $recipients[] = [
        'target_type' => 'user',
        'target_id' => $event->getOwnerId(),
      ];
    }

    // If there are any others we should add. Make them also part of the
    // recipients array.
    \Drupal::moduleHandler()
      ->alter('activity_recipient_organizer', $recipients, $event);

    return $recipients;
  }
1214074
public function getId($resource): ?string
    {
        assert(get_class($resource) === static::MODEL);
        assert($this->classImplements(static::MODEL, ModelInterface::class) === true);

        /** @var ModelInterface $modelClass */
        $modelClass = static::MODEL;

        $pkName = $modelClass::getPrimaryKeyName();

        return $resource->{$pkName};
    }
348442
public function relatedPost(ApiRequest $request, $resourceModel)
    {
        $requestModel = $request->asRequestModel();

        $this->validate($requestModel, $this->getCreatingRules());

        $ids = (array)$requestModel->id();

        /** @var BelongsToMany $relation */
        $relation = $this->getRelation($resourceModel);
        $this->beforeCreating($ids, $relation);

        $requestModel->map(function (RequestModel $model) use ($relation) {
            $this->createRelationshipModel($relation, $model);
        });

        return $this->getRelation($resourceModel->fresh())->get();
    }
203999
public function getPublicRelatedUri($resource, $relationshipName)
    {
        return $this->getPublicUri($resource, $this->relatedControllerActionName,
            $this->getRelationshipControllerArguments($resource, $relationshipName));
    }
757820
public function getResources(
        ResourceTransformer $resourceTransformer,
        ResourceDefinition $resourceDefinition,
        Context $context,
        $request = null
    ) {
        if (!$this->hasApplicableContentType()) {
            return null;
        }

        $rawContent = $this->getRawContent();
        $content = json_decode($rawContent, true);

        if (!$content) {
            throw new \InvalidArgumentException("Could not decode body: " . $rawContent);
        }

        $resourceCollection = $resourceTransformer->getResourceFactory()->createResourceCollection();

        if (isset($content[ResourceTransformer::RELATIONSHIP_ITEMS])) {
            // This is a list of items
            foreach ($content[ResourceTransformer::RELATIONSHIP_ITEMS] as $item) {
                $resource = $resourceTransformer->fromArray(
                    $resourceDefinition,
                    $item,
                    $context
                );
                $resourceCollection->add($resource);
            }
        } else {
            $resource = $resourceTransformer->fromArray(
                $resourceDefinition,
                $content,
                $context
            );
            $resourceCollection->add($resource);
        }

        return $resourceCollection;
    }
883884
protected function get_resource() {
		$resource = null;
		if (isset($_GET[$this->parent_name]))
			$resource = $this->sql->select($this->request);
		else
			$resource = $this->sql->get_variants($this->config->relation_id['name'], $this->request);
		return $resource;
	}
668604
protected function resolveRelativeResource($base, $resource)
    {
        // Return resource path based on relative resource path
        foreach (['', '.min.js', '.js'] as $ext) {
            // Map resource
            if ($base instanceof ModuleResource) {
                $next = $base->getRelativeResource($resource . $ext);
            } else {
                $next = rtrim($base, '/') . '/' . $resource . $ext;
            }
            // Ensure resource exists
            if ($this->resourceExists($next)) {
                return $next;
            }
        }
        return null;
    }
837278
public function indexAction()
	{
		$resource = $related = null;

		if( $this->request->hasArgument( 'resource' )
			&& ( $value = $this->request->getArgument( 'resource' ) ) != ''
		) {
			$resource = $value;
		}

		if( $this->request->hasArgument( 'related' )
			&& ( $value = $this->request->getArgument( 'related' ) ) != ''
		) {
			$related = $value;
		}

		switch( $this->request->getMethod() )
		{
			case 'DELETE': return $this->deleteAction( $resource, $related );
			case 'PATCH': return $this->patchAction( $resource, $related );
			case 'POST': return $this->postAction( $resource, $related );
			case 'PUT': return $this->putAction( $resource, $related );
			case 'GET': return $this->getAction( $resource, $related );
			default: return $this->optionsAction( $resource );
		}
	}
1279661
public function index($resourceId)
    {
        $parameters = $this->request->getParameters();
        $paginator = $this->repository
        ->setResource($resourceId)
        ->setRelation($this->relation())
        ->getPaginatedCollection($parameters);
        return $this->paginatedResponse($paginator);
    }
646463
public function relatedItem($resourceModel, $relatedId, RelatedRepository $repository)
    {
        if ($repository instanceof JsonApiRepository) {
            $this->applyFilters($this->filters, $this->filterFactory, $repository);
        }

        return $repository->findRelated($resourceModel, $relatedId);
    }
223975
function get($resource, $query = array(), $headers = array()) {
        $url = $this->build_url($resource, $query);
        $result = $this->client->get($url, [
            'headers' => array_merge([
                'Authorization' => $this->getBearer()
            ], $headers)
        ])->json();
        return $result;
    }
344873
def set_related_method(self, resource, full_resource_url):
        
        method_name = self.get_method_name(resource, 'get')

        def get(self, **kwargs):
            return self._call_api_single_related_resource(
                resource, full_resource_url, method_name, **kwargs
            )

        def get_list(self, **kwargs):
            return self._call_api_many_related_resources(
                resource, full_resource_url, method_name, **kwargs
            )

        if isinstance(full_resource_url, list):
            setattr(
                self, method_name,
                types.MethodType(get_list, self)
            )
        else:
            setattr(
                self, method_name,
                types.MethodType(get, self)
            )
663280
public function getResource($resource)
    {
        if (array_key_exists($resource, $this->cache)) {
            return $this->cache[$resource];
        }

        if (!array_key_exists($resource, $this->resources)) {
            throw new ResourceNotImplemented($resource);
        }

        $params = $this->resources[$resource];
        $instance = $params['instance'];

        if (is_null($instance)) {
            $class = $params['class'];

            $instance = new $class($this);
        }

        return $this->cache[$resource] = $instance;
    }