MCPcopy Create free account
hub / github.com/decaporg/decap-cms / retrieveMetadataOld

Method retrieveMetadataOld

packages/decap-cms-backend-github/src/API.ts:510–551  ·  view source on GitHub ↗
(key: string)

Source from the content-addressed store, hash-verified

508 }
509
510 async retrieveMetadataOld(key: string): Promise<Metadata> {
511 console.log(
512 '%c Checking for MetaData files',
513 'line-height: 30px;text-align: center;font-weight: bold',
514 );
515
516 const metadataRequestOptions = {
517 params: { ref: 'refs/meta/_decap_cms' },
518 headers: { Accept: 'application/vnd.github.v3.raw' },
519 };
520
521 function errorHandler(err: Error) {
522 if (err.message === 'Not Found') {
523 console.log(
524 '%c %s does not have metadata',
525 'line-height: 30px;text-align: center;font-weight: bold',
526 key,
527 );
528 }
529 throw err;
530 }
531
532 if (!this.useOpenAuthoring) {
533 const result = await this.request(
534 `${this.repoURL}/contents/${key}.json`,
535 metadataRequestOptions,
536 )
537 .then((response: string) => JSON.parse(response))
538 .catch(errorHandler);
539
540 return result;
541 }
542
543 const [user, repo] = key.split('/');
544 const result = this.request(
545 `/repos/${user}/${repo}/contents/${key}.json`,
546 metadataRequestOptions,
547 )
548 .then((response: string) => JSON.parse(response))
549 .catch(errorHandler);
550 return result;
551 }
552
553 async getPullRequests(
554 head: string | undefined,

Callers 1

migratePullRequestMethod · 0.95

Calls 1

requestMethod · 0.95

Tested by

no test coverage detected