@@ -38,7 +38,9 @@ import { TeamPermissionSettingUpdateRequest } from "./models/TeamPermissionSetti
3838import { TeamResponse } from "./models/TeamResponse" ;
3939import { TeamsField } from "./models/TeamsField" ;
4040import { TeamsResponse } from "./models/TeamsResponse" ;
41+ import { TeamSyncAttributesSource } from "./models/TeamSyncAttributesSource" ;
4142import { TeamSyncRequest } from "./models/TeamSyncRequest" ;
43+ import { TeamSyncResponse } from "./models/TeamSyncResponse" ;
4244import { TeamUpdateRequest } from "./models/TeamUpdateRequest" ;
4345import { UserTeam } from "./models/UserTeam" ;
4446import { UserTeamRequest } from "./models/UserTeamRequest" ;
@@ -702,6 +704,63 @@ export class TeamsApiRequestFactory extends BaseAPIRequestFactory {
702704 return requestContext ;
703705 }
704706
707+ public async getTeamSync (
708+ filterSource : TeamSyncAttributesSource ,
709+ _options ?: Configuration ,
710+ ) : Promise < RequestContext > {
711+ const _config = _options || this . configuration ;
712+
713+ if ( ! _config . unstableOperations [ "TeamsApi.v2.getTeamSync" ] ) {
714+ throw new Error (
715+ "Unstable operation 'getTeamSync' is disabled. Enable it by setting `configuration.unstableOperations['TeamsApi.v2.getTeamSync'] = true`" ,
716+ ) ;
717+ }
718+
719+ // verify required parameter 'filterSource' is not null or undefined
720+ if ( filterSource === null || filterSource === undefined ) {
721+ throw new RequiredError ( "filterSource" , "getTeamSync" ) ;
722+ }
723+
724+ // Path Params
725+ const localVarPath = "/api/v2/team/sync" ;
726+
727+ // Make Request Context
728+ const { server, overrides } = _config . getServerAndOverrides (
729+ "TeamsApi.v2.getTeamSync" ,
730+ TeamsApi . operationServers ,
731+ ) ;
732+ const requestContext = server . makeRequestContext (
733+ localVarPath ,
734+ HttpMethod . GET ,
735+ overrides ,
736+ ) ;
737+ requestContext . setHeaderParam ( "Accept" , "application/json" ) ;
738+ requestContext . setHttpConfig ( _config . httpConfig ) ;
739+
740+ // Set User-Agent
741+ if ( this . userAgent ) {
742+ requestContext . setHeaderParam ( "User-Agent" , this . userAgent ) ;
743+ }
744+
745+ // Query Params
746+ if ( filterSource !== undefined ) {
747+ requestContext . setQueryParam (
748+ "filter[source]" ,
749+ serialize ( filterSource , TypingInfo , "TeamSyncAttributesSource" , "" ) ,
750+ "" ,
751+ ) ;
752+ }
753+
754+ // Apply auth methods
755+ applySecurityAuthentication ( _config , requestContext , [
756+ "apiKeyAuth" ,
757+ "appKeyAuth" ,
758+ "AuthZ" ,
759+ ] ) ;
760+
761+ return requestContext ;
762+ }
763+
705764 public async getUserMemberships (
706765 userUuid : string ,
707766 _options ?: Configuration ,
@@ -1955,6 +2014,66 @@ export class TeamsApiResponseProcessor {
19552014 ) ;
19562015 }
19572016
2017+ /**
2018+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
2019+ * to the expected objects
2020+ *
2021+ * @params response Response returned by the server for a request to getTeamSync
2022+ * @throws ApiException if the response code was not in [200, 299]
2023+ */
2024+ public async getTeamSync (
2025+ response : ResponseContext ,
2026+ ) : Promise < TeamSyncResponse > {
2027+ const contentType = normalizeMediaType ( response . headers [ "content-type" ] ) ;
2028+ if ( response . httpStatusCode === 200 ) {
2029+ const body : TeamSyncResponse = deserialize (
2030+ parse ( await response . body . text ( ) , contentType ) ,
2031+ TypingInfo ,
2032+ "TeamSyncResponse" ,
2033+ ) as TeamSyncResponse ;
2034+ return body ;
2035+ }
2036+ if (
2037+ response . httpStatusCode === 403 ||
2038+ response . httpStatusCode === 404 ||
2039+ response . httpStatusCode === 429
2040+ ) {
2041+ const bodyText = parse ( await response . body . text ( ) , contentType ) ;
2042+ let body : APIErrorResponse ;
2043+ try {
2044+ body = deserialize (
2045+ bodyText ,
2046+ TypingInfo ,
2047+ "APIErrorResponse" ,
2048+ ) as APIErrorResponse ;
2049+ } catch ( error ) {
2050+ logger . debug ( `Got error deserializing error: ${ error } ` ) ;
2051+ throw new ApiException < APIErrorResponse > (
2052+ response . httpStatusCode ,
2053+ bodyText ,
2054+ ) ;
2055+ }
2056+ throw new ApiException < APIErrorResponse > ( response . httpStatusCode , body ) ;
2057+ }
2058+
2059+ // Work around for missing responses in specification, e.g. for petstore.yaml
2060+ if ( response . httpStatusCode >= 200 && response . httpStatusCode <= 299 ) {
2061+ const body : TeamSyncResponse = deserialize (
2062+ parse ( await response . body . text ( ) , contentType ) ,
2063+ TypingInfo ,
2064+ "TeamSyncResponse" ,
2065+ "" ,
2066+ ) as TeamSyncResponse ;
2067+ return body ;
2068+ }
2069+
2070+ const body = ( await response . body . text ( ) ) || "" ;
2071+ throw new ApiException < string > (
2072+ response . httpStatusCode ,
2073+ 'Unknown API Status Code!\nBody: "' + body + '"' ,
2074+ ) ;
2075+ }
2076+
19582077 /**
19592078 * Unwraps the actual response sent by the server from the response context and deserializes the response content
19602079 * to the expected objects
@@ -2602,6 +2721,14 @@ export interface TeamsApiGetTeamPermissionSettingsRequest {
26022721 teamId : string ;
26032722}
26042723
2724+ export interface TeamsApiGetTeamSyncRequest {
2725+ /**
2726+ * Filter by the external source platform for team synchronization
2727+ * @type TeamSyncAttributesSource
2728+ */
2729+ filterSource : TeamSyncAttributesSource ;
2730+ }
2731+
26052732export interface TeamsApiGetUserMembershipsRequest {
26062733 /**
26072734 * None
@@ -3081,6 +3208,28 @@ export class TeamsApi {
30813208 } ) ;
30823209 }
30833210
3211+ /**
3212+ * Get all team synchronization configurations.
3213+ * Returns a list of configurations used for linking or provisioning teams with external sources like GitHub.
3214+ * @param param The request object
3215+ */
3216+ public getTeamSync (
3217+ param : TeamsApiGetTeamSyncRequest ,
3218+ options ?: Configuration ,
3219+ ) : Promise < TeamSyncResponse > {
3220+ const requestContextPromise = this . requestFactory . getTeamSync (
3221+ param . filterSource ,
3222+ options ,
3223+ ) ;
3224+ return requestContextPromise . then ( ( requestContext ) => {
3225+ return this . configuration . httpApi
3226+ . send ( requestContext )
3227+ . then ( ( responseContext ) => {
3228+ return this . responseProcessor . getTeamSync ( responseContext ) ;
3229+ } ) ;
3230+ } ) ;
3231+ }
3232+
30843233 /**
30853234 * Get a list of memberships for a user
30863235 * @param param The request object
@@ -3271,7 +3420,7 @@ export class TeamsApi {
32713420 * [A GitHub organization must be connected to your Datadog account](https://docs.datadoghq.com/integrations/github/),
32723421 * and the GitHub App integrated with Datadog must have the `Members Read` permission. Matching is performed by comparing the Datadog team handle to the GitHub team slug
32733422 * using a normalized exact match; case is ignored and spaces are removed. No modifications are made
3274- * to teams in GitHub. This will not create new Teams in Datadog.
3423+ * to teams in GitHub. This will only create new teams in Datadog when type is set to `provision` .
32753424 * @param param The request object
32763425 */
32773426 public syncTeams (
0 commit comments