diff --git a/packages/parsers/src/__test__/__snapshots__/openapi/cohere.json b/packages/parsers/src/__test__/__snapshots__/openapi/cohere.json index c5d2082d9e..a375bf4910 100644 --- a/packages/parsers/src/__test__/__snapshots__/openapi/cohere.json +++ b/packages/parsers/src/__test__/__snapshots__/openapi/cohere.json @@ -1,7 +1,7 @@ { "id": "test-uuid-replacement", "endpoints": { - "test-uuid-replacement": { + "post-v-1-chat": { "description": "Generates a text response to a user message.\nTo learn how to use the Chat API and RAG follow our [Text Generation guides](https://docs.cohere.com/docs/chat-api).\n", "id": "post-v-1-chat", "method": "POST", @@ -452,7 +452,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -474,7 +474,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -496,7 +496,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -518,7 +518,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -540,7 +540,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -562,7 +562,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -584,7 +584,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -606,7 +606,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -628,7 +628,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -650,7 +650,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -672,7 +672,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -694,13 +694,16 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "post-v-2-chat": { "description": "Generates a text response to a user message and streams it down, token by token. To learn how to use the Chat API with streaming follow our [Text Generation guides](https://docs.cohere.com/v2/docs/chat-api).\n\nFollow the [Migration Guide](https://docs.cohere.com/v2/docs/migrating-v1-to-v2) for instructions on moving from API v1 to API v2.\n", + "namespace": [ + "v2" + ], "id": "post-v-2-chat", "method": "POST", "path": [ @@ -1003,7 +1006,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -1025,7 +1028,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -1047,7 +1050,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -1069,7 +1072,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -1091,7 +1094,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -1113,7 +1116,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -1135,7 +1138,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -1157,7 +1160,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -1179,7 +1182,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -1201,7 +1204,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -1223,7 +1226,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -1245,12 +1248,12 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "post-v-1-generate": { "description": "\nThis API is marked as \"Legacy\" and is no longer maintained. Follow the [migration guide](https://docs.cohere.com/docs/migrating-from-cogenerate-to-cochat) to start using the Chat API.\n\nGenerates realistic text conditioned on a given input.\n", "id": "post-v-1-generate", "method": "POST", @@ -1589,7 +1592,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -1611,7 +1614,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -1633,7 +1636,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -1655,7 +1658,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -1677,7 +1680,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -1699,7 +1702,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -1721,7 +1724,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -1743,7 +1746,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -1765,7 +1768,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -1787,7 +1790,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -1809,7 +1812,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -1831,12 +1834,12 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "post-v-1-embed": { "description": "This endpoint returns text and image embeddings. An embedding is a list of floating point numbers that captures semantic information about the content that it represents.\n\nEmbeddings can be used to create classifiers as well as empower semantic search. To learn more about embeddings, see the embedding page.\n\nIf you want to learn more how to use the embedding model, have a look at the [Semantic Search Guide](https://docs.cohere.com/docs/semantic-search).", "id": "post-v-1-embed", "method": "POST", @@ -1999,7 +2002,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -2021,7 +2024,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -2043,7 +2046,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -2065,7 +2068,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -2087,7 +2090,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -2109,7 +2112,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -2131,7 +2134,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -2153,7 +2156,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -2175,7 +2178,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -2197,7 +2200,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -2219,7 +2222,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -2241,13 +2244,16 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "post-v-2-embed": { "description": "This endpoint returns text embeddings. An embedding is a list of floating point numbers that captures semantic information about the text that it represents.\n\nEmbeddings can be used to create text classifiers as well as empower semantic search. To learn more about embeddings, see the embedding page.\n\nIf you want to learn more how to use the embedding model, have a look at the [Semantic Search Guide](https://docs.cohere.com/docs/semantic-search).", + "namespace": [ + "v2" + ], "id": "post-v-2-embed", "method": "POST", "path": [ @@ -2435,7 +2441,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -2457,7 +2463,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -2479,7 +2485,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -2501,7 +2507,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -2523,7 +2529,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -2545,7 +2551,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -2567,7 +2573,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -2589,7 +2595,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -2611,7 +2617,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -2633,7 +2639,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -2655,7 +2661,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -2677,13 +2683,16 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "get-v-1-embed-jobs": { "description": "The list embed job endpoint allows users to view all embed jobs history for that specific user.", + "namespace": [ + "embed-jobs" + ], "id": "get-v-1-embed-jobs", "method": "GET", "path": [ @@ -2765,7 +2774,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -2787,7 +2796,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -2809,7 +2818,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -2831,7 +2840,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -2853,7 +2862,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -2875,7 +2884,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -2897,7 +2906,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -2919,7 +2928,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -2941,7 +2950,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -2963,7 +2972,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -2985,7 +2994,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -3007,13 +3016,16 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "post-v-1-embed-jobs": { "description": "This API launches an async Embed job for a [Dataset](https://docs.cohere.com/docs/datasets) of type `embed-input`. The result of a completed embed job is new Dataset of type `embed-output`, which contains the original text entries and the corresponding embeddings.", + "namespace": [ + "embed-jobs" + ], "id": "post-v-1-embed-jobs", "method": "POST", "path": [ @@ -3105,7 +3117,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -3127,7 +3139,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -3149,7 +3161,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -3171,7 +3183,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -3193,7 +3205,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -3215,7 +3227,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -3237,7 +3249,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -3259,7 +3271,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -3281,7 +3293,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -3303,7 +3315,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -3325,7 +3337,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -3347,13 +3359,16 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "get-v-1-embed-jobs-id": { "description": "This API retrieves the details about an embed job started by the same user.", + "namespace": [ + "embed-jobs" + ], "id": "get-v-1-embed-jobs-id", "method": "GET", "path": [ @@ -3454,7 +3469,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -3476,7 +3491,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -3498,7 +3513,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -3520,7 +3535,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -3542,7 +3557,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -3564,7 +3579,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -3586,7 +3601,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -3608,7 +3623,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -3630,7 +3645,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -3652,7 +3667,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -3674,7 +3689,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -3696,13 +3711,16 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "post-v-1-embed-jobs-id-cancel": { "description": "This API allows users to cancel an active embed job. Once invoked, the embedding process will be terminated, and users will be charged for the embeddings processed up to the cancellation point. It's important to note that partial results will not be available to users after cancellation.", + "namespace": [ + "embed-jobs" + ], "id": "post-v-1-embed-jobs-id-cancel", "method": "POST", "path": [ @@ -3781,7 +3799,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -3803,7 +3821,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -3825,7 +3843,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -3847,7 +3865,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -3869,7 +3887,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -3891,7 +3909,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -3913,7 +3931,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -3935,7 +3953,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -3957,7 +3975,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -3979,7 +3997,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -4001,7 +4019,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -4023,12 +4041,12 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "post-v-1-rerank": { "description": "This endpoint takes in a query and a list of texts and produces an ordered array with each text assigned a relevance score.", "id": "post-v-1-rerank", "method": "POST", @@ -4292,7 +4310,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -4314,7 +4332,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -4336,7 +4354,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -4358,7 +4376,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -4380,7 +4398,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -4402,7 +4420,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -4424,7 +4442,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -4446,7 +4464,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -4468,7 +4486,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -4490,7 +4508,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -4512,7 +4530,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -4534,13 +4552,16 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "post-v-2-rerank": { "description": "This endpoint takes in a query and a list of texts and produces an ordered array with each text assigned a relevance score.", + "namespace": [ + "v2" + ], "id": "post-v-2-rerank", "method": "POST", "path": [ @@ -4751,7 +4772,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -4773,7 +4794,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -4795,7 +4816,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -4817,7 +4838,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -4839,7 +4860,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -4861,7 +4882,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -4883,7 +4904,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -4905,7 +4926,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -4927,7 +4948,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -4949,7 +4970,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -4971,7 +4992,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -4993,12 +5014,12 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "post-v-1-classify": { "description": "This endpoint makes a prediction about which label fits the specified text inputs best. To make a prediction, Classify uses the provided `examples` of text + label pairs as a reference.\nNote: [Fine-tuned models](https://docs.cohere.com/docs/classify-fine-tuning) trained on classification examples don't require the `examples` parameter to be passed in explicitly.", "id": "post-v-1-classify", "method": "POST", @@ -5322,7 +5343,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -5344,7 +5365,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -5366,7 +5387,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -5388,7 +5409,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -5410,7 +5431,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -5432,7 +5453,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -5454,7 +5475,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -5476,7 +5497,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -5498,7 +5519,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -5520,7 +5541,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -5542,7 +5563,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -5564,13 +5585,16 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "get-v-1-datasets": { "description": "List datasets that have been created.", + "namespace": [ + "datasets" + ], "id": "get-v-1-datasets", "method": "GET", "path": [ @@ -5730,7 +5754,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -5752,7 +5776,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -5774,7 +5798,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -5796,7 +5820,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -5818,7 +5842,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -5840,7 +5864,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -5862,7 +5886,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -5884,7 +5908,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -5906,7 +5930,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -5928,7 +5952,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -5950,7 +5974,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -5972,13 +5996,16 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "post-v-1-datasets": { "description": "Create a dataset by uploading a file. See ['Dataset Creation'](https://docs.cohere.com/docs/datasets#dataset-creation) for more information.", + "namespace": [ + "datasets" + ], "id": "post-v-1-datasets", "method": "POST", "path": [ @@ -6193,7 +6220,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -6215,7 +6242,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -6237,7 +6264,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -6259,7 +6286,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -6281,7 +6308,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -6303,7 +6330,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -6325,7 +6352,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -6347,7 +6374,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -6369,7 +6396,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -6391,7 +6418,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -6413,7 +6440,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -6435,13 +6462,16 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "get-v-1-datasets-usage": { "description": "View the dataset storage usage for your Organization. Each Organization can have up to 10GB of storage across all their users.", + "namespace": [ + "datasets" + ], "id": "get-v-1-datasets-usage", "method": "GET", "path": [ @@ -6524,7 +6554,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -6546,7 +6576,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -6568,7 +6598,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -6590,7 +6620,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -6612,7 +6642,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -6634,7 +6664,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -6656,7 +6686,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -6678,7 +6708,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -6700,7 +6730,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -6722,7 +6752,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -6744,7 +6774,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -6766,13 +6796,16 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "get-v-1-datasets-id": { "description": "Retrieve a dataset by ID. See ['Datasets'](https://docs.cohere.com/docs/datasets) for more information.", + "namespace": [ + "datasets" + ], "id": "get-v-1-datasets-id", "method": "GET", "path": [ @@ -6866,7 +6899,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -6888,7 +6921,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -6910,7 +6943,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -6932,7 +6965,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -6954,7 +6987,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -6976,7 +7009,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -6998,7 +7031,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -7020,7 +7053,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -7042,7 +7075,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -7064,7 +7097,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -7086,7 +7119,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -7108,13 +7141,16 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "delete-v-1-datasets-id": { "description": "Delete a dataset by ID. Datasets are automatically deleted after 30 days, but they can also be deleted manually.", + "namespace": [ + "datasets" + ], "id": "delete-v-1-datasets-id", "method": "DELETE", "path": [ @@ -7197,7 +7233,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -7219,7 +7255,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -7241,7 +7277,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -7263,7 +7299,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -7285,7 +7321,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -7307,7 +7343,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -7329,7 +7365,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -7351,7 +7387,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -7373,7 +7409,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -7395,7 +7431,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -7417,7 +7453,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -7439,12 +7475,12 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "post-v-1-summarize": { "description": "\nThis API is marked as \"Legacy\" and is no longer maintained. Follow the [migration guide](https://docs.cohere.com/docs/migrating-from-cogenerate-to-cochat) to start using the Chat API.\n\nGenerates a summary in English for a given text.\n", "id": "post-v-1-summarize", "method": "POST", @@ -7680,7 +7716,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -7702,7 +7738,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -7724,7 +7760,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -7746,7 +7782,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -7768,7 +7804,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -7790,7 +7826,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -7812,7 +7848,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -7834,7 +7870,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -7856,7 +7892,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -7878,7 +7914,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -7900,7 +7936,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -7922,12 +7958,12 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "post-v-1-tokenize": { "description": "This endpoint splits input text into smaller units called tokens using byte-pair encoding (BPE). To learn more about tokenization and byte pair encoding, see the tokens page.", "id": "post-v-1-tokenize", "method": "POST", @@ -8091,7 +8127,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -8113,7 +8149,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -8135,7 +8171,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -8157,7 +8193,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -8179,7 +8215,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -8201,7 +8237,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -8223,7 +8259,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -8245,7 +8281,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -8267,7 +8303,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -8289,7 +8325,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -8311,7 +8347,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -8333,12 +8369,12 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "post-v-1-detokenize": { "description": "This endpoint takes tokens using byte-pair encoding and returns their text representation. To learn more about tokenization and byte pair encoding, see the tokens page.", "id": "post-v-1-detokenize", "method": "POST", @@ -8484,7 +8520,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -8506,7 +8542,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -8528,7 +8564,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -8550,7 +8586,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -8572,7 +8608,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -8594,7 +8630,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -8616,7 +8652,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -8638,7 +8674,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -8660,7 +8696,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -8682,7 +8718,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -8704,7 +8740,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -8726,13 +8762,16 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "get-v-1-connectors": { "description": "Returns a list of connectors ordered by descending creation date (newer first). See ['Managing your Connector'](https://docs.cohere.com/docs/managing-your-connector) for more information.", + "namespace": [ + "connectors" + ], "id": "get-v-1-connectors", "method": "GET", "path": [ @@ -8829,7 +8868,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -8851,7 +8890,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -8873,7 +8912,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -8895,7 +8934,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -8917,7 +8956,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -8939,7 +8978,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -8961,7 +9000,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -8983,7 +9022,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -9005,7 +9044,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -9027,7 +9066,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -9049,7 +9088,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -9071,13 +9110,16 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "post-v-1-connectors": { "description": "Creates a new connector. The connector is tested during registration and will cancel registration when the test is unsuccessful. See ['Creating and Deploying a Connector'](https://docs.cohere.com/v1/docs/creating-and-deploying-a-connector) for more information.", + "namespace": [ + "connectors" + ], "id": "post-v-1-connectors", "method": "POST", "path": [ @@ -9154,7 +9196,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -9176,7 +9218,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -9198,7 +9240,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -9220,7 +9262,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -9242,7 +9284,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -9264,7 +9306,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -9286,7 +9328,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -9308,7 +9350,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -9330,7 +9372,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -9352,7 +9394,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -9374,7 +9416,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -9396,13 +9438,16 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "get-v-1-connectors-id": { "description": "Retrieve a connector by ID. See ['Connectors'](https://docs.cohere.com/docs/connectors) for more information.", + "namespace": [ + "connectors" + ], "id": "get-v-1-connectors-id", "method": "GET", "path": [ @@ -9488,7 +9533,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -9510,7 +9555,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -9532,7 +9577,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -9554,7 +9599,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -9576,7 +9621,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -9598,7 +9643,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -9620,7 +9665,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -9642,7 +9687,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -9664,7 +9709,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -9686,7 +9731,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -9708,7 +9753,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -9730,13 +9775,16 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "delete-v-1-connectors-id": { "description": "Delete a connector by ID. See ['Connectors'](https://docs.cohere.com/docs/connectors) for more information.", + "namespace": [ + "connectors" + ], "id": "delete-v-1-connectors-id", "method": "DELETE", "path": [ @@ -9822,7 +9870,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -9844,7 +9892,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -9866,7 +9914,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -9888,7 +9936,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -9910,7 +9958,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -9932,7 +9980,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -9954,7 +10002,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -9976,7 +10024,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -9998,7 +10046,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -10020,7 +10068,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -10042,7 +10090,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -10064,13 +10112,16 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "post-v-1-connectors-id-oauth-authorize": { "description": "Authorize the connector with the given ID for the connector oauth app. See ['Connector Authentication'](https://docs.cohere.com/docs/connector-authentication) for more information.", + "namespace": [ + "connectors" + ], "id": "post-v-1-connectors-id-oauth-authorize", "method": "POST", "path": [ @@ -10179,7 +10230,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -10201,7 +10252,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -10223,7 +10274,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -10245,7 +10296,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -10267,7 +10318,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -10289,7 +10340,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -10311,7 +10362,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -10333,7 +10384,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -10355,7 +10406,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -10377,7 +10428,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -10399,7 +10450,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -10421,13 +10472,16 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "get-v-1-models-model": { "description": "Returns the details of a model, provided its name.", + "namespace": [ + "models" + ], "id": "get-v-1-models-model", "method": "GET", "path": [ @@ -10527,7 +10581,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -10549,7 +10603,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -10571,7 +10625,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -10593,7 +10647,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -10615,7 +10669,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -10637,7 +10691,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -10659,7 +10713,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -10681,7 +10735,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -10703,7 +10757,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -10725,7 +10779,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -10747,7 +10801,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -10769,13 +10823,16 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "get-v-1-models": { "description": "Returns a list of models available for use. The list contains models from Cohere as well as your fine-tuned models.", + "namespace": [ + "models" + ], "id": "get-v-1-models", "method": "GET", "path": [ @@ -10879,7 +10936,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -10901,7 +10958,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -10923,7 +10980,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -10945,7 +11002,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -10967,7 +11024,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -10989,7 +11046,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -11011,7 +11068,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -11033,7 +11090,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -11055,7 +11112,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -11077,7 +11134,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -11099,7 +11156,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -11121,12 +11178,12 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "post-v-1-check-api-key": { "description": "Checks that the api key in the Authorization header is valid and active\n", "id": "post-v-1-check-api-key", "method": "POST", @@ -11229,7 +11286,7 @@ } ] }, - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -11251,7 +11308,7 @@ } ] }, - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -11273,7 +11330,7 @@ } ] }, - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -11295,7 +11352,7 @@ } ] }, - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 422, @@ -11317,7 +11374,7 @@ } ] }, - "name": "dummy error" + "name": "Unprocessable Entity" }, { "statusCode": 429, @@ -11339,7 +11396,7 @@ } ] }, - "name": "dummy error" + "name": "Too Many Requests" }, { "statusCode": 498, @@ -11361,7 +11418,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 499, @@ -11383,7 +11440,7 @@ } ] }, - "name": "dummy error" + "name": "UNKNOWN ERROR" }, { "statusCode": 500, @@ -11405,7 +11462,7 @@ } ] }, - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 501, @@ -11427,7 +11484,7 @@ } ] }, - "name": "dummy error" + "name": "Not Implemented" }, { "statusCode": 503, @@ -11449,7 +11506,7 @@ } ] }, - "name": "dummy error" + "name": "Service Unavailable" }, { "statusCode": 504, @@ -11471,12 +11528,15 @@ } ] }, - "name": "dummy error" + "name": "Gateway Timeout" } ], "examples": [] }, - "test-uuid-replacement": { + "get-v-1-finetuning-finetuned-models": { + "namespace": [ + "finetuning" + ], "id": "get-v-1-finetuning-finetuned-models", "method": "GET", "path": [ @@ -11578,7 +11638,7 @@ } }, "description": "Bad Request", - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -11590,7 +11650,7 @@ } }, "description": "Unauthorized", - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -11602,7 +11662,7 @@ } }, "description": "Forbidden", - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -11614,7 +11674,7 @@ } }, "description": "Not Found", - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 500, @@ -11626,7 +11686,7 @@ } }, "description": "Internal Server Error", - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 503, @@ -11638,12 +11698,15 @@ } }, "description": "Status Service Unavailable", - "name": "dummy error" + "name": "Service Unavailable" } ], "examples": [] }, - "test-uuid-replacement": { + "post-v-1-finetuning-finetuned-models": { + "namespace": [ + "finetuning" + ], "id": "post-v-1-finetuning-finetuned-models", "method": "POST", "path": [ @@ -11714,7 +11777,7 @@ } }, "description": "Bad Request", - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -11726,7 +11789,7 @@ } }, "description": "Unauthorized", - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -11738,7 +11801,7 @@ } }, "description": "Forbidden", - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -11750,7 +11813,7 @@ } }, "description": "Not Found", - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 500, @@ -11762,7 +11825,7 @@ } }, "description": "Internal Server Error", - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 503, @@ -11774,12 +11837,15 @@ } }, "description": "Status Service Unavailable", - "name": "dummy error" + "name": "Service Unavailable" } ], "examples": [] }, - "test-uuid-replacement": { + "get-v-1-finetuning-finetuned-models-id": { + "namespace": [ + "finetuning" + ], "id": "get-v-1-finetuning-finetuned-models-id", "method": "GET", "path": [ @@ -11859,7 +11925,7 @@ } }, "description": "Bad Request", - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -11871,7 +11937,7 @@ } }, "description": "Unauthorized", - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -11883,7 +11949,7 @@ } }, "description": "Forbidden", - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -11895,7 +11961,7 @@ } }, "description": "Not Found", - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 500, @@ -11907,7 +11973,7 @@ } }, "description": "Internal Server Error", - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 503, @@ -11919,12 +11985,15 @@ } }, "description": "Status Service Unavailable", - "name": "dummy error" + "name": "Service Unavailable" } ], "examples": [] }, - "test-uuid-replacement": { + "delete-v-1-finetuning-finetuned-models-id": { + "namespace": [ + "finetuning" + ], "id": "delete-v-1-finetuning-finetuned-models-id", "method": "DELETE", "path": [ @@ -12004,7 +12073,7 @@ } }, "description": "Bad Request", - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -12016,7 +12085,7 @@ } }, "description": "Unauthorized", - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -12028,7 +12097,7 @@ } }, "description": "Forbidden", - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -12040,7 +12109,7 @@ } }, "description": "Not Found", - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 500, @@ -12052,7 +12121,7 @@ } }, "description": "Internal Server Error", - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 503, @@ -12064,12 +12133,15 @@ } }, "description": "Status Service Unavailable", - "name": "dummy error" + "name": "Service Unavailable" } ], "examples": [] }, - "test-uuid-replacement": { + "get-v-1-finetuning-finetuned-models-finetuned-model-id-events": { + "namespace": [ + "finetuning" + ], "id": "get-v-1-finetuning-finetuned-models-finetuned-model-id-events", "method": "GET", "path": [ @@ -12194,7 +12266,7 @@ } }, "description": "Bad Request", - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -12206,7 +12278,7 @@ } }, "description": "Unauthorized", - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -12218,7 +12290,7 @@ } }, "description": "Forbidden", - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -12230,7 +12302,7 @@ } }, "description": "Not Found", - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 500, @@ -12242,7 +12314,7 @@ } }, "description": "Internal Server Error", - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 503, @@ -12254,12 +12326,15 @@ } }, "description": "Status Service Unavailable", - "name": "dummy error" + "name": "Service Unavailable" } ], "examples": [] }, - "test-uuid-replacement": { + "get-v-1-finetuning-finetuned-models-finetuned-model-id-training-step-metrics": { + "namespace": [ + "finetuning" + ], "id": "get-v-1-finetuning-finetuned-models-finetuned-model-id-training-step-metrics", "method": "GET", "path": [ @@ -12371,7 +12446,7 @@ } }, "description": "Bad Request", - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 401, @@ -12383,7 +12458,7 @@ } }, "description": "Unauthorized", - "name": "dummy error" + "name": "Unauthorized" }, { "statusCode": 403, @@ -12395,7 +12470,7 @@ } }, "description": "Forbidden", - "name": "dummy error" + "name": "Forbidden" }, { "statusCode": 404, @@ -12407,7 +12482,7 @@ } }, "description": "Not Found", - "name": "dummy error" + "name": "Not Found" }, { "statusCode": 500, @@ -12419,7 +12494,7 @@ } }, "description": "Internal Server Error", - "name": "dummy error" + "name": "Internal Server Error" }, { "statusCode": 503, @@ -12431,7 +12506,7 @@ } }, "description": "Status Service Unavailable", - "name": "dummy error" + "name": "Service Unavailable" } ], "examples": [] diff --git a/packages/parsers/src/__test__/__snapshots__/openapi/deeptune.json b/packages/parsers/src/__test__/__snapshots__/openapi/deeptune.json index 45c7c43761..cec51f59a7 100644 --- a/packages/parsers/src/__test__/__snapshots__/openapi/deeptune.json +++ b/packages/parsers/src/__test__/__snapshots__/openapi/deeptune.json @@ -1,8 +1,11 @@ { "id": "test-uuid-replacement", "endpoints": { - "test-uuid-replacement": { + "post-v-1-text-to-speech": { "description": "API that converts text into lifelike speech with best-in-class latency & uses the most advanced AI audio model ever. Create voiceovers for your videos, audiobooks, or create AI chatbots for free.", + "namespace": [ + "text_to_speech" + ], "id": "post-v-1-text-to-speech", "method": "POST", "path": [ @@ -35,8 +38,11 @@ "errors": [], "examples": [] }, - "test-uuid-replacement": { + "post-v-1-text-to-speech-from-prompt": { "description": "If you prefer to manage voices on your own, you can use your own audio file as a reference for the voice clone.x", + "namespace": [ + "text_to_speech" + ], "id": "post-v-1-text-to-speech-from-prompt", "method": "POST", "path": [ @@ -73,8 +79,11 @@ "errors": [], "examples": [] }, - "test-uuid-replacement": { + "get-v-1-voices": { "description": "Retrieve all voices associated with the current workspace.", + "namespace": [ + "voices" + ], "id": "get-v-1-voices", "method": "GET", "path": [ @@ -108,8 +117,11 @@ "errors": [], "examples": [] }, - "test-uuid-replacement": { + "post-v-1-voices": { "description": "Create a new voice with a name, optional description, and audio file.", + "namespace": [ + "voices" + ], "id": "post-v-1-voices", "method": "POST", "path": [ @@ -153,8 +165,11 @@ "errors": [], "examples": [] }, - "test-uuid-replacement": { + "get-v-1-voices-voice-id": { "description": "Retrieve a specific voice by its ID.", + "namespace": [ + "voices" + ], "id": "get-v-1-voices-voice-id", "method": "GET", "path": [ @@ -207,8 +222,11 @@ "errors": [], "examples": [] }, - "test-uuid-replacement": { + "put-v-1-voices-voice-id": { "description": "Update an existing voice with new name, description, or audio file.", + "namespace": [ + "voices" + ], "id": "put-v-1-voices-voice-id", "method": "PUT", "path": [ @@ -271,8 +289,11 @@ "errors": [], "examples": [] }, - "test-uuid-replacement": { + "delete-v-1-voices-voice-id": { "description": "Delete an existing voice by its ID.", + "namespace": [ + "voices" + ], "id": "delete-v-1-voices-voice-id", "method": "DELETE", "path": [ diff --git a/packages/parsers/src/__test__/__snapshots__/openapi/petstore.json b/packages/parsers/src/__test__/__snapshots__/openapi/petstore.json index f47c42a5c8..1c9628c6e1 100644 --- a/packages/parsers/src/__test__/__snapshots__/openapi/petstore.json +++ b/packages/parsers/src/__test__/__snapshots__/openapi/petstore.json @@ -1,7 +1,7 @@ { "id": "test-uuid-replacement", "endpoints": { - "test-uuid-replacement": { + "post-pet": { "description": "Add a new pet to the store", "id": "post-pet", "method": "POST", @@ -43,7 +43,7 @@ "errors": [], "examples": [] }, - "test-uuid-replacement": { + "put-pet": { "description": "Update an existing pet by Id", "id": "put-pet", "method": "PUT", @@ -85,7 +85,7 @@ "errors": [], "examples": [] }, - "test-uuid-replacement": { + "get-pet-pet-id": { "description": "Returns a pet when 0 < ID <= 10. ID > 10 or nonintegers will simulate API error conditions", "id": "get-pet-pet-id", "method": "GET", @@ -144,7 +144,7 @@ } }, "description": "Invalid ID supplied", - "name": "dummy error" + "name": "Bad Request" }, { "statusCode": 404, @@ -156,7 +156,7 @@ } }, "description": "Pet not found", - "name": "dummy error" + "name": "Not Found" } ], "examples": [] diff --git a/packages/parsers/src/openapi/3.1/OpenApiDocumentConverter.node.ts b/packages/parsers/src/openapi/3.1/OpenApiDocumentConverter.node.ts index ed155a0724..a61f15c2ff 100644 --- a/packages/parsers/src/openapi/3.1/OpenApiDocumentConverter.node.ts +++ b/packages/parsers/src/openapi/3.1/OpenApiDocumentConverter.node.ts @@ -7,8 +7,10 @@ import { } from "../BaseOpenApiV3_1Converter.node"; import { coalesceServers } from "../utils/3.1/coalesceServers"; import { SecurityRequirementObjectConverterNode } from "./auth/SecurityRequirementObjectConverter.node"; +import { XFernGroupsConverterNode } from "./extensions/XFernGroupsConverter.node"; import { PathsObjectConverterNode } from "./paths/PathsObjectConverter.node"; import { ServerObjectConverterNode } from "./paths/ServerObjectConverter.node"; +import { WebhooksObjectConverterNode } from "./paths/WebhooksObjectConverter.node"; import { ComponentsConverterNode } from "./schemas/ComponentsConverter.node"; export class OpenApiDocumentConverterNode extends BaseOpenApiV3_1ConverterNode< @@ -16,10 +18,11 @@ export class OpenApiDocumentConverterNode extends BaseOpenApiV3_1ConverterNode< FernRegistry.api.latest.ApiDefinition > { paths: PathsObjectConverterNode | undefined; - // webhooks: WebhooksObjectConverterNode | undefined; + webhooks: WebhooksObjectConverterNode | undefined; components: ComponentsConverterNode | undefined; servers: ServerObjectConverterNode[] | undefined; auth: SecurityRequirementObjectConverterNode | undefined; + fernGroups: XFernGroupsConverterNode | undefined; constructor(args: BaseOpenApiV3_1ConverterNodeConstructorArgs) { super(args); @@ -29,12 +32,14 @@ export class OpenApiDocumentConverterNode extends BaseOpenApiV3_1ConverterNode< parse(): void { this.servers = coalesceServers(this.servers, this.input.servers, this.context, this.accessPath); - if (this.input.paths == null) { + if (this.input.paths == null && this.input.webhooks == null) { this.context.errors.warning({ - message: "Expected 'paths' property to be specified", + message: "Expected 'paths' or 'webhooks' property to be specified", path: this.accessPath, }); - } else { + } + + if (this.input.paths != null) { this.paths = new PathsObjectConverterNode( { input: this.input.paths, @@ -46,7 +51,14 @@ export class OpenApiDocumentConverterNode extends BaseOpenApiV3_1ConverterNode< ); } - // TODO: Webhook disambiguation + if (this.input.webhooks != null) { + this.webhooks = new WebhooksObjectConverterNode({ + input: this.input.webhooks, + context: this.context, + accessPath: this.accessPath, + pathId: "webhooks", + }); + } if (this.input.components == null) { this.context.errors.warning({ @@ -70,14 +82,19 @@ export class OpenApiDocumentConverterNode extends BaseOpenApiV3_1ConverterNode< pathId: "security", }); } + + this.fernGroups = new XFernGroupsConverterNode({ + input: this.input, + context: this.context, + accessPath: this.accessPath, + pathId: "x-fern-groups", + }); } convert(): FernRegistry.api.latest.ApiDefinition | undefined { const apiDefinitionId = v4(); - const endpoints = this.paths?.convert(); - // TODO: Implement webhooks - // const webhooks = this.webhooks?.convert(); + const { webhookEndpoints, endpoints } = this.paths?.convert() ?? {}; const types = this.components?.convert(); if (types == null) { @@ -88,14 +105,11 @@ export class OpenApiDocumentConverterNode extends BaseOpenApiV3_1ConverterNode< id: FernRegistry.ApiDefinitionId(apiDefinitionId), endpoints: endpoints ?? {}, // Websockets are not implemented in OAS, but are in AsyncAPI - websockets: {} as Record, - // TODO: implement webhooks - // webhooks, - webhooks: {} as Record, + websockets: {}, + webhooks: { ...(this.webhooks?.convert() ?? {}), ...(webhookEndpoints ?? {}) }, types, - // TODO: check if we ever have subpackages - subpackages: {} as Record, - // TODO: Implement auths + // This is not necessary and will be removed + subpackages: {}, auths: this.auth?.convert() ?? {}, // TODO: Implement globalHeaders globalHeaders: undefined, diff --git a/packages/parsers/src/openapi/3.1/auth/SecuritySchemeConverter.node.ts b/packages/parsers/src/openapi/3.1/auth/SecuritySchemeConverter.node.ts index ff66ec7aab..b81e1c0db4 100644 --- a/packages/parsers/src/openapi/3.1/auth/SecuritySchemeConverter.node.ts +++ b/packages/parsers/src/openapi/3.1/auth/SecuritySchemeConverter.node.ts @@ -1,7 +1,10 @@ import { OpenAPIV3_1 } from "openapi-types"; import { UnreachableCaseError } from "ts-essentials"; -import { BaseOpenApiV3_1ConverterNode, BaseOpenApiV3_1ConverterNodeConstructorArgs } from "../.."; import { FernRegistry } from "../../../client/generated"; +import { + BaseOpenApiV3_1ConverterNode, + BaseOpenApiV3_1ConverterNodeConstructorArgs, +} from "../../BaseOpenApiV3_1Converter.node"; import { XFernBasicAuthNode } from "../extensions/auth/XFernBasicAuth.node"; import { XFernBasicPasswordVariableNameConverterNode } from "../extensions/auth/XFernBasicPasswordVariableNameConverter.node"; import { XFernBasicUsernameVariableNameConverterNode } from "../extensions/auth/XFernBasicUsernameVariableNameConverter.node"; diff --git a/packages/parsers/src/openapi/3.1/extensions/XFernGroupNameConverter.node.ts b/packages/parsers/src/openapi/3.1/extensions/XFernGroupNameConverter.node.ts index 25fc6dadd6..578984c700 100644 --- a/packages/parsers/src/openapi/3.1/extensions/XFernGroupNameConverter.node.ts +++ b/packages/parsers/src/openapi/3.1/extensions/XFernGroupNameConverter.node.ts @@ -1,17 +1,23 @@ +import { FernRegistry } from "../../../client/generated"; import { BaseOpenApiV3_1ConverterNode, BaseOpenApiV3_1ConverterNodeConstructorArgs, } from "../../BaseOpenApiV3_1Converter.node"; import { extendType } from "../../utils/extendType"; +const xFernGroupNameKey = "x-fern-sdk-group-name"; + export declare namespace XFernGroupNameConverterNode { export interface Input { - "x-fern-group-name"?: string; + [xFernGroupNameKey]?: string | string[]; } } -export class XFernGroupNameConverterNode extends BaseOpenApiV3_1ConverterNode { - groupName?: string; +export class XFernGroupNameConverterNode extends BaseOpenApiV3_1ConverterNode< + unknown, + FernRegistry.api.latest.SubpackageId[] +> { + groupName?: string | string[]; constructor(args: BaseOpenApiV3_1ConverterNodeConstructorArgs) { super(args); @@ -20,10 +26,21 @@ export class XFernGroupNameConverterNode extends BaseOpenApiV3_1ConverterNode(this.input)["x-fern-group-name"]; + this.groupName = extendType(this.input)[xFernGroupNameKey]; } - convert(): string | undefined { - return this.groupName; + convert(): FernRegistry.api.latest.SubpackageId[] | undefined { + if (this.groupName == null) { + return undefined; + } + + let subpackagePath: string[]; + if (Array.isArray(this.groupName)) { + subpackagePath = this.groupName; + } else { + subpackagePath = [this.groupName]; + } + + return subpackagePath.map((path) => FernRegistry.api.v1.SubpackageId(path)); } } diff --git a/packages/parsers/src/openapi/3.1/extensions/XFernGroupsConverter.node.ts b/packages/parsers/src/openapi/3.1/extensions/XFernGroupsConverter.node.ts new file mode 100644 index 0000000000..c0769a8e53 --- /dev/null +++ b/packages/parsers/src/openapi/3.1/extensions/XFernGroupsConverter.node.ts @@ -0,0 +1,35 @@ +import { noop } from "ts-essentials"; +import { + BaseOpenApiV3_1ConverterNode, + BaseOpenApiV3_1ConverterNodeConstructorArgs, +} from "../../BaseOpenApiV3_1Converter.node"; +import { extendType } from "../../utils/extendType"; + +const xFernGroupsKey = "x-fern-groups"; +export declare namespace XFernGroupsConverterNode { + export interface Group { + description?: string; + summary?: string; + } + + export interface Input { + [xFernGroupsKey]: Record[]; + } +} + +export class XFernGroupsConverterNode extends BaseOpenApiV3_1ConverterNode { + groups?: Record[]; + + constructor(args: BaseOpenApiV3_1ConverterNodeConstructorArgs) { + super(args); + this.safeParse(); + } + + parse(): void { + this.groups = extendType(this.input)[xFernGroupsKey]; + } + + convert(): void | undefined { + noop(); + } +} diff --git a/packages/parsers/src/openapi/3.1/extensions/XFernWebhookConverter.node.ts b/packages/parsers/src/openapi/3.1/extensions/XFernWebhookConverter.node.ts new file mode 100644 index 0000000000..3751468ee3 --- /dev/null +++ b/packages/parsers/src/openapi/3.1/extensions/XFernWebhookConverter.node.ts @@ -0,0 +1,21 @@ +import { BaseOpenApiV3_1ConverterNode } from "../../BaseOpenApiV3_1Converter.node"; +import { extendType } from "../../utils/extendType"; + +const xFernWebhookKey = "x-fern-webhook"; + +export declare namespace XFernWebhookConverterNode { + export interface Input { + [xFernWebhookKey]: boolean; + } +} + +export class XFernWebhookConverterNode extends BaseOpenApiV3_1ConverterNode { + isWebhook?: boolean; + + parse(): void { + this.isWebhook = extendType(this.input)[xFernWebhookKey]; + } + convert(): boolean | undefined { + return this.isWebhook ? undefined : undefined; + } +} diff --git a/packages/parsers/src/openapi/3.1/extensions/__test__/XFernGroupNameConverter.node.test.ts b/packages/parsers/src/openapi/3.1/extensions/__test__/XFernGroupNameConverter.node.test.ts index 1da668305a..c6b9cd26eb 100644 --- a/packages/parsers/src/openapi/3.1/extensions/__test__/XFernGroupNameConverter.node.test.ts +++ b/packages/parsers/src/openapi/3.1/extensions/__test__/XFernGroupNameConverter.node.test.ts @@ -7,12 +7,12 @@ describe("XFernGroupNameConverterNode", () => { describe("parse", () => { it("sets groupName from x-fern-group-name when present", () => { const converter = new XFernGroupNameConverterNode({ - input: { "x-fern-group-name": "test-group" }, + input: { "x-fern-sdk-group-name": "test-group" }, context: mockContext, accessPath: [], pathId: "", }); - expect(converter.groupName).toBe("test-group"); + expect(converter.groupName).toEqual("test-group"); }); it("sets groupName to undefined when x-fern-group-name is not present", () => { @@ -29,12 +29,12 @@ describe("XFernGroupNameConverterNode", () => { describe("convert", () => { it("returns the groupName value", () => { const converter = new XFernGroupNameConverterNode({ - input: { "x-fern-group-name": "test-group" }, + input: { "x-fern-sdk-group-name": "test-group" }, context: mockContext, accessPath: [], pathId: "", }); - expect(converter.convert()).toBe("test-group"); + expect(converter.convert()).toEqual(["test-group"]); }); it("returns undefined when groupName is not set", () => { diff --git a/packages/parsers/src/openapi/3.1/guards/isWebhookDefinition.ts b/packages/parsers/src/openapi/3.1/guards/isWebhookDefinition.ts new file mode 100644 index 0000000000..da08093d9e --- /dev/null +++ b/packages/parsers/src/openapi/3.1/guards/isWebhookDefinition.ts @@ -0,0 +1,7 @@ +import { FernRegistry } from "../../../client/generated"; + +export function isWebhookDefinition( + definition: FernRegistry.api.latest.EndpointDefinition | FernRegistry.api.latest.WebhookDefinition, +): definition is FernRegistry.api.latest.WebhookDefinition { + return "payload" in definition; +} diff --git a/packages/parsers/src/openapi/3.1/paths/OperationObjectConverter.node.ts b/packages/parsers/src/openapi/3.1/paths/OperationObjectConverter.node.ts index 0ee07d4726..f63127c4b6 100644 --- a/packages/parsers/src/openapi/3.1/paths/OperationObjectConverter.node.ts +++ b/packages/parsers/src/openapi/3.1/paths/OperationObjectConverter.node.ts @@ -11,6 +11,7 @@ import { resolveParameterReference } from "../../utils/3.1/resolveParameterRefer import { getEndpointId } from "../../utils/getEndpointId"; import { SecurityRequirementObjectConverterNode } from "../auth/SecurityRequirementObjectConverter.node"; import { AvailabilityConverterNode } from "../extensions/AvailabilityConverter.node"; +import { XFernGroupNameConverterNode } from "../extensions/XFernGroupNameConverter.node"; import { isReferenceObject } from "../guards/isReferenceObject"; import { ServerObjectConverterNode } from "./ServerObjectConverter.node"; import { ParameterBaseObjectConverterNode } from "./parameters/ParameterBaseObjectConverter.node"; @@ -19,7 +20,7 @@ import { ResponsesObjectConverterNode } from "./response/ResponsesObjectConverte export class OperationObjectConverterNode extends BaseOpenApiV3_1ConverterNode< OpenAPIV3_1.OperationObject, - FernRegistry.api.latest.EndpointDefinition + FernRegistry.api.latest.EndpointDefinition | FernRegistry.api.latest.WebhookDefinition > { description: string | undefined; pathParameters: Record | undefined; @@ -29,18 +30,28 @@ export class OperationObjectConverterNode extends BaseOpenApiV3_1ConverterNode< responses: ResponsesObjectConverterNode | undefined; availability: AvailabilityConverterNode | undefined; auth: SecurityRequirementObjectConverterNode | undefined; + namespace: XFernGroupNameConverterNode | undefined; constructor( args: BaseOpenApiV3_1ConverterNodeConstructorArgs, protected servers: ServerObjectConverterNode[] | undefined, protected path: string | undefined, protected method: "GET" | "POST" | "PUT" | "DELETE", + protected isWebhook?: boolean, ) { super(args); this.safeParse(); } parse(): void { + if (this.isWebhook && this.method !== "POST" && this.method !== "GET") { + this.context.errors.error({ + message: `Webhook method must be POST or GET. Received: ${this.method}`, + path: this.accessPath, + }); + return; + } + this.description = this.input.description; this.availability = new AvailabilityConverterNode({ input: this.input, @@ -134,6 +145,13 @@ export class OperationObjectConverterNode extends BaseOpenApiV3_1ConverterNode< pathId: "security", }); } + + this.namespace = new XFernGroupNameConverterNode({ + input: this.input, + context: this.context, + accessPath: this.accessPath, + pathId: "x-fern-group-name", + }); } extractPathParameterIds(): string[] | undefined { @@ -173,11 +191,31 @@ export class OperationObjectConverterNode extends BaseOpenApiV3_1ConverterNode< }); } - convert(): FernRegistry.api.latest.EndpointDefinition | undefined { + convert(): FernRegistry.api.latest.EndpointDefinition | FernRegistry.api.latest.WebhookDefinition | undefined { if (this.path == null) { return undefined; } + if (this.isWebhook) { + if (this.method !== "POST" && this.method !== "GET") { + return undefined; + } + + return { + description: this.description, + availability: this.availability?.convert(), + namespace: this.namespace?.convert(), + id: FernRegistry.WebhookId("x-fern-webhook-name"), + method: this.method, + // This is a little bit weird, consider changing the shape of fdr + path: this.convertPathToPathParts()?.map((part) => part.value.toString()) ?? [], + headers: convertToObjectProperties(this.requestHeaders), + // TODO: figure out what this looks like to be able to parse + payload: undefined, + examples: undefined, + }; + } + const endpointId = getEndpointId(this.method, this.path); const environments = this.servers?.map((server) => server.convert()).filter(isNonNullish); @@ -199,7 +237,7 @@ export class OperationObjectConverterNode extends BaseOpenApiV3_1ConverterNode< return { description: this.description, availability: this.availability?.convert(), - namespace: undefined, + namespace: this.namespace?.convert(), id: FernRegistry.EndpointId(endpointId), method: this.method, path: pathParts, @@ -214,6 +252,7 @@ export class OperationObjectConverterNode extends BaseOpenApiV3_1ConverterNode< request: this.requests?.convert()[0], response: responses?.[0]?.response, errors, + // TODO: examples examples: [], snippetTemplates: undefined, }; diff --git a/packages/parsers/src/openapi/3.1/paths/PathItemObjectConverter.node.ts b/packages/parsers/src/openapi/3.1/paths/PathItemObjectConverter.node.ts index 8326116574..f1185df5d6 100644 --- a/packages/parsers/src/openapi/3.1/paths/PathItemObjectConverter.node.ts +++ b/packages/parsers/src/openapi/3.1/paths/PathItemObjectConverter.node.ts @@ -6,12 +6,13 @@ import { BaseOpenApiV3_1ConverterNodeConstructorArgs, } from "../../BaseOpenApiV3_1Converter.node"; import { coalesceServers } from "../../utils/3.1/coalesceServers"; +import { XFernWebhookConverterNode } from "../extensions/XFernWebhookConverter.node"; import { OperationObjectConverterNode } from "./OperationObjectConverter.node"; import { ServerObjectConverterNode } from "./ServerObjectConverter.node"; export class PathItemObjectConverterNode extends BaseOpenApiV3_1ConverterNode< OpenAPIV3_1.PathItemObject, - FernRegistry.api.latest.EndpointDefinition[] + (FernRegistry.api.latest.EndpointDefinition | FernRegistry.api.latest.WebhookDefinition)[] > { description: string | undefined; get: OperationObjectConverterNode | undefined; @@ -25,12 +26,21 @@ export class PathItemObjectConverterNode extends BaseOpenApiV3_1ConverterNode< constructor( args: BaseOpenApiV3_1ConverterNodeConstructorArgs, protected servers: ServerObjectConverterNode[] | undefined, + protected isWebhook: boolean | undefined, ) { super(args); this.safeParse(); } parse(): void { + const isWebhook = + new XFernWebhookConverterNode({ + input: this.input, + context: this.context, + accessPath: this.accessPath, + pathId: this.pathId, + }).isWebhook || this.isWebhook; + this.description = this.input.description; this.servers = coalesceServers(this.servers, this.input.servers, this.context, this.accessPath); @@ -45,6 +55,7 @@ export class PathItemObjectConverterNode extends BaseOpenApiV3_1ConverterNode< this.servers, this.pathId, "GET", + isWebhook, ); } if (this.input.post != null) { @@ -58,6 +69,7 @@ export class PathItemObjectConverterNode extends BaseOpenApiV3_1ConverterNode< this.servers, this.pathId, "POST", + isWebhook, ); } if (this.input.put != null) { @@ -86,13 +98,9 @@ export class PathItemObjectConverterNode extends BaseOpenApiV3_1ConverterNode< "DELETE", ); } - - this.input.parameters; - - // validate if path parts and path parameters match } - convert(): FernRegistry.api.latest.EndpointDefinition[] | undefined { + convert(): (FernRegistry.api.latest.EndpointDefinition | FernRegistry.api.latest.WebhookDefinition)[] | undefined { return [this.get?.convert(), this.post?.convert(), this.put?.convert(), this.delete?.convert()].filter( isNonNullish, ); diff --git a/packages/parsers/src/openapi/3.1/paths/PathsObjectConverter.node.ts b/packages/parsers/src/openapi/3.1/paths/PathsObjectConverter.node.ts index cf366e1fa3..597d1cd3d1 100644 --- a/packages/parsers/src/openapi/3.1/paths/PathsObjectConverter.node.ts +++ b/packages/parsers/src/openapi/3.1/paths/PathsObjectConverter.node.ts @@ -1,18 +1,25 @@ import { isNonNullish } from "@fern-api/ui-core-utils"; import { OpenAPIV3_1 } from "openapi-types"; -import { v4 } from "uuid"; import { FernRegistry } from "../../../client/generated"; import { BaseOpenApiV3_1ConverterNode, BaseOpenApiV3_1ConverterNodeConstructorArgs, } from "../../BaseOpenApiV3_1Converter.node"; import { coalesceServers } from "../../utils/3.1/coalesceServers"; +import { isWebhookDefinition } from "../guards/isWebhookDefinition"; import { PathItemObjectConverterNode } from "./PathItemObjectConverter.node"; import { ServerObjectConverterNode } from "./ServerObjectConverter.node"; +export declare namespace PathsObjectConverterNode { + export interface Output { + endpoints: Record; + webhookEndpoints: Record; + } +} + export class PathsObjectConverterNode extends BaseOpenApiV3_1ConverterNode< OpenAPIV3_1.PathsObject, - Record + PathsObjectConverterNode.Output > { paths: PathItemObjectConverterNode[] | undefined; @@ -23,6 +30,7 @@ export class PathsObjectConverterNode extends BaseOpenApiV3_1ConverterNode< super(args); this.safeParse(); } + parse(): void { this.paths = Object.entries(this.input) .map(([path, pathItem]) => { @@ -37,30 +45,38 @@ export class PathsObjectConverterNode extends BaseOpenApiV3_1ConverterNode< pathId: path, }, coalesceServers(this.servers, pathItem.servers, this.context, this.accessPath), + undefined, ); }) .filter(isNonNullish); } - convert(): Record | undefined { + convert(): PathsObjectConverterNode.Output | undefined { if (this.paths == null) { return undefined; } - return Object.fromEntries( - Object.values(this.paths) - .flatMap((pathItem) => { - const endpointDefinitions = pathItem.convert(); - if (endpointDefinitions == null) { - return undefined; - } + const endpoints: Record = {}; + const webhookEndpoints: Record = {}; + + this.paths.forEach((pathItem) => { + const pathItemDefinitions = pathItem.convert(); + if (pathItemDefinitions == null) { + return undefined; + } + + pathItemDefinitions.forEach((definition) => { + if (isWebhookDefinition(definition)) { + webhookEndpoints[FernRegistry.WebhookId(definition.id)] = definition; + } else { + endpoints[FernRegistry.EndpointId(definition.id)] = definition; + } + }); + }); - return endpointDefinitions.map((endpointDefinition) => [ - FernRegistry.EndpointId(v4()), - endpointDefinition, - ]); - }) - .filter(isNonNullish), - ); + return { + endpoints, + webhookEndpoints, + }; } } diff --git a/packages/parsers/src/openapi/3.1/paths/WebhooksObjectConverter.node.ts b/packages/parsers/src/openapi/3.1/paths/WebhooksObjectConverter.node.ts index a434825505..f08dfb9fb3 100644 --- a/packages/parsers/src/openapi/3.1/paths/WebhooksObjectConverter.node.ts +++ b/packages/parsers/src/openapi/3.1/paths/WebhooksObjectConverter.node.ts @@ -1 +1,52 @@ -// TODO: This is not strictly typed, but the reference objects in this case refer to schemas for endpoints, likely listed in paths, so will need to think about how to disambiguate, or represent +import { OpenAPIV3_1 } from "openapi-types"; + +import { isNonNullish } from "@fern-api/ui-core-utils"; +import { FernRegistry } from "../../../client/generated"; +import { + BaseOpenApiV3_1ConverterNode, + BaseOpenApiV3_1ConverterNodeConstructorArgs, +} from "../../BaseOpenApiV3_1Converter.node"; +import { resolveWebhookReference } from "../../utils/3.1/resolveWebhookReference"; +import { PathItemObjectConverterNode } from "./PathItemObjectConverter.node"; + +export class WebhooksObjectConverterNode extends BaseOpenApiV3_1ConverterNode< + OpenAPIV3_1.Document["webhooks"], + FernRegistry.api.latest.ApiDefinition["webhooks"] +> { + webhooks: Record | undefined; + + constructor(args: BaseOpenApiV3_1ConverterNodeConstructorArgs) { + super(args); + this.safeParse(); + } + + parse(): void { + this.webhooks = Object.fromEntries( + Object.entries(this.input ?? {}) + .map(([operation, operationItem]) => { + const resolvedOperationItem = resolveWebhookReference(operationItem, this.context.document); + if (resolvedOperationItem == null) { + return undefined; + } + return [ + operation, + new PathItemObjectConverterNode( + { + input: resolvedOperationItem, + context: this.context, + accessPath: this.accessPath, + pathId: operation, + }, + undefined, + true, + ), + ]; + }) + .filter(isNonNullish), + ); + } + + convert(): FernRegistry.api.latest.ApiDefinition["webhooks"] | undefined { + return {}; + } +} diff --git a/packages/parsers/src/openapi/3.1/paths/__test__/PathItemObjectConverter.node.test.ts b/packages/parsers/src/openapi/3.1/paths/__test__/PathItemObjectConverter.node.test.ts index b2232de4d6..66817f45eb 100644 --- a/packages/parsers/src/openapi/3.1/paths/__test__/PathItemObjectConverter.node.test.ts +++ b/packages/parsers/src/openapi/3.1/paths/__test__/PathItemObjectConverter.node.test.ts @@ -42,6 +42,7 @@ describe("PathItemObjectConverterNode", () => { pathId: "/pets/{petId}", }, undefined, + undefined, ); const result = node.convert(); @@ -112,6 +113,7 @@ describe("PathItemObjectConverterNode", () => { pathId: "/empty", }, undefined, + undefined, ); const result = node.convert(); @@ -143,6 +145,7 @@ describe("PathItemObjectConverterNode", () => { pathId: "/test", }, undefined, + undefined, ); const result = node.convert(); diff --git a/packages/parsers/src/openapi/3.1/paths/__test__/PathsObjectConverter.node.test.ts b/packages/parsers/src/openapi/3.1/paths/__test__/PathsObjectConverter.node.test.ts index 7bda64290b..53fca36bd5 100644 --- a/packages/parsers/src/openapi/3.1/paths/__test__/PathsObjectConverter.node.test.ts +++ b/packages/parsers/src/openapi/3.1/paths/__test__/PathsObjectConverter.node.test.ts @@ -47,11 +47,11 @@ describe("PathsObjectConverterNode", () => { undefined, ); - const result = node.convert() ?? {}; + const result = node.convert() ?? { endpoints: {} }; expect(result).toBeDefined(); - expect(Object.keys(result)).toHaveLength(2); - Object.values(result).forEach((endpoint) => { + expect(Object.keys(result.endpoints)).toHaveLength(2); + Object.values(result.endpoints).forEach((endpoint) => { expect(endpoint).toEqual( expect.objectContaining({ method: "GET", @@ -74,7 +74,10 @@ describe("PathsObjectConverterNode", () => { ); const result = node.convert(); - expect(result).toEqual({}); + expect(result).toEqual({ + endpoints: {}, + webhookEndpoints: {}, + }); }); it("should handle null path items", () => { @@ -93,7 +96,10 @@ describe("PathsObjectConverterNode", () => { ); const result = node.convert(); - expect(result).toEqual({}); + expect(result).toEqual({ + endpoints: {}, + webhookEndpoints: {}, + }); }); it("should handle paths with servers", () => { @@ -125,9 +131,9 @@ describe("PathsObjectConverterNode", () => { undefined, ); - const result = node.convert() ?? {}; + const result = node.convert() ?? { endpoints: {} }; expect(result).toBeDefined(); - expect(Object.keys(result)).toHaveLength(1); + expect(Object.keys(result.endpoints)).toHaveLength(1); }); }); }); diff --git a/packages/parsers/src/openapi/3.1/paths/response/ResponsesObjectConverter.node.ts b/packages/parsers/src/openapi/3.1/paths/response/ResponsesObjectConverter.node.ts index c22e2bf928..d226ce1e9e 100644 --- a/packages/parsers/src/openapi/3.1/paths/response/ResponsesObjectConverter.node.ts +++ b/packages/parsers/src/openapi/3.1/paths/response/ResponsesObjectConverter.node.ts @@ -6,6 +6,7 @@ import { BaseOpenApiV3_1ConverterNodeConstructorArgs, } from "../../../BaseOpenApiV3_1Converter.node"; import { convertToObjectProperties } from "../../../utils/3.1/convertToObjectProperties"; +import { STATUS_CODE_MESSAGES } from "../../../utils/statusCodes"; import { ResponseObjectConverterNode } from "./ResponseObjectConverter.node"; export class ResponsesObjectConverterNode extends BaseOpenApiV3_1ConverterNode< @@ -97,7 +98,7 @@ export class ResponsesObjectConverterNode extends BaseOpenApiV3_1ConverterNode< shape, description: response.description ?? schema.description, availability: schema.availability?.convert(), - name: "dummy error", + name: schema.name ?? STATUS_CODE_MESSAGES[parseInt(statusCode)] ?? "UNKNOWN ERROR", examples: undefined, }; }) diff --git a/packages/parsers/src/openapi/utils/3.1/resolveResponseReference.ts b/packages/parsers/src/openapi/utils/3.1/resolveResponseReference.ts index 495adf3345..ad513af47d 100644 --- a/packages/parsers/src/openapi/utils/3.1/resolveResponseReference.ts +++ b/packages/parsers/src/openapi/utils/3.1/resolveResponseReference.ts @@ -7,7 +7,14 @@ export function resolveResponseReference( document: OpenAPIV3_1.Document, ): OpenAPIV3_1.ResponseObject | undefined { if (isReferenceObject(referenceObject)) { - return resolveReference(referenceObject, document, undefined); + const resolved = resolveReference(referenceObject, document, undefined); + if (resolved == null) { + return undefined; + } + return { + ...resolved, + ...referenceObject, + } as OpenAPIV3_1.ResponseObject; } return referenceObject; diff --git a/packages/parsers/src/openapi/utils/3.1/resolveWebhookReference.ts b/packages/parsers/src/openapi/utils/3.1/resolveWebhookReference.ts new file mode 100644 index 0000000000..d3a203a30e --- /dev/null +++ b/packages/parsers/src/openapi/utils/3.1/resolveWebhookReference.ts @@ -0,0 +1,21 @@ +import { OpenAPIV3_1 } from "openapi-types"; +import { isReferenceObject } from "../../3.1/guards/isReferenceObject"; +import { resolveReference } from "./resolveReference"; + +export function resolveWebhookReference( + operationItem: OpenAPIV3_1.PathItemObject | OpenAPIV3_1.ReferenceObject, + document: OpenAPIV3_1.Document, +): OpenAPIV3_1.PathItemObject | undefined { + if (isReferenceObject(operationItem)) { + const resolved = resolveReference(operationItem, document, undefined); + if (resolved == null) { + return undefined; + } + return { + ...resolved, + ...operationItem, + } as OpenAPIV3_1.OperationObject; + } + + return operationItem; +} diff --git a/packages/parsers/src/openapi/utils/statusCodes.ts b/packages/parsers/src/openapi/utils/statusCodes.ts new file mode 100644 index 0000000000..49c41c4f9b --- /dev/null +++ b/packages/parsers/src/openapi/utils/statusCodes.ts @@ -0,0 +1,65 @@ +export const STATUS_CODE_MESSAGES: Record = { + 100: "Continue", + 101: "Switching Protocols", + 102: "Processing", + 103: "Early Hints", + 200: "OK", + 201: "Created", + 202: "Accepted", + 203: "Non-Authoritative Information", + 204: "No Content", + 205: "Reset Content", + 206: "Partial Content", + 207: "Multi-Status", + 208: "Already Reported", + 226: "IM Used", + 300: "Multiple Choices", + 301: "Moved Permanently", + 302: "Found", + 303: "See Other", + 304: "Not Modified", + 305: "Use Proxy", + 306: "Switch Proxy", + 307: "Temporary Redirect", + 308: "Permanent Redirect", + 400: "Bad Request", + 401: "Unauthorized", + 402: "Payment Required", + 403: "Forbidden", + 404: "Not Found", + 405: "Method Not Allowed", + 406: "Not Acceptable", + 407: "Proxy Authentication Required", + 408: "Request Timeout", + 409: "Conflict", + 410: "Gone", + 411: "Length Required", + 412: "Precondition Failed", + 413: "Payload Too Large", + 414: "URI Too Long", + 415: "Unsupported Media Type", + 416: "Range Not Satisfiable", + 417: "Expectation Failed", + 418: "I'm a teapot", + 421: "Misdirected Request", + 422: "Unprocessable Entity", + 423: "Locked", + 424: "Failed Dependency", + 425: "Too Early", + 426: "Upgrade Required", + 428: "Precondition Required", + 429: "Too Many Requests", + 431: "Request Header Fields Too Large", + 451: "Unavailable For Legal Reasons", + 500: "Internal Server Error", + 501: "Not Implemented", + 502: "Bad Gateway", + 503: "Service Unavailable", + 504: "Gateway Timeout", + 505: "HTTP Version Not Supported", + 506: "Variant Also Negotiates", + 507: "Insufficient Storage", + 508: "Loop Detected", + 510: "Not Extended", + 511: "Network Authentication Required", +};