@since 0.2

@param Revision $revision
@param array $extraParams

@return Page
321881
public function getFromRevision( Revision $revision, array $extraParams = [] ) {
		$result =
			$this->api->getRequest(
				new SimpleRequest(
					'query',
					$this->getQuery( [ 'revids' => $revision->getId() ], $extraParams )
				)
			);
		$revisions = $this->getRevisionsFromResult( array_shift( $result['query']['pages'] ) );
		$revisions->addRevision( $revision );

		return new Page(
			new PageIdentifier(
				new Title(
					$result['title'],
					$result['ns']
				),
				$result['pageid']
			),
			$revisions
		);
	}
112070
public function getPageListFromPageTransclusions( $pageName, array $extraParams = [] ) {
		$params = array_merge( $extraParams, [
			'list' => 'embeddedin',
			'eititle' => $pageName,
		] );
		return $this->runQuery( $params, 'eicontinue', 'embeddedin' );
	}
1123033
public function save( Revision $revision, EditInfo $editInfo = null ) {
		$editInfo = $editInfo ? $editInfo : $revision->getEditInfo();

		$result = $this->api->postRequest(
			new SimpleRequest( 'edit', $this->getEditParams( $revision, $editInfo ) )
		);
		return ( $result['edit']['result'] == 'Success' );
	}
334481
public function insertEntityRevision($revision, FormData $requestData, $subResource = NULL) {
    $entity = $this->createEmptyEntity($revision);
    
    if ($subResource !== NULL && array_key_exists($subResource, $this->customActions)) {
      return $this->callCustomAction($this->customActions[$subResource], array($entity, $requestData, $revision));
    }
    
    $this->updateEntityRevision($entity, $revision, $requestData);
    $this->setOpenTabMetadata($entity);
    
    return $entity;
  }
1371366
public function createLink($name, array $defaultRouteParams = array(), array $extra = array())
    {
        $options = $this->getLinkOptions($name);
        $factory = $this->createFactory($defaultRouteParams, $extra);

        return $factory->createItem($name, $options);
    }
776649
public function getPaginationPath($route, $page, $extraParams = array())
    {
        $params = array(
            $this->getActionParameterName() => $this->getPageActionParameterName(),
            $this->getDatagridParameterName() => $this->getName(),
            $this->getPageParameterName() => $page,
        );
        return $this->container->get('router')->generate($route, array_merge($params, $extraParams));
    }
100044
public function deleteFromPageId( $pageid, array $extraParams = [] ) {
		$this->api->postRequest( new SimpleRequest(
			'delete',
			$this->getDeleteParams( new PageIdentifier( null, $pageid ), $extraParams )
		) );
		return true;
	}
1027750
public function addRevisions( $revisions ) {
		if( !is_array( $revisions ) && !$revisions instanceof Revisions ) {
			throw new InvalidArgumentException( '$revisions needs to either be an array or a Revisions object' );
		}
		if( $revisions instanceof Revisions ) {
			$revisions = $revisions->toArray();
		}
		foreach( $revisions as $revision ) {
			$this->addRevision( $revision );
		}
	}
858692
private function getTokenForRevision( Revision $revision ) {
		$result = $this->api->postRequest(
			new SimpleRequest(
				'query', [
				'prop' => 'revisions',
				'revids' => $revision->getId(),
				'rvtoken' => 'rollback',
			]
			)
		);
		$result = array_shift( $result['query']['pages'] );

		return $result['revisions'][0]['rollbacktoken'];
	}
1183910
public static function createIri(array $parts, array $parameters, string $pageParameterName = null, float $page = null, bool $absoluteUrl = false): string
    {
        if (null !== $page && null !== $pageParameterName) {
            $parameters[$pageParameterName] = $page;
        }

        $query = http_build_query($parameters, '', '&', PHP_QUERY_RFC3986);
        $parts['query'] = preg_replace('/%5B\d+%5D/', '%5B%5D', $query);

        $url = '';

        if ($absoluteUrl && isset($parts['host'])) {
            if (isset($parts['scheme'])) {
                $url .= $parts['scheme'];
            } elseif (isset($parts['port']) && 443 === $parts['port']) {
                $url .= 'https';
            } else {
                $url .= 'http';
            }

            $url .= '://';

            if (isset($parts['user'])) {
                $url .= $parts['user'];

                if (isset($parts['pass'])) {
                    $url .= ':'.$parts['pass'];
                }

                $url .= '@';
            }

            $url .= $parts['host'];

            if (isset($parts['port'])) {
                $url .= ':'.$parts['port'];
            }
        }

        $url .= $parts['path'];

        if ('' !== $parts['query']) {
            $url .= '?'.$parts['query'];
        }

        if (isset($parts['fragment'])) {
            $url .= '#'.$parts['fragment'];
        }

        return $url;
    }
38915
public function url($file = null, $extra = null, $rewrite = true) {
        if ($extra === false && $rewrite === true) {
            list($extra, $rewrite) = [null, $extra];
        }
        return url()->to($file, $extra, true, $rewrite);
    }
603749
public function export($item, array $extraAttributes = [])
    {
        $attributeObj = [];
        $extraAttributes = array_merge($extraAttributes, $this->additionalAttributes('route'));
        foreach($extraAttributes as $attribute) {
            $attributeObj[$attribute] = $item->$attribute;
        }

        $routeObj = array_merge([
            'template' => $item['template'],
            'uriParts' => $item['uriParts'],
        ], $attributeObj);

        if ($item['siteUid']) {
            try {
                $routeObj['siteId'] = Craft::$app->sites->getSiteByUid($item['siteUid'])->handle;
            } catch (\craft\errors\SiteNotFoundException $e) {}
        }

        return $this->stripNulls($routeObj);
    }
311374
public SubscriptionScheduleRevisionCollection revisions(
      Map<String, Object> params, RequestOptions options) throws StripeException {
    String url =
        String.format(
            "%s%s",
            Stripe.getApiBase(),
            String.format(
                "/v1/subscription_schedules/%s/revisions", ApiResource.urlEncodeId(this.getId())));
    return requestCollection(url, params, SubscriptionScheduleRevisionCollection.class, options);
  }
120872
@InterfaceAudience.Private
    private boolean uploadMultipartRevision(final RevisionInternal revision) {
        Map<String, Object> body = revision.getProperties();
        Map<String, Object> attachments = (Map<String, Object>) body.get("_attachments");

        boolean attachmentsFollow = false;
        for (String attachmentKey : attachments.keySet()) {
            Map<String, Object> attachment = (Map<String, Object>) attachments.get(attachmentKey);
            if (attachment.containsKey("follows")) attachmentsFollow = true;
        }
        if (!attachmentsFollow) return false;

        Log.d(TAG, "Uploading multipart request.  Revision: %s", revision);
        addToChangesCount(1);
        final String path = String.format(Locale.ENGLISH, "%s?new_edits=false", encodeDocumentId(revision.getDocID()));
        CustomFuture future = sendAsyncMultipartRequest("PUT", path, body, attachments,
                new RemoteRequestCompletion() {
                    @Override
                    public void onCompletion(RemoteRequest remoteRequest, Response httpResponse, Object result, Throwable e) {
                        try {
                            if (e != null) {
                                if (e instanceof RemoteRequestResponseException) {
                                    // Server doesn't like multipart, eh? Fall back to JSON.
                                    if (((RemoteRequestResponseException) e).getCode() == 415) {
                                        //status 415 = "bad_content_type"
                                        dontSendMultipart = true;
                                        uploadJsonRevision(revision);
                                    }
                                } else {
                                    Log.e(TAG, "Exception uploading multipart request", e);
                                    setError(e);
                                }
                            } else {
                                Log.v(TAG, "Uploaded multipart request.  Revision: %s", revision);
                                removePending(revision);
                            }
                        } finally {
                            addToCompletedChangesCount(1);
                        }
                    }
                });
        future.setQueue(pendingFutures);
        pendingFutures.add(future);
        return true;
    }
479505
public function getRandom( array $extraParams = [] ) {
		$params = array_merge( $extraParams, [ 'list' => 'random' ] );
		return $this->runQuery( $params, null, 'random', 'id', false );
	}
324158
def get_revisions(page, page_num=1):
    
    revisions   = page.revisions.order_by('-created_at')
    current     = page.get_latest_revision()

    if current:
        revisions.exclude(id=current.id)

    paginator = Paginator(revisions, 5)

    try:
        revisions = paginator.page(page_num)
    except PageNotAnInteger:
        revisions = paginator.page(1)
    except EmptyPage:
        revisions = paginator.page(paginator.num_pages)

    return revisions
892952
def revision_list(
    request, template_name='wakawaka/revision_list.html', extra_context=None
):
    
    revision_list = Revision.objects.all()
    template_context = {'revision_list': revision_list}
    template_context.update(extra_context or {})
    return render(request, template_name, template_context)