@octokit/endpoint#endpoint JavaScript Examples

The following examples show how to use @octokit/endpoint#endpoint. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.js    From ipfs-action with MIT License 6 votes vote down vote up
function withDefaults(oldEndpoint, newDefaults) {
    const endpoint = oldEndpoint.defaults(newDefaults);
    const newApi = function (route, parameters) {
        const endpointOptions = endpoint.merge(route, parameters);
        if (!endpointOptions.request || !endpointOptions.request.hook) {
            return fetchWrapper(endpoint.parse(endpointOptions));
        }
        const request = (route, parameters) => {
            return fetchWrapper(endpoint.parse(endpoint.merge(route, parameters)));
        };
        Object.assign(request, {
            endpoint,
            defaults: withDefaults.bind(null, endpoint),
        });
        return endpointOptions.request.hook(request, endpointOptions);
    };
    return Object.assign(newApi, {
        endpoint,
        defaults: withDefaults.bind(null, endpoint),
    });
}
Example #2
Source File: index.js    From action-download-artifact with MIT License 6 votes vote down vote up
function withDefaults(oldEndpoint, newDefaults) {
    const endpoint = oldEndpoint.defaults(newDefaults);
    const newApi = function (route, parameters) {
        const endpointOptions = endpoint.merge(route, parameters);
        if (!endpointOptions.request || !endpointOptions.request.hook) {
            return fetchWrapper(endpoint.parse(endpointOptions));
        }
        const request = (route, parameters) => {
            return fetchWrapper(endpoint.parse(endpoint.merge(route, parameters)));
        };
        Object.assign(request, {
            endpoint,
            defaults: withDefaults.bind(null, endpoint),
        });
        return endpointOptions.request.hook(request, endpointOptions);
    };
    return Object.assign(newApi, {
        endpoint,
        defaults: withDefaults.bind(null, endpoint),
    });
}
Example #3
Source File: index.js    From replace-action with MIT License 6 votes vote down vote up
function withDefaults(oldEndpoint, newDefaults) {
    const endpoint = oldEndpoint.defaults(newDefaults);
    const newApi = function (route, parameters) {
        const endpointOptions = endpoint.merge(route, parameters);
        if (!endpointOptions.request || !endpointOptions.request.hook) {
            return fetchWrapper(endpoint.parse(endpointOptions));
        }
        const request = (route, parameters) => {
            return fetchWrapper(endpoint.parse(endpoint.merge(route, parameters)));
        };
        Object.assign(request, {
            endpoint,
            defaults: withDefaults.bind(null, endpoint)
        });
        return endpointOptions.request.hook(request, endpointOptions);
    };
    return Object.assign(newApi, {
        endpoint,
        defaults: withDefaults.bind(null, endpoint)
    });
}
Example #4
Source File: index.js    From github-actions-issue-to-work-item with GNU General Public License v3.0 6 votes vote down vote up
function withDefaults(oldEndpoint, newDefaults) {
    const endpoint = oldEndpoint.defaults(newDefaults);
    const newApi = function (route, parameters) {
        const endpointOptions = endpoint.merge(route, parameters);
        if (!endpointOptions.request || !endpointOptions.request.hook) {
            return fetchWrapper(endpoint.parse(endpointOptions));
        }
        const request = (route, parameters) => {
            return fetchWrapper(endpoint.parse(endpoint.merge(route, parameters)));
        };
        Object.assign(request, {
            endpoint,
            defaults: withDefaults.bind(null, endpoint)
        });
        return endpointOptions.request.hook(request, endpointOptions);
    };
    return Object.assign(newApi, {
        endpoint,
        defaults: withDefaults.bind(null, endpoint)
    });
}
Example #5
Source File: index.js    From verify-linked-issue-action with MIT License 6 votes vote down vote up
function withDefaults(oldEndpoint, newDefaults) {
    const endpoint = oldEndpoint.defaults(newDefaults);
    const newApi = function (route, parameters) {
        const endpointOptions = endpoint.merge(route, parameters);
        if (!endpointOptions.request || !endpointOptions.request.hook) {
            return fetchWrapper(endpoint.parse(endpointOptions));
        }
        const request = (route, parameters) => {
            return fetchWrapper(endpoint.parse(endpoint.merge(route, parameters)));
        };
        Object.assign(request, {
            endpoint,
            defaults: withDefaults.bind(null, endpoint),
        });
        return endpointOptions.request.hook(request, endpointOptions);
    };
    return Object.assign(newApi, {
        endpoint,
        defaults: withDefaults.bind(null, endpoint),
    });
}
Example #6
Source File: index.js    From compute-tag with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
function withDefaults(oldEndpoint, newDefaults) {
    const endpoint = oldEndpoint.defaults(newDefaults);
    const newApi = function (route, parameters) {
        const endpointOptions = endpoint.merge(route, parameters);
        if (!endpointOptions.request || !endpointOptions.request.hook) {
            return fetchWrapper(endpoint.parse(endpointOptions));
        }
        const request = (route, parameters) => {
            return fetchWrapper(endpoint.parse(endpoint.merge(route, parameters)));
        };
        Object.assign(request, {
            endpoint,
            defaults: withDefaults.bind(null, endpoint),
        });
        return endpointOptions.request.hook(request, endpointOptions);
    };
    return Object.assign(newApi, {
        endpoint,
        defaults: withDefaults.bind(null, endpoint),
    });
}
Example #7
Source File: index.js    From deploy-gae-action with MIT License 6 votes vote down vote up
function withDefaults(oldEndpoint, newDefaults) {
    const endpoint = oldEndpoint.defaults(newDefaults);
    const newApi = function (route, parameters) {
        const endpointOptions = endpoint.merge(route, parameters);
        if (!endpointOptions.request || !endpointOptions.request.hook) {
            return fetchWrapper(endpoint.parse(endpointOptions));
        }
        const request = (route, parameters) => {
            return fetchWrapper(endpoint.parse(endpoint.merge(route, parameters)));
        };
        Object.assign(request, {
            endpoint,
            defaults: withDefaults.bind(null, endpoint),
        });
        return endpointOptions.request.hook(request, endpointOptions);
    };
    return Object.assign(newApi, {
        endpoint,
        defaults: withDefaults.bind(null, endpoint),
    });
}
Example #8
Source File: index.js    From action-install-gh-release with Apache License 2.0 6 votes vote down vote up
function withDefaults(oldEndpoint, newDefaults) {
    const endpoint = oldEndpoint.defaults(newDefaults);
    const newApi = function (route, parameters) {
        const endpointOptions = endpoint.merge(route, parameters);
        if (!endpointOptions.request || !endpointOptions.request.hook) {
            return fetchWrapper(endpoint.parse(endpointOptions));
        }
        const request = (route, parameters) => {
            return fetchWrapper(endpoint.parse(endpoint.merge(route, parameters)));
        };
        Object.assign(request, {
            endpoint,
            defaults: withDefaults.bind(null, endpoint),
        });
        return endpointOptions.request.hook(request, endpointOptions);
    };
    return Object.assign(newApi, {
        endpoint,
        defaults: withDefaults.bind(null, endpoint),
    });
}
Example #9
Source File: index.js    From discord-commits with MIT License 6 votes vote down vote up
function withDefaults(oldEndpoint, newDefaults) {
    const endpoint = oldEndpoint.defaults(newDefaults);
    const newApi = function (route, parameters) {
        const endpointOptions = endpoint.merge(route, parameters);
        if (!endpointOptions.request || !endpointOptions.request.hook) {
            return fetchWrapper(endpoint.parse(endpointOptions));
        }
        const request = (route, parameters) => {
            return fetchWrapper(endpoint.parse(endpoint.merge(route, parameters)));
        };
        Object.assign(request, {
            endpoint,
            defaults: withDefaults.bind(null, endpoint),
        });
        return endpointOptions.request.hook(request, endpointOptions);
    };
    return Object.assign(newApi, {
        endpoint,
        defaults: withDefaults.bind(null, endpoint),
    });
}
Example #10
Source File: index.js    From github-action-get-latest-release with MIT License 6 votes vote down vote up
function withDefaults(oldEndpoint, newDefaults) {
    const endpoint = oldEndpoint.defaults(newDefaults);
    const newApi = function (route, parameters) {
        const endpointOptions = endpoint.merge(route, parameters);
        if (!endpointOptions.request || !endpointOptions.request.hook) {
            return fetchWrapper(endpoint.parse(endpointOptions));
        }
        const request = (route, parameters) => {
            return fetchWrapper(endpoint.parse(endpoint.merge(route, parameters)));
        };
        Object.assign(request, {
            endpoint,
            defaults: withDefaults.bind(null, endpoint),
        });
        return endpointOptions.request.hook(request, endpointOptions);
    };
    return Object.assign(newApi, {
        endpoint,
        defaults: withDefaults.bind(null, endpoint),
    });
}
Example #11
Source File: index.js    From dotnet-bump-version with MIT License 6 votes vote down vote up
function withDefaults(oldEndpoint, newDefaults) {
    const endpoint = oldEndpoint.defaults(newDefaults);
    const newApi = function (route, parameters) {
        const endpointOptions = endpoint.merge(route, parameters);
        if (!endpointOptions.request || !endpointOptions.request.hook) {
            return fetchWrapper(endpoint.parse(endpointOptions));
        }
        const request = (route, parameters) => {
            return fetchWrapper(endpoint.parse(endpoint.merge(route, parameters)));
        };
        Object.assign(request, {
            endpoint,
            defaults: withDefaults.bind(null, endpoint),
        });
        return endpointOptions.request.hook(request, endpointOptions);
    };
    return Object.assign(newApi, {
        endpoint,
        defaults: withDefaults.bind(null, endpoint),
    });
}
Example #12
Source File: index.js    From payload-info-action with MIT License 6 votes vote down vote up
function withDefaults(oldEndpoint, newDefaults) {
    const endpoint = oldEndpoint.defaults(newDefaults);
    const newApi = function (route, parameters) {
        const endpointOptions = endpoint.merge(route, parameters);
        if (!endpointOptions.request || !endpointOptions.request.hook) {
            return fetchWrapper(endpoint.parse(endpointOptions));
        }
        const request = (route, parameters) => {
            return fetchWrapper(endpoint.parse(endpoint.merge(route, parameters)));
        };
        Object.assign(request, {
            endpoint,
            defaults: withDefaults.bind(null, endpoint)
        });
        return endpointOptions.request.hook(request, endpointOptions);
    };
    return Object.assign(newApi, {
        endpoint,
        defaults: withDefaults.bind(null, endpoint)
    });
}
Example #13
Source File: index.js    From javascript-actions with MIT License 6 votes vote down vote up
function withDefaults(oldEndpoint, newDefaults) {
    const endpoint = oldEndpoint.defaults(newDefaults);
    const newApi = function (route, parameters) {
        const endpointOptions = endpoint.merge(route, parameters);
        if (!endpointOptions.request || !endpointOptions.request.hook) {
            return fetchWrapper(endpoint.parse(endpointOptions));
        }
        const request = (route, parameters) => {
            return fetchWrapper(endpoint.parse(endpoint.merge(route, parameters)));
        };
        Object.assign(request, {
            endpoint,
            defaults: withDefaults.bind(null, endpoint),
        });
        return endpointOptions.request.hook(request, endpointOptions);
    };
    return Object.assign(newApi, {
        endpoint,
        defaults: withDefaults.bind(null, endpoint),
    });
}
Example #14
Source File: index.js    From change-string-case-action with ISC License 6 votes vote down vote up
function withDefaults(oldEndpoint, newDefaults) {
    const endpoint = oldEndpoint.defaults(newDefaults);
    const newApi = function (route, parameters) {
        const endpointOptions = endpoint.merge(route, parameters);
        if (!endpointOptions.request || !endpointOptions.request.hook) {
            return fetchWrapper(endpoint.parse(endpointOptions));
        }
        const request = (route, parameters) => {
            return fetchWrapper(endpoint.parse(endpoint.merge(route, parameters)));
        };
        Object.assign(request, {
            endpoint,
            defaults: withDefaults.bind(null, endpoint),
        });
        return endpointOptions.request.hook(request, endpointOptions);
    };
    return Object.assign(newApi, {
        endpoint,
        defaults: withDefaults.bind(null, endpoint),
    });
}
Example #15
Source File: index.js    From action-install-gh-release with Apache License 2.0 5 votes vote down vote up
request = withDefaults(endpoint, {
    headers: {
        "user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`,
    },
})
Example #16
Source File: index.js    From javascript-actions with MIT License 5 votes vote down vote up
request = withDefaults(endpoint, {
    headers: {
        "user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`,
    },
})
Example #17
Source File: index.js    From verify-linked-issue-action with MIT License 5 votes vote down vote up
request = withDefaults(endpoint, {
    headers: {
        "user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`,
    },
})
Example #18
Source File: index.js    From github-action-get-latest-release with MIT License 5 votes vote down vote up
request = withDefaults(endpoint, {
    headers: {
        "user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`,
    },
})
Example #19
Source File: index.js    From action-download-artifact with MIT License 5 votes vote down vote up
request = withDefaults(endpoint, {
    headers: {
        "user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`,
    },
})
Example #20
Source File: index.js    From change-string-case-action with ISC License 5 votes vote down vote up
request = withDefaults(endpoint, {
    headers: {
        "user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`,
    },
})
Example #21
Source File: index.js    From replace-action with MIT License 5 votes vote down vote up
request = withDefaults(endpoint, {
    headers: {
        "user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`
    }
})
Example #22
Source File: index.js    From github-actions-issue-to-work-item with GNU General Public License v3.0 5 votes vote down vote up
request = withDefaults(endpoint, {
    headers: {
        "user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`
    }
})
Example #23
Source File: index.js    From compute-tag with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
request = withDefaults(endpoint, {
    headers: {
        "user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`,
    },
})
Example #24
Source File: index.js    From deploy-gae-action with MIT License 5 votes vote down vote up
request = withDefaults(endpoint, {
    headers: {
        "user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`,
    },
})
Example #25
Source File: index.js    From ipfs-action with MIT License 5 votes vote down vote up
request = withDefaults(endpoint, {
    headers: {
        "user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`,
    },
})
Example #26
Source File: index.js    From discord-commits with MIT License 5 votes vote down vote up
request = withDefaults(endpoint, {
    headers: {
        "user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`,
    },
})
Example #27
Source File: index.js    From dotnet-bump-version with MIT License 5 votes vote down vote up
request = withDefaults(endpoint, {
    headers: {
        "user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`,
    },
})
Example #28
Source File: index.js    From payload-info-action with MIT License 5 votes vote down vote up
request = withDefaults(endpoint, {
    headers: {
        "user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`
    }
})
Example #29
Source File: index.js    From payload-info-action with MIT License 5 votes vote down vote up
request = withDefaults(endpoint, {
    headers: {
        "user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`
    }
})