ramp_api/custom_ids.rs
1use crate::Client;
2use crate::ClientResult;
3
4pub struct CustomIds {
5 pub client: Client,
6}
7
8impl CustomIds {
9 #[doc(hidden)]
10 pub fn new(client: Client) -> Self {
11 CustomIds { client }
12 }
13
14 /**
15 * GET the Custom ID provider linked to the current OAuth token.
16 *
17 * This function performs a `GET` to the `/custom-id-provider` endpoint.
18 *
19 * **Parameters:**
20 *
21 * * `authorization: &str` -- The OAuth2 token header.
22 */
23 pub async fn get_custom_provider(
24 &self,
25 ) -> ClientResult<crate::Response<crate::types::GetCustomProviderResponse>> {
26 let url = self.client.url("/custom-id-provider", None);
27 self.client
28 .get(
29 &url,
30 crate::Message {
31 body: None,
32 content_type: None,
33 },
34 )
35 .await
36 }
37 /**
38 * Create a Custom ID provider.
39 *
40 * This function performs a `POST` to the `/custom-id-provider` endpoint.
41 *
42 *
43 *
44 * **Parameters:**
45 *
46 * * `authorization_bearer_111111111111: &str` -- The OAuth2 token header.
47 */
48 pub async fn postcustom_provider(
49 &self,
50 ) -> ClientResult<crate::Response<crate::types::PostcustomProviderResponse>> {
51 let url = self.client.url("/custom-id-provider", None);
52 self.client
53 .post(
54 &url,
55 crate::Message {
56 body: None,
57 content_type: None,
58 },
59 )
60 .await
61 }
62 /**
63 * .
64 *
65 * This function performs a `POST` to the `/custom-id-provider/application-link` endpoint.
66 *
67 * Register an access token with a custom ID provider
68 */
69 pub async fn post_custom_provider_application_link(
70 &self,
71 body: &crate::types::GetCustomProviderResponse,
72 ) -> ClientResult<crate::Response<()>> {
73 let url = self
74 .client
75 .url("/custom-id-provider/application-link", None);
76 self.client
77 .post(
78 &url,
79 crate::Message {
80 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
81 content_type: Some("application/json".to_string()),
82 },
83 )
84 .await
85 }
86 /**
87 * Convert custom id to ramp id.
88 *
89 * This function performs a `GET` to the `/custom-id-provider/{entity_type}/{custom_id}/ramp-id` endpoint.
90 *
91 *
92 *
93 * **Parameters:**
94 *
95 * * `authorization: &str` -- The OAuth2 token header.
96 */
97 pub async fn get_entity_type_custom_ramp(
98 &self,
99 entity_type: &str,
100 custom_id: &str,
101 ) -> ClientResult<crate::Response<crate::types::GetEntityTypeCustomRampResponse>> {
102 let url = self.client.url(
103 &format!(
104 "/custom-id-provider/{}/{}/ramp-id",
105 crate::progenitor_support::encode_path(entity_type),
106 crate::progenitor_support::encode_path(custom_id),
107 ),
108 None,
109 );
110 self.client
111 .get(
112 &url,
113 crate::Message {
114 body: None,
115 content_type: None,
116 },
117 )
118 .await
119 }
120 /**
121 * Convert ramp id to custom id.
122 *
123 * This function performs a `GET` to the `/custom-id-provider/{entity_type}/{ramp_id}/custom-id` endpoint.
124 *
125 * **Parameters:**
126 *
127 * * `authorization: &str` -- The OAuth2 token header.
128 */
129 pub async fn get_entity_type_ramp_custom(
130 &self,
131 entity_type: &str,
132 ramp_id: &str,
133 ) -> ClientResult<crate::Response<crate::types::GetEntityTypeRampCustomResponse>> {
134 let url = self.client.url(
135 &format!(
136 "/custom-id-provider/{}/{}/custom-id",
137 crate::progenitor_support::encode_path(entity_type),
138 crate::progenitor_support::encode_path(ramp_id),
139 ),
140 None,
141 );
142 self.client
143 .get(
144 &url,
145 crate::Message {
146 body: None,
147 content_type: None,
148 },
149 )
150 .await
151 }
152 /**
153 * Create custom id link.
154 *
155 * This function performs a `POST` to the `/custom-id-provider/{entity_type}/custom-id-link` endpoint.
156 *
157 * Create a mapping between custom\_id and ramp\_id under the namespace specified by entity\_type.
158 */
159 pub async fn post_custom_provider_entity_type_link(
160 &self,
161 entity_type: &str,
162 body: &crate::types::PostCustomProviderEntityTypeLinkRequest,
163 ) -> ClientResult<crate::Response<()>> {
164 let url = self.client.url(
165 &format!(
166 "/custom-id-provider/{}/custom-id-link",
167 crate::progenitor_support::encode_path(entity_type),
168 ),
169 None,
170 );
171 self.client
172 .post(
173 &url,
174 crate::Message {
175 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
176 content_type: Some("application/json".to_string()),
177 },
178 )
179 .await
180 }
181}