Skip to content

Commit

Permalink
build(update-endpoints): remove workarounds from types generation
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Jan 31, 2020
1 parent 7114403 commit 58a411d
Showing 1 changed file with 0 additions and 215 deletions.
215 changes: 0 additions & 215 deletions scripts/update-endpoints/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,220 +430,5 @@ async function getRoutes() {
}
});

// temporary workaround to bring back obsolete `octokit.repos.getCommitRefSha()` method
newRoutes.repos.getCommitRefSha = {
deprecated:
'"Get the SHA-1 of a commit reference" will be removed. Use "Get a single commit" instead with media type format set to "sha" instead.',
method: "GET",
description:
"**Note:** To access this endpoint, you must provide a custom [media type](https://developer.github.com/v3/media) in the `Accept` header:\n```\napplication/vnd.github.VERSION.sha\n```\nReturns the SHA-1 of the commit reference. You must have `read` access for the repository to get the SHA-1 of a commit reference. You can use this endpoint to check if a remote reference's SHA-1 is the same as your local reference's SHA-1 by providing the local SHA-1 reference as the ETag.",
params: {
owner: {
required: true,
type: "string"
},
ref: {
required: true,
type: "string"
},
repo: {
required: true,
type: "string"
}
},
url: "/repos/:owner/:repo/commits/:ref"
};

// Temporary workarounds to bring back endpoints that got lost due to transition to OpenAPI spec of octokit/routes
// New API endpoints that will replace these are in the works, so that workaround can be removed soon
newRoutes.git.listRefs = {
method: "GET",
description:
"Returns an array of all the references from your Git database, including notes and stashes if they exist on the server. Anything in the namespace is returned, not just `heads` and `tags`. If there are no references to list, a `404` is returned.",
params: {
namespace: {
type: "string",
description:
"Filter by sub-namespace (reference prefix). Most commen examples would be `'heads/'` and `'tags/'` to retrieve branches or tags"
},
owner: {
required: true,
type: "string"
},
page: {
type: "integer"
},
per_page: {
type: "integer"
},
repo: {
required: true,
type: "string"
}
},
url: "/repos/:owner/:repo/git/refs/:namespace"
};
newRoutes.issues.updateLabel = {
method: "PATCH",
description: "",
params: {
color: {
type: "string",
description:
"The [hexadecimal color code](http://www.color-hex.com/) for the label, without the leading `#`."
},
current_name: {
required: true,
type: "string"
},
description: {
type: "string",
description: "A short description of the label."
},
name: {
type: "string",
description:
'The new name of the label. Emoji can be added to label names, using either native emoji or colon-style markup. For example, typing `:strawberry:` will render the emoji ![:strawberry:](https://github.githubassets.com/images/icons/emoji/unicode/1f353.png ":strawberry:"). For a full list of available emoji and codes, see [emoji-cheat-sheet.com](http://emoji-cheat-sheet.com/).'
},
owner: {
required: true,
type: "string"
},
repo: {
required: true,
type: "string"
}
},
url: "/repos/:owner/:repo/labels/:current_name",
responses: [
{
id: 208045946,
node_id: "MDU6TGFiZWwyMDgwNDU5NDY=",
url:
"https://api.github.com/repos/octocat/Hello-World/labels/bug%20:bug:",
name: "bug :bug:",
description: "Small bug fix required",
color: "b01f26",
default: true
}
]
};

newRoutes.pulls.createFromIssue = {
isDeprecated: true,
method: "POST",
description: "",
params: {
base: { required: true, type: "string" },
draft: { type: "boolean" },
head: { required: true, type: "string" },
issue: { required: true, type: "integer" },
maintainer_can_modify: { type: "boolean" },
owner: { required: true, type: "string" },
repo: { required: true, type: "string" }
},
url: "/repos/:owner/:repo/pulls",
responses: newRoutes.pulls.create.responses
};

// workaround to bring back the simpler `octokit.repos.uploadReleaseAsset()` method
newRoutes.repos.uploadReleaseAsset = {
method: "POST",
description: `This endpoint makes use of [a Hypermedia relation](https://developer.github.com/v3/#hypermedia) to determine which URL to access. The endpoint you call to upload release assets is specific to your release. Use the \`upload_url\` returned in the response of the [Create a release endpoint](https://developer.github.com/v3/repos/releases/#create-a-release) to upload a release asset.
You need to use an HTTP client which supports [SNI](http://en.wikipedia.org/wiki/Server_Name_Indication) to make calls to this endpoint.
Most libraries will set the required \`Content-Length\` header automatically. Use the required \`Content-Type\` header to provide the media type of the asset. For a list of media types, see [Media Types](https://www.iana.org/assignments/media-types/media-types.xhtml). For example:
\`application/zip\`
GitHub expects the asset data in its raw binary form, rather than JSON. You will send the raw binary content of the asset as the request body. Everything else about the endpoint is the same as the rest of the API. For example, you'll still need to pass your authentication to be able to upload an asset.`,
params: {
data: {
mapTo: "data",
required: true,
type: "string | object"
},
file: {
mapTo: "data",
deprecated: true,
type: "string | object",
alias: "data"
},
headers: {
required: true,
type: "object"
},
"headers.content-length": {
required: true,
type: "integer"
},
"headers.content-type": {
required: true,
type: "string"
},
label: {
type: "string",
description: `An alternate short description of the asset. Used in place of the filename. This should be set in a URI query parameter.`
},
name: {
required: true,
type: "string",
description: `The file name of the asset. This should be set in a URI query parameter.`
},
url: {
required: true,
type: "string",
description:
"The `upload_url` key returned from creating or getting a release"
}
},
url: ":url",
responses: [
{
value: {
url:
"https://api.github.com/repos/octocat/Hello-World/releases/assets/1",
browser_download_url:
"https://github.com/octocat/Hello-World/releases/download/v1.0.0/example.zip",
id: 1,
node_id: "MDEyOlJlbGVhc2VBc3NldDE=",
name: "example.zip",
label: "short description",
state: "uploaded",
content_type: "application/zip",
size: 1024,
download_count: 42,
created_at: "2013-02-27T19:35:32Z",
updated_at: "2013-02-27T19:35:32Z",
uploader: {
login: "octocat",
id: 1,
node_id: "MDQ6VXNlcjE=",
avatar_url: "https://github.com/images/error/octocat_happy.gif",
gravatar_id: "",
url: "https://api.github.com/users/octocat",
html_url: "https://github.com/octocat",
followers_url: "https://api.github.com/users/octocat/followers",
following_url:
"https://api.github.com/users/octocat/following{/other_user}",
gists_url: "https://api.github.com/users/octocat/gists{/gist_id}",
starred_url:
"https://api.github.com/users/octocat/starred{/owner}{/repo}",
subscriptions_url:
"https://api.github.com/users/octocat/subscriptions",
organizations_url: "https://api.github.com/users/octocat/orgs",
repos_url: "https://api.github.com/users/octocat/repos",
events_url: "https://api.github.com/users/octocat/events{/privacy}",
received_events_url:
"https://api.github.com/users/octocat/received_events",
type: "User",
site_admin: false
}
}
}
]
};

return sortKeys(newRoutes, { deep: true });
}

0 comments on commit 58a411d

Please sign in to comment.