-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
135 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
[[transport]] | ||
== Transport example | ||
|
||
This page demonstrates how to use the low level transport to send requests. | ||
|
||
[source,csharp] | ||
---- | ||
public class MyRequestParameters : RequestParameters | ||
{ | ||
public bool Pretty | ||
{ | ||
get => Q<bool>("pretty"); | ||
init => Q("pretty", value); | ||
} | ||
} | ||
// ... | ||
var body = """ | ||
{ | ||
"name": "my-api-key", | ||
"expiration": "1d", | ||
"...": "..." | ||
} | ||
"""; | ||
MyRequestParameters requestParameters = new() | ||
{ | ||
Pretty = true | ||
}; | ||
var pathAndQuery = requestParameters.CreatePathWithQueryStrings("/_security/api_key", | ||
client.ElasticsearchClientSettings); | ||
var endpointPath = new EndpointPath(Elastic.Transport.HttpMethod.POST, pathAndQuery); | ||
// Or, if the path does not contain query parameters: | ||
// new EndpointPath(Elastic.Transport.HttpMethod.POST, "my_path") | ||
var response = await client.Transport | ||
.RequestAsync<StringResponse>( | ||
endpointPath, | ||
PostData.String(body), | ||
null, | ||
null, | ||
cancellationToken: default) | ||
.ConfigureAwait(false); | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters